Skip to content

Commit

Permalink
Adds features data (free boolean) to manifold-plan-selector custom event
Browse files Browse the repository at this point in the history
Update changelog
  • Loading branch information
TerrySmithDC committed Nov 19, 2019
1 parent 8375bb5 commit 8b3f93c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Added

- Free features data to plan selector custom event. (#743)

### Added

- Added `metrics` property to `<manifold-connection>` to opt-in for metric collection (#724)
- Added performance monitoring of GraphQL endpoints (#726)
- Added performance monitoring of oauth token handshake (#730)
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/components/manifold-plan-selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ document.addEventListener('manifold-planSelector-change', ({ detail }) => {
// planName: 'NVIDIA 1080TI',
// productLabel: 'zerosix',
// features: {
// // …
// free: false
// },
// }
```

The following events are emitted:

| Event Name | Description | Data |
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------- |
| `manifold-planSelector-change` | Fires whenever a user makes a change. | `planID`, `planLabel`, `planName`, `productId`, `productLabel`, `regionId`, `regionName` |
| `manifold-planSelector-load` | Identical to `-update` above, but this fires once on DOM mount to set the initial state (i.e. user hasn’t interacted yet). | `planID`, `planLabel`, `planName`, `productId`, `productLabel`, `regionId`, `regionName` |
| Event Name | Description | Data |
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
| `manifold-planSelector-change` | Fires whenever a user makes a change. | `planID`, `planLabel`, `planName`, `productId`, `productLabel`, `regionId`, `regionName`, `features` |
| `manifold-planSelector-load` | Identical to `-update` above, but this fires once on DOM mount to set the initial state (i.e. user hasn’t interacted yet). | `planID`, `planLabel`, `planName`, `productId`, `productLabel`, `regionId`, `regionName`, `features` |

## Free plans only

Expand Down
15 changes: 15 additions & 0 deletions src/components/manifold-plan-details/manifold-plan-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ interface EventDetail {
productLabel: string | undefined;
regionId?: string;
regionName?: string;
feature?: {
free: boolean;
};
}

@Component({
Expand Down Expand Up @@ -48,6 +51,9 @@ export class ManifoldPlanDetails {
productLabel: this.product && this.product.label,
regionId: defaultRegion && defaultRegion.id,
regionName: defaultRegion && defaultRegion.displayName,
feature: {
free: newPlan.free,
},
};

if (!oldPlan) {
Expand Down Expand Up @@ -83,6 +89,9 @@ export class ManifoldPlanDetails {
productLabel: this.product && this.product.label,
regionId: defaultRegion && defaultRegion.id,
regionName: defaultRegion && defaultRegion.displayName,
feature: {
free: this.plan.free,
},
};
this.planLoad.emit(detail);
// reset features
Expand All @@ -103,6 +112,9 @@ export class ManifoldPlanDetails {
productLabel: this.product.label,
regionId: defaultRegion && defaultRegion.id,
regionName: defaultRegion && defaultRegion.displayName,
feature: {
free: this.plan.free,
},
};
this.planUpdate.emit(detail);
}
Expand All @@ -123,6 +135,9 @@ export class ManifoldPlanDetails {
productLabel: this.product.label,
regionId: e.detail.value,
regionName: defaultRegion && defaultRegion.displayName,
feature: {
free: this.plan.free,
},
};
this.planUpdate.emit(detail);
}
Expand Down

0 comments on commit 8b3f93c

Please sign in to comment.