platform-types 1.10.706 → 1.10.707

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.
@@ -472,7 +472,7 @@ declare global {
472
472
  remaining: number | null;
473
473
  }
474
474
  /**
475
- * Full subscription snapshot. Three producers emit it:
475
+ * Full subscription snapshot. Four producers emit it:
476
476
  *
477
477
  * - `GET /subscription` — the full `usage[]`, including the row-counted
478
478
  * `webhooks` / `maxWarehouses` meters. The two are present together or
@@ -481,7 +481,12 @@ declare global {
481
481
  * - the `GET /store` subscription embed — WITHOUT those two meters (monthly
482
482
  * and lifetime only) and without `provider`;
483
483
  * - the reply of the MANAGER `PUT /platform/stores/{storeId}/subscription` —
484
- * built by the same assembly as `GET /subscription`, meters included.
484
+ * built by the same assembly as `GET /subscription`, meters included, read
485
+ * strongly consistent after the write;
486
+ * - the `data` of a `POST /subscription/cancel` that ended a trial with no
487
+ * payment method — the same assembly again, read after the write; `data` is
488
+ * absent from that 200 only when the read itself failed after the trial had
489
+ * already ended. A cancel that reached a provider answers no `data`.
485
490
  *
486
491
  * The WebSocket only nudges a refetch on subscription/entitlement changes; it
487
492
  * never carries this payload.
@@ -500,6 +505,27 @@ declare global {
500
505
  * (`externalCustomerId`/`externalSubscriptionId`) are never exposed.
501
506
  */
502
507
  provider?: SubscriptionProvider;
508
+ /**
509
+ * Whether the row holds a live provider subscription that `POST /subscription/cancel`
510
+ * can act on: a provider subscription id of its rail's kind (Stripe `sub_…`; a
511
+ * MercadoPago PreApproval id or manual-mode anchor) on a row that is not `canceled`.
512
+ * Unlike `provider`, never a fallback. Carried by every producer, the `GET /store`
513
+ * embed included.
514
+ *
515
+ * `true` does not promise the portal or a payment-method update — those also depend
516
+ * on the rail: MercadoPago has no hosted portal (`501 BILLING_NOT_CONFIGURED`), a
517
+ * manual-mode anchor has no payment method to update (`501`), and a Stripe portal
518
+ * needs the `cus_` Customer (a MANAGER-set `sub_` row without one is `404`).
519
+ *
520
+ * When `false`, those three routes answer `404 NO_SUBSCRIPTION` without calling a
521
+ * provider — no row, a `cus_`-only Stripe checkout, a canceled row, an id from the
522
+ * other rail, and any provider-less row — with exactly two cancel exceptions, both
523
+ * on a provider-less row (no `provider`, provider subscription or customer id):
524
+ * a `trialing` row that is not the platform store, has a `trialEndsAt` and is not
525
+ * covered by a courtesy gift (`freeUntil`) has its trial ended (200); and a row no
526
+ * longer `trialing` that carries `trialEndedFromTier` answers 200 with no write.
527
+ */
528
+ hasProviderSubscription: boolean;
503
529
  billingCycle: BillingCycle | null;
504
530
  currentPeriodStart: number | null;
505
531
  currentPeriodEnd: number | null;
@@ -518,13 +544,15 @@ declare global {
518
544
  */
519
545
  canceledFromTier?: PlanTier | null;
520
546
  /**
521
- * The paid tier a trial ran on when it lapsed with no payment method —
522
- * set only by the grace sweep when it moves a provider-less `trialing`
523
- * row (no provider, no provider subscription or customer id) whose
524
- * `trialEndsAt` has passed to `basico`/`active`. Cleared (`null`) when
525
- * the store re-subscribes to a paid tier or is canceled — a cancel
526
- * records its own lost plan in `canceledFromTier`. `null` when absent —
527
- * every row that never expired that way, or has moved on since.
547
+ * The paid tier a trial ran on when it ended with no payment method —
548
+ * set only when a provider-less `trialing` row (no provider, no provider
549
+ * subscription or customer id) moves to `basico`/`active`: by the grace
550
+ * sweep once its `trialEndsAt` has passed, or by `POST /subscription/cancel`
551
+ * ending it early (that cancel sets this, never `canceledFromTier`).
552
+ * Cleared (`null`) when the store re-subscribes to a paid tier or a provider
553
+ * subscription is canceled — that cancel records its own lost plan in
554
+ * `canceledFromTier`. `null` when absent — every row that never ended a
555
+ * trial that way, or has moved on since.
528
556
  */
529
557
  trialEndedFromTier?: PlanTier | null;
530
558
  entitlements: SubscriptionEntitlementEntry[];
@@ -633,7 +661,11 @@ declare global {
633
661
  * it together with `provider`.
634
662
  */
635
663
  mode?: 'preapproval' | 'manual';
636
- /** The paid tier an expired trial dropped from; `null` when a write cleared it. */
664
+ /**
665
+ * The paid tier a trial with no payment method dropped from — one that expired
666
+ * (the grace sweep) or one the tenant ended through `POST /subscription/cancel`;
667
+ * `null` when a write cleared it.
668
+ */
637
669
  trialEndedFromTier?: PlanTier | null;
638
670
  };
639
671
  /**
@@ -648,7 +680,9 @@ declare global {
648
680
  * `fullName: ''`), `before` holds the trial's `status`/`planTier`/
649
681
  * `trialEndsAt`, and `after` holds `status: 'active'`,
650
682
  * `planTier: 'basico'`, `trialEndsAt: null` and `trialEndedFromTier`
651
- * (the trial's tier).
683
+ * (the trial's tier). `subscription.trial_canceled` rows have the same
684
+ * `before`/`after` and name the tenant user who ended the trial through
685
+ * `POST /subscription/cancel` as `actor`.
652
686
  *
653
687
  * ⚠️ The same partition also carries entitlement-override and advancedPricing
654
688
  * rows whose `before`/`after` hold different keys, so consumers must read
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.706",
3
+ "version": "1.10.707",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",