@commet/node 8.0.1 → 9.0.0

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/dist/index.mjs CHANGED
@@ -187,31 +187,61 @@ var InvoicesResource = class {
187
187
  }
188
188
  };
189
189
 
190
+ // src/resources/markets.ts
191
+ var MarketsResource = class {
192
+ constructor(httpClient) {
193
+ this.httpClient = httpClient;
194
+ }
195
+ /** Get one reusable market. */
196
+ async get(params, options) {
197
+ const { id } = params;
198
+ return this.httpClient.get(`/markets/${id}`, void 0, options);
199
+ }
200
+ /** Replace the name, countries, and metadata of a market. */
201
+ async update(params, options) {
202
+ const { id, ...rest } = params;
203
+ return this.httpClient.patch(`/markets/${id}`, rest, options);
204
+ }
205
+ /** Delete an unused market. Markets referenced by prices or subscriptions cannot be deleted. */
206
+ async delete(params, options) {
207
+ const { id } = params;
208
+ return this.httpClient.delete(`/markets/${id}`, void 0, options);
209
+ }
210
+ /** List reusable country groups that resolve market-specific prices independently from currency. */
211
+ async list() {
212
+ return this.httpClient.get("/markets");
213
+ }
214
+ /** Create a reusable market without attaching it to a plan or price. Countries can belong to only one active market. */
215
+ async create(params, options) {
216
+ return this.httpClient.post("/markets", params, options);
217
+ }
218
+ };
219
+
190
220
  // src/resources/offers.ts
191
221
  var OffersResource = class {
192
222
  constructor(httpClient) {
193
223
  this.httpClient = httpClient;
194
224
  }
195
- /** Retrieve a canonical offer by its public ID. */
225
+ /** Retrieve reusable offer terms by public ID. */
196
226
  async get(params, options) {
197
227
  const { id } = params;
198
228
  return this.httpClient.get(`/offers/${id}`, void 0, options);
199
229
  }
200
- /** Replace an offer's catalog definition. Existing offer applications keep their immutable accepted terms. */
230
+ /** Replace reusable offer terms. Existing applications keep their immutable accepted terms. */
201
231
  async update(params, options) {
202
232
  const { id, ...rest } = params;
203
233
  return this.httpClient.patch(`/offers/${id}`, rest, options);
204
234
  }
205
- /** Soft-delete an offer. Existing applications and their accepted terms remain available for billing and audit. */
235
+ /** Soft-delete an Offer. Existing applications and their accepted terms remain available for billing and audit. */
206
236
  async delete(params, options) {
207
237
  const { id } = params;
208
238
  return this.httpClient.delete(`/offers/${id}`, void 0, options);
209
239
  }
210
- /** List the organization's canonical introductory and promotional offers. */
240
+ /** List reusable offer terms. Offers are independent from plans, prices, eligibility, and distribution channels. */
211
241
  async list(params, options) {
212
242
  return this.httpClient.get("/offers", params, options);
213
243
  }
214
- /** Create a canonical offer scoped to one or more plan prices. Currency-specific phases require an explicit USD value and never fall back across currencies. */
244
+ /** Create reusable offer terms without assigning a plan, price, eligibility rule, or distribution channel. */
215
245
  async create(params, options) {
216
246
  return this.httpClient.post("/offers", params, options);
217
247
  }
@@ -442,44 +472,6 @@ var PortalResource = class {
442
472
  }
443
473
  };
444
474
 
445
- // src/resources/pricing.ts
446
- var PricingResource = class {
447
- constructor(httpClient) {
448
- this.httpClient = httpClient;
449
- }
450
- /** Get one reusable pricing market group. */
451
- async getMarketGroup(params, options) {
452
- const { id } = params;
453
- return this.httpClient.get(
454
- `/pricing/market-groups/${id}`,
455
- void 0,
456
- options
457
- );
458
- }
459
- /** Replace the name, countries, and metadata of a pricing market group. */
460
- async updateMarketGroup(params, options) {
461
- const { id, ...rest } = params;
462
- return this.httpClient.patch(`/pricing/market-groups/${id}`, rest, options);
463
- }
464
- /** Delete an unused pricing market group. Groups referenced by prices or subscriptions cannot be deleted. */
465
- async deleteMarketGroup(params, options) {
466
- const { id } = params;
467
- return this.httpClient.delete(
468
- `/pricing/market-groups/${id}`,
469
- void 0,
470
- options
471
- );
472
- }
473
- /** List reusable country groups used to resolve market-specific prices independently from currency. */
474
- async listMarketGroups() {
475
- return this.httpClient.get("/pricing/market-groups");
476
- }
477
- /** Create a reusable country group. Countries can belong to only one active group; each price chooses its currency independently. */
478
- async createMarketGroup(params, options) {
479
- return this.httpClient.post("/pricing/market-groups", params, options);
480
- }
481
- };
482
-
483
475
  // src/resources/promo-codes.ts
