@stewardhq/sdk 0.1.0-rc.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.
Files changed (48) hide show
  1. package/README.md +437 -0
  2. package/dist/_chunks/errors.js +73 -0
  3. package/dist/_chunks/events.d.ts +537 -0
  4. package/dist/_chunks/events.js +350 -0
  5. package/dist/_chunks/index.d.ts +6005 -0
  6. package/dist/_chunks/locale.d.ts +17 -0
  7. package/dist/_chunks/locale.js +17 -0
  8. package/dist/_chunks/src.js +1202 -0
  9. package/dist/_chunks/steward.d.ts +2588 -0
  10. package/dist/_chunks/steward.js +578 -0
  11. package/dist/_chunks/validators.d.ts +23 -0
  12. package/dist/_chunks/validators.js +106 -0
  13. package/dist/_chunks/webhook-core.d.ts +32 -0
  14. package/dist/_chunks/webhook-core.js +64 -0
  15. package/dist/_chunks/webhook.d.ts +22 -0
  16. package/dist/_chunks/webhook.js +53 -0
  17. package/dist/contract.d.ts +4 -0
  18. package/dist/contract.js +4 -0
  19. package/dist/index.d.ts +268 -0
  20. package/dist/index.js +784 -0
  21. package/dist/server.d.ts +236 -0
  22. package/dist/server.js +384 -0
  23. package/dist/testing/fixtures/events/LOCK.json +27 -0
  24. package/dist/testing/fixtures/events/account.deleted.json +36 -0
  25. package/dist/testing/fixtures/events/account.state_changed.json +53 -0
  26. package/dist/testing/fixtures/events/account.updated.json +37 -0
  27. package/dist/testing/fixtures/events/checkout.completed.json +36 -0
  28. package/dist/testing/fixtures/events/checkout.expired.json +26 -0
  29. package/dist/testing/fixtures/events/checkout.failed.json +27 -0
  30. package/dist/testing/fixtures/events/invoice.created.json +37 -0
  31. package/dist/testing/fixtures/events/invoice.issued.json +38 -0
  32. package/dist/testing/fixtures/events/invoice.voided.json +39 -0
  33. package/dist/testing/fixtures/events/subscription.activated.json +40 -0
  34. package/dist/testing/fixtures/events/subscription.cancel_scheduled.json +38 -0
  35. package/dist/testing/fixtures/events/subscription.canceled.json +29 -0
  36. package/dist/testing/fixtures/events/subscription.expired.json +27 -0
  37. package/dist/testing/fixtures/events/subscription.payment_failed.json +38 -0
  38. package/dist/testing/fixtures/events/subscription.reactivated.json +36 -0
  39. package/dist/testing/fixtures/events/subscription.renewed.json +39 -0
  40. package/dist/testing/fixtures/events/subscription.suspended.json +36 -0
  41. package/dist/testing/fixtures/events/subscription.terminated.json +28 -0
  42. package/dist/testing.d.ts +629 -0
  43. package/dist/testing.js +3759 -0
  44. package/dist/webhook/web.d.ts +17 -0
  45. package/dist/webhook/web.js +66 -0
  46. package/dist/webhook.d.ts +3 -0
  47. package/dist/webhook.js +3 -0
  48. package/package.json +70 -0
