Skip to content

Commit 5452852

Browse files
author
Terry Smith
authored
Merge pull request #743 from manifoldco/add-plan-type-to-customer-plan-selector-event
Adds features data (free boolean) to manifold-plan-selector custom event
2 parents 8375bb5 + 42f4322 commit 5452852

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
66
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Free features data to plan selector custom event. (#743)
13+
814
## [0.7.0] - 2019-11-19
915

1016
### Added

docs/docs/components/manifold-plan-selector.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,16 @@ document.addEventListener('manifold-planSelector-change', ({ detail }) => {
4646
// planLabel: 'nvidia-1080ti-100gb-ssd',
4747
// planName: 'NVIDIA 1080TI',
4848
// productLabel: 'zerosix',
49-
// features: {
50-
// // …
51-
// },
49+
// freePlan: false
5250
// }
5351
```
5452

5553
The following events are emitted:
5654

57-
| Event Name | Description | Data |
58-
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------- |
59-
| `manifold-planSelector-change` | Fires whenever a user makes a change. | `planID`, `planLabel`, `planName`, `productId`, `productLabel`, `regionId`, `regionName` |
60-
| `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` |
55+
| Event Name | Description | Data |
56+
| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
57+
| `manifold-planSelector-change` | Fires whenever a user makes a change. | `planID`, `planLabel`, `planName`, `productId`, `productLabel`, `regionId`, `regionName`, `freePlan` |
58+
| `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`, `freePlan` |
6159

6260
## Free plans only
6361

src/components/manifold-plan-details/manifold-plan-details.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('<manifold-plan-details>', () => {
4949
productLabel: product.label,
5050
regionId: region && region.id,
5151
regionName: region && region.displayName,
52+
freePlan: paidPlan.free,
5253
},
5354
})
5455
);
@@ -77,6 +78,7 @@ describe('<manifold-plan-details>', () => {
7778
productLabel: product.label,
7879
regionId: region && region.id,
7980
regionName: region && region.displayName,
81+
freePlan: freePlan.free,
8082
},
8183
})
8284
);

src/components/manifold-plan-details/manifold-plan-details.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface EventDetail {
1818
productLabel: string | undefined;
1919
regionId?: string;
2020
regionName?: string;
21+
freePlan: boolean;
2122
}
2223

2324
@Component({
@@ -48,6 +49,7 @@ export class ManifoldPlanDetails {
4849
productLabel: this.product && this.product.label,
4950
regionId: defaultRegion && defaultRegion.id,
5051
regionName: defaultRegion && defaultRegion.displayName,
52+
freePlan: newPlan.free,
5153
};
5254

5355
if (!oldPlan) {
@@ -83,6 +85,7 @@ export class ManifoldPlanDetails {
8385
productLabel: this.product && this.product.label,
8486
regionId: defaultRegion && defaultRegion.id,
8587
regionName: defaultRegion && defaultRegion.displayName,
88+
freePlan: this.plan.free,
8689
};
8790
this.planLoad.emit(detail);
8891
// reset features
@@ -103,6 +106,7 @@ export class ManifoldPlanDetails {
103106
productLabel: this.product.label,
104107
regionId: defaultRegion && defaultRegion.id,
105108
regionName: defaultRegion && defaultRegion.displayName,
109+
freePlan: this.plan.free,
106110
};
107111
this.planUpdate.emit(detail);
108112
}
@@ -123,6 +127,7 @@ export class ManifoldPlanDetails {
123127
productLabel: this.product.label,
124128
regionId: e.detail.value,
125129
regionName: defaultRegion && defaultRegion.displayName,
130+
freePlan: this.plan.free,
126131
};
127132
this.planUpdate.emit(detail);
128133
}

0 commit comments

Comments
 (0)