@stewardhq/sdk 0.5.0 → 0.7.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.
@@ -1,27 +1,27 @@
1
1
  import { z } from "zod";
2
2
  //#region ../contract/src/accounts.d.ts
3
3
  declare const AccountLocaleSchema: z.ZodEnum<{
4
- tr: "tr";
5
4
  en: "en";
5
+ tr: "tr";
6
6
  }>;
7
7
  declare const AccountUpsertInputSchema: z.ZodObject<{
8
8
  displayName: z.ZodString;
9
9
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
10
10
  notificationEmails: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEmail>, z.ZodTransform<string[], string[]>>>;
11
11
  locale: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
12
- tr: "tr";
13
12
  en: "en";
13
+ tr: "tr";
14
14
  }>>>;
15
15
  }, z.core.$strip>;
16
16
  type AccountUpsertInput = z.input<typeof AccountUpsertInputSchema>;
17
17
  declare const BillingProfileKindSchema: z.ZodEnum<{
18
- individual: "individual";
19
18
  company: "company";
19
+ individual: "individual";
20
20
  }>;
21
21
  declare const BillingProfileSchema: z.ZodObject<{
22
22
  kind: z.ZodEnum<{
23
- individual: "individual";
24
23
  company: "company";
24
+ individual: "individual";
25
25
  }>;
26
26
  contactName: z.ZodString;
27
27
  companyName: z.ZodOptional<z.ZodString>;
@@ -42,10 +42,10 @@ declare const AccessStateSchema: z.ZodEnum<{
42
42
  type AccessState = z.infer<typeof AccessStateSchema>;
43
43
  declare const SubscriptionStatusSchema: z.ZodEnum<{
44
44
  active: "active";
45
- suspended: "suspended";
46
- past_due: "past_due";
47
45
  canceled: "canceled";
48
46
  expired: "expired";
47
+ past_due: "past_due";
48
+ suspended: "suspended";
49
49
  }>;
50
50
  type SubscriptionStatus = z.infer<typeof SubscriptionStatusSchema>;
51
51
  /** Snapshot içindeki canlı abonelik özeti (yoksa null). */
@@ -53,10 +53,10 @@ declare const SubscriptionSummarySchema: z.ZodObject<{
53
53
  id: z.ZodUUID;
54
54
  status: z.ZodEnum<{
55
55
  active: "active";
56
- suspended: "suspended";
57
- past_due: "past_due";
58
56
  canceled: "canceled";
59
57
  expired: "expired";
58
+ past_due: "past_due";
59
+ suspended: "suspended";
60
60
  }>;
61
61
  planCode: z.ZodString;
62
62
  interval: z.ZodEnum<{
@@ -81,10 +81,10 @@ declare const EntitlementSnapshotSchema: z.ZodObject<{
81
81
  id: z.ZodUUID;
82
82
  status: z.ZodEnum<{
83
83
  active: "active";
84
- suspended: "suspended";
85
- past_due: "past_due";
86
84
  canceled: "canceled";
87
85
  expired: "expired";
86
+ past_due: "past_due";
87
+ suspended: "suspended";
88
88
  }>;
89
89
  planCode: z.ZodString;
90
90
  interval: z.ZodEnum<{
@@ -122,10 +122,10 @@ declare const AccountSubscriptionStateSchema: z.ZodObject<{
122
122
  id: z.ZodUUID;
123
123
  status: z.ZodEnum<{
124
124
  active: "active";
125
- suspended: "suspended";
126
- past_due: "past_due";
127
125
  canceled: "canceled";
128
126
  expired: "expired";
127
+ past_due: "past_due";
128
+ suspended: "suspended";
129
129
  }>;
130
130
  planCode: z.ZodString;
131
131
  interval: z.ZodEnum<{
@@ -166,6 +166,10 @@ declare const AccountOpenCheckoutSchema: z.ZodObject<{
166
166
  currency: z.ZodString;
167
167
  amountMinor: z.ZodNumber;
168
168
  expiresAt: z.ZodISODateTime;
169
+ paymentMethod: z.ZodOptional<z.ZodEnum<{
170
+ bank_transfer: "bank_transfer";
171
+ card: "card";
172
+ }>>;
169
173
  }, z.core.$strip>;
170
174
  type AccountOpenCheckout = z.infer<typeof AccountOpenCheckoutSchema>;
171
175
  /**
@@ -177,11 +181,11 @@ declare const AccountOpenInvoiceSchema: z.ZodObject<{
177
181
  id: z.ZodUUID;
178
182
  subscriptionId: z.ZodNullable<z.ZodUUID>;
179
183
  billingReason: z.ZodEnum<{
184
+ manual: "manual";
185
+ purchase: "purchase";
180
186
  subscription_create: "subscription_create";
181
187
  subscription_cycle: "subscription_cycle";
182
188
  subscription_update: "subscription_update";
183
- purchase: "purchase";
184
- manual: "manual";
185
189
  }>;
186
190
  totalMinor: z.ZodNumber;
187
191
  currency: z.ZodString;
@@ -198,9 +202,9 @@ declare const AccountMeterStateSchema: z.ZodObject<{
198
202
  includedUnits: z.ZodNullable<z.ZodNumber>;
199
203
  billable: z.ZodBoolean;
200
204
  standing: z.ZodEnum<{
201
- ok: "ok";
202
- low: "low";
203
205
  exhausted: "exhausted";
206
+ low: "low";
207
+ ok: "ok";
204
208
  }>;
205
209
  }, z.core.$strip>;
206
210
  type AccountMeterState = z.infer<typeof AccountMeterStateSchema>;
@@ -208,9 +212,9 @@ declare const AccountMetersStateSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
208
212
  includedUnits: z.ZodNullable<z.ZodNumber>;
209
213
  billable: z.ZodBoolean;
210
214
  standing: z.ZodEnum<{
211
- ok: "ok";
212
- low: "low";
213
215
  exhausted: "exhausted";
216
+ low: "low";
217
+ ok: "ok";
214
218
  }>;
215
219
  }, z.core.$strip>>;
216
220
  type AccountMetersState = z.infer<typeof AccountMetersStateSchema>;
@@ -218,8 +222,8 @@ type AccountMetersState = z.infer<typeof AccountMetersStateSchema>;
218
222
  declare const AccountProfileStateSchema: z.ZodObject<{
219
223
  present: z.ZodBoolean;
220
224
  kind: z.ZodNullable<z.ZodEnum<{
221
- individual: "individual";
222
225
  company: "company";
226
+ individual: "individual";
223
227
  }>>;
224
228
  }, z.core.$strip>;
225
229
  type AccountProfileState = z.infer<typeof AccountProfileStateSchema>;
@@ -239,10 +243,10 @@ declare const AccountStateSchema: z.ZodObject<{
239
243
  id: z.ZodUUID;
240
244
  status: z.ZodEnum<{
241
245
  active: "active";
242
- suspended: "suspended";
243
- past_due: "past_due";
244
246
  canceled: "canceled";
245
247
  expired: "expired";
248
+ past_due: "past_due";
249
+ suspended: "suspended";
246
250
  }>;
247
251
  planCode: z.ZodString;
248
252
  interval: z.ZodEnum<{
@@ -281,22 +285,26 @@ declare const AccountStateSchema: z.ZodObject<{
281
285
  currency: z.ZodString;
282
286
  amountMinor: z.ZodNumber;
283
287
  expiresAt: z.ZodISODateTime;
288
+ paymentMethod: z.ZodOptional<z.ZodEnum<{
289
+ bank_transfer: "bank_transfer";
290
+ card: "card";
291
+ }>>;
284
292
  }, z.core.$strip>>;
285
293
  profile: z.ZodObject<{
286
294
  present: z.ZodBoolean;
287
295
  kind: z.ZodNullable<z.ZodEnum<{
288
- individual: "individual";
289
296
  company: "company";
297
+ individual: "individual";
290
298
  }>>;
291
299
  }, z.core.$strip>;
292
300
  subscriptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
301
  id: z.ZodUUID;
294
302
  status: z.ZodEnum<{
295
303
  active: "active";
296
- suspended: "suspended";
297
- past_due: "past_due";
298
304
  canceled: "canceled";
299
305
  expired: "expired";
306
+ past_due: "past_due";
307
+ suspended: "suspended";
300
308
  }>;
301
309
  planCode: z.ZodString;
302
310
  interval: z.ZodEnum<{
@@ -328,11 +336,11 @@ declare const AccountStateSchema: z.ZodObject<{
328
336
  id: z.ZodUUID;
329
337
  subscriptionId: z.ZodNullable<z.ZodUUID>;
330
338
  billingReason: z.ZodEnum<{
339
+ manual: "manual";
340
+ purchase: "purchase";
331
341
  subscription_create: "subscription_create";
332
342
  subscription_cycle: "subscription_cycle";
333
343
  subscription_update: "subscription_update";
334
- purchase: "purchase";
335
- manual: "manual";
336
344
  }>;
337
345
  totalMinor: z.ZodNumber;
338
346
  currency: z.ZodString;
@@ -349,11 +357,12 @@ declare const AccountStateSchema: z.ZodObject<{
349
357
  includedUnits: z.ZodNullable<z.ZodNumber>;
350
358
  billable: z.ZodBoolean;
351
359
  standing: z.ZodEnum<{
352
- ok: "ok";
353
- low: "low";
354
360
  exhausted: "exhausted";
361
+ low: "low";
362
+ ok: "ok";
355
363
  }>;
356
364
  }, z.core.$strip>>>;
365
+ bankTransferCode: z.ZodOptional<z.ZodString>;
357
366
  }, z.core.$strip>;
358
367
  type AccountState = z.infer<typeof AccountStateSchema>;
359
368
  declare const AccountSchema: z.ZodObject<{
@@ -373,10 +382,10 @@ declare const AccountSchema: z.ZodObject<{
373
382
  id: z.ZodUUID;
374
383
  status: z.ZodEnum<{
375
384
  active: "active";
376
- suspended: "suspended";
377
- past_due: "past_due";
378
385
  canceled: "canceled";
379
386
  expired: "expired";
387
+ past_due: "past_due";
388
+ suspended: "suspended";
380
389
  }>;
381
390
  planCode: z.ZodString;
382
391
  interval: z.ZodEnum<{
@@ -391,8 +400,8 @@ declare const AccountSchema: z.ZodObject<{
391
400
  }, z.core.$strip>;
392
401
  notificationEmails: z.ZodDefault<z.ZodArray<z.ZodString>>;
393
402
  locale: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
394
- tr: "tr";
395
403
  en: "en";
404
+ tr: "tr";
396
405
  }>>>;
397
406
  }, z.core.$strip>;
398
407
  type Account = z.infer<typeof AccountSchema>;
@@ -401,28 +410,29 @@ declare const AccountDeleteResponseSchema: z.ZodObject<{
401
410
  deletedAt: z.ZodISODateTime;
402
411
  }, z.core.$strip>;
403
412
  type AccountDeleteResponse = z.infer<typeof AccountDeleteResponseSchema>;
404
- declare const ACCOUNT_INCLUDES: readonly ["profile", "subscriptions", "checkouts", "payments", "invoices", "grants"];
413
+ declare const ACCOUNT_INCLUDES: readonly ['profile', 'subscriptions', 'checkouts', 'payments', 'invoices', 'grants'];
405
414
  type AccountInclude = (typeof ACCOUNT_INCLUDES)[number];
406
415
  //#endregion
407
416
  //#region ../contract/src/events.d.ts
408
417
  declare const EventIdSchema: z.ZodString;
409
418
  declare const ApiVersionSchema: z.ZodString;
410
419
  declare const EVENT_DETAIL_SCHEMAS: {
411
- readonly "account.updated": z.ZodObject<{
420
+ readonly 'account.updated': z.ZodObject<{
412
421
  changed: z.ZodArray<z.ZodString>;
413
422
  }, z.core.$strip>;
414
- readonly "checkout.completed": z.ZodObject<{
423
+ readonly 'checkout.completed': z.ZodObject<{
415
424
  subscriptionId: z.ZodUUID;
416
425
  checkoutSessionId: z.ZodUUID;
417
426
  }, z.core.$strip>;
418
- readonly "checkout.failed": z.ZodObject<{
427
+ readonly 'checkout.failed': z.ZodObject<{
419
428
  checkoutSessionId: z.ZodUUID;
420
429
  reason: z.ZodString;
421
430
  }, z.core.$strip>;
422
- readonly "checkout.expired": z.ZodObject<{
431
+ readonly 'checkout.expired': z.ZodObject<{
423
432
  checkoutSessionId: z.ZodUUID;
424
433
  }, z.core.$strip>;
425
- readonly "subscription.activated": z.ZodObject<{
434
+ readonly 'subscription.activated': z.ZodObject<{
435
+ subscriptionId: z.ZodUUID;
426
436
  planCode: z.ZodString;
427
437
  interval: z.ZodEnum<{
428
438
  month: "month";
@@ -431,95 +441,95 @@ declare const EVENT_DETAIL_SCHEMAS: {
431
441
  amountMinor: z.ZodNumber;
432
442
  currency: z.ZodString;
433
443
  actorRef: z.ZodNullable<z.ZodString>;
434
- subscriptionId: z.ZodUUID;
444
+ replacedSubscriptionId: z.ZodOptional<z.ZodUUID>;
435
445
  }, z.core.$strip>;
436
- readonly "subscription.renewed": z.ZodObject<{
446
+ readonly 'subscription.renewed': z.ZodObject<{
447
+ subscriptionId: z.ZodUUID;
437
448
  paymentId: z.ZodUUID;
438
449
  periodStart: z.ZodNullable<z.ZodISODateTime>;
439
450
  periodEnd: z.ZodNullable<z.ZodISODateTime>;
440
451
  invoiceId: z.ZodNullable<z.ZodUUID>;
441
- subscriptionId: z.ZodUUID;
442
452
  }, z.core.$strip>;
443
- readonly "subscription.payment_failed": z.ZodObject<{
453
+ readonly 'subscription.payment_failed': z.ZodObject<{
454
+ subscriptionId: z.ZodUUID;
444
455
  paymentId: z.ZodNullable<z.ZodUUID>;
445
456
  attempt: z.ZodNumber;
446
457
  nextRetryAt: z.ZodNullable<z.ZodISODateTime>;
447
458
  invoiceId: z.ZodOptional<z.ZodUUID>;
448
- subscriptionId: z.ZodUUID;
449
459
  }, z.core.$strip>;
450
- readonly "subscription.suspended": z.ZodObject<{
451
- dunningDay: z.ZodNumber;
460
+ readonly 'subscription.suspended': z.ZodObject<{
452
461
  subscriptionId: z.ZodUUID;
462
+ dunningDay: z.ZodNumber;
453
463
  }, z.core.$strip>;
454
- readonly "subscription.reactivated": z.ZodObject<{
455
- paymentId: z.ZodNullable<z.ZodUUID>;
464
+ readonly 'subscription.reactivated': z.ZodObject<{
456
465
  subscriptionId: z.ZodUUID;
466
+ paymentId: z.ZodNullable<z.ZodUUID>;
457
467
  }, z.core.$strip>;
458
- readonly "subscription.cancel_scheduled": z.ZodObject<{
468
+ readonly 'subscription.cancel_scheduled': z.ZodObject<{
469
+ subscriptionId: z.ZodUUID;
459
470
  cancelAt: z.ZodISODateTime;
460
471
  reason: z.ZodString;
461
472
  actorRef: z.ZodNullable<z.ZodString>;
462
- subscriptionId: z.ZodUUID;
463
473
  }, z.core.$strip>;
464
- readonly "subscription.canceled": z.ZodObject<{
474
+ readonly 'subscription.canceled': z.ZodObject<{
475
+ subscriptionId: z.ZodUUID;
465
476
  reason: z.ZodString;
466
477
  effectiveAt: z.ZodISODateTime;
467
478
  actorRef: z.ZodNullable<z.ZodString>;
468
- subscriptionId: z.ZodUUID;
469
479
  }, z.core.$strip>;
470
- readonly "subscription.expired": z.ZodObject<{
471
- effectiveAt: z.ZodISODateTime;
480
+ readonly 'subscription.expired': z.ZodObject<{
472
481
  subscriptionId: z.ZodUUID;
482
+ effectiveAt: z.ZodISODateTime;
473
483
  }, z.core.$strip>;
474
- readonly "subscription.terminated": z.ZodObject<{
484
+ readonly 'subscription.terminated': z.ZodObject<{
485
+ subscriptionId: z.ZodUUID;
475
486
  reason: z.ZodEnum<{
476
487
  nonpayment: "nonpayment";
477
488
  }>;
478
489
  dunningDay: z.ZodNumber;
479
- subscriptionId: z.ZodUUID;
480
490
  }, z.core.$strip>;
481
- readonly "invoice.created": z.ZodObject<{
491
+ readonly 'invoice.created': z.ZodObject<{
482
492
  invoiceId: z.ZodUUID;
483
493
  totalMinor: z.ZodNumber;
484
494
  currency: z.ZodString;
485
495
  }, z.core.$strip>;
486
- readonly "invoice.issued": z.ZodObject<{
496
+ readonly 'invoice.issued': z.ZodObject<{
487
497
  invoiceId: z.ZodUUID;
488
498
  number: z.ZodString;
489
499
  totalMinor: z.ZodNumber;
490
500
  currency: z.ZodString;
491
501
  }, z.core.$strip>;
492
- readonly "invoice.voided": z.ZodObject<{
502
+ readonly 'invoice.voided': z.ZodObject<{
493
503
  invoiceId: z.ZodUUID;
494
504
  number: z.ZodNullable<z.ZodString>;
495
505
  totalMinor: z.ZodNumber;
496
506
  currency: z.ZodString;
497
507
  reason: z.ZodString;
498
508
  }, z.core.$strip>;
499
- readonly "account.state_changed": z.ZodObject<{
509
+ readonly 'account.state_changed': z.ZodObject<{
500
510
  cause: z.ZodString;
501
511
  causeEventId: z.ZodNullable<z.ZodString>;
502
512
  }, z.core.$strip>;
503
- readonly "account.deleted": z.ZodObject<{
513
+ readonly 'account.deleted': z.ZodObject<{
504
514
  deletedAt: z.ZodISODateTime;
505
515
  actorRef: z.ZodNullable<z.ZodString>;
506
516
  }, z.core.$strip>;
507
- readonly "invoice.paid": z.ZodObject<{
517
+ readonly 'invoice.paid': z.ZodObject<{
508
518
  invoiceId: z.ZodUUID;
509
519
  subscriptionId: z.ZodNullable<z.ZodUUID>;
510
520
  paymentId: z.ZodUUID;
511
521
  billingReason: z.ZodNullable<z.ZodEnum<{
522
+ manual: "manual";
523
+ purchase: "purchase";
512
524
  subscription_create: "subscription_create";
513
525
  subscription_cycle: "subscription_cycle";
514
526
  subscription_update: "subscription_update";
515
- purchase: "purchase";
516
- manual: "manual";
517
527
  }>>;
518
528
  totalMinor: z.ZodNumber;
519
529
  currency: z.ZodString;
520
530
  paidAt: z.ZodISODateTime;
521
531
  }, z.core.$strip>;
522
- readonly "benefit_grant.created": z.ZodObject<{
532
+ readonly 'benefit_grant.created': z.ZodObject<{
523
533
  grantId: z.ZodUUID;
524
534
  benefit: z.ZodObject<{
525
535
  code: z.ZodNullable<z.ZodString>;
@@ -529,8 +539,7 @@ declare const EVENT_DETAIL_SCHEMAS: {
529
539
  grantedAt: z.ZodISODateTime;
530
540
  }, z.core.$strip>;
531
541
  }, z.core.$strip>;
532
- readonly "benefit_grant.updated": z.ZodObject<{
533
- previousProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
542
+ readonly 'benefit_grant.updated': z.ZodObject<{
534
543
  grantId: z.ZodUUID;
535
544
  benefit: z.ZodObject<{
536
545
  code: z.ZodNullable<z.ZodString>;
@@ -539,9 +548,9 @@ declare const EVENT_DETAIL_SCHEMAS: {
539
548
  source: z.ZodString;
540
549
  grantedAt: z.ZodISODateTime;
541
550
  }, z.core.$strip>;
551
+ previousProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
542
552
  }, z.core.$strip>;
543
- readonly "benefit_grant.revoked": z.ZodObject<{
544
- revokedAt: z.ZodISODateTime;
553
+ readonly 'benefit_grant.revoked': z.ZodObject<{
545
554
  grantId: z.ZodUUID;
546
555
  benefit: z.ZodObject<{
547
556
  code: z.ZodNullable<z.ZodString>;
@@ -550,10 +559,9 @@ declare const EVENT_DETAIL_SCHEMAS: {
550
559
  source: z.ZodString;
551
560
  grantedAt: z.ZodISODateTime;
552
561
  }, z.core.$strip>;
562
+ revokedAt: z.ZodISODateTime;
553
563
  }, z.core.$strip>;
554
- readonly "benefit_grant.cycled": z.ZodObject<{
555
- periodStart: z.ZodISODateTime;
556
- periodEnd: z.ZodISODateTime;
564
+ readonly 'benefit_grant.cycled': z.ZodObject<{
557
565
  grantId: z.ZodUUID;
558
566
  benefit: z.ZodObject<{
559
567
  code: z.ZodNullable<z.ZodString>;
@@ -562,25 +570,27 @@ declare const EVENT_DETAIL_SCHEMAS: {
562
570
  source: z.ZodString;
563
571
  grantedAt: z.ZodISODateTime;
564
572
  }, z.core.$strip>;
573
+ periodStart: z.ZodISODateTime;
574
+ periodEnd: z.ZodISODateTime;
565
575
  }, z.core.$strip>;
566
- readonly "meter.threshold_crossed": z.ZodObject<{
576
+ readonly 'meter.threshold_crossed': z.ZodObject<{
567
577
  meter: z.ZodString;
568
578
  standing: z.ZodEnum<{
569
- ok: "ok";
570
- low: "low";
571
579
  exhausted: "exhausted";
580
+ low: "low";
581
+ ok: "ok";
572
582
  }>;
573
583
  previous: z.ZodEnum<{
574
- ok: "ok";
575
- low: "low";
576
584
  exhausted: "exhausted";
585
+ low: "low";
586
+ ok: "ok";
577
587
  }>;
578
588
  periodStart: z.ZodISODateTime;
579
589
  periodEnd: z.ZodISODateTime;
580
590
  consumedUnits: z.ZodNumber;
581
591
  creditedUnits: z.ZodNumber;
582
592
  }, z.core.$strip>;
583
- readonly "meter.period_closed": z.ZodObject<{
593
+ readonly 'meter.period_closed': z.ZodObject<{
584
594
  periodStart: z.ZodISODateTime;
585
595
  periodEnd: z.ZodISODateTime;
586
596
  subscriptionId: z.ZodNullable<z.ZodUUID>;
@@ -603,8 +613,8 @@ declare const EVENT_TYPES: EventType[];
603
613
  declare const LEGACY_EVENT_TYPES: readonly ["account.updated", "checkout.completed", "checkout.failed", "checkout.expired", "subscription.activated", "subscription.renewed", "subscription.payment_failed", "subscription.suspended", "subscription.reactivated", "subscription.cancel_scheduled", "subscription.canceled", "subscription.expired", "subscription.terminated", "invoice.created", "invoice.issued"];
604
614
  type LegacyEventType = (typeof LEGACY_EVENT_TYPES)[number];
605
615
  /** `account.state_changed.detail.cause` — bilinen değerler; küme açık. */
606
- type AccountStateChangeCause = LegacyEventType | "account.upserted" | "billing_profile.updated" | "checkout.opened" | "checkout.initialize_failed" | "checkout.canceled" | "grant.created" | "grant.revoked" | "grant.window_applied" | "dunning.advanced" | "dunning_policy.updated" | "payment.recorded" | "catalog.synced" | "account.refreshed" | "grant.plan_set" | "resync" | "account.deleted" | "invoice.paid" | "subscription.period_advanced" | "subscription.uncanceled" | "subscription.change_scheduled" | "invoice.waived" | "invoice.payment_reminder" | "meter.threshold_crossed" | "meter.period_rolled" | "credits.granted" | (string & Record<never, never>);
607
- type FullStateEventType = "account.state_changed" | "account.deleted" | "invoice.paid" | "benefit_grant.created" | "benefit_grant.updated" | "benefit_grant.revoked" | "benefit_grant.cycled" | "meter.threshold_crossed" | "meter.period_closed";
616
+ type AccountStateChangeCause = LegacyEventType | 'account.upserted' | 'billing_profile.updated' | 'checkout.opened' | 'checkout.initialize_failed' | 'checkout.canceled' | 'grant.created' | 'grant.revoked' | 'grant.window_applied' | 'dunning.advanced' | 'dunning_policy.updated' | 'payment.recorded' | 'catalog.synced' | 'account.refreshed' | 'grant.plan_set' | 'resync' | 'account.deleted' | 'invoice.paid' | 'subscription.period_advanced' | 'subscription.uncanceled' | 'subscription.change_scheduled' | 'invoice.waived' | 'invoice.payment_reminder' | 'meter.threshold_crossed' | 'meter.period_rolled' | 'credits.granted' | 'bank_transfer.code_assigned' | (string & Record<never, never>);
617
+ type FullStateEventType = 'account.state_changed' | 'account.deleted' | 'invoice.paid' | 'benefit_grant.created' | 'benefit_grant.updated' | 'benefit_grant.revoked' | 'benefit_grant.cycled' | 'meter.threshold_crossed' | 'meter.period_closed';
608
618
  type AccountSchemaOf<T extends EventType> = T extends FullStateEventType ? typeof AccountStateSchema : typeof EntitlementSnapshotSchema;
609
619
  /** Event types whose `data.account` is the full `AccountState` (the others: the entitlement snapshot). */
610
620
  declare const FULL_STATE_EVENT_TYPES: ReadonlySet<string>;
@@ -618,21 +628,22 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
618
628
  data: z.ZodObject<{
619
629
  account: AccountSchemaOf<T>;
620
630
  detail: {
621
- readonly "account.updated": z.ZodObject<{
631
+ readonly 'account.updated': z.ZodObject<{
622
632
  changed: z.ZodArray<z.ZodString>;
623
633
  }, z.core.$strip>;
624
- readonly "checkout.completed": z.ZodObject<{
634
+ readonly 'checkout.completed': z.ZodObject<{
625
635
  subscriptionId: z.ZodUUID;
626
636
  checkoutSessionId: z.ZodUUID;
627
637
  }, z.core.$strip>;
628
- readonly "checkout.failed": z.ZodObject<{
638
+ readonly 'checkout.failed': z.ZodObject<{
629
639
  checkoutSessionId: z.ZodUUID;
630
640
  reason: z.ZodString;
631
641
  }, z.core.$strip>;
632
- readonly "checkout.expired": z.ZodObject<{
642
+ readonly 'checkout.expired': z.ZodObject<{
633
643
  checkoutSessionId: z.ZodUUID;
634
644
  }, z.core.$strip>;
635
- readonly "subscription.activated": z.ZodObject<{
645
+ readonly 'subscription.activated': z.ZodObject<{
646
+ subscriptionId: z.ZodUUID;
636
647
  planCode: z.ZodString;
637
648
  interval: z.ZodEnum<{
638
649
  month: "month";
@@ -641,95 +652,95 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
641
652
  amountMinor: z.ZodNumber;
642
653
  currency: z.ZodString;
643
654
  actorRef: z.ZodNullable<z.ZodString>;
644
- subscriptionId: z.ZodUUID;
655
+ replacedSubscriptionId: z.ZodOptional<z.ZodUUID>;
645
656
  }, z.core.$strip>;
646
- readonly "subscription.renewed": z.ZodObject<{
657
+ readonly 'subscription.renewed': z.ZodObject<{
658
+ subscriptionId: z.ZodUUID;
647
659
  paymentId: z.ZodUUID;
648
660
  periodStart: z.ZodNullable<z.ZodISODateTime>;
649
661
  periodEnd: z.ZodNullable<z.ZodISODateTime>;
650
662
  invoiceId: z.ZodNullable<z.ZodUUID>;
651
- subscriptionId: z.ZodUUID;
652
663
  }, z.core.$strip>;
653
- readonly "subscription.payment_failed": z.ZodObject<{
664
+ readonly 'subscription.payment_failed': z.ZodObject<{
665
+ subscriptionId: z.ZodUUID;
654
666
  paymentId: z.ZodNullable<z.ZodUUID>;
655
667
  attempt: z.ZodNumber;
656
668
  nextRetryAt: z.ZodNullable<z.ZodISODateTime>;
657
669
  invoiceId: z.ZodOptional<z.ZodUUID>;
658
- subscriptionId: z.ZodUUID;
659
670
  }, z.core.$strip>;
660
- readonly "subscription.suspended": z.ZodObject<{
661
- dunningDay: z.ZodNumber;
671
+ readonly 'subscription.suspended': z.ZodObject<{
662
672
  subscriptionId: z.ZodUUID;
673
+ dunningDay: z.ZodNumber;
663
674
  }, z.core.$strip>;
664
- readonly "subscription.reactivated": z.ZodObject<{
665
- paymentId: z.ZodNullable<z.ZodUUID>;
675
+ readonly 'subscription.reactivated': z.ZodObject<{
666
676
  subscriptionId: z.ZodUUID;
677
+ paymentId: z.ZodNullable<z.ZodUUID>;
667
678
  }, z.core.$strip>;
668
- readonly "subscription.cancel_scheduled": z.ZodObject<{
679
+ readonly 'subscription.cancel_scheduled': z.ZodObject<{
680
+ subscriptionId: z.ZodUUID;
669
681
  cancelAt: z.ZodISODateTime;
670
682
  reason: z.ZodString;
671
683
  actorRef: z.ZodNullable<z.ZodString>;
672
- subscriptionId: z.ZodUUID;
673
684
  }, z.core.$strip>;
674
- readonly "subscription.canceled": z.ZodObject<{
685
+ readonly 'subscription.canceled': z.ZodObject<{
686
+ subscriptionId: z.ZodUUID;
675
687
  reason: z.ZodString;
676
688
  effectiveAt: z.ZodISODateTime;
677
689
  actorRef: z.ZodNullable<z.ZodString>;
678
- subscriptionId: z.ZodUUID;
679
690
  }, z.core.$strip>;
680
- readonly "subscription.expired": z.ZodObject<{
681
- effectiveAt: z.ZodISODateTime;
691
+ readonly 'subscription.expired': z.ZodObject<{
682
692
  subscriptionId: z.ZodUUID;
693
+ effectiveAt: z.ZodISODateTime;
683
694
  }, z.core.$strip>;
684
- readonly "subscription.terminated": z.ZodObject<{
695
+ readonly 'subscription.terminated': z.ZodObject<{
696
+ subscriptionId: z.ZodUUID;
685
697
  reason: z.ZodEnum<{
686
698
  nonpayment: "nonpayment";
687
699
  }>;
688
700
  dunningDay: z.ZodNumber;
689
- subscriptionId: z.ZodUUID;
690
701
  }, z.core.$strip>;
691
- readonly "invoice.created": z.ZodObject<{
702
+ readonly 'invoice.created': z.ZodObject<{
692
703
  invoiceId: z.ZodUUID;
693
704
  totalMinor: z.ZodNumber;
694
705
  currency: z.ZodString;
695
706
  }, z.core.$strip>;
696
- readonly "invoice.issued": z.ZodObject<{
707
+ readonly 'invoice.issued': z.ZodObject<{
697
708
  invoiceId: z.ZodUUID;
698
709
  number: z.ZodString;
699
710
  totalMinor: z.ZodNumber;
700
711
  currency: z.ZodString;
701
712
  }, z.core.$strip>;
702
- readonly "invoice.voided": z.ZodObject<{
713
+ readonly 'invoice.voided': z.ZodObject<{
703
714
  invoiceId: z.ZodUUID;
704
715
  number: z.ZodNullable<z.ZodString>;
705
716
  totalMinor: z.ZodNumber;
706
717
  currency: z.ZodString;
707
718
  reason: z.ZodString;
708
719
  }, z.core.$strip>;
709
- readonly "account.state_changed": z.ZodObject<{
720
+ readonly 'account.state_changed': z.ZodObject<{
710
721
  cause: z.ZodString;
711
722
  causeEventId: z.ZodNullable<z.ZodString>;
712
723
  }, z.core.$strip>;
713
- readonly "account.deleted": z.ZodObject<{
724
+ readonly 'account.deleted': z.ZodObject<{
714
725
  deletedAt: z.ZodISODateTime;
715
726
  actorRef: z.ZodNullable<z.ZodString>;
716
727
  }, z.core.$strip>;
717
- readonly "invoice.paid": z.ZodObject<{
728
+ readonly 'invoice.paid': z.ZodObject<{
718
729
  invoiceId: z.ZodUUID;
719
730
  subscriptionId: z.ZodNullable<z.ZodUUID>;
720
731
  paymentId: z.ZodUUID;
721
732
  billingReason: z.ZodNullable<z.ZodEnum<{
733
+ manual: "manual";
734
+ purchase: "purchase";
722
735
  subscription_create: "subscription_create";
723
736
  subscription_cycle: "subscription_cycle";
724
737
  subscription_update: "subscription_update";
725
- purchase: "purchase";
726
- manual: "manual";
727
738
  }>>;
728
739
  totalMinor: z.ZodNumber;
729
740
  currency: z.ZodString;
730
741
  paidAt: z.ZodISODateTime;
731
742
  }, z.core.$strip>;
732
- readonly "benefit_grant.created": z.ZodObject<{
743
+ readonly 'benefit_grant.created': z.ZodObject<{
733
744
  grantId: z.ZodUUID;
734
745
  benefit: z.ZodObject<{
735
746
  code: z.ZodNullable<z.ZodString>;
@@ -739,8 +750,7 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
739
750
  grantedAt: z.ZodISODateTime;
740
751
  }, z.core.$strip>;
741
752
  }, z.core.$strip>;
742
- readonly "benefit_grant.updated": z.ZodObject<{
743
- previousProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
753
+ readonly 'benefit_grant.updated': z.ZodObject<{
744
754
  grantId: z.ZodUUID;
745
755
  benefit: z.ZodObject<{
746
756
  code: z.ZodNullable<z.ZodString>;
@@ -749,9 +759,9 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
749
759
  source: z.ZodString;
750
760
  grantedAt: z.ZodISODateTime;
751
761
  }, z.core.$strip>;
762
+ previousProperties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
752
763
  }, z.core.$strip>;
753
- readonly "benefit_grant.revoked": z.ZodObject<{
754
- revokedAt: z.ZodISODateTime;
764
+ readonly 'benefit_grant.revoked': z.ZodObject<{
755
765
  grantId: z.ZodUUID;
756
766
  benefit: z.ZodObject<{
757
767
  code: z.ZodNullable<z.ZodString>;
@@ -760,10 +770,9 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
760
770
  source: z.ZodString;
761
771
  grantedAt: z.ZodISODateTime;
762
772
  }, z.core.$strip>;
773
+ revokedAt: z.ZodISODateTime;
763
774
  }, z.core.$strip>;
764
- readonly "benefit_grant.cycled": z.ZodObject<{
765
- periodStart: z.ZodISODateTime;
766
- periodEnd: z.ZodISODateTime;
775
+ readonly 'benefit_grant.cycled': z.ZodObject<{
767
776
  grantId: z.ZodUUID;
768
777
  benefit: z.ZodObject<{
769
778
  code: z.ZodNullable<z.ZodString>;
@@ -772,25 +781,27 @@ declare function envelope<T extends EventType>(type: T): z.ZodObject<{
772
781
  source: z.ZodString;
773
782
  grantedAt: z.ZodISODateTime;
774
783
  }, z.core.$strip>;
784
+ periodStart: z.ZodISODateTime;
785
+ periodEnd: z.ZodISODateTime;
775
786
  }, z.core.$strip>;
776
- readonly "meter.threshold_crossed": z.ZodObject<{
787
+ readonly 'meter.threshold_crossed': z.ZodObject<{
777
788
  meter: z.ZodString;
778
789
  standing: z.ZodEnum<{
779
- ok: "ok";
780
- low: "low";
781
790
  exhausted: "exhausted";
791
+ low: "low";
792
+ ok: "ok";
782
793
  }>;
783
794
  previous: z.ZodEnum<{
784
- ok: "ok";
785
- low: "low";
786
795
  exhausted: "exhausted";
796
+ low: "low";
797
+ ok: "ok";
787
798
  }>;
788
799
  periodStart: z.ZodISODateTime;
789
800
  periodEnd: z.ZodISODateTime;
790
801
  consumedUnits: z.ZodNumber;
791
802
  creditedUnits: z.ZodNumber;
792
803
  }, z.core.$strip>;
793
- readonly "meter.period_closed": z.ZodObject<{
804
+ readonly 'meter.period_closed': z.ZodObject<{
794
805
  periodStart: z.ZodISODateTime;
795
806
  periodEnd: z.ZodISODateTime;
796
807
  subscriptionId: z.ZodNullable<z.ZodUUID>;