@@ -0,0 +1,2588 @@
1
+ import { $t as EventRecord, An as CancelSubscriptionInput, B as WebhookEndpointRotateInput, Cr as CatalogSyncInput, F as WebhookEndpoint, Gt as CancelSubscriptionResponse, I as WebhookEndpointCreateInput, Jr as ErrorCategory, Nn as GrantCreateInput, R as WebhookEndpointList, Rn as Stats, Tr as CatalogSyncResult, Un as PortalSession, Ut as BillingProfileResponse, Vt as AccountUpsertResponse, Wn as PortalSessionCreateInput, Zt as EventList, cn as InvoiceIssueResponse, fn as ManualInvoiceResponse, g as DoctorReport, hn as InvoiceIssueInput, ht as PlanSetInput, nt as ProductSettingsPatch, or as CheckoutSessionCreated, qt as CheckoutSessionResponse, rr as CheckoutSessionCreateInput, tn as GrantCreateResponse, tt as ProductSettings, un as InvoiceVoidResponse, wn as ManualInvoiceInput, wt as ResyncResult, xn as InvoiceVoidInput, xr as Catalog, yr as AccountsRefreshResult, yt as PlanSetResponse, zt as AccountDetail } from "./index.js";
2
+ import { C as AccountDeleteResponse, D as AccountInclude, F as AccountState, G as EntitlementSnapshot, H as BillingProfileInput, z as AccountUpsertInput } from "./events.js";
3
+ //#region ../contract/src/client.d.ts
4
+ type BillingClientOptions = {
5
+ baseUrl: string;
6
+ apiKey: string;
7
+ fetch?: typeof fetch;
8
+ timeoutMs?: number;
9
+ /** `X-Steward-Sdk` başlığı, ör. `@stewardhq/sdk/0.2.0` (gözlem; steward loglar). */
10
+ sdk?: string;
11
+ };
12
+ type CallOptions = {
13
+ idempotencyKey?: string;
14
+ actorRef?: string;
15
+ };
16
+ type ClientResult<T> = {
17
+ ok: true;
18
+ status: number;
19
+ data: T;
20
+ requestId?: string;
21
+ } | {
22
+ ok: false;
23
+ status: number;
24
+ error: string;
25
+ message?: string;
26
+ category?: ErrorCategory;
27
+ retryable?: boolean;
28
+ requestId?: string;
29
+ /** 429/503 yanıtındaki `Retry-After` (saniye ya da HTTP tarihi) milisaniyeye çevrilmiş. */
30
+ retryAfterMs?: number;
31
+ };
32
+ /** `getAccountState` sonucu: 304'te gövde yok, elindeki durum güncel. */
33
+ type AccountStateRead = {
34
+ notModified: false;
35
+ etag: string | null;
36
+ state: AccountState;
37
+ } | {
38
+ notModified: true;
39
+ etag: string;
40
+ };
41
+ /**
42
+ * `Retry-After` başlığını milisaniyeye çevirir: saniye (tam sayı) ya da HTTP
43
+ * tarihi. Geçmiş tarih 0; okunamayan değer null.
44
+ */
45
+ declare function parseRetryAfter(value: string | null | undefined, now?: number): number | null;
46
+ type BillingClient = ReturnType<typeof createBillingClient>;
47
+ declare function createBillingClient(options: BillingClientOptions): {
48
+ getCatalog: () => Promise<ClientResult<{
49
+ product: string;
50
+ defaultPlanCode: string;
51
+ features: {
52
+ key: string;
53
+ type: "string" | "boolean" | "limit";
54
+ description?: string | undefined;
55
+ }[];
56
+ plans: {
57
+ code: string;
58
+ name: string;
59
+ rank: number;
60
+ sellable: boolean;
61
+ entitlements: Record<string, string | number | boolean | null>;
62
+ }[];
63
+ prices: {
64
+ planCode: string;
65
+ interval: "month" | "year";
66
+ intervalCount: number;
67
+ currency: string;
68
+ amountMinor: number;
69
+ taxInclusive: boolean;
70
+ taxRateBps: number;
71
+ id: string;
72
+ active: boolean;
73
+ createdAt: string;
74
+ }[];
75
+ }>>;
76
+ syncCatalog: (input: CatalogSyncInput, opts?: CallOptions) => Promise<ClientResult<{
77
+ unchanged: boolean;
78
+ createdPrices: string[];
79
+ deactivatedPrices: string[];
80
+ changedPlans: string[];
81
+ retiredPlans: string[];
82
+ removedFeatures: string[];
83
+ defaultPlanChanged: boolean;
84
+ providerErrors: {
85
+ priceId: string;
86
+ provider: string;
87
+ code: string;
88
+ }[];
89
+ }>>;
90
+ upsertAccount: (accountRef: string, input: AccountUpsertInput, opts?: CallOptions) => Promise<ClientResult<{
91
+ ref: string;
92
+ displayName: string;
93
+ metadata: Record<string, string>;
94
+ createdAt: string;
95
+ snapshot: {
96
+ version: number;
97
+ planCode: string;
98
+ accessState: "active" | "suspended";
99
+ entitlements: Record<string, string | number | boolean | null>;
100
+ subscription: {
101
+ id: string;
102
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
103
+ planCode: string;
104
+ interval: "month" | "year";
105
+ amountMinor: number;
106
+ currency: string;
107
+ currentPeriodEnd: string | null;
108
+ cancelAt: string | null;
109
+ } | null;
110
+ };
111
+ account?: {
112
+ version: number;
113
+ planCode: string;
114
+ accessState: "active" | "suspended";
115
+ entitlements: Record<string, string | number | boolean | null>;
116
+ ref: string;
117
+ displayName: string;
118
+ updatedAt: string;
119
+ catalogVersion: string | null;
120
+ subscription: {
121
+ id: string;
122
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
123
+ planCode: string;
124
+ interval: "month" | "year";
125
+ amountMinor: number;
126
+ currency: string;
127
+ currentPeriodEnd: string | null;
128
+ cancelAt: string | null;
129
+ cancelAtPeriodEnd: boolean;
130
+ pastDueSince: string | null;
131
+ currentPeriodStart: string | null;
132
+ dunning: {
133
+ step: number;
134
+ nextActionAt: string | null;
135
+ } | null;
136
+ scheduledChange: {
137
+ planCode: string;
138
+ interval: "month" | "year";
139
+ effectiveAt: string;
140
+ } | null;
141
+ } | null;
142
+ openCheckout: {
143
+ id: string;
144
+ planCode: string;
145
+ interval: "month" | "year";
146
+ intervalCount: number;
147
+ currency: string;
148
+ amountMinor: number;
149
+ expiresAt: string;
150
+ } | null;
151
+ profile: {
152
+ present: boolean;
153
+ kind: "individual" | "company" | null;
154
+ };
155
+ } | undefined;
156
+ }>>;
157
+ getAccount: (accountRef: string, include?: readonly AccountInclude[]) => Promise<ClientResult<{
158
+ ref: string;
159
+ displayName: string;
160
+ metadata: Record<string, string>;
161
+ createdAt: string;
162
+ snapshot: {
163
+ version: number;
164
+ planCode: string;
165
+ accessState: "active" | "suspended";
166
+ entitlements: Record<string, string | number | boolean | null>;
167
+ subscription: {
168
+ id: string;
169
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
170
+ planCode: string;
171
+ interval: "month" | "year";
172
+ amountMinor: number;
173
+ currency: string;
174
+ currentPeriodEnd: string | null;
175
+ cancelAt: string | null;
176
+ } | null;
177
+ };
178
+ profile?: {
179
+ kind: "individual" | "company";
180
+ contactName: string;
181
+ email: string;
182
+ phone: string;
183
+ address: string;
184
+ city: string;
185
+ country: string;
186
+ companyName?: string | undefined;
187
+ taxOffice?: string | undefined;
188
+ taxId?: string | undefined;
189
+ } | null | undefined;
190
+ subscriptions?: {
191
+ id: string;
192
+ accountRef: string;
193
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
194
+ planCode: string;
195
+ priceId: string;
196
+ interval: "month" | "year";
197
+ amountMinor: number;
198
+ currency: string;
199
+ provider: string;
200
+ providerSubscriptionRef: string;
201
+ cancelAtPeriodEnd: boolean;
202
+ cancelAt: string | null;
203
+ cancelReason: string | null;
204
+ canceledAt: string | null;
205
+ startedAt: string;
206
+ currentPeriodStart: string | null;
207
+ currentPeriodEnd: string | null;
208
+ dunningStartedAt: string | null;
209
+ }[] | undefined;
210
+ checkouts?: {
211
+ id: string;
212
+ accountRef: string;
213
+ status: "canceled" | "expired" | "open" | "completed" | "failed";
214
+ planCode: string;
215
+ interval: "month" | "year";
216
+ amountMinor: number;
217
+ currency: string;
218
+ provider: string;
219
+ locale: string;
220
+ returnUrl: string;
221
+ consents: {
222
+ document: string;
223
+ version: string;
224
+ acceptedAt: string;
225
+ url?: string | undefined;
226
+ }[];
227
+ actorRef: string | null;
228
+ failureReason: string | null;
229
+ subscriptionId: string | null;
230
+ expiresAt: string;
231
+ createdAt: string;
232
+ completedAt: string | null;
233
+ successUrl?: string | undefined;
234
+ cancelUrl?: string | null | undefined;
235
+ }[] | undefined;
236
+ payments?: {
237
+ id: string;
238
+ subscriptionId: string;
239
+ providerOrderRef: string;
240
+ status: "failed" | "succeeded";
241
+ amountMinor: number;
242
+ currency: string;
243
+ periodStart: string | null;
244
+ periodEnd: string | null;
245
+ occurredAt: string;
246
+ }[] | undefined;
247
+ invoices?: {
248
+ id: string;
249
+ accountRef: string;
250
+ subscriptionId: string | null;
251
+ paymentId: string | null;
252
+ status: "void" | "draft" | "issued";
253
+ number: string | null;
254
+ currency: string;
255
+ subtotalMinor: number;
256
+ taxMinor: number;
257
+ totalMinor: number;
258
+ taxRateBps: number;
259
+ buyer: {
260
+ kind: "individual" | "company";
261
+ contactName: string;
262
+ email: string;
263
+ phone: string;
264
+ address: string;
265
+ city: string;
266
+ country: string;
267
+ companyName?: string | undefined;
268
+ taxOffice?: string | undefined;
269
+ taxId?: string | undefined;
270
+ };
271
+ lines: {
272
+ description: string;
273
+ quantity: number;
274
+ unitAmountMinor: number;
275
+ amountMinor: number;
276
+ }[];
277
+ issuer: string;
278
+ externalRef: string | null;
279
+ hasDocument: boolean;
280
+ issuedAt: string | null;
281
+ createdAt: string;
282
+ dueAt?: string | null | undefined;
283
+ note?: string | null | undefined;
284
+ voidedAt?: string | null | undefined;
285
+ voidReason?: string | null | undefined;
286
+ }[] | undefined;
287
+ grants?: {
288
+ id: string;
289
+ accountRef: string;
290
+ planCode: string | null;
291
+ overrides: Record<string, string | number | boolean | null>;
292
+ reason: string;
293
+ actorRef: string | null;
294
+ startsAt: string;
295
+ endsAt: string | null;
296
+ revokedAt: string | null;
297
+ createdAt: string;
298
+ }[] | undefined;
299
+ }>>;
300
+ getEntitlements: (accountRef: string) => Promise<ClientResult<{
301
+ version: number;
302
+ planCode: string;
303
+ accessState: "active" | "suspended";
304
+ entitlements: Record<string, string | number | boolean | null>;
305
+ subscription: {
306
+ id: string;
307
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
308
+ planCode: string;
309
+ interval: "month" | "year";
310
+ amountMinor: number;
311
+ currency: string;
312
+ currentPeriodEnd: string | null;
313
+ cancelAt: string | null;
314
+ } | null;
315
+ }>>;
316
+ /**
317
+ * Hesap durumu (`AccountState`). ETag = `"<version>"`; önceki yanıtın
318
+ * `etag`'i verilirse ve durum değişmediyse 304 → `{notModified: true}`.
319
+ */
320
+ getAccountState: (accountRef: string, opts?: {
321
+ etag?: string;
322
+ }) => Promise<ClientResult<AccountStateRead>>;
323
+ putBillingProfile: (accountRef: string, profile: BillingProfileInput, opts?: CallOptions) => Promise<ClientResult<{
324
+ kind: "individual" | "company";
325
+ contactName: string;
326
+ email: string;
327
+ phone: string;
328
+ address: string;
329
+ city: string;
330
+ country: string;
331
+ companyName?: string | undefined;
332
+ taxOffice?: string | undefined;
333
+ taxId?: string | undefined;
334
+ account?: {
335
+ version: number;
336
+ planCode: string;
337
+ accessState: "active" | "suspended";
338
+ entitlements: Record<string, string | number | boolean | null>;
339
+ ref: string;
340
+ displayName: string;
341
+ updatedAt: string;
342
+ catalogVersion: string | null;
343
+ subscription: {
344
+ id: string;
345
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
346
+ planCode: string;
347
+ interval: "month" | "year";
348
+ amountMinor: number;
349
+ currency: string;
350
+ currentPeriodEnd: string | null;
351
+ cancelAt: string | null;
352
+ cancelAtPeriodEnd: boolean;
353
+ pastDueSince: string | null;
354
+ currentPeriodStart: string | null;
355
+ dunning: {
356
+ step: number;
357
+ nextActionAt: string | null;
358
+ } | null;
359
+ scheduledChange: {
360
+ planCode: string;
361
+ interval: "month" | "year";
362
+ effectiveAt: string;
363
+ } | null;
364
+ } | null;
365
+ openCheckout: {
366
+ id: string;
367
+ planCode: string;
368
+ interval: "month" | "year";
369
+ intervalCount: number;
370
+ currency: string;
371
+ amountMinor: number;
372
+ expiresAt: string;
373
+ } | null;
374
+ profile: {
375
+ present: boolean;
376
+ kind: "individual" | "company" | null;
377
+ };
378
+ } | undefined;
379
+ }>>;
380
+ /** Atomik plan (K6): aktif plan grant'leri → tek plan grant'i (`planCode: null` kaldırır); `strict`'te 409 `subscription_plan_higher`. */
381
+ setPlan: (accountRef: string, input: PlanSetInput, opts?: CallOptions) => Promise<ClientResult<{
382
+ grant: {
383
+ id: string;
384
+ accountRef: string;
385
+ planCode: string | null;
386
+ overrides: Record<string, string | number | boolean | null>;
387
+ reason: string;
388
+ actorRef: string | null;
389
+ startsAt: string;
390
+ endsAt: string | null;
391
+ revokedAt: string | null;
392
+ createdAt: string;
393
+ } | null;
394
+ account: {
395
+ version: number;
396
+ planCode: string;
397
+ accessState: "active" | "suspended";
398
+ entitlements: Record<string, string | number | boolean | null>;
399
+ ref: string;
400
+ displayName: string;
401
+ updatedAt: string;
402
+ catalogVersion: string | null;
403
+ subscription: {
404
+ id: string;
405
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
406
+ planCode: string;
407
+ interval: "month" | "year";
408
+ amountMinor: number;
409
+ currency: string;
410
+ currentPeriodEnd: string | null;
411
+ cancelAt: string | null;
412
+ cancelAtPeriodEnd: boolean;
413
+ pastDueSince: string | null;
414
+ currentPeriodStart: string | null;
415
+ dunning: {
416
+ step: number;
417
+ nextActionAt: string | null;
418
+ } | null;
419
+ scheduledChange: {
420
+ planCode: string;
421
+ interval: "month" | "year";
422
+ effectiveAt: string;
423
+ } | null;
424
+ } | null;
425
+ openCheckout: {
426
+ id: string;
427
+ planCode: string;
428
+ interval: "month" | "year";
429
+ intervalCount: number;
430
+ currency: string;
431
+ amountMinor: number;
432
+ expiresAt: string;
433
+ } | null;
434
+ profile: {
435
+ present: boolean;
436
+ kind: "individual" | "company" | null;
437
+ };
438
+ };
439
+ warnings: {
440
+ code: string;
441
+ message: string;
442
+ }[];
443
+ }>>;
444
+ /** Saklı durumu `account.state_changed` (`cause: "resync"`) olarak yeniden yayınlar; version değişmez (202). */
445
+ resync: (accountRef: string, opts?: CallOptions) => Promise<ClientResult<{
446
+ queued: true;
447
+ eventId?: string | undefined;
448
+ }>>;
449
+ /** KVKK anonimleştirme (F4e): `{ref, deletedAt}`; silinmişse 410 `account_deleted`, canlı abonelikte 409 `subscription_active`. */
450
+ deleteAccount: (accountRef: string, opts?: CallOptions) => Promise<ClientResult<{
451
+ ref: string;
452
+ deletedAt: string;
453
+ }>>;
454
+ createCheckoutSession: (accountRef: string, input: CheckoutSessionCreateInput, opts?: CallOptions) => Promise<ClientResult<{
455
+ id: string;
456
+ accountRef: string;
457
+ status: "canceled" | "expired" | "open" | "completed" | "failed";
458
+ planCode: string;
459
+ interval: "month" | "year";
460
+ amountMinor: number;
461
+ currency: string;
462
+ provider: string;
463
+ locale: string;
464
+ returnUrl: string;
465
+ consents: {
466
+ document: string;
467
+ version: string;
468
+ acceptedAt: string;
469
+ url?: string | undefined;
470
+ }[];
471
+ actorRef: string | null;
472
+ failureReason: string | null;
473
+ subscriptionId: string | null;
474
+ expiresAt: string;
475
+ createdAt: string;
476
+ completedAt: string | null;
477
+ url: string | null;
478
+ successUrl?: string | undefined;
479
+ cancelUrl?: string | null | undefined;
480
+ providerPayload?: {
481
+ type: "html_snippet";
482
+ html: string;
483
+ } | {
484
+ type: "redirect";
485
+ url: string;
486
+ } | undefined;
487
+ account?: {
488
+ version: number;
489
+ planCode: string;
490
+ accessState: "active" | "suspended";
491
+ entitlements: Record<string, string | number | boolean | null>;
492
+ ref: string;
493
+ displayName: string;
494
+ updatedAt: string;
495
+ catalogVersion: string | null;
496
+ subscription: {
497
+ id: string;
498
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
499
+ planCode: string;
500
+ interval: "month" | "year";
501
+ amountMinor: number;
502
+ currency: string;
503
+ currentPeriodEnd: string | null;
504
+ cancelAt: string | null;
505
+ cancelAtPeriodEnd: boolean;
506
+ pastDueSince: string | null;
507
+ currentPeriodStart: string | null;
508
+ dunning: {
509
+ step: number;
510
+ nextActionAt: string | null;
511
+ } | null;
512
+ scheduledChange: {
513
+ planCode: string;
514
+ interval: "month" | "year";
515
+ effectiveAt: string;
516
+ } | null;
517
+ } | null;
518
+ openCheckout: {
519
+ id: string;
520
+ planCode: string;
521
+ interval: "month" | "year";
522
+ intervalCount: number;
523
+ currency: string;
524
+ amountMinor: number;
525
+ expiresAt: string;
526
+ } | null;
527
+ profile: {
528
+ present: boolean;
529
+ kind: "individual" | "company" | null;
530
+ };
531
+ } | undefined;
532
+ }>>;
533
+ getCheckoutSession: (id: string) => Promise<ClientResult<{
534
+ id: string;
535
+ accountRef: string;
536
+ status: "canceled" | "expired" | "open" | "completed" | "failed";
537
+ planCode: string;
538
+ interval: "month" | "year";
539
+ amountMinor: number;
540
+ currency: string;
541
+ provider: string;
542
+ locale: string;
543
+ returnUrl: string;
544
+ consents: {
545
+ document: string;
546
+ version: string;
547
+ acceptedAt: string;
548
+ url?: string | undefined;
549
+ }[];
550
+ actorRef: string | null;
551
+ failureReason: string | null;
552
+ subscriptionId: string | null;
553
+ expiresAt: string;
554
+ createdAt: string;
555
+ completedAt: string | null;
556
+ successUrl?: string | undefined;
557
+ cancelUrl?: string | null | undefined;
558
+ account?: {
559
+ version: number;
560
+ planCode: string;
561
+ accessState: "active" | "suspended";
562
+ entitlements: Record<string, string | number | boolean | null>;
563
+ ref: string;
564
+ displayName: string;
565
+ updatedAt: string;
566
+ catalogVersion: string | null;
567
+ subscription: {
568
+ id: string;
569
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
570
+ planCode: string;
571
+ interval: "month" | "year";
572
+ amountMinor: number;
573
+ currency: string;
574
+ currentPeriodEnd: string | null;
575
+ cancelAt: string | null;
576
+ cancelAtPeriodEnd: boolean;
577
+ pastDueSince: string | null;
578
+ currentPeriodStart: string | null;
579
+ dunning: {
580
+ step: number;
581
+ nextActionAt: string | null;
582
+ } | null;
583
+ scheduledChange: {
584
+ planCode: string;
585
+ interval: "month" | "year";
586
+ effectiveAt: string;
587
+ } | null;
588
+ } | null;
589
+ openCheckout: {
590
+ id: string;
591
+ planCode: string;
592
+ interval: "month" | "year";
593
+ intervalCount: number;
594
+ currency: string;
595
+ amountMinor: number;
596
+ expiresAt: string;
597
+ } | null;
598
+ profile: {
599
+ present: boolean;
600
+ kind: "individual" | "company" | null;
601
+ };
602
+ } | undefined;
603
+ }>>;
604
+ createPortalSession: (accountRef: string, input?: PortalSessionCreateInput, opts?: CallOptions) => Promise<ClientResult<{
605
+ id: string;
606
+ url: string;
607
+ expiresAt: string;
608
+ }>>;
609
+ cancelSubscription: (id: string, input: CancelSubscriptionInput, opts?: CallOptions) => Promise<ClientResult<{
610
+ id: string;
611
+ accountRef: string;
612
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
613
+ planCode: string;
614
+ priceId: string;
615
+ interval: "month" | "year";
616
+ amountMinor: number;
617
+ currency: string;
618
+ provider: string;
619
+ providerSubscriptionRef: string;
620
+ cancelAtPeriodEnd: boolean;
621
+ cancelAt: string | null;
622
+ cancelReason: string | null;
623
+ canceledAt: string | null;
624
+ startedAt: string;
625
+ currentPeriodStart: string | null;
626
+ currentPeriodEnd: string | null;
627
+ dunningStartedAt: string | null;
628
+ account?: {
629
+ version: number;
630
+ planCode: string;
631
+ accessState: "active" | "suspended";
632
+ entitlements: Record<string, string | number | boolean | null>;
633
+ ref: string;
634
+ displayName: string;
635
+ updatedAt: string;
636
+ catalogVersion: string | null;
637
+ subscription: {
638
+ id: string;
639
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
640
+ planCode: string;
641
+ interval: "month" | "year";
642
+ amountMinor: number;
643
+ currency: string;
644
+ currentPeriodEnd: string | null;
645
+ cancelAt: string | null;
646
+ cancelAtPeriodEnd: boolean;
647
+ pastDueSince: string | null;
648
+ currentPeriodStart: string | null;
649
+ dunning: {
650
+ step: number;
651
+ nextActionAt: string | null;
652
+ } | null;
653
+ scheduledChange: {
654
+ planCode: string;
655
+ interval: "month" | "year";
656
+ effectiveAt: string;
657
+ } | null;
658
+ } | null;
659
+ openCheckout: {
660
+ id: string;
661
+ planCode: string;
662
+ interval: "month" | "year";
663
+ intervalCount: number;
664
+ currency: string;
665
+ amountMinor: number;
666
+ expiresAt: string;
667
+ } | null;
668
+ profile: {
669
+ present: boolean;
670
+ kind: "individual" | "company" | null;
671
+ };
672
+ } | undefined;
673
+ }>>;
674
+ createGrant: (accountRef: string, input: GrantCreateInput, opts?: CallOptions) => Promise<ClientResult<{
675
+ id: string;
676
+ accountRef: string;
677
+ planCode: string | null;
678
+ overrides: Record<string, string | number | boolean | null>;
679
+ reason: string;
680
+ actorRef: string | null;
681
+ startsAt: string;
682
+ endsAt: string | null;
683
+ revokedAt: string | null;
684
+ createdAt: string;
685
+ account?: {
686
+ version: number;
687
+ planCode: string;
688
+ accessState: "active" | "suspended";
689
+ entitlements: Record<string, string | number | boolean | null>;
690
+ ref: string;
691
+ displayName: string;
692
+ updatedAt: string;
693
+ catalogVersion: string | null;
694
+ subscription: {
695
+ id: string;
696
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
697
+ planCode: string;
698
+ interval: "month" | "year";
699
+ amountMinor: number;
700
+ currency: string;
701
+ currentPeriodEnd: string | null;
702
+ cancelAt: string | null;
703
+ cancelAtPeriodEnd: boolean;
704
+ pastDueSince: string | null;
705
+ currentPeriodStart: string | null;
706
+ dunning: {
707
+ step: number;
708
+ nextActionAt: string | null;
709
+ } | null;
710
+ scheduledChange: {
711
+ planCode: string;
712
+ interval: "month" | "year";
713
+ effectiveAt: string;
714
+ } | null;
715
+ } | null;
716
+ openCheckout: {
717
+ id: string;
718
+ planCode: string;
719
+ interval: "month" | "year";
720
+ intervalCount: number;
721
+ currency: string;
722
+ amountMinor: number;
723
+ expiresAt: string;
724
+ } | null;
725
+ profile: {
726
+ present: boolean;
727
+ kind: "individual" | "company" | null;
728
+ };
729
+ } | undefined;
730
+ }>>;
731
+ revokeGrant: (id: string, opts?: CallOptions) => Promise<ClientResult<null>>;
732
+ getStats: () => Promise<ClientResult<{
733
+ subscriptions: Record<"active" | "suspended" | "past_due" | "canceled" | "expired", number>;
734
+ mrrMinor: Record<string, number>;
735
+ accounts: number;
736
+ }>>;
737
+ doctor: () => Promise<ClientResult<{
738
+ ok: boolean;
739
+ checkedAt: string;
740
+ product: {
741
+ code: string;
742
+ name: string;
743
+ };
744
+ catalog: {
745
+ synced: boolean;
746
+ version: string | null;
747
+ plans: number;
748
+ sellablePrices: number;
749
+ unsellablePrices: {
750
+ priceId: string;
751
+ planCode: string;
752
+ interval: "month" | "year";
753
+ intervalCount: number;
754
+ currency: string;
755
+ reason: string;
756
+ }[];
757
+ };
758
+ provider: {
759
+ id: string;
760
+ configured: boolean;
761
+ environment: "sandbox" | "live" | "fake" | null;
762
+ merchantId: string | null;
763
+ healthy: boolean | null;
764
+ lastError: {
765
+ code: string;
766
+ operation: string;
767
+ at: string;
768
+ } | null;
769
+ };
770
+ settings: {
771
+ appUrl: string | null;
772
+ returnOrigins: string[];
773
+ };
774
+ hosted: {
775
+ branding: {
776
+ missing: string[];
777
+ };
778
+ legalLinks: {
779
+ missing: string[];
780
+ };
781
+ ready: boolean;
782
+ };
783
+ endpoints: {
784
+ id: string;
785
+ url: string;
786
+ status: "active" | "paused" | "inactive";
787
+ eventTypes: ("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" | "invoice.voided" | "account.state_changed" | "account.deleted")[] | null;
788
+ pending: number;
789
+ dead: number;
790
+ oldestPendingAt: string | null;
791
+ lastDelivery: {
792
+ status: "pending" | "dead" | "delivered";
793
+ httpStatus: number | null;
794
+ error: string | null;
795
+ attempts: number;
796
+ at: string;
797
+ } | null;
798
+ diagnosis: string;
799
+ }[];
800
+ dunning: {
801
+ dryRun: boolean;
802
+ };
803
+ warnings: {
804
+ code: string;
805
+ severity: "error" | "warning" | "info";
806
+ message: string;
807
+ endpointId?: string | undefined;
808
+ }[];
809
+ }>>;
810
+ issueInvoice: (id: string, input: InvoiceIssueInput, opts?: CallOptions) => Promise<ClientResult<{
811
+ id: string;
812
+ accountRef: string;
813
+ subscriptionId: string | null;
814
+ paymentId: string | null;
815
+ status: "void" | "draft" | "issued";
816
+ number: string | null;
817
+ currency: string;
818
+ subtotalMinor: number;
819
+ taxMinor: number;
820
+ totalMinor: number;
821
+ taxRateBps: number;
822
+ buyer: {
823
+ kind: "individual" | "company";
824
+ contactName: string;
825
+ email: string;
826
+ phone: string;
827
+ address: string;
828
+ city: string;
829
+ country: string;
830
+ companyName?: string | undefined;
831
+ taxOffice?: string | undefined;
832
+ taxId?: string | undefined;
833
+ };
834
+ lines: {
835
+ description: string;
836
+ quantity: number;
837
+ unitAmountMinor: number;
838
+ amountMinor: number;
839
+ }[];
840
+ issuer: string;
841
+ externalRef: string | null;
842
+ hasDocument: boolean;
843
+ issuedAt: string | null;
844
+ createdAt: string;
845
+ dueAt?: string | null | undefined;
846
+ note?: string | null | undefined;
847
+ voidedAt?: string | null | undefined;
848
+ voidReason?: string | null | undefined;
849
+ account?: {
850
+ version: number;
851
+ planCode: string;
852
+ accessState: "active" | "suspended";
853
+ entitlements: Record<string, string | number | boolean | null>;
854
+ ref: string;
855
+ displayName: string;
856
+ updatedAt: string;
857
+ catalogVersion: string | null;
858
+ subscription: {
859
+ id: string;
860
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
861
+ planCode: string;
862
+ interval: "month" | "year";
863
+ amountMinor: number;
864
+ currency: string;
865
+ currentPeriodEnd: string | null;
866
+ cancelAt: string | null;
867
+ cancelAtPeriodEnd: boolean;
868
+ pastDueSince: string | null;
869
+ currentPeriodStart: string | null;
870
+ dunning: {
871
+ step: number;
872
+ nextActionAt: string | null;
873
+ } | null;
874
+ scheduledChange: {
875
+ planCode: string;
876
+ interval: "month" | "year";
877
+ effectiveAt: string;
878
+ } | null;
879
+ } | null;
880
+ openCheckout: {
881
+ id: string;
882
+ planCode: string;
883
+ interval: "month" | "year";
884
+ intervalCount: number;
885
+ currency: string;
886
+ amountMinor: number;
887
+ expiresAt: string;
888
+ } | null;
889
+ profile: {
890
+ present: boolean;
891
+ kind: "individual" | "company" | null;
892
+ };
893
+ } | undefined;
894
+ }>>;
895
+ /** Manuel taslak fatura (F4f): profil gerekir (422 `billing_profile_required`); `issueInvoice` ile kesilir. */
896
+ createManualInvoice: (accountRef: string, input: ManualInvoiceInput, opts?: CallOptions) => Promise<ClientResult<{
897
+ id: string;
898
+ accountRef: string;
899
+ subscriptionId: string | null;
900
+ paymentId: string | null;
901
+ status: "void" | "draft" | "issued";
902
+ number: string | null;
903
+ currency: string;
904
+ subtotalMinor: number;
905
+ taxMinor: number;
906
+ totalMinor: number;
907
+ taxRateBps: number;
908
+ buyer: {
909
+ kind: "individual" | "company";
910
+ contactName: string;
911
+ email: string;
912
+ phone: string;
913
+ address: string;
914
+ city: string;
915
+ country: string;
916
+ companyName?: string | undefined;
917
+ taxOffice?: string | undefined;
918
+ taxId?: string | undefined;
919
+ };
920
+ lines: {
921
+ description: string;
922
+ quantity: number;
923
+ unitAmountMinor: number;
924
+ amountMinor: number;
925
+ }[];
926
+ issuer: string;
927
+ externalRef: string | null;
928
+ hasDocument: boolean;
929
+ issuedAt: string | null;
930
+ createdAt: string;
931
+ dueAt?: string | null | undefined;
932
+ note?: string | null | undefined;
933
+ voidedAt?: string | null | undefined;
934
+ voidReason?: string | null | undefined;
935
+ account?: {
936
+ version: number;
937
+ planCode: string;
938
+ accessState: "active" | "suspended";
939
+ entitlements: Record<string, string | number | boolean | null>;
940
+ ref: string;
941
+ displayName: string;
942
+ updatedAt: string;
943
+ catalogVersion: string | null;
944
+ subscription: {
945
+ id: string;
946
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
947
+ planCode: string;
948
+ interval: "month" | "year";
949
+ amountMinor: number;
950
+ currency: string;
951
+ currentPeriodEnd: string | null;
952
+ cancelAt: string | null;
953
+ cancelAtPeriodEnd: boolean;
954
+ pastDueSince: string | null;
955
+ currentPeriodStart: string | null;
956
+ dunning: {
957
+ step: number;
958
+ nextActionAt: string | null;
959
+ } | null;
960
+ scheduledChange: {
961
+ planCode: string;
962
+ interval: "month" | "year";
963
+ effectiveAt: string;
964
+ } | null;
965
+ } | null;
966
+ openCheckout: {
967
+ id: string;
968
+ planCode: string;
969
+ interval: "month" | "year";
970
+ intervalCount: number;
971
+ currency: string;
972
+ amountMinor: number;
973
+ expiresAt: string;
974
+ } | null;
975
+ profile: {
976
+ present: boolean;
977
+ kind: "individual" | "company" | null;
978
+ };
979
+ } | undefined;
980
+ }>>;
981
+ /** Yalnızca manuel fatura (409 `invoice_has_payment` / `invoice_not_voidable`); `invoice.voided`. */
982
+ voidInvoice: (id: string, input: InvoiceVoidInput, opts?: CallOptions) => Promise<ClientResult<{
983
+ id: string;
984
+ accountRef: string;
985
+ subscriptionId: string | null;
986
+ paymentId: string | null;
987
+ status: "void" | "draft" | "issued";
988
+ number: string | null;
989
+ currency: string;
990
+ subtotalMinor: number;
991
+ taxMinor: number;
992
+ totalMinor: number;
993
+ taxRateBps: number;
994
+ buyer: {
995
+ kind: "individual" | "company";
996
+ contactName: string;
997
+ email: string;
998
+ phone: string;
999
+ address: string;
1000
+ city: string;
1001
+ country: string;
1002
+ companyName?: string | undefined;
1003
+ taxOffice?: string | undefined;
1004
+ taxId?: string | undefined;
1005
+ };
1006
+ lines: {
1007
+ description: string;
1008
+ quantity: number;
1009
+ unitAmountMinor: number;
1010
+ amountMinor: number;
1011
+ }[];
1012
+ issuer: string;
1013
+ externalRef: string | null;
1014
+ hasDocument: boolean;
1015
+ issuedAt: string | null;
1016
+ createdAt: string;
1017
+ dueAt?: string | null | undefined;
1018
+ note?: string | null | undefined;
1019
+ voidedAt?: string | null | undefined;
1020
+ voidReason?: string | null | undefined;
1021
+ account?: {
1022
+ version: number;
1023
+ planCode: string;
1024
+ accessState: "active" | "suspended";
1025
+ entitlements: Record<string, string | number | boolean | null>;
1026
+ ref: string;
1027
+ displayName: string;
1028
+ updatedAt: string;
1029
+ catalogVersion: string | null;
1030
+ subscription: {
1031
+ id: string;
1032
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1033
+ planCode: string;
1034
+ interval: "month" | "year";
1035
+ amountMinor: number;
1036
+ currency: string;
1037
+ currentPeriodEnd: string | null;
1038
+ cancelAt: string | null;
1039
+ cancelAtPeriodEnd: boolean;
1040
+ pastDueSince: string | null;
1041
+ currentPeriodStart: string | null;
1042
+ dunning: {
1043
+ step: number;
1044
+ nextActionAt: string | null;
1045
+ } | null;
1046
+ scheduledChange: {
1047
+ planCode: string;
1048
+ interval: "month" | "year";
1049
+ effectiveAt: string;
1050
+ } | null;
1051
+ } | null;
1052
+ openCheckout: {
1053
+ id: string;
1054
+ planCode: string;
1055
+ interval: "month" | "year";
1056
+ intervalCount: number;
1057
+ currency: string;
1058
+ amountMinor: number;
1059
+ expiresAt: string;
1060
+ } | null;
1061
+ profile: {
1062
+ present: boolean;
1063
+ kind: "individual" | "company" | null;
1064
+ };
1065
+ } | undefined;
1066
+ }>>;
1067
+ getInvoiceDocument: (id: string) => Promise<ClientResult<{
1068
+ contentType: string;
1069
+ bytes: Uint8Array;
1070
+ }>>;
1071
+ listEvents: (query?: {
1072
+ accountRef?: string;
1073
+ cursor?: string;
1074
+ limit?: number;
1075
+ }) => Promise<ClientResult<{
1076
+ items: {
1077
+ event: {
1078
+ id: string;
1079
+ type: "account.updated";
1080
+ apiVersion: string;
1081
+ createdAt: string;
1082
+ product: string;
1083
+ accountRef: string;
1084
+ data: {
1085
+ account: {
1086
+ version: number;
1087
+ planCode: string;
1088
+ accessState: "active" | "suspended";
1089
+ entitlements: Record<string, string | number | boolean | null>;
1090
+ subscription: {
1091
+ id: string;
1092
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1093
+ planCode: string;
1094
+ interval: "month" | "year";
1095
+ amountMinor: number;
1096
+ currency: string;
1097
+ currentPeriodEnd: string | null;
1098
+ cancelAt: string | null;
1099
+ } | null;
1100
+ };
1101
+ detail: {
1102
+ changed: string[];
1103
+ };
1104
+ };
1105
+ } | {
1106
+ id: string;
1107
+ type: "checkout.completed";
1108
+ apiVersion: string;
1109
+ createdAt: string;
1110
+ product: string;
1111
+ accountRef: string;
1112
+ data: {
1113
+ account: {
1114
+ version: number;
1115
+ planCode: string;
1116
+ accessState: "active" | "suspended";
1117
+ entitlements: Record<string, string | number | boolean | null>;
1118
+ subscription: {
1119
+ id: string;
1120
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1121
+ planCode: string;
1122
+ interval: "month" | "year";
1123
+ amountMinor: number;
1124
+ currency: string;
1125
+ currentPeriodEnd: string | null;
1126
+ cancelAt: string | null;
1127
+ } | null;
1128
+ };
1129
+ detail: {
1130
+ subscriptionId: string;
1131
+ checkoutSessionId: string;
1132
+ };
1133
+ };
1134
+ } | {
1135
+ id: string;
1136
+ type: "checkout.failed";
1137
+ apiVersion: string;
1138
+ createdAt: string;
1139
+ product: string;
1140
+ accountRef: string;
1141
+ data: {
1142
+ account: {
1143
+ version: number;
1144
+ planCode: string;
1145
+ accessState: "active" | "suspended";
1146
+ entitlements: Record<string, string | number | boolean | null>;
1147
+ subscription: {
1148
+ id: string;
1149
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1150
+ planCode: string;
1151
+ interval: "month" | "year";
1152
+ amountMinor: number;
1153
+ currency: string;
1154
+ currentPeriodEnd: string | null;
1155
+ cancelAt: string | null;
1156
+ } | null;
1157
+ };
1158
+ detail: {
1159
+ checkoutSessionId: string;
1160
+ reason: string;
1161
+ };
1162
+ };
1163
+ } | {
1164
+ id: string;
1165
+ type: "checkout.expired";
1166
+ apiVersion: string;
1167
+ createdAt: string;
1168
+ product: string;
1169
+ accountRef: string;
1170
+ data: {
1171
+ account: {
1172
+ version: number;
1173
+ planCode: string;
1174
+ accessState: "active" | "suspended";
1175
+ entitlements: Record<string, string | number | boolean | null>;
1176
+ subscription: {
1177
+ id: string;
1178
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1179
+ planCode: string;
1180
+ interval: "month" | "year";
1181
+ amountMinor: number;
1182
+ currency: string;
1183
+ currentPeriodEnd: string | null;
1184
+ cancelAt: string | null;
1185
+ } | null;
1186
+ };
1187
+ detail: {
1188
+ checkoutSessionId: string;
1189
+ };
1190
+ };
1191
+ } | {
1192
+ id: string;
1193
+ type: "subscription.activated";
1194
+ apiVersion: string;
1195
+ createdAt: string;
1196
+ product: string;
1197
+ accountRef: string;
1198
+ data: {
1199
+ account: {
1200
+ version: number;
1201
+ planCode: string;
1202
+ accessState: "active" | "suspended";
1203
+ entitlements: Record<string, string | number | boolean | null>;
1204
+ subscription: {
1205
+ id: string;
1206
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1207
+ planCode: string;
1208
+ interval: "month" | "year";
1209
+ amountMinor: number;
1210
+ currency: string;
1211
+ currentPeriodEnd: string | null;
1212
+ cancelAt: string | null;
1213
+ } | null;
1214
+ };
1215
+ detail: {
1216
+ planCode: string;
1217
+ interval: "month" | "year";
1218
+ amountMinor: number;
1219
+ currency: string;
1220
+ actorRef: string | null;
1221
+ subscriptionId: string;
1222
+ };
1223
+ };
1224
+ } | {
1225
+ id: string;
1226
+ type: "subscription.renewed";
1227
+ apiVersion: string;
1228
+ createdAt: string;
1229
+ product: string;
1230
+ accountRef: string;
1231
+ data: {
1232
+ account: {
1233
+ version: number;
1234
+ planCode: string;
1235
+ accessState: "active" | "suspended";
1236
+ entitlements: Record<string, string | number | boolean | null>;
1237
+ subscription: {
1238
+ id: string;
1239
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1240
+ planCode: string;
1241
+ interval: "month" | "year";
1242
+ amountMinor: number;
1243
+ currency: string;
1244
+ currentPeriodEnd: string | null;
1245
+ cancelAt: string | null;
1246
+ } | null;
1247
+ };
1248
+ detail: {
1249
+ paymentId: string;
1250
+ periodStart: string | null;
1251
+ periodEnd: string | null;
1252
+ invoiceId: string | null;
1253
+ subscriptionId: string;
1254
+ };
1255
+ };
1256
+ } | {
1257
+ id: string;
1258
+ type: "subscription.payment_failed";
1259
+ apiVersion: string;
1260
+ createdAt: string;
1261
+ product: string;
1262
+ accountRef: string;
1263
+ data: {
1264
+ account: {
1265
+ version: number;
1266
+ planCode: string;
1267
+ accessState: "active" | "suspended";
1268
+ entitlements: Record<string, string | number | boolean | null>;
1269
+ subscription: {
1270
+ id: string;
1271
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1272
+ planCode: string;
1273
+ interval: "month" | "year";
1274
+ amountMinor: number;
1275
+ currency: string;
1276
+ currentPeriodEnd: string | null;
1277
+ cancelAt: string | null;
1278
+ } | null;
1279
+ };
1280
+ detail: {
1281
+ paymentId: string | null;
1282
+ attempt: number;
1283
+ nextRetryAt: string | null;
1284
+ subscriptionId: string;
1285
+ };
1286
+ };
1287
+ } | {
1288
+ id: string;
1289
+ type: "subscription.suspended";
1290
+ apiVersion: string;
1291
+ createdAt: string;
1292
+ product: string;
1293
+ accountRef: string;
1294
+ data: {
1295
+ account: {
1296
+ version: number;
1297
+ planCode: string;
1298
+ accessState: "active" | "suspended";
1299
+ entitlements: Record<string, string | number | boolean | null>;
1300
+ subscription: {
1301
+ id: string;
1302
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1303
+ planCode: string;
1304
+ interval: "month" | "year";
1305
+ amountMinor: number;
1306
+ currency: string;
1307
+ currentPeriodEnd: string | null;
1308
+ cancelAt: string | null;
1309
+ } | null;
1310
+ };
1311
+ detail: {
1312
+ dunningDay: number;
1313
+ subscriptionId: string;
1314
+ };
1315
+ };
1316
+ } | {
1317
+ id: string;
1318
+ type: "subscription.reactivated";
1319
+ apiVersion: string;
1320
+ createdAt: string;
1321
+ product: string;
1322
+ accountRef: string;
1323
+ data: {
1324
+ account: {
1325
+ version: number;
1326
+ planCode: string;
1327
+ accessState: "active" | "suspended";
1328
+ entitlements: Record<string, string | number | boolean | null>;
1329
+ subscription: {
1330
+ id: string;
1331
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1332
+ planCode: string;
1333
+ interval: "month" | "year";
1334
+ amountMinor: number;
1335
+ currency: string;
1336
+ currentPeriodEnd: string | null;
1337
+ cancelAt: string | null;
1338
+ } | null;
1339
+ };
1340
+ detail: {
1341
+ paymentId: string | null;
1342
+ subscriptionId: string;
1343
+ };
1344
+ };
1345
+ } | {
1346
+ id: string;
1347
+ type: "subscription.cancel_scheduled";
1348
+ apiVersion: string;
1349
+ createdAt: string;
1350
+ product: string;
1351
+ accountRef: string;
1352
+ data: {
1353
+ account: {
1354
+ version: number;
1355
+ planCode: string;
1356
+ accessState: "active" | "suspended";
1357
+ entitlements: Record<string, string | number | boolean | null>;
1358
+ subscription: {
1359
+ id: string;
1360
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1361
+ planCode: string;
1362
+ interval: "month" | "year";
1363
+ amountMinor: number;
1364
+ currency: string;
1365
+ currentPeriodEnd: string | null;
1366
+ cancelAt: string | null;
1367
+ } | null;
1368
+ };
1369
+ detail: {
1370
+ cancelAt: string;
1371
+ reason: string;
1372
+ actorRef: string | null;
1373
+ subscriptionId: string;
1374
+ };
1375
+ };
1376
+ } | {
1377
+ id: string;
1378
+ type: "subscription.canceled";
1379
+ apiVersion: string;
1380
+ createdAt: string;
1381
+ product: string;
1382
+ accountRef: string;
1383
+ data: {
1384
+ account: {
1385
+ version: number;
1386
+ planCode: string;
1387
+ accessState: "active" | "suspended";
1388
+ entitlements: Record<string, string | number | boolean | null>;
1389
+ subscription: {
1390
+ id: string;
1391
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1392
+ planCode: string;
1393
+ interval: "month" | "year";
1394
+ amountMinor: number;
1395
+ currency: string;
1396
+ currentPeriodEnd: string | null;
1397
+ cancelAt: string | null;
1398
+ } | null;
1399
+ };
1400
+ detail: {
1401
+ reason: string;
1402
+ effectiveAt: string;
1403
+ actorRef: string | null;
1404
+ subscriptionId: string;
1405
+ };
1406
+ };
1407
+ } | {
1408
+ id: string;
1409
+ type: "subscription.expired";
1410
+ apiVersion: string;
1411
+ createdAt: string;
1412
+ product: string;
1413
+ accountRef: string;
1414
+ data: {
1415
+ account: {
1416
+ version: number;
1417
+ planCode: string;
1418
+ accessState: "active" | "suspended";
1419
+ entitlements: Record<string, string | number | boolean | null>;
1420
+ subscription: {
1421
+ id: string;
1422
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1423
+ planCode: string;
1424
+ interval: "month" | "year";
1425
+ amountMinor: number;
1426
+ currency: string;
1427
+ currentPeriodEnd: string | null;
1428
+ cancelAt: string | null;
1429
+ } | null;
1430
+ };
1431
+ detail: {
1432
+ effectiveAt: string;
1433
+ subscriptionId: string;
1434
+ };
1435
+ };
1436
+ } | {
1437
+ id: string;
1438
+ type: "subscription.terminated";
1439
+ apiVersion: string;
1440
+ createdAt: string;
1441
+ product: string;
1442
+ accountRef: string;
1443
+ data: {
1444
+ account: {
1445
+ version: number;
1446
+ planCode: string;
1447
+ accessState: "active" | "suspended";
1448
+ entitlements: Record<string, string | number | boolean | null>;
1449
+ subscription: {
1450
+ id: string;
1451
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1452
+ planCode: string;
1453
+ interval: "month" | "year";
1454
+ amountMinor: number;
1455
+ currency: string;
1456
+ currentPeriodEnd: string | null;
1457
+ cancelAt: string | null;
1458
+ } | null;
1459
+ };
1460
+ detail: {
1461
+ reason: "nonpayment";
1462
+ dunningDay: number;
1463
+ subscriptionId: string;
1464
+ };
1465
+ };
1466
+ } | {
1467
+ id: string;
1468
+ type: "invoice.created";
1469
+ apiVersion: string;
1470
+ createdAt: string;
1471
+ product: string;
1472
+ accountRef: string;
1473
+ data: {
1474
+ account: {
1475
+ version: number;
1476
+ planCode: string;
1477
+ accessState: "active" | "suspended";
1478
+ entitlements: Record<string, string | number | boolean | null>;
1479
+ subscription: {
1480
+ id: string;
1481
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1482
+ planCode: string;
1483
+ interval: "month" | "year";
1484
+ amountMinor: number;
1485
+ currency: string;
1486
+ currentPeriodEnd: string | null;
1487
+ cancelAt: string | null;
1488
+ } | null;
1489
+ };
1490
+ detail: {
1491
+ invoiceId: string;
1492
+ totalMinor: number;
1493
+ currency: string;
1494
+ };
1495
+ };
1496
+ } | {
1497
+ id: string;
1498
+ type: "invoice.issued";
1499
+ apiVersion: string;
1500
+ createdAt: string;
1501
+ product: string;
1502
+ accountRef: string;
1503
+ data: {
1504
+ account: {
1505
+ version: number;
1506
+ planCode: string;
1507
+ accessState: "active" | "suspended";
1508
+ entitlements: Record<string, string | number | boolean | null>;
1509
+ subscription: {
1510
+ id: string;
1511
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1512
+ planCode: string;
1513
+ interval: "month" | "year";
1514
+ amountMinor: number;
1515
+ currency: string;
1516
+ currentPeriodEnd: string | null;
1517
+ cancelAt: string | null;
1518
+ } | null;
1519
+ };
1520
+ detail: {
1521
+ invoiceId: string;
1522
+ number: string;
1523
+ totalMinor: number;
1524
+ currency: string;
1525
+ };
1526
+ };
1527
+ } | {
1528
+ id: string;
1529
+ type: "invoice.voided";
1530
+ apiVersion: string;
1531
+ createdAt: string;
1532
+ product: string;
1533
+ accountRef: string;
1534
+ data: {
1535
+ account: {
1536
+ version: number;
1537
+ planCode: string;
1538
+ accessState: "active" | "suspended";
1539
+ entitlements: Record<string, string | number | boolean | null>;
1540
+ subscription: {
1541
+ id: string;
1542
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1543
+ planCode: string;
1544
+ interval: "month" | "year";
1545
+ amountMinor: number;
1546
+ currency: string;
1547
+ currentPeriodEnd: string | null;
1548
+ cancelAt: string | null;
1549
+ } | null;
1550
+ };
1551
+ detail: {
1552
+ invoiceId: string;
1553
+ number: string | null;
1554
+ totalMinor: number;
1555
+ currency: string;
1556
+ reason: string;
1557
+ };
1558
+ };
1559
+ } | {
1560
+ id: string;
1561
+ type: "account.state_changed";
1562
+ apiVersion: string;
1563
+ createdAt: string;
1564
+ product: string;
1565
+ accountRef: string;
1566
+ data: {
1567
+ account: {
1568
+ version: number;
1569
+ planCode: string;
1570
+ accessState: "active" | "suspended";
1571
+ entitlements: Record<string, string | number | boolean | null>;
1572
+ ref: string;
1573
+ displayName: string;
1574
+ updatedAt: string;
1575
+ catalogVersion: string | null;
1576
+ subscription: {
1577
+ id: string;
1578
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1579
+ planCode: string;
1580
+ interval: "month" | "year";
1581
+ amountMinor: number;
1582
+ currency: string;
1583
+ currentPeriodEnd: string | null;
1584
+ cancelAt: string | null;
1585
+ cancelAtPeriodEnd: boolean;
1586
+ pastDueSince: string | null;
1587
+ currentPeriodStart: string | null;
1588
+ dunning: {
1589
+ step: number;
1590
+ nextActionAt: string | null;
1591
+ } | null;
1592
+ scheduledChange: {
1593
+ planCode: string;
1594
+ interval: "month" | "year";
1595
+ effectiveAt: string;
1596
+ } | null;
1597
+ } | null;
1598
+ openCheckout: {
1599
+ id: string;
1600
+ planCode: string;
1601
+ interval: "month" | "year";
1602
+ intervalCount: number;
1603
+ currency: string;
1604
+ amountMinor: number;
1605
+ expiresAt: string;
1606
+ } | null;
1607
+ profile: {
1608
+ present: boolean;
1609
+ kind: "individual" | "company" | null;
1610
+ };
1611
+ };
1612
+ detail: {
1613
+ cause: string;
1614
+ causeEventId: string | null;
1615
+ };
1616
+ };
1617
+ } | {
1618
+ id: string;
1619
+ type: "account.deleted";
1620
+ apiVersion: string;
1621
+ createdAt: string;
1622
+ product: string;
1623
+ accountRef: string;
1624
+ data: {
1625
+ account: {
1626
+ version: number;
1627
+ planCode: string;
1628
+ accessState: "active" | "suspended";
1629
+ entitlements: Record<string, string | number | boolean | null>;
1630
+ ref: string;
1631
+ displayName: string;
1632
+ updatedAt: string;
1633
+ catalogVersion: string | null;
1634
+ subscription: {
1635
+ id: string;
1636
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1637
+ planCode: string;
1638
+ interval: "month" | "year";
1639
+ amountMinor: number;
1640
+ currency: string;
1641
+ currentPeriodEnd: string | null;
1642
+ cancelAt: string | null;
1643
+ cancelAtPeriodEnd: boolean;
1644
+ pastDueSince: string | null;
1645
+ currentPeriodStart: string | null;
1646
+ dunning: {
1647
+ step: number;
1648
+ nextActionAt: string | null;
1649
+ } | null;
1650
+ scheduledChange: {
1651
+ planCode: string;
1652
+ interval: "month" | "year";
1653
+ effectiveAt: string;
1654
+ } | null;
1655
+ } | null;
1656
+ openCheckout: {
1657
+ id: string;
1658
+ planCode: string;
1659
+ interval: "month" | "year";
1660
+ intervalCount: number;
1661
+ currency: string;
1662
+ amountMinor: number;
1663
+ expiresAt: string;
1664
+ } | null;
1665
+ profile: {
1666
+ present: boolean;
1667
+ kind: "individual" | "company" | null;
1668
+ };
1669
+ };
1670
+ detail: {
1671
+ deletedAt: string;
1672
+ actorRef: string | null;
1673
+ };
1674
+ };
1675
+ };
1676
+ deliveries: {
1677
+ endpointId: string;
1678
+ status: "pending" | "dead" | "delivered";
1679
+ attempts: number;
1680
+ lastHttpStatus: number | null;
1681
+ lastError: string | null;
1682
+ nextAttemptAt: string | null;
1683
+ deliveredAt: string | null;
1684
+ }[];
1685
+ }[];
1686
+ nextCursor: string | null;
1687
+ }>>;
1688
+ redeliverEvent: (id: string, opts?: CallOptions) => Promise<ClientResult<{
1689
+ event: {
1690
+ id: string;
1691
+ type: "account.updated";
1692
+ apiVersion: string;
1693
+ createdAt: string;
1694
+ product: string;
1695
+ accountRef: string;
1696
+ data: {
1697
+ account: {
1698
+ version: number;
1699
+ planCode: string;
1700
+ accessState: "active" | "suspended";
1701
+ entitlements: Record<string, string | number | boolean | null>;
1702
+ subscription: {
1703
+ id: string;
1704
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1705
+ planCode: string;
1706
+ interval: "month" | "year";
1707
+ amountMinor: number;
1708
+ currency: string;
1709
+ currentPeriodEnd: string | null;
1710
+ cancelAt: string | null;
1711
+ } | null;
1712
+ };
1713
+ detail: {
1714
+ changed: string[];
1715
+ };
1716
+ };
1717
+ } | {
1718
+ id: string;
1719
+ type: "checkout.completed";
1720
+ apiVersion: string;
1721
+ createdAt: string;
1722
+ product: string;
1723
+ accountRef: string;
1724
+ data: {
1725
+ account: {
1726
+ version: number;
1727
+ planCode: string;
1728
+ accessState: "active" | "suspended";
1729
+ entitlements: Record<string, string | number | boolean | null>;
1730
+ subscription: {
1731
+ id: string;
1732
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1733
+ planCode: string;
1734
+ interval: "month" | "year";
1735
+ amountMinor: number;
1736
+ currency: string;
1737
+ currentPeriodEnd: string | null;
1738
+ cancelAt: string | null;
1739
+ } | null;
1740
+ };
1741
+ detail: {
1742
+ subscriptionId: string;
1743
+ checkoutSessionId: string;
1744
+ };
1745
+ };
1746
+ } | {
1747
+ id: string;
1748
+ type: "checkout.failed";
1749
+ apiVersion: string;
1750
+ createdAt: string;
1751
+ product: string;
1752
+ accountRef: string;
1753
+ data: {
1754
+ account: {
1755
+ version: number;
1756
+ planCode: string;
1757
+ accessState: "active" | "suspended";
1758
+ entitlements: Record<string, string | number | boolean | null>;
1759
+ subscription: {
1760
+ id: string;
1761
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1762
+ planCode: string;
1763
+ interval: "month" | "year";
1764
+ amountMinor: number;
1765
+ currency: string;
1766
+ currentPeriodEnd: string | null;
1767
+ cancelAt: string | null;
1768
+ } | null;
1769
+ };
1770
+ detail: {
1771
+ checkoutSessionId: string;
1772
+ reason: string;
1773
+ };
1774
+ };
1775
+ } | {
1776
+ id: string;
1777
+ type: "checkout.expired";
1778
+ apiVersion: string;
1779
+ createdAt: string;
1780
+ product: string;
1781
+ accountRef: string;
1782
+ data: {
1783
+ account: {
1784
+ version: number;
1785
+ planCode: string;
1786
+ accessState: "active" | "suspended";
1787
+ entitlements: Record<string, string | number | boolean | null>;
1788
+ subscription: {
1789
+ id: string;
1790
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1791
+ planCode: string;
1792
+ interval: "month" | "year";
1793
+ amountMinor: number;
1794
+ currency: string;
1795
+ currentPeriodEnd: string | null;
1796
+ cancelAt: string | null;
1797
+ } | null;
1798
+ };
1799
+ detail: {
1800
+ checkoutSessionId: string;
1801
+ };
1802
+ };
1803
+ } | {
1804
+ id: string;
1805
+ type: "subscription.activated";
1806
+ apiVersion: string;
1807
+ createdAt: string;
1808
+ product: string;
1809
+ accountRef: string;
1810
+ data: {
1811
+ account: {
1812
+ version: number;
1813
+ planCode: string;
1814
+ accessState: "active" | "suspended";
1815
+ entitlements: Record<string, string | number | boolean | null>;
1816
+ subscription: {
1817
+ id: string;
1818
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1819
+ planCode: string;
1820
+ interval: "month" | "year";
1821
+ amountMinor: number;
1822
+ currency: string;
1823
+ currentPeriodEnd: string | null;
1824
+ cancelAt: string | null;
1825
+ } | null;
1826
+ };
1827
+ detail: {
1828
+ planCode: string;
1829
+ interval: "month" | "year";
1830
+ amountMinor: number;
1831
+ currency: string;
1832
+ actorRef: string | null;
1833
+ subscriptionId: string;
1834
+ };
1835
+ };
1836
+ } | {
1837
+ id: string;
1838
+ type: "subscription.renewed";
1839
+ apiVersion: string;
1840
+ createdAt: string;
1841
+ product: string;
1842
+ accountRef: string;
1843
+ data: {
1844
+ account: {
1845
+ version: number;
1846
+ planCode: string;
1847
+ accessState: "active" | "suspended";
1848
+ entitlements: Record<string, string | number | boolean | null>;
1849
+ subscription: {
1850
+ id: string;
1851
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1852
+ planCode: string;
1853
+ interval: "month" | "year";
1854
+ amountMinor: number;
1855
+ currency: string;
1856
+ currentPeriodEnd: string | null;
1857
+ cancelAt: string | null;
1858
+ } | null;
1859
+ };
1860
+ detail: {
1861
+ paymentId: string;
1862
+ periodStart: string | null;
1863
+ periodEnd: string | null;
1864
+ invoiceId: string | null;
1865
+ subscriptionId: string;
1866
+ };
1867
+ };
1868
+ } | {
1869
+ id: string;
1870
+ type: "subscription.payment_failed";
1871
+ apiVersion: string;
1872
+ createdAt: string;
1873
+ product: string;
1874
+ accountRef: string;
1875
+ data: {
1876
+ account: {
1877
+ version: number;
1878
+ planCode: string;
1879
+ accessState: "active" | "suspended";
1880
+ entitlements: Record<string, string | number | boolean | null>;
1881
+ subscription: {
1882
+ id: string;
1883
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1884
+ planCode: string;
1885
+ interval: "month" | "year";
1886
+ amountMinor: number;
1887
+ currency: string;
1888
+ currentPeriodEnd: string | null;
1889
+ cancelAt: string | null;
1890
+ } | null;
1891
+ };
1892
+ detail: {
1893
+ paymentId: string | null;
1894
+ attempt: number;
1895
+ nextRetryAt: string | null;
1896
+ subscriptionId: string;
1897
+ };
1898
+ };
1899
+ } | {
1900
+ id: string;
1901
+ type: "subscription.suspended";
1902
+ apiVersion: string;
1903
+ createdAt: string;
1904
+ product: string;
1905
+ accountRef: string;
1906
+ data: {
1907
+ account: {
1908
+ version: number;
1909
+ planCode: string;
1910
+ accessState: "active" | "suspended";
1911
+ entitlements: Record<string, string | number | boolean | null>;
1912
+ subscription: {
1913
+ id: string;
1914
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1915
+ planCode: string;
1916
+ interval: "month" | "year";
1917
+ amountMinor: number;
1918
+ currency: string;
1919
+ currentPeriodEnd: string | null;
1920
+ cancelAt: string | null;
1921
+ } | null;
1922
+ };
1923
+ detail: {
1924
+ dunningDay: number;
1925
+ subscriptionId: string;
1926
+ };
1927
+ };
1928
+ } | {
1929
+ id: string;
1930
+ type: "subscription.reactivated";
1931
+ apiVersion: string;
1932
+ createdAt: string;
1933
+ product: string;
1934
+ accountRef: string;
1935
+ data: {
1936
+ account: {
1937
+ version: number;
1938
+ planCode: string;
1939
+ accessState: "active" | "suspended";
1940
+ entitlements: Record<string, string | number | boolean | null>;
1941
+ subscription: {
1942
+ id: string;
1943
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1944
+ planCode: string;
1945
+ interval: "month" | "year";
1946
+ amountMinor: number;
1947
+ currency: string;
1948
+ currentPeriodEnd: string | null;
1949
+ cancelAt: string | null;
1950
+ } | null;
1951
+ };
1952
+ detail: {
1953
+ paymentId: string | null;
1954
+ subscriptionId: string;
1955
+ };
1956
+ };
1957
+ } | {
1958
+ id: string;
1959
+ type: "subscription.cancel_scheduled";
1960
+ apiVersion: string;
1961
+ createdAt: string;
1962
+ product: string;
1963
+ accountRef: string;
1964
+ data: {
1965
+ account: {
1966
+ version: number;
1967
+ planCode: string;
1968
+ accessState: "active" | "suspended";
1969
+ entitlements: Record<string, string | number | boolean | null>;
1970
+ subscription: {
1971
+ id: string;
1972
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
1973
+ planCode: string;
1974
+ interval: "month" | "year";
1975
+ amountMinor: number;
1976
+ currency: string;
1977
+ currentPeriodEnd: string | null;
1978
+ cancelAt: string | null;
1979
+ } | null;
1980
+ };
1981
+ detail: {
1982
+ cancelAt: string;
1983
+ reason: string;
1984
+ actorRef: string | null;
1985
+ subscriptionId: string;
1986
+ };
1987
+ };
1988
+ } | {
1989
+ id: string;
1990
+ type: "subscription.canceled";
1991
+ apiVersion: string;
1992
+ createdAt: string;
1993
+ product: string;
1994
+ accountRef: string;
1995
+ data: {
1996
+ account: {
1997
+ version: number;
1998
+ planCode: string;
1999
+ accessState: "active" | "suspended";
2000
+ entitlements: Record<string, string | number | boolean | null>;
2001
+ subscription: {
2002
+ id: string;
2003
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2004
+ planCode: string;
2005
+ interval: "month" | "year";
2006
+ amountMinor: number;
2007
+ currency: string;
2008
+ currentPeriodEnd: string | null;
2009
+ cancelAt: string | null;
2010
+ } | null;
2011
+ };
2012
+ detail: {
2013
+ reason: string;
2014
+ effectiveAt: string;
2015
+ actorRef: string | null;
2016
+ subscriptionId: string;
2017
+ };
2018
+ };
2019
+ } | {
2020
+ id: string;
2021
+ type: "subscription.expired";
2022
+ apiVersion: string;
2023
+ createdAt: string;
2024
+ product: string;
2025
+ accountRef: string;
2026
+ data: {
2027
+ account: {
2028
+ version: number;
2029
+ planCode: string;
2030
+ accessState: "active" | "suspended";
2031
+ entitlements: Record<string, string | number | boolean | null>;
2032
+ subscription: {
2033
+ id: string;
2034
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2035
+ planCode: string;
2036
+ interval: "month" | "year";
2037
+ amountMinor: number;
2038
+ currency: string;
2039
+ currentPeriodEnd: string | null;
2040
+ cancelAt: string | null;
2041
+ } | null;
2042
+ };
2043
+ detail: {
2044
+ effectiveAt: string;
2045
+ subscriptionId: string;
2046
+ };
2047
+ };
2048
+ } | {
2049
+ id: string;
2050
+ type: "subscription.terminated";
2051
+ apiVersion: string;
2052
+ createdAt: string;
2053
+ product: string;
2054
+ accountRef: string;
2055
+ data: {
2056
+ account: {
2057
+ version: number;
2058
+ planCode: string;
2059
+ accessState: "active" | "suspended";
2060
+ entitlements: Record<string, string | number | boolean | null>;
2061
+ subscription: {
2062
+ id: string;
2063
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2064
+ planCode: string;
2065
+ interval: "month" | "year";
2066
+ amountMinor: number;
2067
+ currency: string;
2068
+ currentPeriodEnd: string | null;
2069
+ cancelAt: string | null;
2070
+ } | null;
2071
+ };
2072
+ detail: {
2073
+ reason: "nonpayment";
2074
+ dunningDay: number;
2075
+ subscriptionId: string;
2076
+ };
2077
+ };
2078
+ } | {
2079
+ id: string;
2080
+ type: "invoice.created";
2081
+ apiVersion: string;
2082
+ createdAt: string;
2083
+ product: string;
2084
+ accountRef: string;
2085
+ data: {
2086
+ account: {
2087
+ version: number;
2088
+ planCode: string;
2089
+ accessState: "active" | "suspended";
2090
+ entitlements: Record<string, string | number | boolean | null>;
2091
+ subscription: {
2092
+ id: string;
2093
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2094
+ planCode: string;
2095
+ interval: "month" | "year";
2096
+ amountMinor: number;
2097
+ currency: string;
2098
+ currentPeriodEnd: string | null;
2099
+ cancelAt: string | null;
2100
+ } | null;
2101
+ };
2102
+ detail: {
2103
+ invoiceId: string;
2104
+ totalMinor: number;
2105
+ currency: string;
2106
+ };
2107
+ };
2108
+ } | {
2109
+ id: string;
2110
+ type: "invoice.issued";
2111
+ apiVersion: string;
2112
+ createdAt: string;
2113
+ product: string;
2114
+ accountRef: string;
2115
+ data: {
2116
+ account: {
2117
+ version: number;
2118
+ planCode: string;
2119
+ accessState: "active" | "suspended";
2120
+ entitlements: Record<string, string | number | boolean | null>;
2121
+ subscription: {
2122
+ id: string;
2123
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2124
+ planCode: string;
2125
+ interval: "month" | "year";
2126
+ amountMinor: number;
2127
+ currency: string;
2128
+ currentPeriodEnd: string | null;
2129
+ cancelAt: string | null;
2130
+ } | null;
2131
+ };
2132
+ detail: {
2133
+ invoiceId: string;
2134
+ number: string;
2135
+ totalMinor: number;
2136
+ currency: string;
2137
+ };
2138
+ };
2139
+ } | {
2140
+ id: string;
2141
+ type: "invoice.voided";
2142
+ apiVersion: string;
2143
+ createdAt: string;
2144
+ product: string;
2145
+ accountRef: string;
2146
+ data: {
2147
+ account: {
2148
+ version: number;
2149
+ planCode: string;
2150
+ accessState: "active" | "suspended";
2151
+ entitlements: Record<string, string | number | boolean | null>;
2152
+ subscription: {
2153
+ id: string;
2154
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2155
+ planCode: string;
2156
+ interval: "month" | "year";
2157
+ amountMinor: number;
2158
+ currency: string;
2159
+ currentPeriodEnd: string | null;
2160
+ cancelAt: string | null;
2161
+ } | null;
2162
+ };
2163
+ detail: {
2164
+ invoiceId: string;
2165
+ number: string | null;
2166
+ totalMinor: number;
2167
+ currency: string;
2168
+ reason: string;
2169
+ };
2170
+ };
2171
+ } | {
2172
+ id: string;
2173
+ type: "account.state_changed";
2174
+ apiVersion: string;
2175
+ createdAt: string;
2176
+ product: string;
2177
+ accountRef: string;
2178
+ data: {
2179
+ account: {
2180
+ version: number;
2181
+ planCode: string;
2182
+ accessState: "active" | "suspended";
2183
+ entitlements: Record<string, string | number | boolean | null>;
2184
+ ref: string;
2185
+ displayName: string;
2186
+ updatedAt: string;
2187
+ catalogVersion: string | null;
2188
+ subscription: {
2189
+ id: string;
2190
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2191
+ planCode: string;
2192
+ interval: "month" | "year";
2193
+ amountMinor: number;
2194
+ currency: string;
2195
+ currentPeriodEnd: string | null;
2196
+ cancelAt: string | null;
2197
+ cancelAtPeriodEnd: boolean;
2198
+ pastDueSince: string | null;
2199
+ currentPeriodStart: string | null;
2200
+ dunning: {
2201
+ step: number;
2202
+ nextActionAt: string | null;
2203
+ } | null;
2204
+ scheduledChange: {
2205
+ planCode: string;
2206
+ interval: "month" | "year";
2207
+ effectiveAt: string;
2208
+ } | null;
2209
+ } | null;
2210
+ openCheckout: {
2211
+ id: string;
2212
+ planCode: string;
2213
+ interval: "month" | "year";
2214
+ intervalCount: number;
2215
+ currency: string;
2216
+ amountMinor: number;
2217
+ expiresAt: string;
2218
+ } | null;
2219
+ profile: {
2220
+ present: boolean;
2221
+ kind: "individual" | "company" | null;
2222
+ };
2223
+ };
2224
+ detail: {
2225
+ cause: string;
2226
+ causeEventId: string | null;
2227
+ };
2228
+ };
2229
+ } | {
2230
+ id: string;
2231
+ type: "account.deleted";
2232
+ apiVersion: string;
2233
+ createdAt: string;
2234
+ product: string;
2235
+ accountRef: string;
2236
+ data: {
2237
+ account: {
2238
+ version: number;
2239
+ planCode: string;
2240
+ accessState: "active" | "suspended";
2241
+ entitlements: Record<string, string | number | boolean | null>;
2242
+ ref: string;
2243
+ displayName: string;
2244
+ updatedAt: string;
2245
+ catalogVersion: string | null;
2246
+ subscription: {
2247
+ id: string;
2248
+ status: "active" | "suspended" | "past_due" | "canceled" | "expired";
2249
+ planCode: string;
2250
+ interval: "month" | "year";
2251
+ amountMinor: number;
2252
+ currency: string;
2253
+ currentPeriodEnd: string | null;
2254
+ cancelAt: string | null;
2255
+ cancelAtPeriodEnd: boolean;
2256
+ pastDueSince: string | null;
2257
+ currentPeriodStart: string | null;
2258
+ dunning: {
2259
+ step: number;
2260
+ nextActionAt: string | null;
2261
+ } | null;
2262
+ scheduledChange: {
2263
+ planCode: string;
2264
+ interval: "month" | "year";
2265
+ effectiveAt: string;
2266
+ } | null;
2267
+ } | null;
2268
+ openCheckout: {
2269
+ id: string;
2270
+ planCode: string;
2271
+ interval: "month" | "year";
2272
+ intervalCount: number;
2273
+ currency: string;
2274
+ amountMinor: number;
2275
+ expiresAt: string;
2276
+ } | null;
2277
+ profile: {
2278
+ present: boolean;
2279
+ kind: "individual" | "company" | null;
2280
+ };
2281
+ };
2282
+ detail: {
2283
+ deletedAt: string;
2284
+ actorRef: string | null;
2285
+ };
2286
+ };
2287
+ };
2288
+ deliveries: {
2289
+ endpointId: string;
2290
+ status: "pending" | "dead" | "delivered";
2291
+ attempts: number;
2292
+ lastHttpStatus: number | null;
2293
+ lastError: string | null;
2294
+ nextAttemptAt: string | null;
2295
+ deliveredAt: string | null;
2296
+ }[];
2297
+ }>>;
2298
+ getSettings: () => Promise<ClientResult<{
2299
+ provider: string;
2300
+ defaultCurrency: string;
2301
+ defaultLocale: "tr" | "en";
2302
+ extraReturnOrigins: string[];
2303
+ branding: {
2304
+ name?: string | undefined;
2305
+ logoUrl?: string | undefined;
2306
+ accentColor?: string | undefined;
2307
+ supportEmail?: string | undefined;
2308
+ };
2309
+ checkoutTtlMinutes: number;
2310
+ portalTtlMinutes: number;
2311
+ appUrl?: string | undefined;
2312
+ privacyUrl?: string | undefined;
2313
+ termsUrl?: string | undefined;
2314
+ }>>;
2315
+ updateSettings: (patch: ProductSettingsPatch, opts?: CallOptions) => Promise<ClientResult<{
2316
+ provider: string;
2317
+ defaultCurrency: string;
2318
+ defaultLocale: "tr" | "en";
2319
+ extraReturnOrigins: string[];
2320
+ branding: {
2321
+ name?: string | undefined;
2322
+ logoUrl?: string | undefined;
2323
+ accentColor?: string | undefined;
2324
+ supportEmail?: string | undefined;
2325
+ };
2326
+ checkoutTtlMinutes: number;
2327
+ portalTtlMinutes: number;
2328
+ appUrl?: string | undefined;
2329
+ privacyUrl?: string | undefined;
2330
+ termsUrl?: string | undefined;
2331
+ }>>;
2332
+ listWebhookEndpoints: () => Promise<ClientResult<{
2333
+ items: {
2334
+ id: string;
2335
+ url: string;
2336
+ status: "active" | "paused" | "inactive";
2337
+ eventTypes: ("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" | "invoice.voided" | "account.state_changed" | "account.deleted")[] | null;
2338
+ description: string | null;
2339
+ createdAt: string;
2340
+ rotatedAt: string | null;
2341
+ lastDelivery: {
2342
+ status: "pending" | "dead" | "delivered";
2343
+ httpStatus: number | null;
2344
+ error: string | null;
2345
+ attempts: number;
2346
+ at: string;
2347
+ } | null;
2348
+ }[];
2349
+ }>>;
2350
+ createWebhookEndpoint: (input: WebhookEndpointCreateInput, opts?: CallOptions) => Promise<ClientResult<{
2351
+ id: string;
2352
+ url: string;
2353
+ status: "active" | "paused" | "inactive";
2354
+ eventTypes: ("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" | "invoice.voided" | "account.state_changed" | "account.deleted")[] | null;
2355
+ description: string | null;
2356
+ createdAt: string;
2357
+ rotatedAt: string | null;
2358
+ lastDelivery: {
2359
+ status: "pending" | "dead" | "delivered";
2360
+ httpStatus: number | null;
2361
+ error: string | null;
2362
+ attempts: number;
2363
+ at: string;
2364
+ } | null;
2365
+ }>>;
2366
+ rotateWebhookEndpointSecret: (id: string, input: WebhookEndpointRotateInput, opts?: CallOptions) => Promise<ClientResult<{
2367
+ id: string;
2368
+ url: string;
2369
+ status: "active" | "paused" | "inactive";
2370
+ eventTypes: ("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" | "invoice.voided" | "account.state_changed" | "account.deleted")[] | null;
2371
+ description: string | null;
2372
+ createdAt: string;
2373
+ rotatedAt: string | null;
2374
+ lastDelivery: {
2375
+ status: "pending" | "dead" | "delivered";
2376
+ httpStatus: number | null;
2377
+ error: string | null;
2378
+ attempts: number;
2379
+ at: string;
2380
+ } | null;
2381
+ }>>;
2382
+ deactivateWebhookEndpoint: (id: string, opts?: CallOptions) => Promise<ClientResult<{
2383
+ id: string;
2384
+ url: string;
2385
+ status: "active" | "paused" | "inactive";
2386
+ eventTypes: ("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" | "invoice.voided" | "account.state_changed" | "account.deleted")[] | null;
2387
+ description: string | null;
2388
+ createdAt: string;
2389
+ rotatedAt: string | null;
2390
+ lastDelivery: {
2391
+ status: "pending" | "dead" | "delivered";
2392
+ httpStatus: number | null;
2393
+ error: string | null;
2394
+ attempts: number;
2395
+ at: string;
2396
+ } | null;
2397
+ }>>;
2398
+ };
2399
+ //#endregion
2400
+ //#region src/retry.d.ts
2401
+ type RetryClass = "network" | "5xx" | "429";
2402
+ type RetryOptions = {
2403
+ /** İlk istekten sonraki en çok tekrar sayısı; 0 kapatır. Varsayılan 2. */
2404
+ attempts?: number;
2405
+ /** Tekrar denenen hata sınıfları. Varsayılan hepsi. */
2406
+ on?: readonly RetryClass[];
2407
+ /** Tek bir beklemenin üst sınırı (Retry-After dahil), ms. Varsayılan 5000. */
2408
+ maxDelayMs?: number;
2409
+ /** Test için: bekleme. Varsayılan `setTimeout`. */
2410
+ sleep?: (ms: number) => Promise<void>;
2411
+ /** Test için: jitter kaynağı, [0, 1). Varsayılan `Math.random`. */
2412
+ random?: () => number;
2413
+ };
2414
+ //#endregion
2415
+ //#region src/steward.d.ts
2416
+ type StewardEnv = Readonly<Record<string, string | undefined>>;
2417
+ type StewardOptions = {
2418
+ /** Varsayılan `STEWARD_URL`. Ürün adresi ve anahtarı ikisi de yoksa ve admin ayarları tamsa istemci yalnızca `admin.*` içindir. */
2419
+ baseUrl?: string;
2420
+ /** Varsayılan `STEWARD_API_KEY`. */
2421
+ apiKey?: string;
2422
+ /** Ayarların okunduğu ortam; varsayılan `process.env` (varsa). */
2423
+ env?: StewardEnv;
2424
+ fetch?: typeof fetch;
2425
+ /** Deneme başına zaman aşımı, ms. Varsayılan 10 sn. */
2426
+ timeoutMs?: number;
2427
+ /**
2428
+ * Mutasyonlarda varsayılan `X-Actor-Ref` (ör. `system`); çağrıdaki `actorRef` ezer. İkisi de
2429
+ * yoksa mutasyon istek göndermeden `StewardConfigError` (`actor_ref_required`) fırlatır.
2430
+ */
2431
+ actorRef?: string;
2432
+ /** Varsayılan `STEWARD_ADMIN_URL`; yalnızca `admin.*` için. */
2433
+ adminBaseUrl?: string;
2434
+ /** Varsayılan `STEWARD_ADMIN_API_KEY`; yalnızca `admin.*` için. */
2435
+ adminApiKey?: string;
2436
+ retries?: RetryOptions;
2437
+ };
2438
+ /** Mutasyon çağrısı seçenekleri: `Idempotency-Key` ve `X-Actor-Ref`. */
2439
+ type MutationOptions = CallOptions;
2440
+ /** Koşullu katalog okuması: 304'te gövde yok, elindeki katalog güncel. */
2441
+ type CatalogRead = {
2442
+ notModified: false;
2443
+ etag: string | null;
2444
+ catalog: Catalog;
2445
+ } | {
2446
+ notModified: true;
2447
+ etag: string;
2448
+ };
2449
+ type EventListQuery = {
2450
+ accountRef?: string;
2451
+ cursor?: string;
2452
+ limit?: number;
2453
+ };
2454
+ type InvoiceDocument = {
2455
+ contentType: string;
2456
+ bytes: Uint8Array;
2457
+ };
2458
+ /** `GET /v1/me`: anahtarın ürünü ve kapsamı (kurulum doğrulaması). */
2459
+ type StewardMe = {
2460
+ product: string;
2461
+ keyName: string;
2462
+ scope: "product" | "admin";
2463
+ };
2464
+ type Steward = {
2465
+ accounts: {
2466
+ /** `PUT /v1/accounts/{ref}` — hesabı oluşturur ya da günceller. */
2467
+ upsert(ref: string, input: AccountUpsertInput, options?: MutationOptions): Promise<AccountUpsertResponse>;
2468
+ get(ref: string, options?: {
2469
+ include?: readonly AccountInclude[];
2470
+ }): Promise<AccountDetail>;
2471
+ /** `GET /v1/accounts/{ref}/state`. */
2472
+ state(ref: string): Promise<AccountState>;
2473
+ /** Koşullu durum okuması (önbellekler için): `etag` verilir ve durum değişmediyse `{notModified: true}`. */
2474
+ readState(ref: string, options?: {
2475
+ etag?: string;
2476
+ }): Promise<AccountStateRead>;
2477
+ /** `GET /v1/accounts/{ref}/entitlements` (snapshot; `state`'in alt kümesi). */
2478
+ entitlements(ref: string): Promise<EntitlementSnapshot>;
2479
+ putBillingProfile(ref: string, profile: BillingProfileInput, options?: MutationOptions): Promise<BillingProfileResponse>;
2480
+ /**
2481
+ * `PUT /v1/accounts/{ref}/plan` — atomik plan (K6): aktif plan grant'leri tek plan
2482
+ * grant'iyle değişir, `planCode: null` kaldırır. Canlı abonelik planı hedefi
2483
+ * geçiyorsa `mode: "ensure"` (varsayılan) sonuç + `warnings`, `"strict"`
2484
+ * `StewardApiError` `subscription_plan_higher` (409). Yanıttaki `account` önbelleğe `prime` edilebilir.
2485
+ */
2486
+ setPlan(ref: string, input: PlanSetInput, options?: MutationOptions): Promise<PlanSetResponse>;
2487
+ /** `POST /v1/accounts/{ref}/resync` — saklı durumu `account.state_changed` (`cause: "resync"`) olarak yeniden yayınlar; version değişmez. */
2488
+ resync(ref: string, options?: MutationOptions): Promise<ResyncResult>;
2489
+ /**
2490
+ * `DELETE /v1/accounts/{ref}` — KVKK anonimleştirme (F4e): profil ve kişisel veri silinir,
2491
+ * faturalar kalır → `{ref, deletedAt}`. Sonra hesabın her ucu `account_deleted` (410; aynı
2492
+ * ref'le `upsert` dahil). Canlı abonelikte `subscription_active` (409; önce `immediate`
2493
+ * iptal), formu açık checkout'ta `checkout_in_progress` (409; süresi dolunca tekrar);
2494
+ * zaten silinmişse `account_deleted` — iş tekrarında başarı sayılabilir.
2495
+ */
2496
+ delete(ref: string, options?: MutationOptions): Promise<AccountDeleteResponse>;
2497
+ };
2498
+ checkoutSessions: {
2499
+ create(ref: string, input: CheckoutSessionCreateInput, options?: MutationOptions): Promise<CheckoutSessionCreated>;
2500
+ get(id: string): Promise<CheckoutSessionResponse>;
2501
+ };
2502
+ /**
2503
+ * Hosted müşteri portalı (F3a): `POST /v1/accounts/{ref}/portal-sessions` → `{id, url, expiresAt}`.
2504
+ * Tarayıcı `url`e yönlendirilir (iptal, ödemeyi yeniden dene, fatura, profil steward'da).
2505
+ * Yetki üründe; `actorRef` portalı açan kullanıcı. Durum değişmez, event yok.
2506
+ */
2507
+ portalSessions: {
2508
+ create(ref: string, input?: PortalSessionCreateInput, options?: MutationOptions): Promise<PortalSession>;
2509
+ };
2510
+ subscriptions: {
2511
+ cancel(id: string, input: CancelSubscriptionInput, options?: MutationOptions): Promise<CancelSubscriptionResponse>;
2512
+ };
2513
+ grants: {
2514
+ create(ref: string, input: GrantCreateInput, options?: MutationOptions): Promise<GrantCreateResponse>;
2515
+ revoke(id: string, options?: MutationOptions): Promise<void>;
2516
+ };
2517
+ invoices: {
2518
+ issue(id: string, input: InvoiceIssueInput, options?: MutationOptions): Promise<InvoiceIssueResponse>;
2519
+ document(id: string): Promise<InvoiceDocument>;
2520
+ /**
2521
+ * `POST /v1/accounts/{ref}/invoices` (F4f) — manuel taslak fatura (Enterprise satışı); `issue` ile kesilir.
2522
+ * Hesabın fatura profili gerekir (422 `billing_profile_required`). `invoice.created` yayınlanır, durum değişmez.
2523
+ */
2524
+ createManual(ref: string, input: ManualInvoiceInput, options?: MutationOptions): Promise<ManualInvoiceResponse>;
2525
+ /**
2526
+ * `POST /v1/invoices/{id}/void` (F4f) — yalnızca manuel fatura (taslak ya da kesilmiş; numara ve belge kalır).
2527
+ * Ödemeli fatura 409 `invoice_has_payment`, zaten void 409 `invoice_not_voidable`. `invoice.voided` yayınlanır.
2528
+ */
2529
+ void(id: string, input: InvoiceVoidInput, options?: MutationOptions): Promise<InvoiceVoidResponse>;
2530
+ };
2531
+ catalog: {
2532
+ get(): Promise<Catalog>;
2533
+ /** Koşullu okuma (`If-None-Match`); `createCatalogCache` kullanır. */
2534
+ read(options?: {
2535
+ etag?: string;
2536
+ }): Promise<CatalogRead>;
2537
+ };
2538
+ events: {
2539
+ list(query?: EventListQuery): Promise<EventList>;
2540
+ redeliver(id: string, options?: MutationOptions): Promise<EventRecord>;
2541
+ };
2542
+ stats(): Promise<Stats>;
2543
+ me(): Promise<StewardMe>;
2544
+ /**
2545
+ * `GET /v1/doctor` — kurulum teşhisi (K11): katalog senkronu, sağlayıcı, ayarlar, hosted
2546
+ * sayfa hazırlığı, endpoint teslimat teşhisi (`wrong_secret` = son teslimat 401),
2547
+ * dunning ve `warnings[{code, severity, message}]`; `ok` = `error` önemde uyarı yok.
2548
+ * Ürün anahtarıyla çalışır (yalnızca admin ayarlı istemcide admin anahtarıyla). Sağlayıcı
2549
+ * sağlığı yanıtı veren pod'un gözlemidir.
2550
+ */
2551
+ doctor(): Promise<DoctorReport>;
2552
+ /** Admin kapsamlı uçlar: `adminBaseUrl`/`adminApiKey` (ya da `STEWARD_ADMIN_*`) gerekir. */
2553
+ admin: {
2554
+ catalog: {
2555
+ sync(input: CatalogSyncInput, options?: MutationOptions): Promise<CatalogSyncResult>;
2556
+ };
2557
+ accounts: {
2558
+ refresh(options?: MutationOptions): Promise<AccountsRefreshResult>;
2559
+ };
2560
+ settings: {
2561
+ /** `GET /v1/admin/settings`. */
2562
+ get(): Promise<ProductSettings>;
2563
+ /** `PATCH /v1/admin/settings`: verilmeyen alan değişmez, `null` temizler, `branding` sığ birleşir. */
2564
+ update(patch: ProductSettingsPatch, options?: MutationOptions): Promise<ProductSettings>;
2565
+ };
2566
+ /**
2567
+ * Webhook endpoint'leri. Sırrı çağıran üretir (`generateWebhookSecret()`) ve
2568
+ * saklar; steward hiçbir yanıtta geri vermez.
2569
+ */
2570
+ endpoints: {
2571
+ list(): Promise<WebhookEndpointList>;
2572
+ /** `eventTypes` verilmezse yalnızca `account.state_changed`. */
2573
+ create(input: WebhookEndpointCreateInput, options?: MutationOptions): Promise<WebhookEndpoint>;
2574
+ /** Yeni sır; eskisi ürün geçişi bitene kadar ikinci imza olarak kalır. */
2575
+ rotate(id: string, input: WebhookEndpointRotateInput, options?: MutationOptions): Promise<WebhookEndpoint>;
2576
+ /** `status: inactive`; geri alınmaz (yeni endpoint açılır). */
2577
+ deactivate(id: string, options?: MutationOptions): Promise<WebhookEndpoint>;
2578
+ };
2579
+ };
2580
+ /**
2581
+ * Fırlatmayan, tekrar denemeyen sözleşme istemcisi (`ClientResult`; ürün hedefi). Aktör
2582
+ * denetimi yapmaz. Yalnızca admin ayarlı istemcide her metot `StewardConfigError` ile reddeder.
2583
+ */
2584
+ raw: BillingClient;
2585
+ };
2586
+ declare function createSteward(options?: StewardOptions): Steward;
2587
+ //#endregion
2588
+ export { createBillingClient as _, Steward as a, StewardOptions as c, RetryOptions as d, AccountStateRead as f, ClientResult as g, CallOptions as h, MutationOptions as i, createSteward as l, BillingClientOptions as m, EventListQuery as n, StewardEnv as o, BillingClient as p, InvoiceDocument as r, StewardMe as s, CatalogRead as t, RetryClass as u, parseRetryAfter as v };