@houzhen888/groove-grow 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3188 @@
1
+ import { z } from 'zod';
2
+ import { c as StackNode, d as ScreenAction, G as GrooveError, e as GrooveOptions, A as ApiInput, f as ApiOutput, a as ScreenDocument, F as FunnelRequest, g as FunnelRun, C as Currency } from './transport-DrW-__2k.js';
3
+
4
+ declare const couponInputSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ description: z.ZodString;
7
+ discount: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
+ type: z.ZodLiteral<"percent">;
9
+ percentOff: z.ZodNumber;
10
+ }, z.core.$strict>, z.ZodObject<{
11
+ type: z.ZodLiteral<"amount">;
12
+ amountOffCents: z.ZodNumber;
13
+ currency: z.ZodEnum<{
14
+ USD: "USD";
15
+ EUR: "EUR";
16
+ CNY: "CNY";
17
+ GBP: "GBP";
18
+ JPY: "JPY";
19
+ CAD: "CAD";
20
+ AUD: "AUD";
21
+ NZD: "NZD";
22
+ CHF: "CHF";
23
+ HKD: "HKD";
24
+ SGD: "SGD";
25
+ KRW: "KRW";
26
+ INR: "INR";
27
+ BRL: "BRL";
28
+ MXN: "MXN";
29
+ TWD: "TWD";
30
+ THB: "THB";
31
+ IDR: "IDR";
32
+ MYR: "MYR";
33
+ PHP: "PHP";
34
+ VND: "VND";
35
+ ZAR: "ZAR";
36
+ AED: "AED";
37
+ SAR: "SAR";
38
+ SEK: "SEK";
39
+ NOK: "NOK";
40
+ DKK: "DKK";
41
+ PLN: "PLN";
42
+ CZK: "CZK";
43
+ HUF: "HUF";
44
+ ILS: "ILS";
45
+ TRY: "TRY";
46
+ RON: "RON";
47
+ }>;
48
+ }, z.core.$strict>], "type">;
49
+ duration: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ type: z.ZodLiteral<"once">;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ type: z.ZodLiteral<"repeating">;
53
+ months: z.ZodNumber;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ type: z.ZodLiteral<"forever">;
56
+ }, z.core.$strict>], "type">;
57
+ appliesTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
58
+ type: z.ZodLiteral<"all">;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ type: z.ZodLiteral<"plans">;
61
+ planIds: z.ZodArray<z.ZodUUID>;
62
+ }, z.core.$strict>], "type">;
63
+ eligibility: z.ZodObject<{
64
+ firstPurchaseOnly: z.ZodBoolean;
65
+ requiredTags: z.ZodArray<z.ZodString>;
66
+ }, z.core.$strict>;
67
+ startsAt: z.ZodNullable<z.ZodISODateTime>;
68
+ endsAt: z.ZodNullable<z.ZodISODateTime>;
69
+ totalLimit: z.ZodNullable<z.ZodNumber>;
70
+ perCustomerLimit: z.ZodNumber;
71
+ grantWindowHours: z.ZodNumber;
72
+ }, z.core.$strict>;
73
+ type CouponInput = z.infer<typeof couponInputSchema>;
74
+ /**
75
+ * 客户领到的优惠(SDK 返回)。id 用作 createCheckout 的 offerId;折扣条款供 App 展示优惠说明,
76
+ * 真正的金额由 Stripe 结账时计算。appliesTo.planIds 对应 listPlans 返回的 planId。
77
+ */
78
+ declare const offerSchema: z.ZodObject<{
79
+ id: z.ZodUUID;
80
+ couponId: z.ZodUUID;
81
+ status: z.ZodEnum<{
82
+ issued: "issued";
83
+ redeemed: "redeemed";
84
+ revoked: "revoked";
85
+ expired: "expired";
86
+ }>;
87
+ issuedAt: z.ZodISODateTime;
88
+ expiresAt: z.ZodISODateTime;
89
+ coupon: z.ZodObject<{
90
+ name: z.ZodString;
91
+ discount: z.ZodDiscriminatedUnion<[z.ZodObject<{
92
+ type: z.ZodLiteral<"percent">;
93
+ percentOff: z.ZodNumber;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ type: z.ZodLiteral<"amount">;
96
+ amountOffCents: z.ZodNumber;
97
+ currency: z.ZodEnum<{
98
+ USD: "USD";
99
+ EUR: "EUR";
100
+ CNY: "CNY";
101
+ GBP: "GBP";
102
+ JPY: "JPY";
103
+ CAD: "CAD";
104
+ AUD: "AUD";
105
+ NZD: "NZD";
106
+ CHF: "CHF";
107
+ HKD: "HKD";
108
+ SGD: "SGD";
109
+ KRW: "KRW";
110
+ INR: "INR";
111
+ BRL: "BRL";
112
+ MXN: "MXN";
113
+ TWD: "TWD";
114
+ THB: "THB";
115
+ IDR: "IDR";
116
+ MYR: "MYR";
117
+ PHP: "PHP";
118
+ VND: "VND";
119
+ ZAR: "ZAR";
120
+ AED: "AED";
121
+ SAR: "SAR";
122
+ SEK: "SEK";
123
+ NOK: "NOK";
124
+ DKK: "DKK";
125
+ PLN: "PLN";
126
+ CZK: "CZK";
127
+ HUF: "HUF";
128
+ ILS: "ILS";
129
+ TRY: "TRY";
130
+ RON: "RON";
131
+ }>;
132
+ }, z.core.$strict>], "type">;
133
+ duration: z.ZodDiscriminatedUnion<[z.ZodObject<{
134
+ type: z.ZodLiteral<"once">;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ type: z.ZodLiteral<"repeating">;
137
+ months: z.ZodNumber;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ type: z.ZodLiteral<"forever">;
140
+ }, z.core.$strict>], "type">;
141
+ appliesTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
142
+ type: z.ZodLiteral<"all">;
143
+ }, z.core.$strict>, z.ZodObject<{
144
+ type: z.ZodLiteral<"plans">;
145
+ planIds: z.ZodArray<z.ZodUUID>;
146
+ }, z.core.$strict>], "type">;
147
+ }, z.core.$strip>;
148
+ }, z.core.$strip>;
149
+ type Offer = z.infer<typeof offerSchema>;
150
+ /** 领取失败的原因:未生效 / 不在有效期 / 不符合标签 / 不是首购 / 已达每人上限 / 已领完。 */
151
+ declare const offerUnavailableReasonSchema: z.ZodEnum<{
152
+ inactive: "inactive";
153
+ outside_window: "outside_window";
154
+ not_targeted: "not_targeted";
155
+ not_first_purchase: "not_first_purchase";
156
+ limit_reached: "limit_reached";
157
+ sold_out: "sold_out";
158
+ }>;
159
+ type OfferUnavailableReason = z.infer<typeof offerUnavailableReasonSchema>;
160
+
161
+ /** 一次下发:只含一种语言的文档(见 localizeScreen),locale 是实际使用的语言。 */
162
+ declare const popupDeliverySchema: z.ZodObject<{
163
+ id: z.ZodUUID;
164
+ campaignId: z.ZodUUID;
165
+ versionId: z.ZodUUID;
166
+ popup: z.ZodObject<{
167
+ kind: z.ZodLiteral<"screen">;
168
+ schemaVersion: z.ZodLiteral<3>;
169
+ name: z.ZodString;
170
+ surface: z.ZodEnum<{
171
+ popup: "popup";
172
+ paywall: "paywall";
173
+ onboarding: "onboarding";
174
+ page: "page";
175
+ }>;
176
+ presentation: z.ZodDiscriminatedUnion<[z.ZodObject<{
177
+ type: z.ZodLiteral<"modal">;
178
+ size: z.ZodEnum<{
179
+ sm: "sm";
180
+ md: "md";
181
+ lg: "lg";
182
+ }>;
183
+ }, z.core.$strict>, z.ZodObject<{
184
+ type: z.ZodLiteral<"sheet">;
185
+ size: z.ZodEnum<{
186
+ sm: "sm";
187
+ md: "md";
188
+ lg: "lg";
189
+ }>;
190
+ }, z.core.$strict>, z.ZodObject<{
191
+ type: z.ZodLiteral<"fullscreen">;
192
+ }, z.core.$strict>], "type">;
193
+ theme: z.ZodObject<{
194
+ primary: z.ZodString;
195
+ background: z.ZodString;
196
+ text: z.ZodString;
197
+ radius: z.ZodEnum<{
198
+ sm: "sm";
199
+ md: "md";
200
+ lg: "lg";
201
+ none: "none";
202
+ full: "full";
203
+ }>;
204
+ font: z.ZodEnum<{
205
+ system: "system";
206
+ serif: "serif";
207
+ rounded: "rounded";
208
+ mono: "mono";
209
+ }>;
210
+ }, z.core.$strict>;
211
+ funnel: z.ZodOptional<z.ZodObject<{
212
+ version: z.ZodLiteral<1>;
213
+ entry: z.ZodString;
214
+ questions: z.ZodArray<z.ZodObject<{
215
+ id: z.ZodString;
216
+ source: z.ZodString;
217
+ required: z.ZodBoolean;
218
+ }, z.core.$strict>>;
219
+ nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
220
+ id: z.ZodString;
221
+ name: z.ZodString;
222
+ type: z.ZodLiteral<"branch">;
223
+ question: z.ZodString;
224
+ cases: z.ZodArray<z.ZodObject<{
225
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
226
+ target: z.ZodString;
227
+ }, z.core.$strict>>;
228
+ fallback: z.ZodString;
229
+ editorPosition: z.ZodOptional<z.ZodObject<{
230
+ x: z.ZodNumber;
231
+ y: z.ZodNumber;
232
+ }, z.core.$strict>>;
233
+ }, z.core.$strict>, z.ZodObject<{
234
+ id: z.ZodString;
235
+ name: z.ZodString;
236
+ type: z.ZodLiteral<"auth">;
237
+ success: z.ZodString;
238
+ cancel: z.ZodString;
239
+ failure: z.ZodString;
240
+ editorPosition: z.ZodOptional<z.ZodObject<{
241
+ x: z.ZodNumber;
242
+ y: z.ZodNumber;
243
+ }, z.core.$strict>>;
244
+ }, z.core.$strict>, z.ZodObject<{
245
+ id: z.ZodString;
246
+ name: z.ZodString;
247
+ type: z.ZodLiteral<"purchase">;
248
+ planVersionId: z.ZodUUID;
249
+ success: z.ZodString;
250
+ cancel: z.ZodString;
251
+ failure: z.ZodString;
252
+ editorPosition: z.ZodOptional<z.ZodObject<{
253
+ x: z.ZodNumber;
254
+ y: z.ZodNumber;
255
+ }, z.core.$strict>>;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ id: z.ZodString;
258
+ name: z.ZodString;
259
+ type: z.ZodLiteral<"experiment">;
260
+ experimentId: z.ZodUUID;
261
+ revision: z.ZodNumber;
262
+ bucketVersion: z.ZodNumber;
263
+ variants: z.ZodArray<z.ZodObject<{
264
+ id: z.ZodString;
265
+ name: z.ZodString;
266
+ weight: z.ZodNumber;
267
+ target: z.ZodString;
268
+ }, z.core.$strict>>;
269
+ editorPosition: z.ZodOptional<z.ZodObject<{
270
+ x: z.ZodNumber;
271
+ y: z.ZodNumber;
272
+ }, z.core.$strict>>;
273
+ }, z.core.$strict>, z.ZodObject<{
274
+ id: z.ZodString;
275
+ name: z.ZodString;
276
+ type: z.ZodLiteral<"complete">;
277
+ editorPosition: z.ZodOptional<z.ZodObject<{
278
+ x: z.ZodNumber;
279
+ y: z.ZodNumber;
280
+ }, z.core.$strict>>;
281
+ }, z.core.$strict>], "type">>;
282
+ routes: z.ZodArray<z.ZodObject<{
283
+ action: z.ZodString;
284
+ target: z.ZodString;
285
+ }, z.core.$strict>>;
286
+ }, z.core.$strict>>;
287
+ pages: z.ZodArray<z.ZodObject<{
288
+ id: z.ZodString;
289
+ name: z.ZodString;
290
+ root: z.ZodType<StackNode, unknown, z.core.$ZodTypeInternals<StackNode, unknown>>;
291
+ theme: z.ZodOptional<z.ZodObject<{
292
+ primary: z.ZodString;
293
+ background: z.ZodString;
294
+ text: z.ZodString;
295
+ radius: z.ZodEnum<{
296
+ sm: "sm";
297
+ md: "md";
298
+ lg: "lg";
299
+ none: "none";
300
+ full: "full";
301
+ }>;
302
+ font: z.ZodEnum<{
303
+ system: "system";
304
+ serif: "serif";
305
+ rounded: "rounded";
306
+ mono: "mono";
307
+ }>;
308
+ }, z.core.$strict>>;
309
+ source: z.ZodOptional<z.ZodObject<{
310
+ campaignId: z.ZodUUID;
311
+ versionId: z.ZodUUID;
312
+ map: z.ZodRecord<z.ZodString, z.ZodString>;
313
+ strings: z.ZodOptional<z.ZodObject<{
314
+ defaultLocale: z.ZodString;
315
+ locales: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>;
316
+ }, z.core.$strict>>;
317
+ }, z.core.$strict>>;
318
+ editorPosition: z.ZodOptional<z.ZodObject<{
319
+ x: z.ZodNumber;
320
+ y: z.ZodNumber;
321
+ }, z.core.$strict>>;
322
+ }, z.core.$strict>>;
323
+ strings: z.ZodObject<{
324
+ defaultLocale: z.ZodString;
325
+ locales: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>;
326
+ }, z.core.$strict>;
327
+ actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
328
+ type: z.ZodLiteral<"purchase">;
329
+ close: z.ZodLiteral<false>;
330
+ plan: z.ZodUnion<readonly [z.ZodLiteral<"selected">, z.ZodUUID]>;
331
+ picker: z.ZodOptional<z.ZodString>;
332
+ offer: z.ZodEnum<{
333
+ scope: "scope";
334
+ none: "none";
335
+ }>;
336
+ channel: z.ZodEnum<{
337
+ web: "web";
338
+ native: "native";
339
+ }>;
340
+ id: z.ZodString;
341
+ event: z.ZodString;
342
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
343
+ }, z.core.$strict>, z.ZodObject<{
344
+ type: z.ZodLiteral<"navigate">;
345
+ target: z.ZodString;
346
+ close: z.ZodLiteral<false>;
347
+ id: z.ZodString;
348
+ event: z.ZodString;
349
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
350
+ }, z.core.$strict>, z.ZodObject<{
351
+ type: z.ZodLiteral<"event">;
352
+ close: z.ZodBoolean;
353
+ id: z.ZodString;
354
+ event: z.ZodString;
355
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
356
+ }, z.core.$strict>, z.ZodObject<{
357
+ type: z.ZodLiteral<"close">;
358
+ close: z.ZodLiteral<true>;
359
+ id: z.ZodString;
360
+ event: z.ZodString;
361
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
362
+ }, z.core.$strict>, z.ZodObject<{
363
+ type: z.ZodLiteral<"open_url">;
364
+ close: z.ZodBoolean;
365
+ url: z.ZodString;
366
+ id: z.ZodString;
367
+ event: z.ZodString;
368
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
369
+ }, z.core.$strict>, z.ZodObject<{
370
+ type: z.ZodLiteral<"claim_offer">;
371
+ close: z.ZodBoolean;
372
+ couponId: z.ZodUUID;
373
+ id: z.ZodString;
374
+ event: z.ZodString;
375
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
376
+ }, z.core.$strict>], "type">>;
377
+ }, z.core.$strict>;
378
+ capabilities: z.ZodOptional<z.ZodObject<{
379
+ nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
380
+ base: z.ZodObject<{
381
+ text: z.ZodOptional<z.ZodString>;
382
+ label: z.ZodOptional<z.ZodString>;
383
+ alt: z.ZodOptional<z.ZodString>;
384
+ html: z.ZodOptional<z.ZodString>;
385
+ price: z.ZodOptional<z.ZodObject<{
386
+ current: z.ZodString;
387
+ original: z.ZodNullable<z.ZodString>;
388
+ period: z.ZodString;
389
+ }, z.core.$strip>>;
390
+ code: z.ZodOptional<z.ZodString>;
391
+ countdownAt: z.ZodOptional<z.ZodISODateTime>;
392
+ planId: z.ZodOptional<z.ZodUUID>;
393
+ planVersionId: z.ZodOptional<z.ZodUUID>;
394
+ currency: z.ZodOptional<z.ZodEnum<{
395
+ USD: "USD";
396
+ EUR: "EUR";
397
+ CNY: "CNY";
398
+ GBP: "GBP";
399
+ JPY: "JPY";
400
+ CAD: "CAD";
401
+ AUD: "AUD";
402
+ NZD: "NZD";
403
+ CHF: "CHF";
404
+ HKD: "HKD";
405
+ SGD: "SGD";
406
+ KRW: "KRW";
407
+ INR: "INR";
408
+ BRL: "BRL";
409
+ MXN: "MXN";
410
+ TWD: "TWD";
411
+ THB: "THB";
412
+ IDR: "IDR";
413
+ MYR: "MYR";
414
+ PHP: "PHP";
415
+ VND: "VND";
416
+ ZAR: "ZAR";
417
+ AED: "AED";
418
+ SAR: "SAR";
419
+ SEK: "SEK";
420
+ NOK: "NOK";
421
+ DKK: "DKK";
422
+ PLN: "PLN";
423
+ CZK: "CZK";
424
+ HUF: "HUF";
425
+ ILS: "ILS";
426
+ TRY: "TRY";
427
+ RON: "RON";
428
+ }>>;
429
+ couponId: z.ZodOptional<z.ZodUUID>;
430
+ offerId: z.ZodOptional<z.ZodUUID>;
431
+ unavailable: z.ZodOptional<z.ZodBoolean>;
432
+ unavailableReason: z.ZodOptional<z.ZodString>;
433
+ missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
434
+ }, z.core.$strict>;
435
+ picker: z.ZodOptional<z.ZodString>;
436
+ byPlan: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
437
+ text: z.ZodOptional<z.ZodString>;
438
+ label: z.ZodOptional<z.ZodString>;
439
+ alt: z.ZodOptional<z.ZodString>;
440
+ html: z.ZodOptional<z.ZodString>;
441
+ price: z.ZodOptional<z.ZodObject<{
442
+ current: z.ZodString;
443
+ original: z.ZodNullable<z.ZodString>;
444
+ period: z.ZodString;
445
+ }, z.core.$strip>>;
446
+ code: z.ZodOptional<z.ZodString>;
447
+ countdownAt: z.ZodOptional<z.ZodISODateTime>;
448
+ planId: z.ZodOptional<z.ZodUUID>;
449
+ planVersionId: z.ZodOptional<z.ZodUUID>;
450
+ currency: z.ZodOptional<z.ZodEnum<{
451
+ USD: "USD";
452
+ EUR: "EUR";
453
+ CNY: "CNY";
454
+ GBP: "GBP";
455
+ JPY: "JPY";
456
+ CAD: "CAD";
457
+ AUD: "AUD";
458
+ NZD: "NZD";
459
+ CHF: "CHF";
460
+ HKD: "HKD";
461
+ SGD: "SGD";
462
+ KRW: "KRW";
463
+ INR: "INR";
464
+ BRL: "BRL";
465
+ MXN: "MXN";
466
+ TWD: "TWD";
467
+ THB: "THB";
468
+ IDR: "IDR";
469
+ MYR: "MYR";
470
+ PHP: "PHP";
471
+ VND: "VND";
472
+ ZAR: "ZAR";
473
+ AED: "AED";
474
+ SAR: "SAR";
475
+ SEK: "SEK";
476
+ NOK: "NOK";
477
+ DKK: "DKK";
478
+ PLN: "PLN";
479
+ CZK: "CZK";
480
+ HUF: "HUF";
481
+ ILS: "ILS";
482
+ TRY: "TRY";
483
+ RON: "RON";
484
+ }>>;
485
+ couponId: z.ZodOptional<z.ZodUUID>;
486
+ offerId: z.ZodOptional<z.ZodUUID>;
487
+ unavailable: z.ZodOptional<z.ZodBoolean>;
488
+ unavailableReason: z.ZodOptional<z.ZodString>;
489
+ missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
490
+ }, z.core.$strict>>>;
491
+ }, z.core.$strict>>;
492
+ plans: z.ZodRecord<z.ZodString, z.ZodObject<{
493
+ id: z.ZodUUID;
494
+ versionId: z.ZodUUID;
495
+ name: z.ZodString;
496
+ price: z.ZodString;
497
+ period: z.ZodString;
498
+ currency: z.ZodOptional<z.ZodEnum<{
499
+ USD: "USD";
500
+ EUR: "EUR";
501
+ CNY: "CNY";
502
+ GBP: "GBP";
503
+ JPY: "JPY";
504
+ CAD: "CAD";
505
+ AUD: "AUD";
506
+ NZD: "NZD";
507
+ CHF: "CHF";
508
+ HKD: "HKD";
509
+ SGD: "SGD";
510
+ KRW: "KRW";
511
+ INR: "INR";
512
+ BRL: "BRL";
513
+ MXN: "MXN";
514
+ TWD: "TWD";
515
+ THB: "THB";
516
+ IDR: "IDR";
517
+ MYR: "MYR";
518
+ PHP: "PHP";
519
+ VND: "VND";
520
+ ZAR: "ZAR";
521
+ AED: "AED";
522
+ SAR: "SAR";
523
+ SEK: "SEK";
524
+ NOK: "NOK";
525
+ DKK: "DKK";
526
+ PLN: "PLN";
527
+ CZK: "CZK";
528
+ HUF: "HUF";
529
+ ILS: "ILS";
530
+ TRY: "TRY";
531
+ RON: "RON";
532
+ }>>;
533
+ }, z.core.$strict>>;
534
+ pickers: z.ZodRecord<z.ZodString, z.ZodObject<{
535
+ options: z.ZodArray<z.ZodUUID>;
536
+ selected: z.ZodNullable<z.ZodUUID>;
537
+ }, z.core.$strict>>;
538
+ diagnostics: z.ZodArray<z.ZodObject<{
539
+ nodeId: z.ZodString;
540
+ message: z.ZodString;
541
+ }, z.core.$strict>>;
542
+ }, z.core.$strict>>;
543
+ locale: z.ZodString;
544
+ expiresAt: z.ZodISODateTime;
545
+ }, z.core.$strip>;
546
+ declare const popupTrackSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
547
+ eventId: z.ZodUUID;
548
+ deliveryId: z.ZodUUID;
549
+ type: z.ZodLiteral<"shown">;
550
+ locale: z.ZodOptional<z.ZodString>;
551
+ }, z.core.$strict>, z.ZodObject<{
552
+ eventId: z.ZodUUID;
553
+ deliveryId: z.ZodUUID;
554
+ type: z.ZodLiteral<"action">;
555
+ actionId: z.ZodString;
556
+ }, z.core.$strict>, z.ZodObject<{
557
+ eventId: z.ZodUUID;
558
+ deliveryId: z.ZodUUID;
559
+ type: z.ZodLiteral<"closed">;
560
+ reason: z.ZodEnum<{
561
+ action: "action";
562
+ close_button: "close_button";
563
+ escape: "escape";
564
+ destroy: "destroy";
565
+ timeout: "timeout";
566
+ }>;
567
+ }, z.core.$strict>], "type">;
568
+ type PopupTrack = z.infer<typeof popupTrackSchema>;
569
+ type PopupDelivery = z.infer<typeof popupDeliverySchema>;
570
+ type PopupEvent = {
571
+ type: "shown";
572
+ } | {
573
+ type: "action";
574
+ actionId: string;
575
+ nodeId?: string;
576
+ name: string;
577
+ properties: ScreenAction["properties"];
578
+ /** Presentation-only choices; validate actual prices and entitlements on the server. */
579
+ selection?: Record<string, string | boolean>;
580
+ } | {
581
+ type: "purchase";
582
+ actionId: string;
583
+ status: "started" | "checkout" | "trial_started" | "error";
584
+ url?: string;
585
+ message?: string;
586
+ } | {
587
+ type: "closed";
588
+ reason: "close_button" | "escape" | "action" | "destroy" | "timeout";
589
+ } | {
590
+ /** claim_offer 按钮的领取结果(showRemotePopup 才有;离线 showPopup 没有投放凭证,不能领取)。 */
591
+ type: "offer";
592
+ actionId: string;
593
+ offer: Offer | null;
594
+ reason: OfferUnavailableReason | "error" | null;
595
+ };
596
+
597
+ /** Currency always comes from business data; locale only controls notation. No currency conversion. */
598
+ declare function formatCouponMoney(cents: number, currency: string, locale?: string): string;
599
+ declare function formatCouponDiscount(discount: CouponInput["discount"], locale?: string): string;
600
+ declare function formatCouponTerms(coupon: Pick<CouponInput, "discount" | "duration">, locale?: string, billing?: "month" | "year" | "any"): string;
601
+
602
+ type FunnelAnswers = Record<string, string | boolean>;
603
+ type FunnelState = {
604
+ status: "running" | "waiting" | "completed" | "failed";
605
+ nodeId: string;
606
+ pageId: string | null;
607
+ answers: FunnelAnswers;
608
+ history: string[];
609
+ error?: string;
610
+ };
611
+
612
+ declare const customerResourceSchema: z.ZodObject<{
613
+ resourceKey: z.ZodString;
614
+ name: z.ZodString;
615
+ granted: z.ZodString;
616
+ available: z.ZodString;
617
+ reserved: z.ZodString;
618
+ spendable: z.ZodString;
619
+ consumedInActiveGrants: z.ZodString;
620
+ nextExpiry: z.ZodNullable<z.ZodObject<{
621
+ at: z.ZodISODateTime;
622
+ spendable: z.ZodString;
623
+ }, z.core.$strip>>;
624
+ breakdown: z.ZodArray<z.ZodObject<{
625
+ id: z.ZodUUID;
626
+ entityId: z.ZodNullable<z.ZodUUID>;
627
+ resourceKey: z.ZodString;
628
+ name: z.ZodString;
629
+ source: z.ZodString;
630
+ granted: z.ZodString;
631
+ available: z.ZodString;
632
+ reserved: z.ZodString;
633
+ spendable: z.ZodString;
634
+ consumed: z.ZodString;
635
+ forfeited: z.ZodString;
636
+ rolledOver: z.ZodString;
637
+ startsAt: z.ZodISODateTime;
638
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
639
+ eligible: z.ZodBoolean;
640
+ rates: z.ZodArray<z.ZodObject<{
641
+ featureKey: z.ZodString;
642
+ units: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
643
+ cost: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
644
+ tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
645
+ upTo: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
646
+ cost: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
647
+ }, z.core.$strict>>>;
648
+ dimensions: z.ZodOptional<z.ZodArray<z.ZodObject<{
649
+ key: z.ZodString;
650
+ match: z.ZodRecord<z.ZodString, z.ZodString>;
651
+ priority: z.ZodDefault<z.ZodNumber>;
652
+ cost: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
653
+ tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
654
+ upTo: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
655
+ cost: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
656
+ }, z.core.$strict>>>;
657
+ }, z.core.$strict>>>;
658
+ multipliers: z.ZodOptional<z.ZodArray<z.ZodObject<{
659
+ key: z.ZodString;
660
+ match: z.ZodRecord<z.ZodString, z.ZodString>;
661
+ factor: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
662
+ add: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
663
+ }, z.core.$strict>>>;
664
+ }, z.core.$strict>>;
665
+ }, z.core.$strip>>;
666
+ }, z.core.$strict>;
667
+ type CustomerResource = z.infer<typeof customerResourceSchema>;
668
+ declare const customerStateSchema: z.ZodObject<{
669
+ customerId: z.ZodUUID;
670
+ entityId: z.ZodNullable<z.ZodUUID>;
671
+ evaluatedAt: z.ZodISODateTime;
672
+ membership: z.ZodOptional<z.ZodObject<{
673
+ customerId: z.ZodUUID;
674
+ evaluatedAt: z.ZodISODateTime;
675
+ holdings: z.ZodArray<z.ZodObject<{
676
+ id: z.ZodUUID;
677
+ planVersionId: z.ZodUUID;
678
+ planId: z.ZodUUID;
679
+ basePlanId: z.ZodNullable<z.ZodUUID>;
680
+ name: z.ZodString;
681
+ group: z.ZodString;
682
+ kind: z.ZodEnum<{
683
+ main: "main";
684
+ addon: "addon";
685
+ }>;
686
+ source: z.ZodEnum<{
687
+ apple: "apple";
688
+ google: "google";
689
+ subscription: "subscription";
690
+ assignment: "assignment";
691
+ license: "license";
692
+ }>;
693
+ status: z.ZodString;
694
+ accessEnabled: z.ZodBoolean;
695
+ startsAt: z.ZodNullable<z.ZodISODateTime>;
696
+ endsAt: z.ZodNullable<z.ZodISODateTime>;
697
+ cancelAtPeriodEnd: z.ZodBoolean;
698
+ scheduledChange: z.ZodNullable<z.ZodObject<{
699
+ id: z.ZodUUID;
700
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
701
+ targetPlanVersionId: z.ZodNullable<z.ZodUUID>;
702
+ action: z.ZodEnum<{
703
+ cancel: "cancel";
704
+ attach: "attach";
705
+ change: "change";
706
+ resume: "resume";
707
+ cancel_change: "cancel_change";
708
+ }>;
709
+ timing: z.ZodEnum<{
710
+ immediate: "immediate";
711
+ end_of_cycle: "end_of_cycle";
712
+ }>;
713
+ status: z.ZodEnum<{
714
+ preparing: "preparing";
715
+ payment_pending: "payment_pending";
716
+ scheduled: "scheduled";
717
+ completed: "completed";
718
+ canceled: "canceled";
719
+ failed: "failed";
720
+ }>;
721
+ effectiveAt: z.ZodNullable<z.ZodISODateTime>;
722
+ createdAt: z.ZodISODateTime;
723
+ }, z.core.$strip>>;
724
+ trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
725
+ id: z.ZodUUID;
726
+ planVersionId: z.ZodUUID;
727
+ slot: z.ZodString;
728
+ cardRequired: z.ZodBoolean;
729
+ status: z.ZodEnum<{
730
+ expired: "expired";
731
+ canceled: "canceled";
732
+ failed: "failed";
733
+ pending: "pending";
734
+ active: "active";
735
+ converted: "converted";
736
+ }>;
737
+ startsAt: z.ZodNullable<z.ZodISODateTime>;
738
+ endsAt: z.ZodNullable<z.ZodISODateTime>;
739
+ createdAt: z.ZodISODateTime;
740
+ }, z.core.$strict>>>;
741
+ }, z.core.$strip>>;
742
+ changes: z.ZodArray<z.ZodObject<{
743
+ id: z.ZodUUID;
744
+ subscriptionId: z.ZodNullable<z.ZodUUID>;
745
+ targetPlanVersionId: z.ZodNullable<z.ZodUUID>;
746
+ action: z.ZodEnum<{
747
+ cancel: "cancel";
748
+ attach: "attach";
749
+ change: "change";
750
+ resume: "resume";
751
+ cancel_change: "cancel_change";
752
+ }>;
753
+ timing: z.ZodEnum<{
754
+ immediate: "immediate";
755
+ end_of_cycle: "end_of_cycle";
756
+ }>;
757
+ status: z.ZodEnum<{
758
+ preparing: "preparing";
759
+ payment_pending: "payment_pending";
760
+ scheduled: "scheduled";
761
+ completed: "completed";
762
+ canceled: "canceled";
763
+ failed: "failed";
764
+ }>;
765
+ effectiveAt: z.ZodNullable<z.ZodISODateTime>;
766
+ createdAt: z.ZodISODateTime;
767
+ }, z.core.$strip>>;
768
+ trials: z.ZodOptional<z.ZodArray<z.ZodObject<{
769
+ id: z.ZodUUID;
770
+ planVersionId: z.ZodUUID;
771
+ slot: z.ZodString;
772
+ cardRequired: z.ZodBoolean;
773
+ status: z.ZodEnum<{
774
+ expired: "expired";
775
+ canceled: "canceled";
776
+ failed: "failed";
777
+ pending: "pending";
778
+ active: "active";
779
+ converted: "converted";
780
+ }>;
781
+ startsAt: z.ZodNullable<z.ZodISODateTime>;
782
+ endsAt: z.ZodNullable<z.ZodISODateTime>;
783
+ createdAt: z.ZodISODateTime;
784
+ }, z.core.$strict>>>;
785
+ }, z.core.$strip>>;
786
+ features: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
787
+ key: z.ZodString;
788
+ name: z.ZodString;
789
+ type: z.ZodEnum<{
790
+ boolean: "boolean";
791
+ metered: "metered";
792
+ }>;
793
+ allowed: z.ZodBoolean;
794
+ allowance: z.ZodNullable<z.ZodNumber>;
795
+ used: z.ZodNumber;
796
+ remaining: z.ZodNullable<z.ZodNumber>;
797
+ }, z.core.$strict>>>;
798
+ resources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
799
+ resourceKey: z.ZodString;
800
+ name: z.ZodString;
801
+ granted: z.ZodString;
802
+ available: z.ZodString;
803
+ reserved: z.ZodString;
804
+ spendable: z.ZodString;
805
+ consumedInActiveGrants: z.ZodString;
806
+ nextExpiry: z.ZodNullable<z.ZodObject<{
807
+ at: z.ZodISODateTime;
808
+ spendable: z.ZodString;
809
+ }, z.core.$strip>>;
810
+ breakdown: z.ZodArray<z.ZodObject<{
811
+ id: z.ZodUUID;
812
+ entityId: z.ZodNullable<z.ZodUUID>;
813
+ resourceKey: z.ZodString;
814
+ name: z.ZodString;
815
+ source: z.ZodString;
816
+ granted: z.ZodString;
817
+ available: z.ZodString;
818
+ reserved: z.ZodString;
819
+ spendable: z.ZodString;
820
+ consumed: z.ZodString;
821
+ forfeited: z.ZodString;
822
+ rolledOver: z.ZodString;
823
+ startsAt: z.ZodISODateTime;
824
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
825
+ eligible: z.ZodBoolean;
826
+ rates: z.ZodArray<z.ZodObject<{
827
+ featureKey: z.ZodString;
828
+ units: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
829
+ cost: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
830
+ tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
831
+ upTo: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
832
+ cost: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
833
+ }, z.core.$strict>>>;
834
+ dimensions: z.ZodOptional<z.ZodArray<z.ZodObject<{
835
+ key: z.ZodString;
836
+ match: z.ZodRecord<z.ZodString, z.ZodString>;
837
+ priority: z.ZodDefault<z.ZodNumber>;
838
+ cost: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
839
+ tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
840
+ upTo: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
841
+ cost: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
842
+ }, z.core.$strict>>>;
843
+ }, z.core.$strict>>>;
844
+ multipliers: z.ZodOptional<z.ZodArray<z.ZodObject<{
845
+ key: z.ZodString;
846
+ match: z.ZodRecord<z.ZodString, z.ZodString>;
847
+ factor: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
848
+ add: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
849
+ }, z.core.$strict>>>;
850
+ }, z.core.$strict>>;
851
+ }, z.core.$strip>>;
852
+ }, z.core.$strict>>>;
853
+ }, z.core.$strict>;
854
+ type CustomerState = z.infer<typeof customerStateSchema>;
855
+ declare const customerPlanEligibilitySchema: z.ZodObject<{
856
+ status: z.ZodEnum<{
857
+ current: "current";
858
+ scheduled: "scheduled";
859
+ available: "available";
860
+ blocked: "blocked";
861
+ }>;
862
+ action: z.ZodNullable<z.ZodEnum<{
863
+ attach: "attach";
864
+ change: "change";
865
+ }>>;
866
+ direction: z.ZodNullable<z.ZodEnum<{
867
+ new: "new";
868
+ upgrade: "upgrade";
869
+ downgrade: "downgrade";
870
+ same: "same";
871
+ }>>;
872
+ reason: z.ZodEnum<{
873
+ current: "current";
874
+ scheduled: "scheduled";
875
+ available: "available";
876
+ pending_change: "pending_change";
877
+ ambiguous_membership: "ambiguous_membership";
878
+ managed_by_store: "managed_by_store";
879
+ managed_by_payer: "managed_by_payer";
880
+ currency_unavailable: "currency_unavailable";
881
+ }>;
882
+ holdingId: z.ZodNullable<z.ZodUUID>;
883
+ trial: z.ZodNullable<z.ZodObject<{
884
+ eligible: z.ZodBoolean;
885
+ reason: z.ZodEnum<{
886
+ pending: "pending";
887
+ eligible: "eligible";
888
+ not_configured: "not_configured";
889
+ already_used: "already_used";
890
+ already_subscribed: "already_subscribed";
891
+ entity_requires_payer: "entity_requires_payer";
892
+ }>;
893
+ policy: z.ZodNullable<z.ZodObject<{
894
+ days: z.ZodNumber;
895
+ cardRequired: z.ZodBoolean;
896
+ featureAllowances: z.ZodRecord<z.ZodUUID, z.ZodNumber>;
897
+ creditAmounts: z.ZodRecord<z.ZodUUID, z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
898
+ }, z.core.$strict>>;
899
+ }, z.core.$strict>>;
900
+ }, z.core.$strict>;
901
+ type CustomerPlanEligibility = z.infer<typeof customerPlanEligibilitySchema>;
902
+
903
+ declare const customerPageDataSchema: z.ZodObject<{
904
+ nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
905
+ source: z.ZodEnum<{
906
+ membership: "membership";
907
+ credit_balance: "credit_balance";
908
+ credit_transactions: "credit_transactions";
909
+ customer_plans: "customer_plans";
910
+ credit_packs: "credit_packs";
911
+ credit_pack_orders: "credit_pack_orders";
912
+ offer_history: "offer_history";
913
+ }>;
914
+ status: z.ZodEnum<{
915
+ error: "error";
916
+ ready: "ready";
917
+ idle: "idle";
918
+ loading: "loading";
919
+ }>;
920
+ stale: z.ZodBoolean;
921
+ preview: z.ZodBoolean;
922
+ errorCode: z.ZodOptional<z.ZodString>;
923
+ errorMessage: z.ZodOptional<z.ZodString>;
924
+ resources: z.ZodArray<z.ZodObject<{
925
+ key: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
926
+ name: z.ZodString;
927
+ spendable: z.ZodString;
928
+ reserved: z.ZodString;
929
+ available: z.ZodString;
930
+ expiry: z.ZodNullable<z.ZodString>;
931
+ sources: z.ZodArray<z.ZodObject<{
932
+ id: z.ZodString;
933
+ label: z.ZodString;
934
+ detail: z.ZodArray<z.ZodString>;
935
+ value: z.ZodOptional<z.ZodString>;
936
+ status: z.ZodOptional<z.ZodString>;
937
+ facts: z.ZodArray<z.ZodObject<{
938
+ label: z.ZodString;
939
+ value: z.ZodString;
940
+ }, z.core.$strict>>;
941
+ purchaseId: z.ZodOptional<z.ZodUUID>;
942
+ }, z.core.$strict>>;
943
+ sourceCount: z.ZodNumber;
944
+ sourcePage: z.ZodNumber;
945
+ hasNextSources: z.ZodBoolean;
946
+ hasPreviousSources: z.ZodBoolean;
947
+ }, z.core.$strict>>;
948
+ rows: z.ZodArray<z.ZodObject<{
949
+ id: z.ZodString;
950
+ label: z.ZodString;
951
+ detail: z.ZodArray<z.ZodString>;
952
+ value: z.ZodOptional<z.ZodString>;
953
+ status: z.ZodOptional<z.ZodString>;
954
+ facts: z.ZodArray<z.ZodObject<{
955
+ label: z.ZodString;
956
+ value: z.ZodString;
957
+ }, z.core.$strict>>;
958
+ purchaseId: z.ZodOptional<z.ZodUUID>;
959
+ }, z.core.$strict>>;
960
+ hasNext: z.ZodBoolean;
961
+ hasPrevious: z.ZodBoolean;
962
+ page: z.ZodNumber;
963
+ filter: z.ZodString;
964
+ updatedAt: z.ZodOptional<z.ZodISODateTime>;
965
+ buyingId: z.ZodOptional<z.ZodUUID>;
966
+ }, z.core.$strict>>;
967
+ }, z.core.$strict>;
968
+ type CustomerPageData = z.infer<typeof customerPageDataSchema>;
969
+ declare const customerDataIntentSchema: z.ZodObject<{
970
+ nodeId: z.ZodString;
971
+ action: z.ZodEnum<{
972
+ filter: "filter";
973
+ refresh: "refresh";
974
+ next: "next";
975
+ previous: "previous";
976
+ buy_pack: "buy_pack";
977
+ sources_next: "sources_next";
978
+ sources_previous: "sources_previous";
979
+ }>;
980
+ value: z.ZodOptional<z.ZodString>;
981
+ }, z.core.$strict>;
982
+ type CustomerDataIntent = z.infer<typeof customerDataIntentSchema>;
983
+
984
+ declare const commerceIntentSchema: z.ZodObject<{
985
+ protocolVersion: z.ZodLiteral<1>;
986
+ id: z.ZodUUID;
987
+ scope: z.ZodObject<{
988
+ projectId: z.ZodUUID;
989
+ environment: z.ZodEnum<{
990
+ live: "live";
991
+ sandbox: "sandbox";
992
+ }>;
993
+ }, z.core.$strict>;
994
+ expiresAt: z.ZodISODateTime;
995
+ nextStep: z.ZodDiscriminatedUnion<[z.ZodObject<{
996
+ provider: z.ZodLiteral<"stripe">;
997
+ checkoutUrl: z.ZodURL;
998
+ }, z.core.$strict>, z.ZodObject<{
999
+ provider: z.ZodLiteral<"apple">;
1000
+ productId: z.ZodString;
1001
+ appAccountToken: z.ZodUUID;
1002
+ }, z.core.$strict>, z.ZodObject<{
1003
+ provider: z.ZodLiteral<"google">;
1004
+ productId: z.ZodString;
1005
+ basePlanId: z.ZodNullable<z.ZodString>;
1006
+ offerId: z.ZodNullable<z.ZodString>;
1007
+ obfuscatedAccountId: z.ZodString;
1008
+ obfuscatedProfileId: z.ZodUUID;
1009
+ }, z.core.$strict>], "provider">;
1010
+ submissionTicket: z.ZodNullable<z.ZodString>;
1011
+ }, z.core.$strict>;
1012
+ declare const commerceEvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1013
+ provider: z.ZodLiteral<"apple">;
1014
+ signedTransaction: z.ZodString;
1015
+ }, z.core.$strict>, z.ZodObject<{
1016
+ provider: z.ZodLiteral<"google">;
1017
+ purchaseToken: z.ZodString;
1018
+ }, z.core.$strict>], "provider">;
1019
+ declare const commercePurchaseStatusSchema: z.ZodObject<{
1020
+ protocolVersion: z.ZodLiteral<1>;
1021
+ intentId: z.ZodUUID;
1022
+ state: z.ZodEnum<{
1023
+ pending: "pending";
1024
+ processing: "processing";
1025
+ ownership_conflict: "ownership_conflict";
1026
+ rejected: "rejected";
1027
+ ready: "ready";
1028
+ fulfilled: "fulfilled";
1029
+ }>;
1030
+ purchaseId: z.ZodNullable<z.ZodUUID>;
1031
+ finishTransactionKeys: z.ZodArray<z.ZodString>;
1032
+ retryAt: z.ZodNullable<z.ZodISODateTime>;
1033
+ }, z.core.$strict>;
1034
+ type CommerceIntent = z.infer<typeof commerceIntentSchema>;
1035
+ type CommerceEvidence = z.infer<typeof commerceEvidenceSchema>;
1036
+ type CommercePurchaseStatus = z.infer<typeof commercePurchaseStatusSchema>;
1037
+
1038
+ type CustomerStateSnapshot = Readonly<{
1039
+ status: "idle" | "loading" | "ready" | "error";
1040
+ data: CustomerState | null;
1041
+ error: GrooveError | null;
1042
+ stale: boolean;
1043
+ }>;
1044
+ interface CustomerStateStore {
1045
+ getSnapshot(): CustomerStateSnapshot;
1046
+ subscribe(listener: () => void): () => void;
1047
+ load(): Promise<CustomerState>;
1048
+ refresh(): Promise<CustomerState>;
1049
+ }
1050
+
1051
+ interface PendingPurchaseStore {
1052
+ /** The native host must provide Keychain/Keystore-backed persistence before opening the store. */
1053
+ put(intent: CommerceIntent): Promise<void>;
1054
+ get(intentId: string): Promise<CommerceIntent | null>;
1055
+ remove(intentId: string): Promise<void>;
1056
+ }
1057
+ interface PurchaseHost {
1058
+ provider: "apple" | "google";
1059
+ purchase(intent: CommerceIntent): Promise<{
1060
+ state: "purchased";
1061
+ evidence: CommerceEvidence;
1062
+ } | {
1063
+ state: "pending";
1064
+ } | {
1065
+ state: "canceled";
1066
+ }>;
1067
+ /** Apple finishes exact confirmed transactions; Google acknowledgement belongs to the backend. */
1068
+ confirmed(evidence: CommerceEvidence, status: CommercePurchaseStatus): Promise<void>;
1069
+ }
1070
+ interface PurchaseTicketTransport {
1071
+ submit(intent: CommerceIntent, evidence: CommerceEvidence): Promise<unknown>;
1072
+ status(intent: CommerceIntent): Promise<unknown>;
1073
+ }
1074
+ /** One JS package: native hosts adapt the shared protocol. This module imports no framework or platform secrets. */
1075
+ declare function createPurchaseHostClient(options: {
1076
+ scope: {
1077
+ projectId: string;
1078
+ environment: "sandbox" | "live";
1079
+ };
1080
+ prepare: (bindingId: string, idempotencyKey: string) => Promise<unknown>;
1081
+ pending: PendingPurchaseStore;
1082
+ host: PurchaseHost;
1083
+ tickets: PurchaseTicketTransport;
1084
+ }): {
1085
+ /** Must be called on every identify/reset. In-flight evidence delivery remains bound to its original ticket. */
1086
+ identityChanged(): void;
1087
+ purchase(bindingId: string, idempotencyKey?: `${string}-${string}-${string}-${string}-${string}`): Promise<{
1088
+ state: "pending";
1089
+ intentId: string;
1090
+ result?: undefined;
1091
+ } | {
1092
+ state: "canceled";
1093
+ intentId?: undefined;
1094
+ result?: undefined;
1095
+ } | {
1096
+ state: "delivered_to_original_identity";
1097
+ intentId?: undefined;
1098
+ result?: undefined;
1099
+ } | {
1100
+ state: "result";
1101
+ result: {
1102
+ protocolVersion: 1;
1103
+ intentId: string;
1104
+ state: "pending" | "processing" | "ownership_conflict" | "rejected" | "ready" | "fulfilled";
1105
+ purchaseId: string | null;
1106
+ finishTransactionKeys: string[];
1107
+ retryAt: string | null;
1108
+ };
1109
+ intentId?: undefined;
1110
+ }>;
1111
+ recover(intentId: string, evidence: CommerceEvidence): Promise<{
1112
+ protocolVersion: 1;
1113
+ intentId: string;
1114
+ state: "pending" | "processing" | "ownership_conflict" | "rejected" | "ready" | "fulfilled";
1115
+ purchaseId: string | null;
1116
+ finishTransactionKeys: string[];
1117
+ retryAt: string | null;
1118
+ }>;
1119
+ status(intentId: string): Promise<{
1120
+ protocolVersion: 1;
1121
+ intentId: string;
1122
+ state: "pending" | "processing" | "ownership_conflict" | "rejected" | "ready" | "fulfilled";
1123
+ purchaseId: string | null;
1124
+ finishTransactionKeys: string[];
1125
+ retryAt: string | null;
1126
+ }>;
1127
+ };
1128
+
1129
+ /** Ticket transport deliberately has no identify(): account changes cannot replace this bounded capability. */
1130
+ declare function createPurchaseTicketTransport(options: GrooveOptions): PurchaseTicketTransport;
1131
+
1132
+ type BrowserInput<K extends "listCreditTransactions" | "listCreditPackOrders" | "listOfferHistory"> = Omit<ApiInput<K>, "customerId" | "entityId">;
1133
+ interface CustomerPageClient {
1134
+ createCustomerStateStore(input: {
1135
+ include: ("credits" | "memberships")[];
1136
+ }): CustomerStateStore;
1137
+ subscribeIdentity(listener: (identified: boolean) => void): () => void;
1138
+ listCreditTransactions(input: BrowserInput<"listCreditTransactions">): Promise<ApiOutput<"listCreditTransactions">>;
1139
+ listCreditPackOrders(input: BrowserInput<"listCreditPackOrders">): Promise<ApiOutput<"listCreditPackOrders">>;
1140
+ listOfferHistory(input: BrowserInput<"listOfferHistory">): Promise<ApiOutput<"listOfferHistory">>;
1141
+ listCustomerPlans(input?: Omit<ApiInput<"listCustomerPlans">, "customerId" | "entityId">): Promise<ApiOutput<"listCustomerPlans">>;
1142
+ listCreditPacks(): Promise<ApiOutput<"listCreditPacks">>;
1143
+ createCreditPackCheckout(input: {
1144
+ packVersionId: string;
1145
+ requestId: string;
1146
+ }): Promise<ApiOutput<"createCreditPackCheckout">>;
1147
+ }
1148
+ type CustomerPageController = {
1149
+ snapshot(): CustomerPageData;
1150
+ intent(input: unknown): Promise<void>;
1151
+ refresh(): Promise<void>;
1152
+ destroy(): void;
1153
+ };
1154
+ /** Group the integer with BigInt; never round a credit quantity through Number. */
1155
+ declare function formatCustomerDecimal(value: string, locale: string): string;
1156
+ declare function createCustomerPageController(doc: ScreenDocument, client: CustomerPageClient, options: {
1157
+ locale: string;
1158
+ onData(data: CustomerPageData): void;
1159
+ onCheckout?: (checkout: ApiOutput<"createCreditPackCheckout">) => void | Promise<void>;
1160
+ onError?: (error: unknown) => void;
1161
+ }): CustomerPageController;
1162
+
1163
+ declare function createFunnelClient(options: GrooveOptions & {
1164
+ runToken: string;
1165
+ }): {
1166
+ readonly webViewUrl: string | undefined;
1167
+ get: () => Promise<{
1168
+ run?: {
1169
+ id: string;
1170
+ campaignId: string;
1171
+ versionId: string;
1172
+ document: {
1173
+ kind: "screen";
1174
+ schemaVersion: 3;
1175
+ name: string;
1176
+ surface: "popup" | "paywall" | "onboarding" | "page";
1177
+ presentation: {
1178
+ type: "modal";
1179
+ size: "sm" | "md" | "lg";
1180
+ } | {
1181
+ type: "sheet";
1182
+ size: "sm" | "md" | "lg";
1183
+ } | {
1184
+ type: "fullscreen";
1185
+ };
1186
+ theme: {
1187
+ primary: string;
1188
+ background: string;
1189
+ text: string;
1190
+ radius: "sm" | "md" | "lg" | "none" | "full";
1191
+ font: "system" | "serif" | "rounded" | "mono";
1192
+ };
1193
+ pages: {
1194
+ id: string;
1195
+ name: string;
1196
+ root: StackNode;
1197
+ theme?: {
1198
+ primary: string;
1199
+ background: string;
1200
+ text: string;
1201
+ radius: "sm" | "md" | "lg" | "none" | "full";
1202
+ font: "system" | "serif" | "rounded" | "mono";
1203
+ } | undefined;
1204
+ source?: {
1205
+ campaignId: string;
1206
+ versionId: string;
1207
+ map: Record<string, string>;
1208
+ strings?: {
1209
+ defaultLocale: string;
1210
+ locales: Record<string, Record<string, string>>;
1211
+ } | undefined;
1212
+ } | undefined;
1213
+ editorPosition?: {
1214
+ x: number;
1215
+ y: number;
1216
+ } | undefined;
1217
+ }[];
1218
+ strings: {
1219
+ defaultLocale: string;
1220
+ locales: Record<string, Record<string, string>>;
1221
+ };
1222
+ actions: ({
1223
+ type: "purchase";
1224
+ close: false;
1225
+ plan: string;
1226
+ offer: "scope" | "none";
1227
+ channel: "web" | "native";
1228
+ id: string;
1229
+ event: string;
1230
+ properties: Record<string, string | number | boolean | null>;
1231
+ picker?: string | undefined;
1232
+ } | {
1233
+ type: "navigate";
1234
+ target: string;
1235
+ close: false;
1236
+ id: string;
1237
+ event: string;
1238
+ properties: Record<string, string | number | boolean | null>;
1239
+ } | {
1240
+ type: "event";
1241
+ close: boolean;
1242
+ id: string;
1243
+ event: string;
1244
+ properties: Record<string, string | number | boolean | null>;
1245
+ } | {
1246
+ type: "close";
1247
+ close: true;
1248
+ id: string;
1249
+ event: string;
1250
+ properties: Record<string, string | number | boolean | null>;
1251
+ } | {
1252
+ type: "open_url";
1253
+ close: boolean;
1254
+ url: string;
1255
+ id: string;
1256
+ event: string;
1257
+ properties: Record<string, string | number | boolean | null>;
1258
+ } | {
1259
+ type: "claim_offer";
1260
+ close: boolean;
1261
+ couponId: string;
1262
+ id: string;
1263
+ event: string;
1264
+ properties: Record<string, string | number | boolean | null>;
1265
+ })[];
1266
+ funnel?: {
1267
+ version: 1;
1268
+ entry: string;
1269
+ questions: {
1270
+ id: string;
1271
+ source: string;
1272
+ required: boolean;
1273
+ }[];
1274
+ nodes: ({
1275
+ id: string;
1276
+ name: string;
1277
+ type: "branch";
1278
+ question: string;
1279
+ cases: {
1280
+ value: string | boolean;
1281
+ target: string;
1282
+ }[];
1283
+ fallback: string;
1284
+ editorPosition?: {
1285
+ x: number;
1286
+ y: number;
1287
+ } | undefined;
1288
+ } | {
1289
+ id: string;
1290
+ name: string;
1291
+ type: "auth";
1292
+ success: string;
1293
+ cancel: string;
1294
+ failure: string;
1295
+ editorPosition?: {
1296
+ x: number;
1297
+ y: number;
1298
+ } | undefined;
1299
+ } | {
1300
+ id: string;
1301
+ name: string;
1302
+ type: "purchase";
1303
+ planVersionId: string;
1304
+ success: string;
1305
+ cancel: string;
1306
+ failure: string;
1307
+ editorPosition?: {
1308
+ x: number;
1309
+ y: number;
1310
+ } | undefined;
1311
+ } | {
1312
+ id: string;
1313
+ name: string;
1314
+ type: "experiment";
1315
+ experimentId: string;
1316
+ revision: number;
1317
+ bucketVersion: number;
1318
+ variants: {
1319
+ id: string;
1320
+ name: string;
1321
+ weight: number;
1322
+ target: string;
1323
+ }[];
1324
+ editorPosition?: {
1325
+ x: number;
1326
+ y: number;
1327
+ } | undefined;
1328
+ } | {
1329
+ id: string;
1330
+ name: string;
1331
+ type: "complete";
1332
+ editorPosition?: {
1333
+ x: number;
1334
+ y: number;
1335
+ } | undefined;
1336
+ })[];
1337
+ routes: {
1338
+ action: string;
1339
+ target: string;
1340
+ }[];
1341
+ } | undefined;
1342
+ };
1343
+ locale: string;
1344
+ nodeId: string;
1345
+ history: string[];
1346
+ status: "completed" | "closed" | "running";
1347
+ customerId: string | null;
1348
+ expiresAt: string;
1349
+ assignments: {
1350
+ nodeId: string;
1351
+ variantId: string;
1352
+ target: string;
1353
+ experimentId: string;
1354
+ revision: number;
1355
+ bucketVersion: number;
1356
+ excluded: boolean;
1357
+ }[];
1358
+ } | undefined;
1359
+ runToken?: string | undefined;
1360
+ visitorToken?: string | undefined;
1361
+ visitorExpiresAt?: string | undefined;
1362
+ target?: string | undefined;
1363
+ pending?: boolean | undefined;
1364
+ trialTerms?: string | undefined;
1365
+ checkout?: {
1366
+ checkoutId: string;
1367
+ url: string;
1368
+ } | null | undefined;
1369
+ price?: {
1370
+ amountCents: number;
1371
+ currency: string;
1372
+ interval: string | null;
1373
+ } | undefined;
1374
+ accepted?: boolean | undefined;
1375
+ }>;
1376
+ track: (input: Omit<Extract<FunnelRequest, {
1377
+ operation: "event";
1378
+ }>, "operation">) => Promise<{
1379
+ run?: {
1380
+ id: string;
1381
+ campaignId: string;
1382
+ versionId: string;
1383
+ document: {
1384
+ kind: "screen";
1385
+ schemaVersion: 3;
1386
+ name: string;
1387
+ surface: "popup" | "paywall" | "onboarding" | "page";
1388
+ presentation: {
1389
+ type: "modal";
1390
+ size: "sm" | "md" | "lg";
1391
+ } | {
1392
+ type: "sheet";
1393
+ size: "sm" | "md" | "lg";
1394
+ } | {
1395
+ type: "fullscreen";
1396
+ };
1397
+ theme: {
1398
+ primary: string;
1399
+ background: string;
1400
+ text: string;
1401
+ radius: "sm" | "md" | "lg" | "none" | "full";
1402
+ font: "system" | "serif" | "rounded" | "mono";
1403
+ };
1404
+ pages: {
1405
+ id: string;
1406
+ name: string;
1407
+ root: StackNode;
1408
+ theme?: {
1409
+ primary: string;
1410
+ background: string;
1411
+ text: string;
1412
+ radius: "sm" | "md" | "lg" | "none" | "full";
1413
+ font: "system" | "serif" | "rounded" | "mono";
1414
+ } | undefined;
1415
+ source?: {
1416
+ campaignId: string;
1417
+ versionId: string;
1418
+ map: Record<string, string>;
1419
+ strings?: {
1420
+ defaultLocale: string;
1421
+ locales: Record<string, Record<string, string>>;
1422
+ } | undefined;
1423
+ } | undefined;
1424
+ editorPosition?: {
1425
+ x: number;
1426
+ y: number;
1427
+ } | undefined;
1428
+ }[];
1429
+ strings: {
1430
+ defaultLocale: string;
1431
+ locales: Record<string, Record<string, string>>;
1432
+ };
1433
+ actions: ({
1434
+ type: "purchase";
1435
+ close: false;
1436
+ plan: string;
1437
+ offer: "scope" | "none";
1438
+ channel: "web" | "native";
1439
+ id: string;
1440
+ event: string;
1441
+ properties: Record<string, string | number | boolean | null>;
1442
+ picker?: string | undefined;
1443
+ } | {
1444
+ type: "navigate";
1445
+ target: string;
1446
+ close: false;
1447
+ id: string;
1448
+ event: string;
1449
+ properties: Record<string, string | number | boolean | null>;
1450
+ } | {
1451
+ type: "event";
1452
+ close: boolean;
1453
+ id: string;
1454
+ event: string;
1455
+ properties: Record<string, string | number | boolean | null>;
1456
+ } | {
1457
+ type: "close";
1458
+ close: true;
1459
+ id: string;
1460
+ event: string;
1461
+ properties: Record<string, string | number | boolean | null>;
1462
+ } | {
1463
+ type: "open_url";
1464
+ close: boolean;
1465
+ url: string;
1466
+ id: string;
1467
+ event: string;
1468
+ properties: Record<string, string | number | boolean | null>;
1469
+ } | {
1470
+ type: "claim_offer";
1471
+ close: boolean;
1472
+ couponId: string;
1473
+ id: string;
1474
+ event: string;
1475
+ properties: Record<string, string | number | boolean | null>;
1476
+ })[];
1477
+ funnel?: {
1478
+ version: 1;
1479
+ entry: string;
1480
+ questions: {
1481
+ id: string;
1482
+ source: string;
1483
+ required: boolean;
1484
+ }[];
1485
+ nodes: ({
1486
+ id: string;
1487
+ name: string;
1488
+ type: "branch";
1489
+ question: string;
1490
+ cases: {
1491
+ value: string | boolean;
1492
+ target: string;
1493
+ }[];
1494
+ fallback: string;
1495
+ editorPosition?: {
1496
+ x: number;
1497
+ y: number;
1498
+ } | undefined;
1499
+ } | {
1500
+ id: string;
1501
+ name: string;
1502
+ type: "auth";
1503
+ success: string;
1504
+ cancel: string;
1505
+ failure: string;
1506
+ editorPosition?: {
1507
+ x: number;
1508
+ y: number;
1509
+ } | undefined;
1510
+ } | {
1511
+ id: string;
1512
+ name: string;
1513
+ type: "purchase";
1514
+ planVersionId: string;
1515
+ success: string;
1516
+ cancel: string;
1517
+ failure: string;
1518
+ editorPosition?: {
1519
+ x: number;
1520
+ y: number;
1521
+ } | undefined;
1522
+ } | {
1523
+ id: string;
1524
+ name: string;
1525
+ type: "experiment";
1526
+ experimentId: string;
1527
+ revision: number;
1528
+ bucketVersion: number;
1529
+ variants: {
1530
+ id: string;
1531
+ name: string;
1532
+ weight: number;
1533
+ target: string;
1534
+ }[];
1535
+ editorPosition?: {
1536
+ x: number;
1537
+ y: number;
1538
+ } | undefined;
1539
+ } | {
1540
+ id: string;
1541
+ name: string;
1542
+ type: "complete";
1543
+ editorPosition?: {
1544
+ x: number;
1545
+ y: number;
1546
+ } | undefined;
1547
+ })[];
1548
+ routes: {
1549
+ action: string;
1550
+ target: string;
1551
+ }[];
1552
+ } | undefined;
1553
+ };
1554
+ locale: string;
1555
+ nodeId: string;
1556
+ history: string[];
1557
+ status: "completed" | "closed" | "running";
1558
+ customerId: string | null;
1559
+ expiresAt: string;
1560
+ assignments: {
1561
+ nodeId: string;
1562
+ variantId: string;
1563
+ target: string;
1564
+ experimentId: string;
1565
+ revision: number;
1566
+ bucketVersion: number;
1567
+ excluded: boolean;
1568
+ }[];
1569
+ } | undefined;
1570
+ runToken?: string | undefined;
1571
+ visitorToken?: string | undefined;
1572
+ visitorExpiresAt?: string | undefined;
1573
+ target?: string | undefined;
1574
+ pending?: boolean | undefined;
1575
+ trialTerms?: string | undefined;
1576
+ checkout?: {
1577
+ checkoutId: string;
1578
+ url: string;
1579
+ } | null | undefined;
1580
+ price?: {
1581
+ amountCents: number;
1582
+ currency: string;
1583
+ interval: string | null;
1584
+ } | undefined;
1585
+ accepted?: boolean | undefined;
1586
+ }>;
1587
+ node: (nodeId: string, outcome: Extract<FunnelRequest, {
1588
+ operation: "node";
1589
+ }>["outcome"], requestId?: string) => Promise<{
1590
+ run?: {
1591
+ id: string;
1592
+ campaignId: string;
1593
+ versionId: string;
1594
+ document: {
1595
+ kind: "screen";
1596
+ schemaVersion: 3;
1597
+ name: string;
1598
+ surface: "popup" | "paywall" | "onboarding" | "page";
1599
+ presentation: {
1600
+ type: "modal";
1601
+ size: "sm" | "md" | "lg";
1602
+ } | {
1603
+ type: "sheet";
1604
+ size: "sm" | "md" | "lg";
1605
+ } | {
1606
+ type: "fullscreen";
1607
+ };
1608
+ theme: {
1609
+ primary: string;
1610
+ background: string;
1611
+ text: string;
1612
+ radius: "sm" | "md" | "lg" | "none" | "full";
1613
+ font: "system" | "serif" | "rounded" | "mono";
1614
+ };
1615
+ pages: {
1616
+ id: string;
1617
+ name: string;
1618
+ root: StackNode;
1619
+ theme?: {
1620
+ primary: string;
1621
+ background: string;
1622
+ text: string;
1623
+ radius: "sm" | "md" | "lg" | "none" | "full";
1624
+ font: "system" | "serif" | "rounded" | "mono";
1625
+ } | undefined;
1626
+ source?: {
1627
+ campaignId: string;
1628
+ versionId: string;
1629
+ map: Record<string, string>;
1630
+ strings?: {
1631
+ defaultLocale: string;
1632
+ locales: Record<string, Record<string, string>>;
1633
+ } | undefined;
1634
+ } | undefined;
1635
+ editorPosition?: {
1636
+ x: number;
1637
+ y: number;
1638
+ } | undefined;
1639
+ }[];
1640
+ strings: {
1641
+ defaultLocale: string;
1642
+ locales: Record<string, Record<string, string>>;
1643
+ };
1644
+ actions: ({
1645
+ type: "purchase";
1646
+ close: false;
1647
+ plan: string;
1648
+ offer: "scope" | "none";
1649
+ channel: "web" | "native";
1650
+ id: string;
1651
+ event: string;
1652
+ properties: Record<string, string | number | boolean | null>;
1653
+ picker?: string | undefined;
1654
+ } | {
1655
+ type: "navigate";
1656
+ target: string;
1657
+ close: false;
1658
+ id: string;
1659
+ event: string;
1660
+ properties: Record<string, string | number | boolean | null>;
1661
+ } | {
1662
+ type: "event";
1663
+ close: boolean;
1664
+ id: string;
1665
+ event: string;
1666
+ properties: Record<string, string | number | boolean | null>;
1667
+ } | {
1668
+ type: "close";
1669
+ close: true;
1670
+ id: string;
1671
+ event: string;
1672
+ properties: Record<string, string | number | boolean | null>;
1673
+ } | {
1674
+ type: "open_url";
1675
+ close: boolean;
1676
+ url: string;
1677
+ id: string;
1678
+ event: string;
1679
+ properties: Record<string, string | number | boolean | null>;
1680
+ } | {
1681
+ type: "claim_offer";
1682
+ close: boolean;
1683
+ couponId: string;
1684
+ id: string;
1685
+ event: string;
1686
+ properties: Record<string, string | number | boolean | null>;
1687
+ })[];
1688
+ funnel?: {
1689
+ version: 1;
1690
+ entry: string;
1691
+ questions: {
1692
+ id: string;
1693
+ source: string;
1694
+ required: boolean;
1695
+ }[];
1696
+ nodes: ({
1697
+ id: string;
1698
+ name: string;
1699
+ type: "branch";
1700
+ question: string;
1701
+ cases: {
1702
+ value: string | boolean;
1703
+ target: string;
1704
+ }[];
1705
+ fallback: string;
1706
+ editorPosition?: {
1707
+ x: number;
1708
+ y: number;
1709
+ } | undefined;
1710
+ } | {
1711
+ id: string;
1712
+ name: string;
1713
+ type: "auth";
1714
+ success: string;
1715
+ cancel: string;
1716
+ failure: string;
1717
+ editorPosition?: {
1718
+ x: number;
1719
+ y: number;
1720
+ } | undefined;
1721
+ } | {
1722
+ id: string;
1723
+ name: string;
1724
+ type: "purchase";
1725
+ planVersionId: string;
1726
+ success: string;
1727
+ cancel: string;
1728
+ failure: string;
1729
+ editorPosition?: {
1730
+ x: number;
1731
+ y: number;
1732
+ } | undefined;
1733
+ } | {
1734
+ id: string;
1735
+ name: string;
1736
+ type: "experiment";
1737
+ experimentId: string;
1738
+ revision: number;
1739
+ bucketVersion: number;
1740
+ variants: {
1741
+ id: string;
1742
+ name: string;
1743
+ weight: number;
1744
+ target: string;
1745
+ }[];
1746
+ editorPosition?: {
1747
+ x: number;
1748
+ y: number;
1749
+ } | undefined;
1750
+ } | {
1751
+ id: string;
1752
+ name: string;
1753
+ type: "complete";
1754
+ editorPosition?: {
1755
+ x: number;
1756
+ y: number;
1757
+ } | undefined;
1758
+ })[];
1759
+ routes: {
1760
+ action: string;
1761
+ target: string;
1762
+ }[];
1763
+ } | undefined;
1764
+ };
1765
+ locale: string;
1766
+ nodeId: string;
1767
+ history: string[];
1768
+ status: "completed" | "closed" | "running";
1769
+ customerId: string | null;
1770
+ expiresAt: string;
1771
+ assignments: {
1772
+ nodeId: string;
1773
+ variantId: string;
1774
+ target: string;
1775
+ experimentId: string;
1776
+ revision: number;
1777
+ bucketVersion: number;
1778
+ excluded: boolean;
1779
+ }[];
1780
+ } | undefined;
1781
+ runToken?: string | undefined;
1782
+ visitorToken?: string | undefined;
1783
+ visitorExpiresAt?: string | undefined;
1784
+ target?: string | undefined;
1785
+ pending?: boolean | undefined;
1786
+ trialTerms?: string | undefined;
1787
+ checkout?: {
1788
+ checkoutId: string;
1789
+ url: string;
1790
+ } | null | undefined;
1791
+ price?: {
1792
+ amountCents: number;
1793
+ currency: string;
1794
+ interval: string | null;
1795
+ } | undefined;
1796
+ accepted?: boolean | undefined;
1797
+ }>;
1798
+ authenticate(token: string): Promise<{
1799
+ run?: {
1800
+ id: string;
1801
+ campaignId: string;
1802
+ versionId: string;
1803
+ document: {
1804
+ kind: "screen";
1805
+ schemaVersion: 3;
1806
+ name: string;
1807
+ surface: "popup" | "paywall" | "onboarding" | "page";
1808
+ presentation: {
1809
+ type: "modal";
1810
+ size: "sm" | "md" | "lg";
1811
+ } | {
1812
+ type: "sheet";
1813
+ size: "sm" | "md" | "lg";
1814
+ } | {
1815
+ type: "fullscreen";
1816
+ };
1817
+ theme: {
1818
+ primary: string;
1819
+ background: string;
1820
+ text: string;
1821
+ radius: "sm" | "md" | "lg" | "none" | "full";
1822
+ font: "system" | "serif" | "rounded" | "mono";
1823
+ };
1824
+ pages: {
1825
+ id: string;
1826
+ name: string;
1827
+ root: StackNode;
1828
+ theme?: {
1829
+ primary: string;
1830
+ background: string;
1831
+ text: string;
1832
+ radius: "sm" | "md" | "lg" | "none" | "full";
1833
+ font: "system" | "serif" | "rounded" | "mono";
1834
+ } | undefined;
1835
+ source?: {
1836
+ campaignId: string;
1837
+ versionId: string;
1838
+ map: Record<string, string>;
1839
+ strings?: {
1840
+ defaultLocale: string;
1841
+ locales: Record<string, Record<string, string>>;
1842
+ } | undefined;
1843
+ } | undefined;
1844
+ editorPosition?: {
1845
+ x: number;
1846
+ y: number;
1847
+ } | undefined;
1848
+ }[];
1849
+ strings: {
1850
+ defaultLocale: string;
1851
+ locales: Record<string, Record<string, string>>;
1852
+ };
1853
+ actions: ({
1854
+ type: "purchase";
1855
+ close: false;
1856
+ plan: string;
1857
+ offer: "scope" | "none";
1858
+ channel: "web" | "native";
1859
+ id: string;
1860
+ event: string;
1861
+ properties: Record<string, string | number | boolean | null>;
1862
+ picker?: string | undefined;
1863
+ } | {
1864
+ type: "navigate";
1865
+ target: string;
1866
+ close: false;
1867
+ id: string;
1868
+ event: string;
1869
+ properties: Record<string, string | number | boolean | null>;
1870
+ } | {
1871
+ type: "event";
1872
+ close: boolean;
1873
+ id: string;
1874
+ event: string;
1875
+ properties: Record<string, string | number | boolean | null>;
1876
+ } | {
1877
+ type: "close";
1878
+ close: true;
1879
+ id: string;
1880
+ event: string;
1881
+ properties: Record<string, string | number | boolean | null>;
1882
+ } | {
1883
+ type: "open_url";
1884
+ close: boolean;
1885
+ url: string;
1886
+ id: string;
1887
+ event: string;
1888
+ properties: Record<string, string | number | boolean | null>;
1889
+ } | {
1890
+ type: "claim_offer";
1891
+ close: boolean;
1892
+ couponId: string;
1893
+ id: string;
1894
+ event: string;
1895
+ properties: Record<string, string | number | boolean | null>;
1896
+ })[];
1897
+ funnel?: {
1898
+ version: 1;
1899
+ entry: string;
1900
+ questions: {
1901
+ id: string;
1902
+ source: string;
1903
+ required: boolean;
1904
+ }[];
1905
+ nodes: ({
1906
+ id: string;
1907
+ name: string;
1908
+ type: "branch";
1909
+ question: string;
1910
+ cases: {
1911
+ value: string | boolean;
1912
+ target: string;
1913
+ }[];
1914
+ fallback: string;
1915
+ editorPosition?: {
1916
+ x: number;
1917
+ y: number;
1918
+ } | undefined;
1919
+ } | {
1920
+ id: string;
1921
+ name: string;
1922
+ type: "auth";
1923
+ success: string;
1924
+ cancel: string;
1925
+ failure: string;
1926
+ editorPosition?: {
1927
+ x: number;
1928
+ y: number;
1929
+ } | undefined;
1930
+ } | {
1931
+ id: string;
1932
+ name: string;
1933
+ type: "purchase";
1934
+ planVersionId: string;
1935
+ success: string;
1936
+ cancel: string;
1937
+ failure: string;
1938
+ editorPosition?: {
1939
+ x: number;
1940
+ y: number;
1941
+ } | undefined;
1942
+ } | {
1943
+ id: string;
1944
+ name: string;
1945
+ type: "experiment";
1946
+ experimentId: string;
1947
+ revision: number;
1948
+ bucketVersion: number;
1949
+ variants: {
1950
+ id: string;
1951
+ name: string;
1952
+ weight: number;
1953
+ target: string;
1954
+ }[];
1955
+ editorPosition?: {
1956
+ x: number;
1957
+ y: number;
1958
+ } | undefined;
1959
+ } | {
1960
+ id: string;
1961
+ name: string;
1962
+ type: "complete";
1963
+ editorPosition?: {
1964
+ x: number;
1965
+ y: number;
1966
+ } | undefined;
1967
+ })[];
1968
+ routes: {
1969
+ action: string;
1970
+ target: string;
1971
+ }[];
1972
+ } | undefined;
1973
+ };
1974
+ locale: string;
1975
+ nodeId: string;
1976
+ history: string[];
1977
+ status: "completed" | "closed" | "running";
1978
+ customerId: string | null;
1979
+ expiresAt: string;
1980
+ assignments: {
1981
+ nodeId: string;
1982
+ variantId: string;
1983
+ target: string;
1984
+ experimentId: string;
1985
+ revision: number;
1986
+ bucketVersion: number;
1987
+ excluded: boolean;
1988
+ }[];
1989
+ } | undefined;
1990
+ runToken?: string | undefined;
1991
+ visitorToken?: string | undefined;
1992
+ visitorExpiresAt?: string | undefined;
1993
+ target?: string | undefined;
1994
+ pending?: boolean | undefined;
1995
+ trialTerms?: string | undefined;
1996
+ checkout?: {
1997
+ checkoutId: string;
1998
+ url: string;
1999
+ } | null | undefined;
2000
+ price?: {
2001
+ amountCents: number;
2002
+ currency: string;
2003
+ interval: string | null;
2004
+ } | undefined;
2005
+ accepted?: boolean | undefined;
2006
+ }>;
2007
+ identify(token: string): void;
2008
+ isAuthenticated: () => boolean;
2009
+ reset(): void;
2010
+ };
2011
+ declare function showFunnel(container: HTMLElement, options: {
2012
+ client: ReturnType<typeof createFunnelClient>;
2013
+ customerClient?: CustomerPageClient & {
2014
+ identify(token: string): void;
2015
+ };
2016
+ onAuthenticate: () => Promise<string | null>;
2017
+ onCheckout?: (checkout: {
2018
+ checkoutId: string;
2019
+ url: string;
2020
+ }) => void;
2021
+ onCreditPackCheckout?: Parameters<typeof createCustomerPageController>[2]["onCheckout"];
2022
+ onState?: (state: FunnelState, run: FunnelRun) => void;
2023
+ onError?: (error: unknown) => void;
2024
+ resume?: {
2025
+ versionId: string;
2026
+ state: FunnelState;
2027
+ };
2028
+ }): Promise<{
2029
+ destroy(): void;
2030
+ close(): Promise<void>;
2031
+ snapshot: () => {
2032
+ id: string;
2033
+ campaignId: string;
2034
+ versionId: string;
2035
+ document: {
2036
+ kind: "screen";
2037
+ schemaVersion: 3;
2038
+ name: string;
2039
+ surface: "popup" | "paywall" | "onboarding" | "page";
2040
+ presentation: {
2041
+ type: "modal";
2042
+ size: "sm" | "md" | "lg";
2043
+ } | {
2044
+ type: "sheet";
2045
+ size: "sm" | "md" | "lg";
2046
+ } | {
2047
+ type: "fullscreen";
2048
+ };
2049
+ theme: {
2050
+ primary: string;
2051
+ background: string;
2052
+ text: string;
2053
+ radius: "sm" | "md" | "lg" | "none" | "full";
2054
+ font: "system" | "serif" | "rounded" | "mono";
2055
+ };
2056
+ pages: {
2057
+ id: string;
2058
+ name: string;
2059
+ root: StackNode;
2060
+ theme?: {
2061
+ primary: string;
2062
+ background: string;
2063
+ text: string;
2064
+ radius: "sm" | "md" | "lg" | "none" | "full";
2065
+ font: "system" | "serif" | "rounded" | "mono";
2066
+ } | undefined;
2067
+ source?: {
2068
+ campaignId: string;
2069
+ versionId: string;
2070
+ map: Record<string, string>;
2071
+ strings?: {
2072
+ defaultLocale: string;
2073
+ locales: Record<string, Record<string, string>>;
2074
+ } | undefined;
2075
+ } | undefined;
2076
+ editorPosition?: {
2077
+ x: number;
2078
+ y: number;
2079
+ } | undefined;
2080
+ }[];
2081
+ strings: {
2082
+ defaultLocale: string;
2083
+ locales: Record<string, Record<string, string>>;
2084
+ };
2085
+ actions: ({
2086
+ type: "purchase";
2087
+ close: false;
2088
+ plan: string;
2089
+ offer: "scope" | "none";
2090
+ channel: "web" | "native";
2091
+ id: string;
2092
+ event: string;
2093
+ properties: Record<string, string | number | boolean | null>;
2094
+ picker?: string | undefined;
2095
+ } | {
2096
+ type: "navigate";
2097
+ target: string;
2098
+ close: false;
2099
+ id: string;
2100
+ event: string;
2101
+ properties: Record<string, string | number | boolean | null>;
2102
+ } | {
2103
+ type: "event";
2104
+ close: boolean;
2105
+ id: string;
2106
+ event: string;
2107
+ properties: Record<string, string | number | boolean | null>;
2108
+ } | {
2109
+ type: "close";
2110
+ close: true;
2111
+ id: string;
2112
+ event: string;
2113
+ properties: Record<string, string | number | boolean | null>;
2114
+ } | {
2115
+ type: "open_url";
2116
+ close: boolean;
2117
+ url: string;
2118
+ id: string;
2119
+ event: string;
2120
+ properties: Record<string, string | number | boolean | null>;
2121
+ } | {
2122
+ type: "claim_offer";
2123
+ close: boolean;
2124
+ couponId: string;
2125
+ id: string;
2126
+ event: string;
2127
+ properties: Record<string, string | number | boolean | null>;
2128
+ })[];
2129
+ funnel?: {
2130
+ version: 1;
2131
+ entry: string;
2132
+ questions: {
2133
+ id: string;
2134
+ source: string;
2135
+ required: boolean;
2136
+ }[];
2137
+ nodes: ({
2138
+ id: string;
2139
+ name: string;
2140
+ type: "branch";
2141
+ question: string;
2142
+ cases: {
2143
+ value: string | boolean;
2144
+ target: string;
2145
+ }[];
2146
+ fallback: string;
2147
+ editorPosition?: {
2148
+ x: number;
2149
+ y: number;
2150
+ } | undefined;
2151
+ } | {
2152
+ id: string;
2153
+ name: string;
2154
+ type: "auth";
2155
+ success: string;
2156
+ cancel: string;
2157
+ failure: string;
2158
+ editorPosition?: {
2159
+ x: number;
2160
+ y: number;
2161
+ } | undefined;
2162
+ } | {
2163
+ id: string;
2164
+ name: string;
2165
+ type: "purchase";
2166
+ planVersionId: string;
2167
+ success: string;
2168
+ cancel: string;
2169
+ failure: string;
2170
+ editorPosition?: {
2171
+ x: number;
2172
+ y: number;
2173
+ } | undefined;
2174
+ } | {
2175
+ id: string;
2176
+ name: string;
2177
+ type: "experiment";
2178
+ experimentId: string;
2179
+ revision: number;
2180
+ bucketVersion: number;
2181
+ variants: {
2182
+ id: string;
2183
+ name: string;
2184
+ weight: number;
2185
+ target: string;
2186
+ }[];
2187
+ editorPosition?: {
2188
+ x: number;
2189
+ y: number;
2190
+ } | undefined;
2191
+ } | {
2192
+ id: string;
2193
+ name: string;
2194
+ type: "complete";
2195
+ editorPosition?: {
2196
+ x: number;
2197
+ y: number;
2198
+ } | undefined;
2199
+ })[];
2200
+ routes: {
2201
+ action: string;
2202
+ target: string;
2203
+ }[];
2204
+ } | undefined;
2205
+ };
2206
+ locale: string;
2207
+ nodeId: string;
2208
+ history: string[];
2209
+ status: "completed" | "closed" | "running";
2210
+ customerId: string | null;
2211
+ expiresAt: string;
2212
+ assignments: {
2213
+ nodeId: string;
2214
+ variantId: string;
2215
+ target: string;
2216
+ experimentId: string;
2217
+ revision: number;
2218
+ bucketVersion: number;
2219
+ excluded: boolean;
2220
+ }[];
2221
+ };
2222
+ }>;
2223
+
2224
+ /** Browser SDK: customer token only; never configure a secret API key here. */
2225
+ declare function createGroove(options: GrooveOptions & {
2226
+ nativeCommerce?: {
2227
+ host: PurchaseHost;
2228
+ pending: PendingPurchaseStore;
2229
+ };
2230
+ }): {
2231
+ purchases: {
2232
+ identityChanged(): void;
2233
+ purchase(bindingId: string, idempotencyKey?: `${string}-${string}-${string}-${string}-${string}`): Promise<{
2234
+ state: "pending";
2235
+ intentId: string;
2236
+ result?: undefined;
2237
+ } | {
2238
+ state: "canceled";
2239
+ intentId?: undefined;
2240
+ result?: undefined;
2241
+ } | {
2242
+ state: "delivered_to_original_identity";
2243
+ intentId?: undefined;
2244
+ result?: undefined;
2245
+ } | {
2246
+ state: "result";
2247
+ result: {
2248
+ protocolVersion: 1;
2249
+ intentId: string;
2250
+ state: "pending" | "processing" | "ownership_conflict" | "rejected" | "ready" | "fulfilled";
2251
+ purchaseId: string | null;
2252
+ finishTransactionKeys: string[];
2253
+ retryAt: string | null;
2254
+ };
2255
+ intentId?: undefined;
2256
+ }>;
2257
+ recover(intentId: string, evidence: CommerceEvidence): Promise<{
2258
+ protocolVersion: 1;
2259
+ intentId: string;
2260
+ state: "pending" | "processing" | "ownership_conflict" | "rejected" | "ready" | "fulfilled";
2261
+ purchaseId: string | null;
2262
+ finishTransactionKeys: string[];
2263
+ retryAt: string | null;
2264
+ }>;
2265
+ status(intentId: string): Promise<{
2266
+ protocolVersion: 1;
2267
+ intentId: string;
2268
+ state: "pending" | "processing" | "ownership_conflict" | "rejected" | "ready" | "fulfilled";
2269
+ purchaseId: string | null;
2270
+ finishTransactionKeys: string[];
2271
+ retryAt: string | null;
2272
+ }>;
2273
+ } | null;
2274
+ readonly webViewUrl: string | undefined;
2275
+ subscribeIdentity(listener: (identified: boolean) => void): () => void;
2276
+ getPage(input: Omit<ApiInput<"getPage">, "entityId" | "cachedContentTag">): Promise<Omit<ApiOutput<"getPage">, "document" | "contentTag"> & {
2277
+ document: ScreenDocument;
2278
+ }>;
2279
+ listOfferHistory(input?: Omit<ApiInput<"listOfferHistory">, "customerId" | "entityId">): Promise<{
2280
+ requestId: string;
2281
+ scope: {
2282
+ projectId: string;
2283
+ environment: "live" | "sandbox";
2284
+ };
2285
+ offers: {
2286
+ id: string;
2287
+ couponId: string;
2288
+ status: "issued" | "redeemed" | "revoked" | "expired";
2289
+ issuedAt: string;
2290
+ expiresAt: string;
2291
+ coupon: {
2292
+ name: string;
2293
+ discount: {
2294
+ type: "percent";
2295
+ percentOff: number;
2296
+ } | {
2297
+ type: "amount";
2298
+ amountOffCents: number;
2299
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
2300
+ };
2301
+ duration: {
2302
+ type: "once";
2303
+ } | {
2304
+ type: "repeating";
2305
+ months: number;
2306
+ } | {
2307
+ type: "forever";
2308
+ };
2309
+ appliesTo: {
2310
+ type: "all";
2311
+ } | {
2312
+ type: "plans";
2313
+ planIds: string[];
2314
+ };
2315
+ };
2316
+ }[];
2317
+ nextCursor: {
2318
+ at: string;
2319
+ id: string;
2320
+ } | null;
2321
+ }>;
2322
+ getCustomerState: (input?: Omit<ApiInput<"getCustomerState">, "customerId" | "entityId">) => Promise<{
2323
+ requestId: string;
2324
+ scope: {
2325
+ projectId: string;
2326
+ environment: "live" | "sandbox";
2327
+ };
2328
+ state: {
2329
+ customerId: string;
2330
+ entityId: string | null;
2331
+ evaluatedAt: string;
2332
+ membership?: {
2333
+ customerId: string;
2334
+ evaluatedAt: string;
2335
+ holdings: {
2336
+ id: string;
2337
+ planVersionId: string;
2338
+ planId: string;
2339
+ basePlanId: string | null;
2340
+ name: string;
2341
+ group: string;
2342
+ kind: "main" | "addon";
2343
+ source: "apple" | "google" | "subscription" | "assignment" | "license";
2344
+ status: string;
2345
+ accessEnabled: boolean;
2346
+ startsAt: string | null;
2347
+ endsAt: string | null;
2348
+ cancelAtPeriodEnd: boolean;
2349
+ scheduledChange: {
2350
+ id: string;
2351
+ subscriptionId: string | null;
2352
+ targetPlanVersionId: string | null;
2353
+ action: "cancel" | "attach" | "change" | "resume" | "cancel_change";
2354
+ timing: "immediate" | "end_of_cycle";
2355
+ status: "preparing" | "payment_pending" | "scheduled" | "completed" | "canceled" | "failed";
2356
+ effectiveAt: string | null;
2357
+ createdAt: string;
2358
+ } | null;
2359
+ trial?: {
2360
+ id: string;
2361
+ planVersionId: string;
2362
+ slot: string;
2363
+ cardRequired: boolean;
2364
+ status: "expired" | "canceled" | "failed" | "pending" | "active" | "converted";
2365
+ startsAt: string | null;
2366
+ endsAt: string | null;
2367
+ createdAt: string;
2368
+ } | null | undefined;
2369
+ }[];
2370
+ changes: {
2371
+ id: string;
2372
+ subscriptionId: string | null;
2373
+ targetPlanVersionId: string | null;
2374
+ action: "cancel" | "attach" | "change" | "resume" | "cancel_change";
2375
+ timing: "immediate" | "end_of_cycle";
2376
+ status: "preparing" | "payment_pending" | "scheduled" | "completed" | "canceled" | "failed";
2377
+ effectiveAt: string | null;
2378
+ createdAt: string;
2379
+ }[];
2380
+ trials?: {
2381
+ id: string;
2382
+ planVersionId: string;
2383
+ slot: string;
2384
+ cardRequired: boolean;
2385
+ status: "expired" | "canceled" | "failed" | "pending" | "active" | "converted";
2386
+ startsAt: string | null;
2387
+ endsAt: string | null;
2388
+ createdAt: string;
2389
+ }[] | undefined;
2390
+ } | undefined;
2391
+ features?: Record<string, {
2392
+ key: string;
2393
+ name: string;
2394
+ type: "boolean" | "metered";
2395
+ allowed: boolean;
2396
+ allowance: number | null;
2397
+ used: number;
2398
+ remaining: number | null;
2399
+ }> | undefined;
2400
+ resources?: Record<string, {
2401
+ resourceKey: string;
2402
+ name: string;
2403
+ granted: string;
2404
+ available: string;
2405
+ reserved: string;
2406
+ spendable: string;
2407
+ consumedInActiveGrants: string;
2408
+ nextExpiry: {
2409
+ at: string;
2410
+ spendable: string;
2411
+ } | null;
2412
+ breakdown: {
2413
+ id: string;
2414
+ entityId: string | null;
2415
+ resourceKey: string;
2416
+ name: string;
2417
+ source: string;
2418
+ granted: string;
2419
+ available: string;
2420
+ reserved: string;
2421
+ spendable: string;
2422
+ consumed: string;
2423
+ forfeited: string;
2424
+ rolledOver: string;
2425
+ startsAt: string;
2426
+ expiresAt: string | null;
2427
+ eligible: boolean;
2428
+ rates: {
2429
+ featureKey: string;
2430
+ units: string;
2431
+ cost: string;
2432
+ tiers?: {
2433
+ upTo: string | null;
2434
+ cost: string;
2435
+ }[] | undefined;
2436
+ dimensions?: {
2437
+ key: string;
2438
+ match: Record<string, string>;
2439
+ priority: number;
2440
+ cost?: string | undefined;
2441
+ tiers?: {
2442
+ upTo: string | null;
2443
+ cost: string;
2444
+ }[] | undefined;
2445
+ }[] | undefined;
2446
+ multipliers?: {
2447
+ key: string;
2448
+ match: Record<string, string>;
2449
+ factor: string;
2450
+ add: string;
2451
+ }[] | undefined;
2452
+ }[];
2453
+ }[];
2454
+ }> | undefined;
2455
+ };
2456
+ }>;
2457
+ createCustomerStateStore(input?: Omit<ApiInput<"getCustomerState">, "customerId" | "entityId">): CustomerStateStore;
2458
+ listCustomerPlans(input?: Omit<ApiInput<"listCustomerPlans">, "customerId" | "entityId">): Promise<{
2459
+ requestId: string;
2460
+ scope: {
2461
+ projectId: string;
2462
+ environment: "live" | "sandbox";
2463
+ };
2464
+ customerId: string;
2465
+ entityId: string | null;
2466
+ evaluatedAt: string;
2467
+ plans: {
2468
+ plan: {
2469
+ projectId: string;
2470
+ environment: "live" | "sandbox";
2471
+ id: string;
2472
+ planId: string;
2473
+ variant: {
2474
+ basePlanId: string;
2475
+ baseVersionId: string;
2476
+ } | null;
2477
+ version: number;
2478
+ name: string;
2479
+ description: string;
2480
+ price: {
2481
+ amountCents: number;
2482
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
2483
+ interval: "free" | "month" | "year";
2484
+ currencyOptions?: Partial<Record<"USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON", number>> | undefined;
2485
+ };
2486
+ items: {
2487
+ type: "boolean" | "metered";
2488
+ name: string;
2489
+ key: string;
2490
+ featureId: string;
2491
+ allowance: number | null;
2492
+ pooled?: boolean | undefined;
2493
+ }[];
2494
+ publishedAt: string;
2495
+ membership?: {
2496
+ group: string;
2497
+ kind: "main" | "addon";
2498
+ } | undefined;
2499
+ trial?: {
2500
+ days: number;
2501
+ cardRequired: boolean;
2502
+ featureAllowances: Record<string, number>;
2503
+ creditAmounts: Record<string, string>;
2504
+ } | null | undefined;
2505
+ licenses?: {
2506
+ key: string;
2507
+ featureId: string;
2508
+ planVersionId: string;
2509
+ includedQuantity: number;
2510
+ maximumQuantity: number;
2511
+ unitAmountCents: number;
2512
+ stripePriceId: string | null;
2513
+ pooledResources: string[];
2514
+ requireAssignment: boolean;
2515
+ }[] | undefined;
2516
+ credits?: {
2517
+ poolVersionId: string;
2518
+ amount: string;
2519
+ reset: "month" | "lifetime";
2520
+ pooled?: boolean | undefined;
2521
+ rollover?: {
2522
+ cap: string;
2523
+ cycles: number;
2524
+ } | undefined;
2525
+ }[] | undefined;
2526
+ };
2527
+ price: {
2528
+ amountCents: number;
2529
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
2530
+ interval: "free" | "month" | "year";
2531
+ currencyOptions?: Partial<Record<"USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON", number>> | undefined;
2532
+ } | null;
2533
+ eligibility: {
2534
+ status: "current" | "scheduled" | "available" | "blocked";
2535
+ action: "attach" | "change" | null;
2536
+ direction: "new" | "upgrade" | "downgrade" | "same" | null;
2537
+ reason: "current" | "scheduled" | "available" | "pending_change" | "ambiguous_membership" | "managed_by_store" | "managed_by_payer" | "currency_unavailable";
2538
+ holdingId: string | null;
2539
+ trial: {
2540
+ eligible: boolean;
2541
+ reason: "pending" | "eligible" | "not_configured" | "already_used" | "already_subscribed" | "entity_requires_payer";
2542
+ policy: {
2543
+ days: number;
2544
+ cardRequired: boolean;
2545
+ featureAllowances: Record<string, number>;
2546
+ creditAmounts: Record<string, string>;
2547
+ } | null;
2548
+ } | null;
2549
+ };
2550
+ }[];
2551
+ }>;
2552
+ identify(token: string): void;
2553
+ reset(): void;
2554
+ listCreditPacks(input?: Omit<ApiInput<"listCreditPacks">, "customerId">): Promise<{
2555
+ requestId: string;
2556
+ scope: {
2557
+ projectId: string;
2558
+ environment: "live" | "sandbox";
2559
+ };
2560
+ packs: {
2561
+ key: string;
2562
+ name: string;
2563
+ poolVersionId: string;
2564
+ amount: string;
2565
+ amountCents: number;
2566
+ currency: "USD";
2567
+ expiresDays: number | null;
2568
+ stripePriceId: string;
2569
+ id: string;
2570
+ packId: string;
2571
+ version: number;
2572
+ }[];
2573
+ }>;
2574
+ listCreditPackOrders(input?: Omit<ApiInput<"listCreditPackOrders">, "customerId">): Promise<{
2575
+ requestId: string;
2576
+ scope: {
2577
+ projectId: string;
2578
+ environment: "live" | "sandbox";
2579
+ };
2580
+ orders: {
2581
+ id: string;
2582
+ packVersionId: string;
2583
+ name: string;
2584
+ amount: string;
2585
+ amountCents: number;
2586
+ currency: "USD";
2587
+ status: "expired" | "pending" | "created" | "paid" | "refunded" | "disputed";
2588
+ refundedCents: number;
2589
+ shortfall: string;
2590
+ at: string;
2591
+ paidAt: string | null;
2592
+ }[];
2593
+ nextCursor: {
2594
+ at: string;
2595
+ id: string;
2596
+ } | null;
2597
+ }>;
2598
+ createCreditPackCheckout(input: Omit<ApiInput<"createCreditPackCheckout">, "customerId">): Promise<{
2599
+ requestId: string;
2600
+ scope: {
2601
+ projectId: string;
2602
+ environment: "live" | "sandbox";
2603
+ };
2604
+ orderId: string;
2605
+ url: string;
2606
+ }>;
2607
+ listCreditTransactions(input?: Omit<ApiInput<"listCreditTransactions">, "customerId">): Promise<{
2608
+ requestId: string;
2609
+ scope: {
2610
+ projectId: string;
2611
+ environment: "live" | "sandbox";
2612
+ };
2613
+ transactions: {
2614
+ id: string;
2615
+ kind: string;
2616
+ featureKey: string | null;
2617
+ featureName: string | null;
2618
+ quantity: string;
2619
+ at: string;
2620
+ reason: string;
2621
+ referenceId: string | null;
2622
+ refundableQuantity: string;
2623
+ allocations: {
2624
+ balanceId: string;
2625
+ amount: string;
2626
+ pricing?: {
2627
+ dimension: string;
2628
+ cycleStart: string;
2629
+ counterKey: string;
2630
+ unitCost: string;
2631
+ units: string;
2632
+ amount: string;
2633
+ tier: number | null;
2634
+ poolVersionId: string | null;
2635
+ }[] | undefined;
2636
+ }[];
2637
+ }[];
2638
+ nextCursor: {
2639
+ at: string;
2640
+ id: string;
2641
+ } | null;
2642
+ }>;
2643
+ getBalances(): Promise<{
2644
+ customerId: string;
2645
+ entityId: string | null;
2646
+ evaluatedAt: string;
2647
+ balances: {
2648
+ id: string;
2649
+ entityId: string | null;
2650
+ resourceKey: string;
2651
+ name: string;
2652
+ source: string;
2653
+ granted: string;
2654
+ available: string;
2655
+ reserved: string;
2656
+ spendable: string;
2657
+ consumed: string;
2658
+ forfeited: string;
2659
+ rolledOver: string;
2660
+ startsAt: string;
2661
+ expiresAt: string | null;
2662
+ eligible: boolean;
2663
+ rates: {
2664
+ featureKey: string;
2665
+ units: string;
2666
+ cost: string;
2667
+ tiers?: {
2668
+ upTo: string | null;
2669
+ cost: string;
2670
+ }[] | undefined;
2671
+ dimensions?: {
2672
+ key: string;
2673
+ match: Record<string, string>;
2674
+ priority: number;
2675
+ cost?: string | undefined;
2676
+ tiers?: {
2677
+ upTo: string | null;
2678
+ cost: string;
2679
+ }[] | undefined;
2680
+ }[] | undefined;
2681
+ multipliers?: {
2682
+ key: string;
2683
+ match: Record<string, string>;
2684
+ factor: string;
2685
+ add: string;
2686
+ }[] | undefined;
2687
+ }[];
2688
+ }[];
2689
+ }>;
2690
+ checkCredits(input: Omit<ApiInput<"checkCredits">, "customerId">): Promise<{
2691
+ requestId: string;
2692
+ scope: {
2693
+ projectId: string;
2694
+ environment: "live" | "sandbox";
2695
+ };
2696
+ allowed: boolean;
2697
+ featureKey: string;
2698
+ quantity: string;
2699
+ reason: "insufficient_balance" | "feature_unavailable" | null;
2700
+ allocations: {
2701
+ balanceId: string;
2702
+ amount: string;
2703
+ units: string;
2704
+ pricing?: {
2705
+ dimension: string;
2706
+ cycleStart: string;
2707
+ counterKey: string;
2708
+ unitCost: string;
2709
+ units: string;
2710
+ amount: string;
2711
+ tier: number | null;
2712
+ poolVersionId: string | null;
2713
+ }[] | undefined;
2714
+ }[];
2715
+ }>;
2716
+ /**
2717
+ * 打开 Stripe 结账。第二个参数使用 { requestId, offerId, promotionCode }:
2718
+ * offerId 来自 listOffers / claimOffer;promotionCode 是客户在 App 里输入的优惠码,两者二选一。
2719
+ */
2720
+ refreshSurface(input: ApiInput<"refreshSurface">): Promise<{
2721
+ nodes: Record<string, {
2722
+ base: {
2723
+ text?: string | undefined;
2724
+ label?: string | undefined;
2725
+ alt?: string | undefined;
2726
+ html?: string | undefined;
2727
+ price?: {
2728
+ current: string;
2729
+ original: string | null;
2730
+ period: string;
2731
+ } | undefined;
2732
+ code?: string | undefined;
2733
+ countdownAt?: string | undefined;
2734
+ planId?: string | undefined;
2735
+ planVersionId?: string | undefined;
2736
+ currency?: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON" | undefined;
2737
+ couponId?: string | undefined;
2738
+ offerId?: string | undefined;
2739
+ unavailable?: boolean | undefined;
2740
+ unavailableReason?: string | undefined;
2741
+ missing?: string[] | undefined;
2742
+ };
2743
+ picker?: string | undefined;
2744
+ byPlan?: Record<string, {
2745
+ text?: string | undefined;
2746
+ label?: string | undefined;
2747
+ alt?: string | undefined;
2748
+ html?: string | undefined;
2749
+ price?: {
2750
+ current: string;
2751
+ original: string | null;
2752
+ period: string;
2753
+ } | undefined;
2754
+ code?: string | undefined;
2755
+ countdownAt?: string | undefined;
2756
+ planId?: string | undefined;
2757
+ planVersionId?: string | undefined;
2758
+ currency?: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON" | undefined;
2759
+ couponId?: string | undefined;
2760
+ offerId?: string | undefined;
2761
+ unavailable?: boolean | undefined;
2762
+ unavailableReason?: string | undefined;
2763
+ missing?: string[] | undefined;
2764
+ }> | undefined;
2765
+ }>;
2766
+ plans: Record<string, {
2767
+ id: string;
2768
+ versionId: string;
2769
+ name: string;
2770
+ price: string;
2771
+ period: string;
2772
+ currency?: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON" | undefined;
2773
+ }>;
2774
+ pickers: Record<string, {
2775
+ options: string[];
2776
+ selected: string | null;
2777
+ }>;
2778
+ diagnostics: {
2779
+ nodeId: string;
2780
+ message: string;
2781
+ }[];
2782
+ }>;
2783
+ purchaseSurface(input: ApiInput<"purchaseSurface">): Promise<{
2784
+ requestId: string;
2785
+ scope: {
2786
+ projectId: string;
2787
+ environment: "live" | "sandbox";
2788
+ };
2789
+ checkoutId: string | null;
2790
+ url: string | null;
2791
+ discount: {
2792
+ couponId: string;
2793
+ offerId: string | null;
2794
+ promotionCode: string | null;
2795
+ } | null;
2796
+ trial?: {
2797
+ id: string;
2798
+ planVersionId: string;
2799
+ slot: string;
2800
+ cardRequired: boolean;
2801
+ status: "expired" | "canceled" | "failed" | "pending" | "active" | "converted";
2802
+ startsAt: string | null;
2803
+ endsAt: string | null;
2804
+ createdAt: string;
2805
+ } | undefined;
2806
+ }>;
2807
+ createCheckout(planVersionId: string, options?: {
2808
+ requestId?: string;
2809
+ offerId?: string;
2810
+ promotionCode?: string;
2811
+ currency?: Currency;
2812
+ }): Promise<{
2813
+ requestId: string;
2814
+ scope: {
2815
+ projectId: string;
2816
+ environment: "live" | "sandbox";
2817
+ };
2818
+ checkoutId: string;
2819
+ url: string;
2820
+ discount: {
2821
+ couponId: string;
2822
+ offerId: string | null;
2823
+ promotionCode: string | null;
2824
+ } | null;
2825
+ }>;
2826
+ getMemberships(): Promise<{
2827
+ customerId: string;
2828
+ evaluatedAt: string;
2829
+ holdings: {
2830
+ id: string;
2831
+ planVersionId: string;
2832
+ planId: string;
2833
+ basePlanId: string | null;
2834
+ name: string;
2835
+ group: string;
2836
+ kind: "main" | "addon";
2837
+ source: "apple" | "google" | "subscription" | "assignment" | "license";
2838
+ status: string;
2839
+ accessEnabled: boolean;
2840
+ startsAt: string | null;
2841
+ endsAt: string | null;
2842
+ cancelAtPeriodEnd: boolean;
2843
+ scheduledChange: {
2844
+ id: string;
2845
+ subscriptionId: string | null;
2846
+ targetPlanVersionId: string | null;
2847
+ action: "cancel" | "attach" | "change" | "resume" | "cancel_change";
2848
+ timing: "immediate" | "end_of_cycle";
2849
+ status: "preparing" | "payment_pending" | "scheduled" | "completed" | "canceled" | "failed";
2850
+ effectiveAt: string | null;
2851
+ createdAt: string;
2852
+ } | null;
2853
+ trial?: {
2854
+ id: string;
2855
+ planVersionId: string;
2856
+ slot: string;
2857
+ cardRequired: boolean;
2858
+ status: "expired" | "canceled" | "failed" | "pending" | "active" | "converted";
2859
+ startsAt: string | null;
2860
+ endsAt: string | null;
2861
+ createdAt: string;
2862
+ } | null | undefined;
2863
+ }[];
2864
+ changes: {
2865
+ id: string;
2866
+ subscriptionId: string | null;
2867
+ targetPlanVersionId: string | null;
2868
+ action: "cancel" | "attach" | "change" | "resume" | "cancel_change";
2869
+ timing: "immediate" | "end_of_cycle";
2870
+ status: "preparing" | "payment_pending" | "scheduled" | "completed" | "canceled" | "failed";
2871
+ effectiveAt: string | null;
2872
+ createdAt: string;
2873
+ }[];
2874
+ trials?: {
2875
+ id: string;
2876
+ planVersionId: string;
2877
+ slot: string;
2878
+ cardRequired: boolean;
2879
+ status: "expired" | "canceled" | "failed" | "pending" | "active" | "converted";
2880
+ startsAt: string | null;
2881
+ endsAt: string | null;
2882
+ createdAt: string;
2883
+ }[] | undefined;
2884
+ }>;
2885
+ previewMembership(input: ApiInput<"previewMembership">): Promise<{
2886
+ action: "cancel" | "attach" | "change" | "resume" | "cancel_change";
2887
+ direction: "new" | "upgrade" | "downgrade" | "same";
2888
+ timing: "immediate" | "end_of_cycle";
2889
+ group: string;
2890
+ kind: "main" | "addon";
2891
+ currentPlanVersionId: string | null;
2892
+ targetPlanVersionId: string | null;
2893
+ effectiveAt: string;
2894
+ amountDueCents: number | null;
2895
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
2896
+ requiresCheckout: boolean;
2897
+ estimate: boolean;
2898
+ lineItems: {
2899
+ description: string;
2900
+ amountCents: number;
2901
+ }[];
2902
+ nextCycle: {
2903
+ startsAt: string | null;
2904
+ amountCents: number;
2905
+ interval: "free" | "month" | "year";
2906
+ estimate: boolean;
2907
+ } | null;
2908
+ }>;
2909
+ manageMembership(input: ApiInput<"manageMembership">): Promise<{
2910
+ requestId: string;
2911
+ scope: {
2912
+ projectId: string;
2913
+ environment: "live" | "sandbox";
2914
+ };
2915
+ changeId: string;
2916
+ status: "payment_pending" | "scheduled" | "completed";
2917
+ checkout: {
2918
+ checkoutId: string;
2919
+ url: string;
2920
+ } | null;
2921
+ effectiveAt: string | null;
2922
+ paymentUrl?: string | null | undefined;
2923
+ }>;
2924
+ getTrialEligibility(planVersionId: string): Promise<{
2925
+ eligible: boolean;
2926
+ reason: "pending" | "eligible" | "not_configured" | "already_used" | "already_subscribed" | "entity_requires_payer";
2927
+ policy: {
2928
+ days: number;
2929
+ cardRequired: boolean;
2930
+ featureAllowances: Record<string, number>;
2931
+ creditAmounts: Record<string, string>;
2932
+ } | null;
2933
+ }>;
2934
+ startTrial(input: ApiInput<"startTrial">): Promise<{
2935
+ requestId: string;
2936
+ scope: {
2937
+ projectId: string;
2938
+ environment: "live" | "sandbox";
2939
+ };
2940
+ trial: {
2941
+ id: string;
2942
+ planVersionId: string;
2943
+ slot: string;
2944
+ cardRequired: boolean;
2945
+ status: "expired" | "canceled" | "failed" | "pending" | "active" | "converted";
2946
+ startsAt: string | null;
2947
+ endsAt: string | null;
2948
+ createdAt: string;
2949
+ };
2950
+ checkout: {
2951
+ checkoutId: string;
2952
+ url: string;
2953
+ } | null;
2954
+ discount?: {
2955
+ couponId: string;
2956
+ offerId: string | null;
2957
+ promotionCode: string | null;
2958
+ } | null | undefined;
2959
+ }>;
2960
+ getSubscriptions(): Promise<{
2961
+ id: string;
2962
+ status: string;
2963
+ planVersionId: string | null;
2964
+ startsAt: string;
2965
+ endsAt: string;
2966
+ cancelAtPeriodEnd: boolean;
2967
+ accessEnabled: boolean;
2968
+ }[]>;
2969
+ /**
2970
+ * 按触发名取一个弹窗。语言提示依次是:本次调用的 locale、createGroove 的 locale、
2971
+ * 浏览器语言(自动带上);服务端还会参考客户资料里的 traits.locale。
2972
+ */
2973
+ getPopup(trigger: string, options?: {
2974
+ requestId?: string;
2975
+ locale?: string;
2976
+ currency?: Currency;
2977
+ }): Promise<PopupDelivery | null>;
2978
+ trackPopup(event: PopupTrack): Promise<void>;
2979
+ listPlans(): Promise<{
2980
+ requestId: string;
2981
+ scope: {
2982
+ projectId: string;
2983
+ environment: "live" | "sandbox";
2984
+ };
2985
+ plans: {
2986
+ projectId: string;
2987
+ environment: "live" | "sandbox";
2988
+ id: string;
2989
+ planId: string;
2990
+ variant: {
2991
+ basePlanId: string;
2992
+ baseVersionId: string;
2993
+ } | null;
2994
+ version: number;
2995
+ name: string;
2996
+ description: string;
2997
+ price: {
2998
+ amountCents: number;
2999
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
3000
+ interval: "free" | "month" | "year";
3001
+ currencyOptions?: Partial<Record<"USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON", number>> | undefined;
3002
+ };
3003
+ items: {
3004
+ type: "boolean" | "metered";
3005
+ name: string;
3006
+ key: string;
3007
+ featureId: string;
3008
+ allowance: number | null;
3009
+ pooled?: boolean | undefined;
3010
+ }[];
3011
+ publishedAt: string;
3012
+ membership?: {
3013
+ group: string;
3014
+ kind: "main" | "addon";
3015
+ } | undefined;
3016
+ trial?: {
3017
+ days: number;
3018
+ cardRequired: boolean;
3019
+ featureAllowances: Record<string, number>;
3020
+ creditAmounts: Record<string, string>;
3021
+ } | null | undefined;
3022
+ licenses?: {
3023
+ key: string;
3024
+ featureId: string;
3025
+ planVersionId: string;
3026
+ includedQuantity: number;
3027
+ maximumQuantity: number;
3028
+ unitAmountCents: number;
3029
+ stripePriceId: string | null;
3030
+ pooledResources: string[];
3031
+ requireAssignment: boolean;
3032
+ }[] | undefined;
3033
+ credits?: {
3034
+ poolVersionId: string;
3035
+ amount: string;
3036
+ reset: "month" | "lifetime";
3037
+ pooled?: boolean | undefined;
3038
+ rollover?: {
3039
+ cap: string;
3040
+ cycles: number;
3041
+ } | undefined;
3042
+ }[] | undefined;
3043
+ }[];
3044
+ }>;
3045
+ getEntitlements(): Promise<{
3046
+ requestId: string;
3047
+ scope: {
3048
+ projectId: string;
3049
+ environment: "live" | "sandbox";
3050
+ };
3051
+ customerId: string;
3052
+ evaluatedAt: string;
3053
+ status: "unknown" | "expired" | "scheduled" | "active" | "unassigned";
3054
+ validity: {
3055
+ startsAt: string;
3056
+ endsAt: string | null;
3057
+ } | null;
3058
+ planVersion: {
3059
+ projectId: string;
3060
+ environment: "live" | "sandbox";
3061
+ id: string;
3062
+ planId: string;
3063
+ variant: {
3064
+ basePlanId: string;
3065
+ baseVersionId: string;
3066
+ } | null;
3067
+ version: number;
3068
+ name: string;
3069
+ description: string;
3070
+ price: {
3071
+ amountCents: number;
3072
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
3073
+ interval: "free" | "month" | "year";
3074
+ currencyOptions?: Partial<Record<"USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON", number>> | undefined;
3075
+ };
3076
+ items: {
3077
+ type: "boolean" | "metered";
3078
+ name: string;
3079
+ key: string;
3080
+ featureId: string;
3081
+ allowance: number | null;
3082
+ pooled?: boolean | undefined;
3083
+ }[];
3084
+ publishedAt: string;
3085
+ membership?: {
3086
+ group: string;
3087
+ kind: "main" | "addon";
3088
+ } | undefined;
3089
+ trial?: {
3090
+ days: number;
3091
+ cardRequired: boolean;
3092
+ featureAllowances: Record<string, number>;
3093
+ creditAmounts: Record<string, string>;
3094
+ } | null | undefined;
3095
+ licenses?: {
3096
+ key: string;
3097
+ featureId: string;
3098
+ planVersionId: string;
3099
+ includedQuantity: number;
3100
+ maximumQuantity: number;
3101
+ unitAmountCents: number;
3102
+ stripePriceId: string | null;
3103
+ pooledResources: string[];
3104
+ requireAssignment: boolean;
3105
+ }[] | undefined;
3106
+ credits?: {
3107
+ poolVersionId: string;
3108
+ amount: string;
3109
+ reset: "month" | "lifetime";
3110
+ pooled?: boolean | undefined;
3111
+ rollover?: {
3112
+ cap: string;
3113
+ cycles: number;
3114
+ } | undefined;
3115
+ }[] | undefined;
3116
+ } | null;
3117
+ entitlements: {
3118
+ featureId: string;
3119
+ featureKey: string;
3120
+ featureName: string;
3121
+ type: "boolean" | "metered";
3122
+ allowance: number | null;
3123
+ used: number;
3124
+ remaining: number | null;
3125
+ allowed: boolean;
3126
+ sources?: {
3127
+ holdingId: string;
3128
+ planVersionId: string;
3129
+ group: string;
3130
+ kind: "main" | "addon";
3131
+ allowance: number | null;
3132
+ }[] | undefined;
3133
+ }[];
3134
+ holdings?: {
3135
+ id: string;
3136
+ planVersionId: string;
3137
+ source: "subscription" | "assignment" | "license" | "license_pool" | "entity_pool";
3138
+ }[] | undefined;
3139
+ }>;
3140
+ /** 当前客户还能用的优惠(已领取、未使用、未过期)。 */
3141
+ listOffers(): Promise<Offer[]>;
3142
+ /**
3143
+ * 领取弹窗里 claim_offer 按钮对应的优惠。通常不需要直接调用:showRemotePopup 会在按钮点击后
3144
+ * 自动领取,并通过 onEvent 的 { type: "offer" } 事件返回结果。
3145
+ */
3146
+ claimOffer(input: {
3147
+ deliveryId: string;
3148
+ actionId: string;
3149
+ couponId: string;
3150
+ requestId?: string;
3151
+ }): Promise<{
3152
+ offer: {
3153
+ id: string;
3154
+ couponId: string;
3155
+ status: "issued" | "redeemed" | "revoked" | "expired";
3156
+ issuedAt: string;
3157
+ expiresAt: string;
3158
+ coupon: {
3159
+ name: string;
3160
+ discount: {
3161
+ type: "percent";
3162
+ percentOff: number;
3163
+ } | {
3164
+ type: "amount";
3165
+ amountOffCents: number;
3166
+ currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
3167
+ };
3168
+ duration: {
3169
+ type: "once";
3170
+ } | {
3171
+ type: "repeating";
3172
+ months: number;
3173
+ } | {
3174
+ type: "forever";
3175
+ };
3176
+ appliesTo: {
3177
+ type: "all";
3178
+ } | {
3179
+ type: "plans";
3180
+ planIds: string[];
3181
+ };
3182
+ };
3183
+ } | null;
3184
+ reason: "inactive" | "outside_window" | "not_targeted" | "not_first_purchase" | "limit_reached" | "sold_out" | null;
3185
+ }>;
3186
+ };
3187
+
3188
+ export { type CustomerPageData as C, type FunnelState as F, type Offer as O, type PopupEvent as P, type CustomerPageClient as a, createCustomerPageController as b, createGroove as c, type CustomerDataIntent as d, type CustomerPageController as e, formatCustomerDecimal as f, type CustomerPlanEligibility as g, type CustomerResource as h, type CustomerState as i, type CustomerStateSnapshot as j, type CustomerStateStore as k, type OfferUnavailableReason as l, type PendingPurchaseStore as m, type PurchaseHost as n, type PurchaseTicketTransport as o, createFunnelClient as p, createPurchaseHostClient as q, createPurchaseTicketTransport as r, formatCouponDiscount as s, formatCouponMoney as t, formatCouponTerms as u, showFunnel as v };