484
476
  var PromoCodesResource = class {
485
477
  constructor(httpClient) {
@@ -499,7 +491,7 @@ var PromoCodesResource = class {
499
491
  async list(params, options) {
500
492
  return this.httpClient.get("/promo-codes", params, options);
501
493
  }
502
- /** Create a distribution code for an existing promotional offer. Offer economics remain owned by the referenced Offer. */
494
+ /** Create a distribution code for an existing Offer. The referenced Offer owns the benefit and duration; the promo code owns redemption restrictions. */
503
495
  async create(params, options) {
504
496
  return this.httpClient.post("/promo-codes", params, options);
505
497
  }
@@ -616,7 +608,7 @@ var SubscriptionsResource = class {
616
608
  const { id, ...rest } = params;
617
609
  return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
618
610
  }
619
- /** Upgrade or change billing interval immediately, optionally applying a quoted Promotional Offer. Scheduled changes do not accept offers. */
611
+ /** Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes do not accept offers. */
620
612
  async changePlan(params, options) {
621
613
  const { id, ...rest } = params;
622
614
  return this.httpClient.post(
@@ -639,7 +631,7 @@ var SubscriptionsResource = class {
639
631
  options
640
632
  );
641
633
  }
642
- /** Preview proration details for an immediate plan change (a higher-sort-order plan or a longer interval) without applying it. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Downgrades — a lower-sort-order plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with a Promotional Offer. */
634
+ /** Preview proration details for an immediate plan change without applying it. Interval direction takes precedence: a longer interval is immediate and a shorter interval is scheduled. When the interval is unchanged, a higher-sort-order plan is immediate and a lower-sort-order plan is scheduled. A paid-to-free change is always scheduled. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Scheduled changes return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with an Offer. */
643
635
  async previewChange(params, options) {
644
636
  const { id, ...rest } = params;
645
637
  return this.httpClient.post(
@@ -648,7 +640,7 @@ var SubscriptionsResource = class {
648
640
  options
649
641
  );
650
642
  }
651
- /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply a Promotional Offer by offerId; past-due recovery cannot. */
643
+ /** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
652
644
  async reactivate(params, options) {
653
645
  const { id, ...rest } = params;
654
646
  return this.httpClient.post(
@@ -684,7 +676,7 @@ var SubscriptionsResource = class {
684
676
  async list(params, options) {
685
677
  return this.httpClient.get("/subscriptions", params, options);
686
678
  }
687
- /** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory offer. Pass one Promotional Offer through offerId to override it. Experiment assignment remains external. */
679
+ /** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply any active compatible Offer directly; the Offer does not need a prior plan-price association. */
688
680
  async create(params, options) {
689
681
  return this.httpClient.post("/subscriptions", params, options);
690
682
  }
@@ -764,13 +756,13 @@ var GeneratedResources = class {
764
756
  this.featureAccess = new FeatureAccessResource(http);
765
757
  this.features = new FeaturesResource(http);
766
758
  this.invoices = new InvoicesResource(http);
759
+ this.markets = new MarketsResource(http);
767
760
  this.offers = new OffersResource(http);
768
761
  this.payments = new PaymentsResource(http);
769
762
  this.payouts = new PayoutsResource(http);
770
763
  this.planGroups = new PlanGroupsResource(http);
771
764
  this.plans = new PlansResource(http);
772
765
  this.portal = new PortalResource(http);
773
- this.pricing = new PricingResource(http);
774
766
  this.promoCodes = new PromoCodesResource(http);
775
767
  this.provisioning = new ProvisioningResource(http);
776
768
  this.quota = new QuotaResource(http);
@@ -901,8 +893,8 @@ var CommetValidationError = class extends CommetError {
901
893
  };
902
894
 
903
895
  // src/version.ts
904
- var API_VERSION = "2026-07-24";
905
- var SDK_VERSION = "8.0.1";
896
+ var API_VERSION = "2026-07-31";
897
+ var SDK_VERSION = "9.0.0";
906
898
 
907
899
  // src/utils/telemetry.ts
908
900
  var registeredIntegrations = /* @__PURE__ */ new Set();