@commet/node 7.10.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -3
- package/dist/index.d.mts +2029 -940
- package/dist/index.d.ts +2029 -940
- package/dist/index.js +396 -342
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +396 -342
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ await commet.subscriptions.create({
|
|
|
60
60
|
|
|
61
61
|
// Track usage events
|
|
62
62
|
await commet.usage.track({
|
|
63
|
-
|
|
63
|
+
featureCode: 'api_call',
|
|
64
64
|
value: 1,
|
|
65
65
|
customerId: 'cus_123'
|
|
66
66
|
});
|
|
@@ -86,9 +86,9 @@ const projects = await commet.quota.get({
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
// Check feature access
|
|
89
|
-
const access = await commet.
|
|
89
|
+
const access = await commet.usage.check({
|
|
90
90
|
customerId: 'cus_123',
|
|
91
|
-
|
|
91
|
+
featureCode: 'api_calls'
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// Generate customer portal link
|
|
@@ -97,6 +97,52 @@ const portal = await commet.portal.getUrl({
|
|
|
97
97
|
});
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Offers and selectable pricing
|
|
101
|
+
|
|
102
|
+
Create reusable country Markets and attach market prices to a base price or an inherited selectable variant:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const argentina = await commet.pricing.createMarketGroup({
|
|
106
|
+
name: 'Argentina',
|
|
107
|
+
countryCodes: ['AR'],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const variant = await commet.plans.addPrice({
|
|
111
|
+
id: 'pln_pro',
|
|
112
|
+
billingInterval: 'monthly',
|
|
113
|
+
inheritsFromPriceId: 'pp_monthly',
|
|
114
|
+
marketPrices: [{
|
|
115
|
+
marketGroupId: argentina.id,
|
|
116
|
+
currency: 'ars',
|
|
117
|
+
price: 1_500_000,
|
|
118
|
+
}],
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
await commet.subscriptions.create({
|
|
122
|
+
customerId: 'cus_123',
|
|
123
|
+
planId: 'pln_pro',
|
|
124
|
+
priceId: variant.id,
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Offers own discount phases. Promo Codes reference Promotional Offers instead of duplicating discount fields:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
const offer = await commet.offers.create({
|
|
132
|
+
name: 'First three months at 25% off',
|
|
133
|
+
purpose: 'promotional',
|
|
134
|
+
planPriceIds: ['pp_monthly'],
|
|
135
|
+
phases: [{ type: 'percentage', percentage: 2500, durationCycles: 3 }],
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
await commet.promoCodes.create({
|
|
139
|
+
code: 'LAUNCH25',
|
|
140
|
+
offerId: offer.id,
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Omitting `priceId` preserves default price resolution and still applies Currency Pricing and Markets. A subscription keeps the selected price identity and renews from that catalog price's current value.
|
|
145
|
+
|
|
100
146
|
## Type Safety
|
|
101
147
|
|
|
102
148
|
Use the [Commet CLI](https://www.npmjs.com/package/commet) to generate TypeScript types from your organization:
|