sinfactura-types 1.6.26 → 1.6.28

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.
@@ -0,0 +1,45 @@
1
+ declare global {
2
+ /**
3
+ * Wire contract returned by `POST /tenants/{storeId}/impersonate` — the
4
+ * MANAGER tenant-impersonation mint endpoint (app#1756 · spine #1187).
5
+ *
6
+ * BE produces, FE consumes. This is the ONLY impersonation type that crosses
7
+ * the api↔app boundary: the JWT claims (`act`/`aud`/`scope`/`store`/`sid`),
8
+ * the request body (`{ targetUserId, reason }`) and the server-side
9
+ * session-registry DDB item all stay service-local.
10
+ *
11
+ * The minted token is an RFC 8693 *delegation* token (`sub` = the tenant
12
+ * user, `act.sub` = the operator), short-lived (30 min) and
13
+ * **non-refreshable**, signed with a separate key so a leak is revocable
14
+ * without rotating the normal auth key. The FE reads the impersonated
15
+ * identity's roles/permissions from `impersonatedUser` (NOT from the JWT —
16
+ * `jose.decodeJwt` is used only to read `exp` for the countdown); the
17
+ * `act`/`scope`/`aud` claims exist purely for BE verification + audit.
18
+ */
19
+ interface ImpersonationMintResponse {
20
+ /**
21
+ * The minted delegation JWT (`aud: "impersonation"`). In-memory only on the
22
+ * FE — never persisted to localStorage / URL / the refresh cookie.
23
+ */
24
+ impersonationToken: string;
25
+ /**
26
+ * The impersonated tenant user, AuthUser-shaped: the target's
27
+ * roles/permissions/storeId plus the impersonation `accessToken`. The FE
28
+ * repoints its session identity to this inside the new impersonation tab.
29
+ */
30
+ impersonatedUser: AuthUser;
31
+ /**
32
+ * Hard expiry of the session, unix milliseconds. Mirrors the JWT `exp`;
33
+ * because the token is non-refreshable this is absolute. Drives the banner
34
+ * countdown and the auto-exit.
35
+ */
36
+ expiresAt: number;
37
+ /**
38
+ * Server-side impersonation-session id (also the JWT `sid`). Identifies the
39
+ * registry row the FE later passes to
40
+ * `POST /tenants/{storeId}/impersonation/{sessionId}/end`.
41
+ */
42
+ sessionId: string;
43
+ }
44
+ }
45
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./categories";
10
10
  export * from "./currency";
11
11
  export * from "./customer";
12
12
  export * from "./demo";
13
+ export * from "./impersonation";
13
14
  export * from "./imports";
14
15
  export * from "./invoice";
15
16
  export * from "./log";
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export * from "./categories";
10
10
  export * from "./currency";
11
11
  export * from "./customer";
12
12
  export * from "./demo";
13
+ export * from "./impersonation";
13
14
  export * from "./imports";
14
15
  export * from "./invoice";
15
16
  export * from "./log";
@@ -178,8 +178,9 @@ declare global {
178
178
  }
179
179
  /**
180
180
  * One audit row per SUPER_ADMIN-driven plan mutation. Returned by
181
- * `GET /sa/plans/{tier}/audit` (api#859). The same row shape is used
182
- * for the sibling `STORE` audit partition (api#827).
181
+ * `GET /platform/billing/plans/{tier}/audit` (api#859). The store-subscription
182
+ * audit (api#827) shares this storage shape but is read as
183
+ * `SubscriptionAuditEntry`.
183
184
  *
184
185
  * `before` and `after` carry only the fields that changed (diff slice),
185
186
  * not the full row blob.
@@ -264,11 +265,13 @@ declare global {
264
265
  /** A single usage entry as returned by GET /subscription. */
265
266
  interface SubscriptionUsageEntry {
266
267
  key: FeatureKey;
267
- /** Period in YYYYMM format. */
268
- period: string;
268
+ /** Period in YYYYMM format; `null` for lifetime caps (maxProducts/maxCustomers/maxUsers). */
269
+ period: string | null;
269
270
  current: number;
270
- limit: number;
271
- remaining: number;
271
+ /** `null` for unlimited tiers (no cap). */
272
+ limit: number | null;
273
+ /** `null` when `limit` is unlimited/uncapped. */
274
+ remaining: number | null;
272
275
  }
273
276
  /**
274
277
  * Full subscription snapshot pushed to the frontend on subscription/entitlement
@@ -277,6 +280,8 @@ declare global {
277
280
  interface SubscriptionSyncPayload {
278
281
  planTier: PlanTier;
279
282
  status: SubscriptionStatus;
283
+ /** Billing currency snapshotted from the plan template; `null` on free/unbilled tiers (basico). */
284
+ currency: 'ARS' | 'USD' | null;
280
285
  billingCycle: BillingCycle | null;
281
286
  currentPeriodStart: number | null;
282
287
  currentPeriodEnd: number | null;
@@ -288,5 +293,39 @@ declare global {
288
293
  entitlements: SubscriptionEntitlementEntry[];
289
294
  usage: SubscriptionUsageEntry[];
290
295
  }
296
+ /**
297
+ * Request body for the MANAGER out-of-band override
298
+ * `PUT /platform/stores/{storeId}/subscription` (api#827). No Stripe call —
299
+ * a direct DynamoDB write + audit row. `trialEndsAt` is required when
300
+ * `status === 'trialing'`; `reason` is the audit message (min 10 chars).
301
+ */
302
+ interface SubscriptionAdminOverrideInput {
303
+ planTier: PlanTier;
304
+ status: SubscriptionStatus;
305
+ billingCycle: BillingCycle;
306
+ /** Courtesy-gift cutoff (ADR-0010), `YYYY-MM-DD`. Optional on any status. */
307
+ freeUntil?: string;
308
+ /** Trial end (Unix ms). Required when `status === 'trialing'`. */
309
+ trialEndsAt?: number;
310
+ reason: string;
311
+ }
312
+ /**
313
+ * One audit row for a MANAGER out-of-band subscription change, as returned by
314
+ * `GET /platform/stores/{storeId}/subscription/audit` (api#827). Written by
315
+ * the override endpoint and the gift endpoint to the
316
+ * `AUDIT#SUBSCRIPTION#{storeId}` partition. `before`/`after` carry the
317
+ * subscription fields an operator can change.
318
+ */
319
+ interface SubscriptionAuditEntry {
320
+ storeId: string;
321
+ timestamp: number;
322
+ actor: {
323
+ userId: string;
324
+ fullName: string;
325
+ };
326
+ before: Pick<Subscription, 'planTier' | 'status' | 'billingCycle' | 'freeUntil' | 'trialEndsAt'>;
327
+ after: Pick<Subscription, 'planTier' | 'status' | 'billingCycle' | 'freeUntil' | 'trialEndsAt'>;
328
+ reason: string;
329
+ }
291
330
  }
292
331
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.6.26",
3
+ "version": "1.6.28",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",