platform-types 1.10.703 → 1.10.705
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/cjs/subscription.js +6 -3
- package/dist/store.d.ts +10 -4
- package/dist/subscription.d.ts +46 -12
- package/dist/subscription.js +6 -3
- package/package.json +1 -1
package/dist/cjs/subscription.js
CHANGED
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
* - Tier names are the 4 locked Spanish tiers (per SUBSCRIPTION_TIERS_BEST_PRACTICES §0):
|
|
11
11
|
* BÁSICO, EMPRENDEDOR, PROFESIONAL, AVANZADO. A new store starts trialing on
|
|
12
12
|
* the `trialTier` platform global, with `trialEndsAt` set `trialDays` days out
|
|
13
|
-
* (see `PlanCatalogue.trial`)
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* (see `PlanCatalogue.trial`). A trial with no payment method drops to
|
|
14
|
+
* `basico` (`active`, free-tier limits, no lock-out) on the first nightly
|
|
15
|
+
* sweep after that date, unless a courtesy gift covers today. A Stripe
|
|
16
|
+
* checkout grants no trial of its own: it carries over what is left of the
|
|
17
|
+
* row's `trialEndsAt` (as `subscription_data.trial_end`) when that is at
|
|
18
|
+
* least 48 h + 5 min away, and bills from checkout otherwise. Courtesy
|
|
16
19
|
* gifts (formerly the Founders cohort) are now a one-off ops action via
|
|
17
20
|
* `gift-subscription` that sets `freeUntil` on the SUBSCRIPTION row.
|
|
18
21
|
* - `freeUntil` lives on every Subscription independent of status. It is the
|
package/dist/store.d.ts
CHANGED
|
@@ -829,10 +829,16 @@ declare global {
|
|
|
829
829
|
* writes `planTier: 'basico'` on a delinquent store at day 14. A security
|
|
830
830
|
* posture does not lapse because an invoice did.
|
|
831
831
|
*
|
|
832
|
-
* Verified rather than assumed:
|
|
833
|
-
* `
|
|
834
|
-
*
|
|
835
|
-
*
|
|
832
|
+
* Verified rather than assumed: on the SUBSCRIPTION row `graceSweep`
|
|
833
|
+
* writes `status`, `planTier`, `pastDueSince`, `canceledFromTier`,
|
|
834
|
+
* `canceledAt`, `trialEndingNotifiedAt` and `updatedAt`, SETs
|
|
835
|
+
* `trialEndedFromTier` and REMOVEs `trialEndsAt` on a trial expiry, and
|
|
836
|
+
* REMOVEs `pastDueSince` and `trialEndedFromTier` on a cancel. Its other
|
|
837
|
+
* writes are its checkpoint row, ERROR rows and the shop-grace reconcile,
|
|
838
|
+
* which SETs only the STORE row's `ecommerce.deactivatesAt` and
|
|
839
|
+
* `updatedAt` (plus its own grace rows and custom-domain rows'
|
|
840
|
+
* `deactivatesAt`) — none of them touches `totp` or anything under
|
|
841
|
+
* `config`. So an obligation kept here survives the downgrade **by
|
|
836
842
|
* construction**, with no special case for anyone to remember and nothing
|
|
837
843
|
* to re-check when the sweep changes.
|
|
838
844
|
*
|
package/dist/subscription.d.ts
CHANGED
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
* - Tier names are the 4 locked Spanish tiers (per SUBSCRIPTION_TIERS_BEST_PRACTICES §0):
|
|
10
10
|
* BÁSICO, EMPRENDEDOR, PROFESIONAL, AVANZADO. A new store starts trialing on
|
|
11
11
|
* the `trialTier` platform global, with `trialEndsAt` set `trialDays` days out
|
|
12
|
-
* (see `PlanCatalogue.trial`)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* (see `PlanCatalogue.trial`). A trial with no payment method drops to
|
|
13
|
+
* `basico` (`active`, free-tier limits, no lock-out) on the first nightly
|
|
14
|
+
* sweep after that date, unless a courtesy gift covers today. A Stripe
|
|
15
|
+
* checkout grants no trial of its own: it carries over what is left of the
|
|
16
|
+
* row's `trialEndsAt` (as `subscription_data.trial_end`) when that is at
|
|
17
|
+
* least 48 h + 5 min away, and bills from checkout otherwise. Courtesy
|
|
15
18
|
* gifts (formerly the Founders cohort) are now a one-off ops action via
|
|
16
19
|
* `gift-subscription` that sets `freeUntil` on the SUBSCRIPTION row.
|
|
17
20
|
* - `freeUntil` lives on every Subscription independent of status. It is the
|
|
@@ -34,8 +37,11 @@ declare global {
|
|
|
34
37
|
*
|
|
35
38
|
* - `trialing` — a trial on a paid tier: a new store trials on the
|
|
36
39
|
* `trialTier` platform global with `trialEndsAt` set `trialDays` days out
|
|
37
|
-
* (`PlanCatalogue.trial`) —
|
|
38
|
-
*
|
|
40
|
+
* (`PlanCatalogue.trial`) — once that date passes with no payment method the
|
|
41
|
+
* nightly sweep drops the row to `basico`/`active` (unless a courtesy gift
|
|
42
|
+
* covers today). A Stripe checkout carries over the remaining
|
|
43
|
+
* `trialEndsAt` when it is at least 48 h + 5 min away, else no trial —
|
|
44
|
+
* never a fresh fixed period.
|
|
39
45
|
* - `active` — paid subscription, period current.
|
|
40
46
|
* - `past_due` — payment failed, in the 7-day grace window.
|
|
41
47
|
* - `readonly` — grace elapsed, writes blocked, tenant can still read.
|
|
@@ -220,17 +226,22 @@ declare global {
|
|
|
220
226
|
/**
|
|
221
227
|
* How a billing cycle of a plan can be bought:
|
|
222
228
|
*
|
|
223
|
-
* - `self` — self-serve checkout: the cycle has a charged price
|
|
224
|
-
* plan has a `currency
|
|
229
|
+
* - `self` — self-serve checkout: the cycle has a charged price, the
|
|
230
|
+
* plan has a `currency`, and the plan is active.
|
|
225
231
|
* - `sales` — the plan charges some cycle, but not this one self-serve
|
|
226
|
-
* (no price on it,
|
|
232
|
+
* (no price on it, no `currency`, or `isActive: false`); route
|
|
233
|
+
* to "Contactar ventas". On `GET /subscription/plans` the
|
|
234
|
+
* caller's OWN hidden tier reads `self` instead, as checkout
|
|
235
|
+
* lets that store renew it.
|
|
227
236
|
* - `none` — neither cycle is charged (the free tier); nothing to buy.
|
|
228
237
|
*/
|
|
229
238
|
type PlanCheckoutMode = 'self' | 'sales' | 'none';
|
|
230
239
|
/**
|
|
231
240
|
* A sellable plan in the catalog, exactly as `GET /subscription/plans` and
|
|
232
241
|
* `GET /public/plans` emit it — both build it with the same catalogue
|
|
233
|
-
* builder, so the two endpoints return identical plans
|
|
242
|
+
* builder, so the two endpoints return identical plans — except the
|
|
243
|
+
* caller's own hidden tier's `checkout` on `GET /subscription/plans` (see
|
|
244
|
+
* {@link PlanCheckoutMode}). The template fields
|
|
234
245
|
* (copy, prices, flags) live in DynamoDB (`PLAN#{tier}` / `SK: PLAN`),
|
|
235
246
|
* administered via `POST /platform/billing/plans` +
|
|
236
247
|
* `PATCH /platform/billing/plans/{tier}`; `features` are code, rendered at
|
|
@@ -268,7 +279,9 @@ declare global {
|
|
|
268
279
|
/**
|
|
269
280
|
* Whether the plan is shown on the pricing page and accepting new
|
|
270
281
|
* subscribers. Pre-launch / sales-led tiers set this `false` without
|
|
271
|
-
* deleting the row.
|
|
282
|
+
* deleting the row. `POST /subscription/checkout` refuses a `false`
|
|
283
|
+
* tier with 400 `PLAN_NOT_PURCHASABLE` unless the store's subscription
|
|
284
|
+
* is already on it — existing subscribers on it may renew.
|
|
272
285
|
*/
|
|
273
286
|
isActive: boolean;
|
|
274
287
|
/**
|
|
@@ -336,8 +349,10 @@ declare global {
|
|
|
336
349
|
groups: PlanFeatureGroup[];
|
|
337
350
|
/**
|
|
338
351
|
* What a store registered now starts on: `tier` — a paid tier — in status
|
|
339
|
-
* `trialing`, with `trialEndsAt` set `days` days out.
|
|
340
|
-
*
|
|
352
|
+
* `trialing`, with `trialEndsAt` set `days` days out. A store that has
|
|
353
|
+
* attached no payment method by then drops to `basico` (`active`, free-tier
|
|
354
|
+
* limits) on the first nightly sweep after that date, unless a courtesy gift
|
|
355
|
+
* covers today. Resolved from the platform globals
|
|
341
356
|
* `trialTier` / `trialDays` — `profesional` / `30` when unset or invalid —
|
|
342
357
|
* so it is always present.
|
|
343
358
|
*/
|
|
@@ -502,6 +517,16 @@ declare global {
|
|
|
502
517
|
* field existed — forward-only, readers fall back to generic copy.
|
|
503
518
|
*/
|
|
504
519
|
canceledFromTier?: PlanTier | null;
|
|
520
|
+
/**
|
|
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.
|
|
528
|
+
*/
|
|
529
|
+
trialEndedFromTier?: PlanTier | null;
|
|
505
530
|
entitlements: SubscriptionEntitlementEntry[];
|
|
506
531
|
usage: SubscriptionUsageEntry[];
|
|
507
532
|
}
|
|
@@ -608,6 +633,8 @@ declare global {
|
|
|
608
633
|
* it together with `provider`.
|
|
609
634
|
*/
|
|
610
635
|
mode?: 'preapproval' | 'manual';
|
|
636
|
+
/** The paid tier an expired trial dropped from; `null` when a write cleared it. */
|
|
637
|
+
trialEndedFromTier?: PlanTier | null;
|
|
611
638
|
};
|
|
612
639
|
/**
|
|
613
640
|
* One audit row for a MANAGER out-of-band subscription change, as returned by
|
|
@@ -616,6 +643,13 @@ declare global {
|
|
|
616
643
|
* `AUDIT#SUBSCRIPTION#{storeId}` partition. `before`/`after` carry the
|
|
617
644
|
* subscription fields an operator can change.
|
|
618
645
|
*
|
|
646
|
+
* The partition also carries SYSTEM-written `subscription.trial_expired`
|
|
647
|
+
* rows from the grace sweep: `actor` is empty (`userId: ''`,
|
|
648
|
+
* `fullName: ''`), `before` holds the trial's `status`/`planTier`/
|
|
649
|
+
* `trialEndsAt`, and `after` holds `status: 'active'`,
|
|
650
|
+
* `planTier: 'basico'`, `trialEndsAt: null` and `trialEndedFromTier`
|
|
651
|
+
* (the trial's tier).
|
|
652
|
+
*
|
|
619
653
|
* ⚠️ The same partition also carries entitlement-override and advancedPricing
|
|
620
654
|
* rows whose `before`/`after` hold different keys, so consumers must read
|
|
621
655
|
* each side structurally rather than trusting every field to be present.
|
package/dist/subscription.js
CHANGED
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
* - Tier names are the 4 locked Spanish tiers (per SUBSCRIPTION_TIERS_BEST_PRACTICES §0):
|
|
10
10
|
* BÁSICO, EMPRENDEDOR, PROFESIONAL, AVANZADO. A new store starts trialing on
|
|
11
11
|
* the `trialTier` platform global, with `trialEndsAt` set `trialDays` days out
|
|
12
|
-
* (see `PlanCatalogue.trial`)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* (see `PlanCatalogue.trial`). A trial with no payment method drops to
|
|
13
|
+
* `basico` (`active`, free-tier limits, no lock-out) on the first nightly
|
|
14
|
+
* sweep after that date, unless a courtesy gift covers today. A Stripe
|
|
15
|
+
* checkout grants no trial of its own: it carries over what is left of the
|
|
16
|
+
* row's `trialEndsAt` (as `subscription_data.trial_end`) when that is at
|
|
17
|
+
* least 48 h + 5 min away, and bills from checkout otherwise. Courtesy
|
|
15
18
|
* gifts (formerly the Founders cohort) are now a one-off ops action via
|
|
16
19
|
* `gift-subscription` that sets `freeUntil` on the SUBSCRIPTION row.
|
|
17
20
|
* - `freeUntil` lives on every Subscription independent of status. It is the
|