sinfactura-types 1.2.0 → 1.3.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/subscription.d.ts +25 -25
- package/dist/subscription.js +9 -7
- package/package.json +1 -1
package/dist/subscription.d.ts
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
* Subscription types — plan tiers, entitlements, feature matrix, subscription state.
|
|
3
3
|
*
|
|
4
4
|
* Ships app#710 (Chunk 1). Canonical decisions live in
|
|
5
|
-
* sinfactura/app/docs/plans/SUBSCRIPTION_BUSINESS_DECISIONS.md
|
|
5
|
+
* sinfactura/app/docs/plans/SUBSCRIPTION_BUSINESS_DECISIONS.md and
|
|
6
|
+
* sinfactura/app/docs/adr/0010-launch-trial-policy.md.
|
|
6
7
|
*
|
|
7
8
|
* Notes:
|
|
8
|
-
* - Tier names are the
|
|
9
|
-
* and api#802
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* - Tier names are the 4 locked Spanish tiers (per SUBSCRIPTION_TIERS_BEST_PRACTICES §0
|
|
10
|
+
* and api#802): BÁSICO, EMPRENDEDOR, PROFESIONAL, AVANZADO. The launch policy
|
|
11
|
+
* (ADR-0010) gives every new paid subscription a 30-day Stripe trial; courtesy
|
|
12
|
+
* gifts (formerly the Founders cohort) are now a one-off ops action via
|
|
13
|
+
* `gift-subscription` that sets `freeUntil` on the SUBSCRIPTION row.
|
|
14
|
+
* - `freeUntil` lives on every Subscription independent of status. It is the
|
|
15
|
+
* courtesy-gift cutoff; while `freeUntil > now` the BE suppresses billing.
|
|
14
16
|
* - `FeatureKey` uses flat camelCase (not the dotted `reports.advanced` from the design kit).
|
|
15
17
|
* - Monetary amounts are integers in minor units (ARS cents) to avoid float issues.
|
|
16
18
|
* - Feature keys now match the BE wire format directly (renamed afip→afipInvoicing,
|
|
@@ -20,19 +22,21 @@
|
|
|
20
22
|
* enabled:false until they do.
|
|
21
23
|
*/
|
|
22
24
|
declare global {
|
|
23
|
-
type PlanTier = 'basico' | 'emprendedor' | 'profesional' | 'avanzado'
|
|
25
|
+
type PlanTier = 'basico' | 'emprendedor' | 'profesional' | 'avanzado';
|
|
24
26
|
/**
|
|
25
27
|
* Lifecycle status of a tenant's subscription.
|
|
26
28
|
*
|
|
27
|
-
* - `trialing` — new signup in
|
|
29
|
+
* - `trialing` — new paid-tier signup in their 30-day Stripe trial.
|
|
28
30
|
* - `active` — paid subscription, period current.
|
|
29
31
|
* - `past_due` — payment failed, in the 7-day grace window.
|
|
30
32
|
* - `readonly` — grace elapsed, writes blocked, tenant can still read.
|
|
31
33
|
* - `canceled` — tenant ended subscription; data retained per grace policy.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* Courtesy gifts (formerly the Founders cohort, ADR-0009) are no longer a
|
|
36
|
+
* status — they are represented by `Subscription.freeUntil` on top of any
|
|
37
|
+
* normal status. See ADR-0010.
|
|
34
38
|
*/
|
|
35
|
-
type SubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'readonly' | 'canceled'
|
|
39
|
+
type SubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'readonly' | 'canceled';
|
|
36
40
|
type BillingCycle = 'monthly' | 'annual';
|
|
37
41
|
/**
|
|
38
42
|
* Shape of a single entitlement on a (tier, feature) cell.
|
|
@@ -125,9 +129,8 @@ declare global {
|
|
|
125
129
|
description: string;
|
|
126
130
|
/**
|
|
127
131
|
* Whether the plan is shown on the pricing page and accepting new
|
|
128
|
-
* subscribers.
|
|
129
|
-
*
|
|
130
|
-
* set this to `false` without deleting the plan row.
|
|
132
|
+
* subscribers. Pre-launch / sales-led tiers (e.g. AVANZADO until ≥2
|
|
133
|
+
* Planned features ship) set this to `false` without deleting the row.
|
|
131
134
|
*/
|
|
132
135
|
isActive: boolean;
|
|
133
136
|
/**
|
|
@@ -146,7 +149,7 @@ declare global {
|
|
|
146
149
|
/**
|
|
147
150
|
* Currency the prices are denominated in. `'ARS'` at launch; `'USD'`
|
|
148
151
|
* is the migration target (api#841). `null` on free / off-billing
|
|
149
|
-
* tiers (basico
|
|
152
|
+
* tiers (basico).
|
|
150
153
|
*/
|
|
151
154
|
currency: 'ARS' | 'USD' | null;
|
|
152
155
|
/**
|
|
@@ -207,17 +210,13 @@ declare global {
|
|
|
207
210
|
/** Set while `status === 'trialing'`. Unix ms. */
|
|
208
211
|
trialEndsAt?: number;
|
|
209
212
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
213
|
+
* Courtesy-gift cutoff (ADR-0010) — YYYY-MM-DD up to which billing is
|
|
214
|
+
* suppressed regardless of `status`. String (not numeric ms) so it's
|
|
215
|
+
* human-readable in the DynamoDB console. Set/cleared via the
|
|
216
|
+
* `gift-subscription` super endpoint with an audit-logged reason.
|
|
214
217
|
*/
|
|
215
218
|
freeUntil?: string;
|
|
216
|
-
/**
|
|
217
|
-
graceUntil?: string;
|
|
218
|
-
/** Founders cohort only — eligible for the perpetual founder discount after cutoff. */
|
|
219
|
-
founderDiscountEligible?: boolean;
|
|
220
|
-
/** Stripe identifiers (absent for trialing/fundador before checkout). */
|
|
219
|
+
/** Stripe identifiers (absent before first checkout). */
|
|
221
220
|
stripeCustomerId?: string;
|
|
222
221
|
stripeSubscriptionId?: string;
|
|
223
222
|
/**
|
|
@@ -270,6 +269,7 @@ declare global {
|
|
|
270
269
|
currentPeriodStart: number | null;
|
|
271
270
|
currentPeriodEnd: number | null;
|
|
272
271
|
trialEndsAt: number | null;
|
|
272
|
+
/** Courtesy-gift cutoff (ADR-0010). YYYY-MM-DD or omitted. */
|
|
273
273
|
freeUntil?: string;
|
|
274
274
|
cancelAt: number | null;
|
|
275
275
|
canceledAt: number | null;
|
package/dist/subscription.js
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
* Subscription types — plan tiers, entitlements, feature matrix, subscription state.
|
|
3
3
|
*
|
|
4
4
|
* Ships app#710 (Chunk 1). Canonical decisions live in
|
|
5
|
-
* sinfactura/app/docs/plans/SUBSCRIPTION_BUSINESS_DECISIONS.md
|
|
5
|
+
* sinfactura/app/docs/plans/SUBSCRIPTION_BUSINESS_DECISIONS.md and
|
|
6
|
+
* sinfactura/app/docs/adr/0010-launch-trial-policy.md.
|
|
6
7
|
*
|
|
7
8
|
* Notes:
|
|
8
|
-
* - Tier names are the
|
|
9
|
-
* and api#802
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* - Tier names are the 4 locked Spanish tiers (per SUBSCRIPTION_TIERS_BEST_PRACTICES §0
|
|
10
|
+
* and api#802): BÁSICO, EMPRENDEDOR, PROFESIONAL, AVANZADO. The launch policy
|
|
11
|
+
* (ADR-0010) gives every new paid subscription a 30-day Stripe trial; courtesy
|
|
12
|
+
* gifts (formerly the Founders cohort) are now a one-off ops action via
|
|
13
|
+
* `gift-subscription` that sets `freeUntil` on the SUBSCRIPTION row.
|
|
14
|
+
* - `freeUntil` lives on every Subscription independent of status. It is the
|
|
15
|
+
* courtesy-gift cutoff; while `freeUntil > now` the BE suppresses billing.
|
|
14
16
|
* - `FeatureKey` uses flat camelCase (not the dotted `reports.advanced` from the design kit).
|
|
15
17
|
* - Monetary amounts are integers in minor units (ARS cents) to avoid float issues.
|
|
16
18
|
* - Feature keys now match the BE wire format directly (renamed afip→afipInvoicing,
|