sinfactura-types 1.1.0 → 1.1.2
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 +65 -12
- package/dist/subscription.js +5 -2
- package/package.json +1 -1
package/dist/subscription.d.ts
CHANGED
|
@@ -13,8 +13,11 @@
|
|
|
13
13
|
* flow now sets status='active' on fundador subscriptions).
|
|
14
14
|
* - `FeatureKey` uses flat camelCase (not the dotted `reports.advanced` from the design kit).
|
|
15
15
|
* - Monetary amounts are integers in minor units (ARS cents) to avoid float issues.
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
16
|
+
* - Feature keys now match the BE wire format directly (renamed afip→afipInvoicing,
|
|
17
|
+
* cash→cashManagement, stripePayments→paymentIntegrations, reportsAdvanced→advancedReports
|
|
18
|
+
* as of 2026-04-26). New keys whatsappCommerce/aiFeatures/mobileApp/customDomain are
|
|
19
|
+
* declared here even when their epics haven't shipped — the matrix can set
|
|
20
|
+
* enabled:false until they do.
|
|
18
21
|
*/
|
|
19
22
|
declare global {
|
|
20
23
|
type PlanTier = 'basico' | 'emprendedor' | 'profesional' | 'avanzado' | 'fundador';
|
|
@@ -44,16 +47,19 @@ declare global {
|
|
|
44
47
|
type EntitlementType = 'boolean' | 'numeric' | 'metered';
|
|
45
48
|
interface Entitlement {
|
|
46
49
|
type: EntitlementType;
|
|
47
|
-
|
|
50
|
+
/** `null` for `numeric`/`metered` types where on/off semantics don't apply (limit-driven). */
|
|
51
|
+
enabled: boolean | null;
|
|
48
52
|
/** Required for `numeric` and `metered`. `Infinity`-equivalent — treat sentinel value for "unlimited". */
|
|
49
53
|
limit?: number;
|
|
54
|
+
/** Origin of this entitlement entry. `plan` = from the tier matrix; `override` = tenant-specific override; `trial` = trial bonus. */
|
|
55
|
+
source?: 'plan' | 'override' | 'trial';
|
|
50
56
|
}
|
|
51
57
|
/**
|
|
52
58
|
* All gated features. Add new keys here when a new feature becomes gateable;
|
|
53
59
|
* every existing plan in `FEATURE_MATRIX` must then declare the new key
|
|
54
60
|
* (TypeScript enforces this via `Record<FeatureKey, Entitlement>`).
|
|
55
61
|
*/
|
|
56
|
-
type FeatureKey = 'maxOrdersMonth' | 'maxInvoicesMonth' | 'maxProducts' | 'maxUsers' | 'maxCustomers' | 'maxStores' | '
|
|
62
|
+
type FeatureKey = 'maxOrdersMonth' | 'maxInvoicesMonth' | 'maxProducts' | 'maxUsers' | 'maxCustomers' | 'maxStores' | 'afipInvoicing' | 'paymentIntegrations' | 'suppliers' | 'cashManagement' | 'multiStore' | 'importExport' | 'advancedReports' | 'customBranding' | 'apiAccess' | 'prioritySupport' | 'whatsappCommerce' | 'aiFeatures' | 'mobileApp' | 'customDomain';
|
|
57
63
|
/** Full feature matrix — every tier declares every feature. */
|
|
58
64
|
type FeatureMatrix = Record<PlanTier, Record<FeatureKey, Entitlement>>;
|
|
59
65
|
/** Resolved entitlements for a specific tenant (matrix + overrides applied). */
|
|
@@ -71,12 +77,17 @@ declare global {
|
|
|
71
77
|
label: string;
|
|
72
78
|
/** Short marketing tagline (Spanish). */
|
|
73
79
|
blurb?: string;
|
|
74
|
-
/** Price in
|
|
80
|
+
/** Price in the plan's `currency` smallest unit for monthly billing. `null` = contactar. */
|
|
75
81
|
priceMonthly: number | null;
|
|
76
|
-
/** Price in
|
|
82
|
+
/** Price in the plan's `currency` smallest unit for annual billing (total / 12; ~20% discount). `null` = contactar. */
|
|
77
83
|
priceAnnual: number | null;
|
|
78
|
-
/**
|
|
79
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Currency the prices are denominated in. `'ARS'` at launch; `'USD'`
|
|
86
|
+
* is the migration target (api#841). Widened from the launch-only
|
|
87
|
+
* `'ARS'` literal in api#842 so the FE can render either currency
|
|
88
|
+
* without a type change once the platform flips.
|
|
89
|
+
*/
|
|
90
|
+
currency: 'ARS' | 'USD';
|
|
80
91
|
/**
|
|
81
92
|
* Whether the plan is accepting new subscribers. Closed-cohort plans
|
|
82
93
|
* (e.g. Founders after 2026-05-31) set this to `false` without deleting
|
|
@@ -93,6 +104,14 @@ declare global {
|
|
|
93
104
|
/** Stripe Price IDs once the plan is wired to Stripe Products (api#627). */
|
|
94
105
|
stripeMonthlyPriceId?: string;
|
|
95
106
|
stripeAnnualPriceId?: string;
|
|
107
|
+
/**
|
|
108
|
+
* MercadoPago PreApprovalPlan IDs — populated by the future
|
|
109
|
+
* `seed-mercadopago-plans` Lambda (api#843). Coexist with the Stripe
|
|
110
|
+
* IDs above on the same Plan row so both providers' state can live
|
|
111
|
+
* in one place; unused fields stay dormant.
|
|
112
|
+
*/
|
|
113
|
+
mpPreApprovalPlanIdMonthly?: string;
|
|
114
|
+
mpPreApprovalPlanIdAnnual?: string;
|
|
96
115
|
/** Per-tier entitlement configuration. */
|
|
97
116
|
entitlements: Record<FeatureKey, Entitlement>;
|
|
98
117
|
createdAt: number;
|
|
@@ -107,6 +126,15 @@ declare global {
|
|
|
107
126
|
planTier: PlanTier;
|
|
108
127
|
status: SubscriptionStatus;
|
|
109
128
|
billingCycle: BillingCycle;
|
|
129
|
+
/**
|
|
130
|
+
* Currency this subscription was billed in at checkout time.
|
|
131
|
+
* Snapshotted from the Plan's `currency` field so it survives
|
|
132
|
+
* platform-wide currency switches (api#841 / api#842) — a customer
|
|
133
|
+
* who signed up on ARS keeps being charged in ARS even after the
|
|
134
|
+
* platform flips to USD for new signups. Required for accurate
|
|
135
|
+
* historical reporting + AFIP invoices.
|
|
136
|
+
*/
|
|
137
|
+
currency?: 'ARS' | 'USD';
|
|
110
138
|
/** Current period window (Unix ms). */
|
|
111
139
|
currentPeriodStart: number;
|
|
112
140
|
currentPeriodEnd: number;
|
|
@@ -148,14 +176,39 @@ declare global {
|
|
|
148
176
|
counters: Partial<Record<FeatureKey, number>>;
|
|
149
177
|
updatedAt: number;
|
|
150
178
|
}
|
|
179
|
+
/** A single entitlement entry as returned by GET /subscription. */
|
|
180
|
+
interface SubscriptionEntitlementEntry {
|
|
181
|
+
key: FeatureKey;
|
|
182
|
+
type: EntitlementType;
|
|
183
|
+
enabled: boolean | null;
|
|
184
|
+
limit: number | null;
|
|
185
|
+
source: 'plan' | 'override' | 'trial';
|
|
186
|
+
}
|
|
187
|
+
/** A single usage entry as returned by GET /subscription. */
|
|
188
|
+
interface SubscriptionUsageEntry {
|
|
189
|
+
key: FeatureKey;
|
|
190
|
+
/** Period in YYYYMM format. */
|
|
191
|
+
period: string;
|
|
192
|
+
current: number;
|
|
193
|
+
limit: number;
|
|
194
|
+
remaining: number;
|
|
195
|
+
}
|
|
151
196
|
/**
|
|
152
197
|
* Full subscription snapshot pushed to the frontend on subscription/entitlement
|
|
153
|
-
* changes.
|
|
198
|
+
* changes. Flat shape — matches GET /subscription wire format directly.
|
|
154
199
|
*/
|
|
155
200
|
interface SubscriptionSyncPayload {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
201
|
+
planTier: PlanTier;
|
|
202
|
+
status: SubscriptionStatus;
|
|
203
|
+
billingCycle: BillingCycle | null;
|
|
204
|
+
currentPeriodStart: number | null;
|
|
205
|
+
currentPeriodEnd: number | null;
|
|
206
|
+
trialEndsAt: number | null;
|
|
207
|
+
freeUntil?: string;
|
|
208
|
+
cancelAt: number | null;
|
|
209
|
+
canceledAt: number | null;
|
|
210
|
+
entitlements: SubscriptionEntitlementEntry[];
|
|
211
|
+
usage: SubscriptionUsageEntry[];
|
|
159
212
|
}
|
|
160
213
|
}
|
|
161
214
|
export {};
|
package/dist/subscription.js
CHANGED
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
* flow now sets status='active' on fundador subscriptions).
|
|
14
14
|
* - `FeatureKey` uses flat camelCase (not the dotted `reports.advanced` from the design kit).
|
|
15
15
|
* - Monetary amounts are integers in minor units (ARS cents) to avoid float issues.
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
16
|
+
* - Feature keys now match the BE wire format directly (renamed afip→afipInvoicing,
|
|
17
|
+
* cash→cashManagement, stripePayments→paymentIntegrations, reportsAdvanced→advancedReports
|
|
18
|
+
* as of 2026-04-26). New keys whatsappCommerce/aiFeatures/mobileApp/customDomain are
|
|
19
|
+
* declared here even when their epics haven't shipped — the matrix can set
|
|
20
|
+
* enabled:false until they do.
|
|
18
21
|
*/
|
|
19
22
|
export {};
|