@tinkerlandai/longplay-sdk 0.0.0-stage → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/README.md +485 -2
  3. package/README.zh-CN.md +375 -0
  4. package/THIRD_PARTY_NOTICES.md +101 -0
  5. package/dist/ai-usage-Btwg1nD7.d.ts +247 -0
  6. package/dist/api-5gAz4-Sb.d.ts +16897 -0
  7. package/dist/chunk-2HFA34QO.js +6 -0
  8. package/dist/chunk-7DXL3LHT.js +1 -0
  9. package/dist/chunk-ACF2FBUB.js +1 -0
  10. package/dist/chunk-CLXORAOK.js +1 -0
  11. package/dist/chunk-DSPLGTQI.js +1 -0
  12. package/dist/chunk-EARSGITJ.js +1 -0
  13. package/dist/chunk-G56XGVMS.js +1 -0
  14. package/dist/chunk-HOW7NIIR.js +1 -0
  15. package/dist/chunk-JB46ZKGZ.js +1 -0
  16. package/dist/chunk-KBM7BYQY.js +1 -0
  17. package/dist/chunk-MRN4HP4W.js +1 -0
  18. package/dist/chunk-RE6BIFLN.js +2 -0
  19. package/dist/chunk-SBPTOOYB.js +1 -0
  20. package/dist/chunk-SSLZKIIU.js +1 -0
  21. package/dist/chunk-VMM3GA3L.js +4 -0
  22. package/dist/chunk-VOEFXEPP.js +1 -0
  23. package/dist/chunk-X6BCUINI.js +173 -0
  24. package/dist/chunk-XSVQHPQT.js +17 -0
  25. package/dist/chunk-YQHPEP4X.js +1 -0
  26. package/dist/chunk-ZPZVSC4J.js +1 -0
  27. package/dist/configuration-sync-CywDxRkX.d.ts +1698 -0
  28. package/dist/content-NYMIZRNR.js +1 -0
  29. package/dist/coupon-fA1QujHt.d.ts +184 -0
  30. package/dist/customer-page-km5f1PJZ.d.ts +480 -0
  31. package/dist/funnel-local-client-CVokI0rx.d.ts +46997 -0
  32. package/dist/funnel-node-evaluation-P5B4fPfJ.d.ts +2054 -0
  33. package/dist/funnel-resource-client-Cv5OjfAn.d.ts +14525 -0
  34. package/dist/funnel-runtime-host-UL4DEJDU.js +1 -0
  35. package/dist/growth-rules-B4YYy64R.d.ts +173 -0
  36. package/dist/index.d.ts +23545 -0
  37. package/dist/index.js +1 -0
  38. package/dist/native-shell.d.ts +4 -0
  39. package/dist/native-shell.js +1 -0
  40. package/dist/openrouter.d.ts +43 -0
  41. package/dist/openrouter.js +1 -0
  42. package/dist/page.d.ts +134 -0
  43. package/dist/page.js +1 -0
  44. package/dist/paywall-EJCNWDHK.js +1 -0
  45. package/dist/popup.d.ts +191 -0
  46. package/dist/popup.js +1 -0
  47. package/dist/react-native.d.ts +36701 -0
  48. package/dist/react-native.js +1 -0
  49. package/dist/screen-D81zCpfi.d.ts +3000 -0
  50. package/dist/screen-renderer-JMHV4GPP.js +1 -0
  51. package/dist/server.d.ts +7073 -0
  52. package/dist/server.js +1 -0
  53. package/dist/visual-dom-DQLPBZ2Z.js +1 -0
  54. package/dist/visual.d.ts +87 -0
  55. package/dist/visual.js +1 -0
  56. package/package.json +90 -3
@@ -0,0 +1,1698 @@
1
+ import { z } from 'zod';
2
+ import { S as StackNode } from './screen-D81zCpfi.js';
3
+
4
+ declare const configurationScopeSchema: z.ZodObject<{
5
+ projectId: z.ZodString;
6
+ environment: z.ZodEnum<{
7
+ sandbox: "sandbox";
8
+ live: "live";
9
+ }>;
10
+ environmentId: z.ZodUUID;
11
+ }, z.core.$strict>;
12
+ declare const sdkConfigurationManifestSchema: z.ZodObject<{
13
+ kind: z.ZodLiteral<"sdk_configuration">;
14
+ schemaVersion: z.ZodLiteral<1>;
15
+ scope: z.ZodObject<{
16
+ projectId: z.ZodString;
17
+ environment: z.ZodEnum<{
18
+ sandbox: "sandbox";
19
+ live: "live";
20
+ }>;
21
+ environmentId: z.ZodUUID;
22
+ }, z.core.$strict>;
23
+ revision: z.ZodNumber;
24
+ generation: z.ZodString;
25
+ policy: z.ZodObject<{
26
+ refreshIntervalSeconds: z.ZodNumber;
27
+ maxControlAgeSeconds: z.ZodNumber;
28
+ }, z.core.$strict>;
29
+ gb: z.ZodObject<{
30
+ features: z.ZodNullable<z.ZodString>;
31
+ pageExperiments: z.ZodNullable<z.ZodString>;
32
+ }, z.core.$strict>;
33
+ artifacts: z.ZodRecord<z.ZodString, z.ZodObject<{
34
+ kind: z.ZodEnum<{
35
+ paywall: "paywall";
36
+ funnel: "funnel";
37
+ gb_features: "gb_features";
38
+ gb_page_experiments: "gb_page_experiments";
39
+ }>;
40
+ formatVersion: z.ZodNumber;
41
+ url: z.ZodString;
42
+ sha256: z.ZodString;
43
+ byteLength: z.ZodNumber;
44
+ generation: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strict>>;
46
+ funnels: z.ZodRecord<z.ZodUUID, z.ZodObject<{
47
+ state: z.ZodEnum<{
48
+ active: "active";
49
+ paused: "paused";
50
+ archived: "archived";
51
+ }>;
52
+ controlRevision: z.ZodNumber;
53
+ evaluationMode: z.ZodEnum<{
54
+ local: "local";
55
+ remote: "remote";
56
+ }>;
57
+ evaluationRevision: z.ZodNumber;
58
+ currentVersionId: z.ZodUUID;
59
+ versions: z.ZodRecord<z.ZodUUID, z.ZodObject<{
60
+ artifact: z.ZodString;
61
+ dependencies: z.ZodObject<{
62
+ features: z.ZodArray<z.ZodString>;
63
+ experiments: z.ZodRecord<z.ZodUUID, z.ZodArray<z.ZodString>>;
64
+ savedGroups: z.ZodArray<z.ZodString>;
65
+ }, z.core.$strict>;
66
+ definitionDigest: z.ZodOptional<z.ZodString>;
67
+ couponDigests: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodString>>;
68
+ }, z.core.$strict>>;
69
+ }, z.core.$strict>>;
70
+ paywalls: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
71
+ state: z.ZodEnum<{
72
+ archived: "archived";
73
+ published: "published";
74
+ }>;
75
+ controlRevision: z.ZodNumber;
76
+ currentVersionId: z.ZodUUID;
77
+ versions: z.ZodRecord<z.ZodUUID, z.ZodObject<{
78
+ version: z.ZodNumber;
79
+ artifact: z.ZodString;
80
+ sourceDigest: z.ZodString;
81
+ }, z.core.$strict>>;
82
+ }, z.core.$strict>>>;
83
+ }, z.core.$strict>;
84
+ type SdkConfigurationManifest = z.infer<typeof sdkConfigurationManifestSchema>;
85
+ type ConfigurationScope = z.infer<typeof configurationScopeSchema>;
86
+
87
+ type ConfigurationStorage = {
88
+ getItem(key: string): string | null | Promise<string | null>;
89
+ setItem(key: string, value: string): void | Promise<void>;
90
+ };
91
+
92
+ type ConfigurationSyncOptions = {
93
+ /** Public configuration origin; defaults to https://api.longplayai.com. */
94
+ origin?: string;
95
+ scope: ConfigurationScope;
96
+ fetch?: typeof globalThis.fetch;
97
+ storage?: ConfigurationStorage | null;
98
+ assetOrigins?: string[];
99
+ onError?: (error: unknown) => void;
100
+ };
101
+ type Manifest = SdkConfigurationManifest;
102
+ type Listener = () => void;
103
+ /** Public configuration only. No credential, Customer state, accepted visit or business command lives here. */
104
+ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
105
+ scope: Readonly<{
106
+ projectId: string;
107
+ environment: "sandbox" | "live";
108
+ environmentId: string;
109
+ }>;
110
+ refresh: () => Promise<Manifest>;
111
+ subscribe: (listener: Listener) => () => void;
112
+ assertFresh: () => void;
113
+ assertFeatures(generation?: string): void;
114
+ readonly fresh: boolean;
115
+ readonly snapshot: {
116
+ kind: "sdk_configuration";
117
+ schemaVersion: 1;
118
+ scope: {
119
+ projectId: string;
120
+ environment: "sandbox" | "live";
121
+ environmentId: string;
122
+ };
123
+ revision: number;
124
+ generation: string;
125
+ policy: {
126
+ refreshIntervalSeconds: number;
127
+ maxControlAgeSeconds: number;
128
+ };
129
+ gb: {
130
+ features: string | null;
131
+ pageExperiments: string | null;
132
+ };
133
+ artifacts: Record<string, {
134
+ kind: "paywall" | "funnel" | "gb_features" | "gb_page_experiments";
135
+ formatVersion: number;
136
+ url: string;
137
+ sha256: string;
138
+ byteLength: number;
139
+ generation?: string | undefined;
140
+ }>;
141
+ funnels: Record<string, {
142
+ state: "active" | "paused" | "archived";
143
+ controlRevision: number;
144
+ evaluationMode: "local" | "remote";
145
+ evaluationRevision: number;
146
+ currentVersionId: string;
147
+ versions: Record<string, {
148
+ artifact: string;
149
+ dependencies: {
150
+ features: string[];
151
+ experiments: Record<string, string[]>;
152
+ savedGroups: string[];
153
+ };
154
+ definitionDigest?: string | undefined;
155
+ couponDigests?: Record<string, string> | undefined;
156
+ }>;
157
+ }>;
158
+ paywalls?: Record<string, {
159
+ state: "archived" | "published";
160
+ controlRevision: number;
161
+ currentVersionId: string;
162
+ versions: Record<string, {
163
+ version: number;
164
+ artifact: string;
165
+ sourceDigest: string;
166
+ }>;
167
+ }> | undefined;
168
+ } | null;
169
+ readonly remainingMs: number;
170
+ features(): Promise<{
171
+ evaluatedAt: string;
172
+ expiresAt: string;
173
+ scope: {
174
+ projectId: string;
175
+ environment: "sandbox" | "live";
176
+ };
177
+ features: Record<string, {
178
+ defaultValue?: z.core.util.JSONType | undefined;
179
+ rules?: {
180
+ id?: string | undefined;
181
+ force?: z.core.util.JSONType | undefined;
182
+ variations?: z.core.util.JSONType[] | undefined;
183
+ key?: string | undefined;
184
+ range?: [number, number] | undefined;
185
+ tracks?: {
186
+ experiment: {
187
+ key: string;
188
+ variations: [z.core.util.JSONType, z.core.util.JSONType, ...z.core.util.JSONType[]];
189
+ urlPatterns?: {
190
+ include: boolean;
191
+ type: "regex" | "simple";
192
+ pattern: string;
193
+ }[] | undefined;
194
+ force?: number | undefined;
195
+ active?: boolean | undefined;
196
+ persistQueryString?: boolean | undefined;
197
+ condition?: Record<string, z.core.util.JSONType> | undefined;
198
+ parentConditions?: {
199
+ id: string;
200
+ condition: Record<string, z.core.util.JSONType>;
201
+ gate?: boolean | undefined;
202
+ }[] | undefined;
203
+ weights?: number[] | undefined;
204
+ coverage?: number | undefined;
205
+ hashAttribute?: string | undefined;
206
+ fallbackAttribute?: string | undefined;
207
+ hashVersion?: 2 | undefined;
208
+ disableStickyBucketing?: boolean | undefined;
209
+ bucketVersion?: number | undefined;
210
+ minBucketVersion?: number | undefined;
211
+ filters?: {
212
+ seed: string;
213
+ hashVersion: 2;
214
+ ranges: [number, number][];
215
+ attribute?: string | undefined;
216
+ }[] | undefined;
217
+ ranges?: [number, number][] | undefined;
218
+ meta?: {
219
+ key?: string | undefined;
220
+ name?: string | undefined;
221
+ passthrough?: boolean | undefined;
222
+ }[] | undefined;
223
+ seed?: string | undefined;
224
+ name?: string | undefined;
225
+ phase?: string | undefined;
226
+ };
227
+ result: {
228
+ value: z.core.util.JSONType;
229
+ variationId: number;
230
+ key: string;
231
+ inExperiment: boolean;
232
+ hashAttribute: string;
233
+ hashValue: string;
234
+ featureId: string | null;
235
+ name?: string | undefined;
236
+ bucket?: number | undefined;
237
+ passthrough?: boolean | undefined;
238
+ hashUsed?: boolean | undefined;
239
+ stickyBucketUsed?: boolean | undefined;
240
+ };
241
+ }[] | undefined;
242
+ condition?: Record<string, z.core.util.JSONType> | undefined;
243
+ parentConditions?: {
244
+ id: string;
245
+ condition: Record<string, z.core.util.JSONType>;
246
+ gate?: boolean | undefined;
247
+ }[] | undefined;
248
+ weights?: number[] | undefined;
249
+ coverage?: number | undefined;
250
+ hashAttribute?: string | undefined;
251
+ fallbackAttribute?: string | undefined;
252
+ hashVersion?: 2 | undefined;
253
+ disableStickyBucketing?: boolean | undefined;
254
+ bucketVersion?: number | undefined;
255
+ minBucketVersion?: number | undefined;
256
+ filters?: {
257
+ seed: string;
258
+ hashVersion: 2;
259
+ ranges: [number, number][];
260
+ attribute?: string | undefined;
261
+ }[] | undefined;
262
+ ranges?: [number, number][] | undefined;
263
+ meta?: {
264
+ key?: string | undefined;
265
+ name?: string | undefined;
266
+ passthrough?: boolean | undefined;
267
+ }[] | undefined;
268
+ seed?: string | undefined;
269
+ name?: string | undefined;
270
+ phase?: string | undefined;
271
+ }[] | undefined;
272
+ }>;
273
+ generation: string;
274
+ savedGroups: Record<string, {
275
+ type: "hashed";
276
+ attributeKey: string;
277
+ values: string[];
278
+ } | {
279
+ type: "list";
280
+ attributeKey: string;
281
+ values: (string | number)[];
282
+ } | {
283
+ type: "condition";
284
+ condition: Record<string, z.core.util.JSONType>;
285
+ }>;
286
+ experiments: Record<string, {
287
+ key: string;
288
+ variations: [z.core.util.JSONType, z.core.util.JSONType, ...z.core.util.JSONType[]];
289
+ urlPatterns?: {
290
+ include: boolean;
291
+ type: "regex" | "simple";
292
+ pattern: string;
293
+ }[] | undefined;
294
+ force?: number | undefined;
295
+ active?: boolean | undefined;
296
+ persistQueryString?: boolean | undefined;
297
+ condition?: Record<string, z.core.util.JSONType> | undefined;
298
+ parentConditions?: {
299
+ id: string;
300
+ condition: Record<string, z.core.util.JSONType>;
301
+ gate?: boolean | undefined;
302
+ }[] | undefined;
303
+ weights?: number[] | undefined;
304
+ coverage?: number | undefined;
305
+ hashAttribute?: string | undefined;
306
+ fallbackAttribute?: string | undefined;
307
+ hashVersion?: 2 | undefined;
308
+ disableStickyBucketing?: boolean | undefined;
309
+ bucketVersion?: number | undefined;
310
+ minBucketVersion?: number | undefined;
311
+ filters?: {
312
+ seed: string;
313
+ hashVersion: 2;
314
+ ranges: [number, number][];
315
+ attribute?: string | undefined;
316
+ }[] | undefined;
317
+ ranges?: [number, number][] | undefined;
318
+ meta?: {
319
+ key?: string | undefined;
320
+ name?: string | undefined;
321
+ passthrough?: boolean | undefined;
322
+ }[] | undefined;
323
+ seed?: string | undefined;
324
+ name?: string | undefined;
325
+ phase?: string | undefined;
326
+ }>;
327
+ analyticsConfig: {
328
+ eventsEnabled: boolean;
329
+ experimentViewsEnabled: boolean;
330
+ featureUsageEnabled: boolean;
331
+ };
332
+ remoteFeatures: string[];
333
+ }>;
334
+ pageExperiments: () => Promise<{
335
+ environmentId: string;
336
+ trackExposures: boolean;
337
+ generation: string;
338
+ experiments: {
339
+ key: string;
340
+ changeId: string;
341
+ variations: {
342
+ urlRedirect: string;
343
+ }[];
344
+ name?: string | undefined;
345
+ phase?: string | undefined;
346
+ filters?: {
347
+ seed: string;
348
+ hashVersion: 2;
349
+ ranges: [number, number][];
350
+ attribute?: string | undefined;
351
+ }[] | undefined;
352
+ condition?: Record<string, z.core.util.JSONType> | undefined;
353
+ force?: number | undefined;
354
+ hashAttribute?: string | undefined;
355
+ seed?: string | undefined;
356
+ hashVersion?: 2 | undefined;
357
+ ranges?: [number, number][] | undefined;
358
+ urlPatterns?: {
359
+ include: boolean;
360
+ type: "regex" | "simple";
361
+ pattern: string;
362
+ }[] | undefined;
363
+ persistQueryString?: boolean | undefined;
364
+ parentConditions?: {
365
+ id: string;
366
+ condition: Record<string, z.core.util.JSONType>;
367
+ gate?: boolean | undefined;
368
+ }[] | undefined;
369
+ weights?: number[] | undefined;
370
+ coverage?: number | undefined;
371
+ fallbackAttribute?: string | undefined;
372
+ disableStickyBucketing?: boolean | undefined;
373
+ bucketVersion?: number | undefined;
374
+ minBucketVersion?: number | undefined;
375
+ meta?: {
376
+ key?: string | undefined;
377
+ name?: string | undefined;
378
+ passthrough?: boolean | undefined;
379
+ }[] | undefined;
380
+ }[];
381
+ savedGroups: Record<string, {
382
+ type: "hashed";
383
+ attributeKey: string;
384
+ values: string[];
385
+ } | {
386
+ type: "list";
387
+ attributeKey: string;
388
+ values: (string | number)[];
389
+ } | {
390
+ type: "condition";
391
+ condition: Record<string, z.core.util.JSONType>;
392
+ }>;
393
+ }>;
394
+ funnel: (funnelId: string, versionId?: string) => Promise<{
395
+ document: {
396
+ graph: {
397
+ version: 5;
398
+ entry: string;
399
+ nodes: ({
400
+ type: "entry";
401
+ next: string;
402
+ id: string;
403
+ name: string;
404
+ triggers?: {
405
+ id: string;
406
+ name: string;
407
+ client: string;
408
+ source: {
409
+ versionId: string;
410
+ manifestDigest: string;
411
+ sourceGraphDigest: string;
412
+ pageKey: string;
413
+ stateKey: string;
414
+ documentKey: string;
415
+ documentHash: string;
416
+ elementKey?: string | undefined;
417
+ nodeId?: string | undefined;
418
+ contentHash?: string | undefined;
419
+ renderKey?: string | undefined;
420
+ };
421
+ event: "screen_enter" | "button_click";
422
+ cooldownSeconds: number;
423
+ behavior: "observe";
424
+ }[] | undefined;
425
+ position?: {
426
+ x: number;
427
+ y: number;
428
+ } | undefined;
429
+ } | {
430
+ type: "screen";
431
+ screenId: string;
432
+ presentation: {
433
+ type: "modal";
434
+ size: "sm" | "md" | "lg";
435
+ } | {
436
+ type: "sheet";
437
+ size: "sm" | "md" | "lg";
438
+ } | {
439
+ type: "fullscreen";
440
+ } | {
441
+ type: "inline";
442
+ };
443
+ outputs: Record<string, string>;
444
+ id: string;
445
+ name: string;
446
+ offering?: {
447
+ source: "variable";
448
+ key: string;
449
+ } | {
450
+ source: "fixed";
451
+ versionId: string;
452
+ } | undefined;
453
+ position?: {
454
+ x: number;
455
+ y: number;
456
+ } | undefined;
457
+ } | {
458
+ type: "offering";
459
+ configuration: {
460
+ source: "fixed";
461
+ versionId: string;
462
+ } | {
463
+ source: "feature";
464
+ featureKey: string;
465
+ };
466
+ writes: {
467
+ value: string;
468
+ };
469
+ next: string;
470
+ id: string;
471
+ name: string;
472
+ position?: {
473
+ x: number;
474
+ y: number;
475
+ } | undefined;
476
+ } | {
477
+ type: "coupon";
478
+ couponId: string;
479
+ writes: {
480
+ value: string;
481
+ };
482
+ next: string;
483
+ id: string;
484
+ name: string;
485
+ position?: {
486
+ x: number;
487
+ y: number;
488
+ } | undefined;
489
+ } | {
490
+ type: "coupons";
491
+ couponIds: string[];
492
+ writes: {
493
+ value: string;
494
+ };
495
+ next: string;
496
+ id: string;
497
+ name: string;
498
+ position?: {
499
+ x: number;
500
+ y: number;
501
+ } | undefined;
502
+ } | {
503
+ type: "output";
504
+ value: {
505
+ type: "bundle";
506
+ coupons: {
507
+ source: "literal";
508
+ value: z.core.util.JSONType;
509
+ } | {
510
+ source: "variable";
511
+ key: string;
512
+ path?: string | undefined;
513
+ };
514
+ data: {
515
+ source: "literal";
516
+ value: z.core.util.JSONType;
517
+ } | {
518
+ source: "variable";
519
+ key: string;
520
+ path?: string | undefined;
521
+ };
522
+ paywall?: {
523
+ source: "literal";
524
+ value: z.core.util.JSONType;
525
+ } | {
526
+ source: "variable";
527
+ key: string;
528
+ path?: string | undefined;
529
+ } | undefined;
530
+ offering?: {
531
+ source: "literal";
532
+ value: z.core.util.JSONType;
533
+ } | {
534
+ source: "variable";
535
+ key: string;
536
+ path?: string | undefined;
537
+ } | undefined;
538
+ } | {
539
+ type: "literal";
540
+ value: z.core.util.JSONType;
541
+ } | {
542
+ type: "variable";
543
+ key: string;
544
+ path?: string | undefined;
545
+ } | {
546
+ type: "feature";
547
+ featureKey: string;
548
+ } | {
549
+ type: "selection";
550
+ screenId: string;
551
+ offeringKey: string;
552
+ };
553
+ id: string;
554
+ name: string;
555
+ position?: {
556
+ x: number;
557
+ y: number;
558
+ } | undefined;
559
+ } | {
560
+ type: "condition";
561
+ cases: {
562
+ condition: Record<string, z.core.util.JSONType>;
563
+ target: string;
564
+ }[];
565
+ default: string;
566
+ id: string;
567
+ name: string;
568
+ position?: {
569
+ x: number;
570
+ y: number;
571
+ } | undefined;
572
+ } | {
573
+ type: "feature";
574
+ featureKey: string;
575
+ writes: {
576
+ value: string;
577
+ };
578
+ next: string;
579
+ id: string;
580
+ name: string;
581
+ position?: {
582
+ x: number;
583
+ y: number;
584
+ } | undefined;
585
+ } | {
586
+ type: "split";
587
+ experimentId: string;
588
+ routes: Record<string, string>;
589
+ notParticipating: string;
590
+ id: string;
591
+ name: string;
592
+ applyPageExperiment?: true | undefined;
593
+ position?: {
594
+ x: number;
595
+ y: number;
596
+ } | undefined;
597
+ } | {
598
+ execution: {
599
+ maxAttempts: number;
600
+ retryDelaySeconds: number;
601
+ backoff: "fixed" | "exponential";
602
+ requestTimeoutSeconds: number;
603
+ timeoutSeconds: number;
604
+ };
605
+ action: {
606
+ type: "external_task";
607
+ endpointId: string;
608
+ taskKey: string;
609
+ inputs: Record<string, {
610
+ source: "literal";
611
+ value: z.core.util.JSONType;
612
+ } | {
613
+ source: "variable";
614
+ key: string;
615
+ path?: string | undefined;
616
+ }>;
617
+ outputs: Record<string, "string" | "number" | "boolean" | "strings">;
618
+ } | {
619
+ type: "claim_offer";
620
+ coupon: {
621
+ source: "literal";
622
+ value: z.core.util.JSONType;
623
+ } | {
624
+ source: "variable";
625
+ key: string;
626
+ path?: string | undefined;
627
+ };
628
+ } | {
629
+ type: "event";
630
+ event: string;
631
+ } | {
632
+ type: "api";
633
+ operation: "update" | "refund" | "sendMessage" | "readBalanceSource" | "adjustBalance" | "readUsage" | "setUsage" | "manageBalanceGrant" | "listBalanceGrants" | "restoreNativePurchase" | "setupPayment" | "readPaymentSetup" | "verifySubscriptions" | "previewAttach" | "attach" | "readSubscriptionOperation" | "previewUpdate" | "readSubscriptionUpdate" | "previewRefund" | "readRefund" | "readBillingControls" | "prepareBillingAuthorization" | "confirmBillingAuthorization" | "setBillingCoupons" | "revokeBillingAuthorization" | "listBillingInvoices" | "confirmBillingAdjustment" | "manageBillingLimits" | "manageUsageEntity" | "readUsageAnalytics" | "readCreditAnalytics" | "submitUsageBatch" | "readUsageBatch" | "checkEntitlement" | "resolveOffering" | "readHoldings" | "readLedger" | "readBillingInvoice" | "readCreditStatement" | "quoteBalance" | "trackUsage" | "mutateBalance" | "redeemReward" | "createReferralCode" | "claimRewardProduct" | "readSeats" | "manageSeat" | "redeemCoupon" | "listOffers" | "grantOffer";
634
+ inputs: Record<string, {
635
+ source: "literal";
636
+ value: z.core.util.JSONType;
637
+ } | {
638
+ source: "variable";
639
+ key: string;
640
+ path?: string | undefined;
641
+ }>;
642
+ outputs: Record<string, {
643
+ path: string;
644
+ type: "string" | "number" | "boolean" | "strings";
645
+ nullable?: boolean | undefined;
646
+ aggregation?: "count" | "exists" | undefined;
647
+ where?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
648
+ }>;
649
+ };
650
+ success: string;
651
+ cancel: string;
652
+ unavailable: string;
653
+ failure: string;
654
+ type: "action";
655
+ id: string;
656
+ name: string;
657
+ writes?: Record<string, string> | undefined;
658
+ position?: {
659
+ x: number;
660
+ y: number;
661
+ } | undefined;
662
+ } | {
663
+ type: "external_page";
664
+ url: string;
665
+ openIn: "same_window" | "new_window";
666
+ opened: string;
667
+ failed: string;
668
+ id: string;
669
+ name: string;
670
+ appManifest?: {
671
+ versionId: string;
672
+ manifestDigest: string;
673
+ sourceGraphDigest: string;
674
+ pageKey: string;
675
+ stateKey: string;
676
+ documentKey: string;
677
+ documentHash: string;
678
+ elementKey?: string | undefined;
679
+ nodeId?: string | undefined;
680
+ contentHash?: string | undefined;
681
+ renderKey?: string | undefined;
682
+ } | undefined;
683
+ position?: {
684
+ x: number;
685
+ y: number;
686
+ } | undefined;
687
+ } | {
688
+ type: "end";
689
+ outcome: "failed" | "completed" | "closed" | "ineligible";
690
+ id: string;
691
+ name: string;
692
+ output?: {
693
+ type: "literal";
694
+ value: z.core.util.JSONType;
695
+ } | {
696
+ type: "variable";
697
+ key: string;
698
+ path?: string | undefined;
699
+ } | {
700
+ type: "feature";
701
+ featureKey: string;
702
+ } | undefined;
703
+ position?: {
704
+ x: number;
705
+ y: number;
706
+ } | undefined;
707
+ } | {
708
+ type: "wait";
709
+ wait: {
710
+ type: "duration";
711
+ delaySeconds: number;
712
+ elapsed: string;
713
+ } | {
714
+ type: "event";
715
+ eventName: string;
716
+ outputs: Record<string, "string" | "number" | "boolean" | "strings">;
717
+ timeoutSeconds: number;
718
+ received: string;
719
+ timeout: string;
720
+ };
721
+ id: string;
722
+ name: string;
723
+ writes?: Record<string, string> | undefined;
724
+ position?: {
725
+ x: number;
726
+ y: number;
727
+ } | undefined;
728
+ })[];
729
+ };
730
+ displayName: string;
731
+ kind: "funnel";
732
+ schemaVersion: 4;
733
+ screens: ({
734
+ id: string;
735
+ type: "owned";
736
+ document: {
737
+ kind: "screen";
738
+ schemaVersion: 4;
739
+ name: string;
740
+ surface: "paywall" | "popup" | "onboarding" | "page" | "banner";
741
+ presentation: {
742
+ type: "modal";
743
+ size: "sm" | "md" | "lg";
744
+ } | {
745
+ type: "sheet";
746
+ size: "sm" | "md" | "lg";
747
+ } | {
748
+ type: "fullscreen";
749
+ } | {
750
+ type: "inline";
751
+ };
752
+ theme: {
753
+ primary: string;
754
+ background: string;
755
+ text: string;
756
+ radius: "none" | "full" | "sm" | "md" | "lg";
757
+ font: "system" | "serif" | "rounded" | "mono";
758
+ };
759
+ pages: {
760
+ id: string;
761
+ name: string;
762
+ root: StackNode;
763
+ theme?: {
764
+ primary: string;
765
+ background: string;
766
+ text: string;
767
+ radius: "none" | "full" | "sm" | "md" | "lg";
768
+ font: "system" | "serif" | "rounded" | "mono";
769
+ } | undefined;
770
+ editorPosition?: {
771
+ x: number;
772
+ y: number;
773
+ } | undefined;
774
+ }[];
775
+ strings: {
776
+ defaultLocale: string;
777
+ locales: Record<string, Record<string, string>>;
778
+ };
779
+ actions: ({
780
+ type: "navigate";
781
+ close: false;
782
+ pageId: string;
783
+ id: string;
784
+ event: string;
785
+ properties: Record<string, string | number | boolean | null>;
786
+ } | {
787
+ type: "event";
788
+ close: boolean;
789
+ id: string;
790
+ event: string;
791
+ properties: Record<string, string | number | boolean | null>;
792
+ } | {
793
+ type: "close";
794
+ close: true;
795
+ id: string;
796
+ event: string;
797
+ properties: Record<string, string | number | boolean | null>;
798
+ } | {
799
+ type: "open_url";
800
+ close: boolean;
801
+ url: string;
802
+ id: string;
803
+ event: string;
804
+ properties: Record<string, string | number | boolean | null>;
805
+ } | {
806
+ type: "claim_offer";
807
+ close: boolean;
808
+ couponId: string;
809
+ id: string;
810
+ event: string;
811
+ properties: Record<string, string | number | boolean | null>;
812
+ })[];
813
+ initialPageId?: string | undefined;
814
+ };
815
+ publicData?: {
816
+ couponDigests: Record<string, string>;
817
+ variables: Record<string, Record<string, Partial<Record<"offer.headline" | "offer.name" | "offer.description" | "offer.eligibility" | "offer.validity" | "offer.terms" | "offer.discount" | "offer.months" | "offer.ends_at", string>>>>;
818
+ locales: Record<string, {
819
+ nodes: Record<string, {
820
+ base: {
821
+ text?: string | undefined;
822
+ label?: string | undefined;
823
+ alt?: string | undefined;
824
+ html?: string | undefined;
825
+ countdownAt?: string | undefined;
826
+ couponId?: string | undefined;
827
+ missing?: string[] | undefined;
828
+ };
829
+ }>;
830
+ plans: Record<string, never>;
831
+ pickers: Record<string, never>;
832
+ diagnostics: {
833
+ nodeId: string;
834
+ message: string;
835
+ }[];
836
+ quantities?: Record<string, {
837
+ minimum: number;
838
+ maximum: number;
839
+ step: number;
840
+ value: number;
841
+ label: string;
842
+ available: boolean;
843
+ }> | undefined;
844
+ }>;
845
+ } | undefined;
846
+ } | {
847
+ id: string;
848
+ type: "paywall";
849
+ paywallVersionId: string;
850
+ })[];
851
+ references: Record<string, {
852
+ type: "flag";
853
+ key: string;
854
+ } | {
855
+ type: "experiment";
856
+ id: string;
857
+ } | {
858
+ type: "saved_group";
859
+ id: string;
860
+ } | {
861
+ type: "config";
862
+ key: string;
863
+ } | {
864
+ type: "constant";
865
+ key: string;
866
+ } | {
867
+ type: "paywall_version";
868
+ id: string;
869
+ } | {
870
+ type: "offering_version";
871
+ id: string;
872
+ } | {
873
+ type: "reward";
874
+ id: string;
875
+ }>;
876
+ inputs: {
877
+ variable: string;
878
+ screenId: string;
879
+ componentId: string;
880
+ required: boolean;
881
+ }[];
882
+ variables: Record<string, {
883
+ nullable: boolean;
884
+ type: "string" | "number" | "boolean" | "array" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
885
+ source: {
886
+ type: "input";
887
+ } | {
888
+ type: "node";
889
+ } | {
890
+ type: "attribute" | "parameter";
891
+ key: string;
892
+ };
893
+ enum?: string[] | undefined;
894
+ items?: {
895
+ type: "string" | "number" | "boolean" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
896
+ nullable: boolean;
897
+ enum?: string[] | undefined;
898
+ } | undefined;
899
+ }>;
900
+ outputSchema: {
901
+ nullable: boolean;
902
+ type: "string" | "number" | "boolean" | "array" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
903
+ enum?: string[] | undefined;
904
+ items?: {
905
+ type: "string" | "number" | "boolean" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
906
+ nullable: boolean;
907
+ enum?: string[] | undefined;
908
+ } | undefined;
909
+ };
910
+ execution: {
911
+ runTimeoutSeconds: number;
912
+ maxTransitions: number;
913
+ };
914
+ };
915
+ growth: {
916
+ evaluatedAt: string;
917
+ expiresAt: string;
918
+ scope: {
919
+ projectId: string;
920
+ environment: "sandbox" | "live";
921
+ };
922
+ features: Record<string, {
923
+ defaultValue?: z.core.util.JSONType | undefined;
924
+ rules?: {
925
+ id?: string | undefined;
926
+ force?: z.core.util.JSONType | undefined;
927
+ variations?: z.core.util.JSONType[] | undefined;
928
+ key?: string | undefined;
929
+ range?: [number, number] | undefined;
930
+ tracks?: {
931
+ experiment: {
932
+ key: string;
933
+ variations: [z.core.util.JSONType, z.core.util.JSONType, ...z.core.util.JSONType[]];
934
+ urlPatterns?: {
935
+ include: boolean;
936
+ type: "regex" | "simple";
937
+ pattern: string;
938
+ }[] | undefined;
939
+ force?: number | undefined;
940
+ active?: boolean | undefined;
941
+ persistQueryString?: boolean | undefined;
942
+ condition?: Record<string, z.core.util.JSONType> | undefined;
943
+ parentConditions?: {
944
+ id: string;
945
+ condition: Record<string, z.core.util.JSONType>;
946
+ gate?: boolean | undefined;
947
+ }[] | undefined;
948
+ weights?: number[] | undefined;
949
+ coverage?: number | undefined;
950
+ hashAttribute?: string | undefined;
951
+ fallbackAttribute?: string | undefined;
952
+ hashVersion?: 2 | undefined;
953
+ disableStickyBucketing?: boolean | undefined;
954
+ bucketVersion?: number | undefined;
955
+ minBucketVersion?: number | undefined;
956
+ filters?: {
957
+ seed: string;
958
+ hashVersion: 2;
959
+ ranges: [number, number][];
960
+ attribute?: string | undefined;
961
+ }[] | undefined;
962
+ ranges?: [number, number][] | undefined;
963
+ meta?: {
964
+ key?: string | undefined;
965
+ name?: string | undefined;
966
+ passthrough?: boolean | undefined;
967
+ }[] | undefined;
968
+ seed?: string | undefined;
969
+ name?: string | undefined;
970
+ phase?: string | undefined;
971
+ };
972
+ result: {
973
+ value: z.core.util.JSONType;
974
+ variationId: number;
975
+ key: string;
976
+ inExperiment: boolean;
977
+ hashAttribute: string;
978
+ hashValue: string;
979
+ featureId: string | null;
980
+ name?: string | undefined;
981
+ bucket?: number | undefined;
982
+ passthrough?: boolean | undefined;
983
+ hashUsed?: boolean | undefined;
984
+ stickyBucketUsed?: boolean | undefined;
985
+ };
986
+ }[] | undefined;
987
+ condition?: Record<string, z.core.util.JSONType> | undefined;
988
+ parentConditions?: {
989
+ id: string;
990
+ condition: Record<string, z.core.util.JSONType>;
991
+ gate?: boolean | undefined;
992
+ }[] | undefined;
993
+ weights?: number[] | undefined;
994
+ coverage?: number | undefined;
995
+ hashAttribute?: string | undefined;
996
+ fallbackAttribute?: string | undefined;
997
+ hashVersion?: 2 | undefined;
998
+ disableStickyBucketing?: boolean | undefined;
999
+ bucketVersion?: number | undefined;
1000
+ minBucketVersion?: number | undefined;
1001
+ filters?: {
1002
+ seed: string;
1003
+ hashVersion: 2;
1004
+ ranges: [number, number][];
1005
+ attribute?: string | undefined;
1006
+ }[] | undefined;
1007
+ ranges?: [number, number][] | undefined;
1008
+ meta?: {
1009
+ key?: string | undefined;
1010
+ name?: string | undefined;
1011
+ passthrough?: boolean | undefined;
1012
+ }[] | undefined;
1013
+ seed?: string | undefined;
1014
+ name?: string | undefined;
1015
+ phase?: string | undefined;
1016
+ }[] | undefined;
1017
+ }>;
1018
+ generation: string;
1019
+ savedGroups: Record<string, {
1020
+ type: "hashed";
1021
+ attributeKey: string;
1022
+ values: string[];
1023
+ } | {
1024
+ type: "list";
1025
+ attributeKey: string;
1026
+ values: (string | number)[];
1027
+ } | {
1028
+ type: "condition";
1029
+ condition: Record<string, z.core.util.JSONType>;
1030
+ }>;
1031
+ experiments: Record<string, {
1032
+ key: string;
1033
+ variations: [z.core.util.JSONType, z.core.util.JSONType, ...z.core.util.JSONType[]];
1034
+ urlPatterns?: {
1035
+ include: boolean;
1036
+ type: "regex" | "simple";
1037
+ pattern: string;
1038
+ }[] | undefined;
1039
+ force?: number | undefined;
1040
+ active?: boolean | undefined;
1041
+ persistQueryString?: boolean | undefined;
1042
+ condition?: Record<string, z.core.util.JSONType> | undefined;
1043
+ parentConditions?: {
1044
+ id: string;
1045
+ condition: Record<string, z.core.util.JSONType>;
1046
+ gate?: boolean | undefined;
1047
+ }[] | undefined;
1048
+ weights?: number[] | undefined;
1049
+ coverage?: number | undefined;
1050
+ hashAttribute?: string | undefined;
1051
+ fallbackAttribute?: string | undefined;
1052
+ hashVersion?: 2 | undefined;
1053
+ disableStickyBucketing?: boolean | undefined;
1054
+ bucketVersion?: number | undefined;
1055
+ minBucketVersion?: number | undefined;
1056
+ filters?: {
1057
+ seed: string;
1058
+ hashVersion: 2;
1059
+ ranges: [number, number][];
1060
+ attribute?: string | undefined;
1061
+ }[] | undefined;
1062
+ ranges?: [number, number][] | undefined;
1063
+ meta?: {
1064
+ key?: string | undefined;
1065
+ name?: string | undefined;
1066
+ passthrough?: boolean | undefined;
1067
+ }[] | undefined;
1068
+ seed?: string | undefined;
1069
+ name?: string | undefined;
1070
+ phase?: string | undefined;
1071
+ }>;
1072
+ analyticsConfig: {
1073
+ eventsEnabled: boolean;
1074
+ experimentViewsEnabled: boolean;
1075
+ featureUsageEnabled: boolean;
1076
+ };
1077
+ remoteFeatures: string[];
1078
+ } | undefined;
1079
+ versionId: string;
1080
+ control: {
1081
+ state: "active" | "paused" | "archived";
1082
+ controlRevision: number;
1083
+ evaluationMode: "local" | "remote";
1084
+ evaluationRevision: number;
1085
+ currentVersionId: string;
1086
+ versions: Record<string, {
1087
+ artifact: string;
1088
+ dependencies: {
1089
+ features: string[];
1090
+ experiments: Record<string, string[]>;
1091
+ savedGroups: string[];
1092
+ };
1093
+ definitionDigest?: string | undefined;
1094
+ couponDigests?: Record<string, string> | undefined;
1095
+ }>;
1096
+ };
1097
+ manifest: {
1098
+ kind: "sdk_configuration";
1099
+ schemaVersion: 1;
1100
+ scope: {
1101
+ projectId: string;
1102
+ environment: "sandbox" | "live";
1103
+ environmentId: string;
1104
+ };
1105
+ revision: number;
1106
+ generation: string;
1107
+ policy: {
1108
+ refreshIntervalSeconds: number;
1109
+ maxControlAgeSeconds: number;
1110
+ };
1111
+ gb: {
1112
+ features: string | null;
1113
+ pageExperiments: string | null;
1114
+ };
1115
+ artifacts: Record<string, {
1116
+ kind: "paywall" | "funnel" | "gb_features" | "gb_page_experiments";
1117
+ formatVersion: number;
1118
+ url: string;
1119
+ sha256: string;
1120
+ byteLength: number;
1121
+ generation?: string | undefined;
1122
+ }>;
1123
+ funnels: Record<string, {
1124
+ state: "active" | "paused" | "archived";
1125
+ controlRevision: number;
1126
+ evaluationMode: "local" | "remote";
1127
+ evaluationRevision: number;
1128
+ currentVersionId: string;
1129
+ versions: Record<string, {
1130
+ artifact: string;
1131
+ dependencies: {
1132
+ features: string[];
1133
+ experiments: Record<string, string[]>;
1134
+ savedGroups: string[];
1135
+ };
1136
+ definitionDigest?: string | undefined;
1137
+ couponDigests?: Record<string, string> | undefined;
1138
+ }>;
1139
+ }>;
1140
+ paywalls?: Record<string, {
1141
+ state: "archived" | "published";
1142
+ controlRevision: number;
1143
+ currentVersionId: string;
1144
+ versions: Record<string, {
1145
+ version: number;
1146
+ artifact: string;
1147
+ sourceDigest: string;
1148
+ }>;
1149
+ }> | undefined;
1150
+ };
1151
+ }>;
1152
+ paywall: (paywallId: string, versionId?: string) => Promise<{
1153
+ document: {
1154
+ kind: "paywall";
1155
+ formatVersion: 1;
1156
+ name: string;
1157
+ offeringVersionId: string;
1158
+ presentation: {
1159
+ type: "modal";
1160
+ size: "sm" | "md" | "lg";
1161
+ } | {
1162
+ type: "sheet";
1163
+ size: "sm" | "md" | "lg";
1164
+ } | {
1165
+ type: "fullscreen";
1166
+ } | {
1167
+ type: "inline";
1168
+ };
1169
+ screen: {
1170
+ kind: "screen";
1171
+ schemaVersion: 4;
1172
+ name: string;
1173
+ surface: "paywall" | "popup" | "onboarding" | "page" | "banner";
1174
+ presentation: {
1175
+ type: "modal";
1176
+ size: "sm" | "md" | "lg";
1177
+ } | {
1178
+ type: "sheet";
1179
+ size: "sm" | "md" | "lg";
1180
+ } | {
1181
+ type: "fullscreen";
1182
+ } | {
1183
+ type: "inline";
1184
+ };
1185
+ theme: {
1186
+ primary: string;
1187
+ background: string;
1188
+ text: string;
1189
+ radius: "none" | "full" | "sm" | "md" | "lg";
1190
+ font: "system" | "serif" | "rounded" | "mono";
1191
+ };
1192
+ pages: {
1193
+ id: string;
1194
+ name: string;
1195
+ root: StackNode;
1196
+ theme?: {
1197
+ primary: string;
1198
+ background: string;
1199
+ text: string;
1200
+ radius: "none" | "full" | "sm" | "md" | "lg";
1201
+ font: "system" | "serif" | "rounded" | "mono";
1202
+ } | undefined;
1203
+ editorPosition?: {
1204
+ x: number;
1205
+ y: number;
1206
+ } | undefined;
1207
+ }[];
1208
+ strings: {
1209
+ defaultLocale: string;
1210
+ locales: Record<string, Record<string, string>>;
1211
+ };
1212
+ actions: ({
1213
+ type: "navigate";
1214
+ close: false;
1215
+ pageId: string;
1216
+ id: string;
1217
+ event: string;
1218
+ properties: Record<string, string | number | boolean | null>;
1219
+ } | {
1220
+ type: "event";
1221
+ close: boolean;
1222
+ id: string;
1223
+ event: string;
1224
+ properties: Record<string, string | number | boolean | null>;
1225
+ } | {
1226
+ type: "close";
1227
+ close: true;
1228
+ id: string;
1229
+ event: string;
1230
+ properties: Record<string, string | number | boolean | null>;
1231
+ } | {
1232
+ type: "open_url";
1233
+ close: boolean;
1234
+ url: string;
1235
+ id: string;
1236
+ event: string;
1237
+ properties: Record<string, string | number | boolean | null>;
1238
+ } | {
1239
+ type: "claim_offer";
1240
+ close: boolean;
1241
+ couponId: string;
1242
+ id: string;
1243
+ event: string;
1244
+ properties: Record<string, string | number | boolean | null>;
1245
+ })[];
1246
+ initialPageId?: string | undefined;
1247
+ };
1248
+ products: {
1249
+ items: {
1250
+ productVersionId: string;
1251
+ label: string;
1252
+ }[];
1253
+ defaultProductVersionId: string | null;
1254
+ grouping?: {
1255
+ tiers: {
1256
+ id: string;
1257
+ name: string;
1258
+ }[];
1259
+ assignments: {
1260
+ productVersionId: string;
1261
+ tierId: string;
1262
+ period: "month" | "year";
1263
+ }[];
1264
+ } | undefined;
1265
+ };
1266
+ catalog: Record<string, {
1267
+ name: string;
1268
+ interval: "free" | "week" | "month" | "year" | "one_time";
1269
+ intervalCount: number;
1270
+ trial: {
1271
+ days: number;
1272
+ cardRequired: boolean;
1273
+ } | null;
1274
+ benefits: {
1275
+ featureId: string;
1276
+ name: string;
1277
+ allowance: string | null;
1278
+ access: boolean;
1279
+ }[];
1280
+ channels: {
1281
+ stripe?: {
1282
+ prices: {
1283
+ 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";
1284
+ amountMinor: number;
1285
+ }[];
1286
+ } | undefined;
1287
+ apple?: {
1288
+ productIds: string[];
1289
+ } | undefined;
1290
+ google?: {
1291
+ products: {
1292
+ productId: string;
1293
+ basePlanId: string | null;
1294
+ }[];
1295
+ } | undefined;
1296
+ };
1297
+ prepaid?: {
1298
+ internalFeatureId: string;
1299
+ name: string;
1300
+ includedAmount: string;
1301
+ reset: "week" | "month" | "year" | "hour" | "day" | "lifetime";
1302
+ resetCount: number;
1303
+ terms: {
1304
+ units: string;
1305
+ prices: {
1306
+ 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";
1307
+ amountMinor: number;
1308
+ pricing?: {
1309
+ kind: "graduated" | "volume";
1310
+ tiers: {
1311
+ upTo: number | null;
1312
+ unitAmountMinor: number;
1313
+ flatAmountMinor?: number | undefined;
1314
+ }[];
1315
+ } | undefined;
1316
+ }[];
1317
+ minimumQuantity: number;
1318
+ maximumQuantity: number;
1319
+ };
1320
+ }[] | undefined;
1321
+ }>;
1322
+ buttons: Record<string, {
1323
+ type: "checkout";
1324
+ product: {
1325
+ type: "picker";
1326
+ pickerId: string;
1327
+ allowedProductVersionIds: string[];
1328
+ } | {
1329
+ type: "fixed";
1330
+ productVersionId: string;
1331
+ };
1332
+ } | {
1333
+ type: "close";
1334
+ } | {
1335
+ type: "action";
1336
+ action: {
1337
+ type: "event";
1338
+ event: string;
1339
+ } | {
1340
+ type: "open_url";
1341
+ url: string;
1342
+ };
1343
+ }>;
1344
+ coupons: Record<string, {
1345
+ digest: string;
1346
+ content: {
1347
+ discount: {
1348
+ type: "percent";
1349
+ percentOff: number;
1350
+ } | {
1351
+ type: "amount";
1352
+ amountOffCents: number;
1353
+ 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";
1354
+ };
1355
+ duration: {
1356
+ type: "once";
1357
+ } | {
1358
+ type: "repeating";
1359
+ months: number;
1360
+ } | {
1361
+ type: "forever";
1362
+ };
1363
+ appliesTo: {
1364
+ type: "all";
1365
+ } | {
1366
+ type: "plans";
1367
+ planIds: string[];
1368
+ } | {
1369
+ type: "merchandise";
1370
+ scope: {
1371
+ type: "selected" | "all" | "condition";
1372
+ };
1373
+ };
1374
+ displayCopy: {
1375
+ defaultLocale: string;
1376
+ locales: Record<string, {
1377
+ name: string;
1378
+ description: string;
1379
+ }>;
1380
+ } | null;
1381
+ firstPurchaseOnly: boolean;
1382
+ qualificationRequired: boolean;
1383
+ startsAt: string | null;
1384
+ endsAt: string | null;
1385
+ grantWindowHours: number;
1386
+ perCustomerLimit: number;
1387
+ };
1388
+ }>;
1389
+ };
1390
+ versionId: string;
1391
+ version: number;
1392
+ control: {
1393
+ state: "archived" | "published";
1394
+ controlRevision: number;
1395
+ currentVersionId: string;
1396
+ versions: Record<string, {
1397
+ version: number;
1398
+ artifact: string;
1399
+ sourceDigest: string;
1400
+ }>;
1401
+ };
1402
+ manifest: {
1403
+ kind: "sdk_configuration";
1404
+ schemaVersion: 1;
1405
+ scope: {
1406
+ projectId: string;
1407
+ environment: "sandbox" | "live";
1408
+ environmentId: string;
1409
+ };
1410
+ revision: number;
1411
+ generation: string;
1412
+ policy: {
1413
+ refreshIntervalSeconds: number;
1414
+ maxControlAgeSeconds: number;
1415
+ };
1416
+ gb: {
1417
+ features: string | null;
1418
+ pageExperiments: string | null;
1419
+ };
1420
+ artifacts: Record<string, {
1421
+ kind: "paywall" | "funnel" | "gb_features" | "gb_page_experiments";
1422
+ formatVersion: number;
1423
+ url: string;
1424
+ sha256: string;
1425
+ byteLength: number;
1426
+ generation?: string | undefined;
1427
+ }>;
1428
+ funnels: Record<string, {
1429
+ state: "active" | "paused" | "archived";
1430
+ controlRevision: number;
1431
+ evaluationMode: "local" | "remote";
1432
+ evaluationRevision: number;
1433
+ currentVersionId: string;
1434
+ versions: Record<string, {
1435
+ artifact: string;
1436
+ dependencies: {
1437
+ features: string[];
1438
+ experiments: Record<string, string[]>;
1439
+ savedGroups: string[];
1440
+ };
1441
+ definitionDigest?: string | undefined;
1442
+ couponDigests?: Record<string, string> | undefined;
1443
+ }>;
1444
+ }>;
1445
+ paywalls?: Record<string, {
1446
+ state: "archived" | "published";
1447
+ controlRevision: number;
1448
+ currentVersionId: string;
1449
+ versions: Record<string, {
1450
+ version: number;
1451
+ artifact: string;
1452
+ sourceDigest: string;
1453
+ }>;
1454
+ }> | undefined;
1455
+ };
1456
+ }>;
1457
+ localFunnel(funnelId: string, versionId?: string): Promise<{
1458
+ evaluationMode: "local";
1459
+ growth: {
1460
+ scope: {
1461
+ projectId: string;
1462
+ environment: "sandbox" | "live";
1463
+ };
1464
+ generation: string;
1465
+ evaluatedAt: string;
1466
+ expiresAt: string | null;
1467
+ features: Record<string, {
1468
+ defaultValue?: z.core.util.JSONType | undefined;
1469
+ rules?: {
1470
+ id?: string | undefined;
1471
+ force?: z.core.util.JSONType | undefined;
1472
+ variations?: z.core.util.JSONType[] | undefined;
1473
+ key?: string | undefined;
1474
+ range?: [number, number] | undefined;
1475
+ tracks?: {
1476
+ experiment: {
1477
+ key: string;
1478
+ variations: [z.core.util.JSONType, z.core.util.JSONType, ...z.core.util.JSONType[]];
1479
+ urlPatterns?: {
1480
+ include: boolean;
1481
+ type: "regex" | "simple";
1482
+ pattern: string;
1483
+ }[] | undefined;
1484
+ force?: number | undefined;
1485
+ active?: boolean | undefined;
1486
+ persistQueryString?: boolean | undefined;
1487
+ condition?: Record<string, z.core.util.JSONType> | undefined;
1488
+ parentConditions?: {
1489
+ id: string;
1490
+ condition: Record<string, z.core.util.JSONType>;
1491
+ gate?: boolean | undefined;
1492
+ }[] | undefined;
1493
+ weights?: number[] | undefined;
1494
+ coverage?: number | undefined;
1495
+ hashAttribute?: string | undefined;
1496
+ fallbackAttribute?: string | undefined;
1497
+ hashVersion?: 2 | undefined;
1498
+ disableStickyBucketing?: boolean | undefined;
1499
+ bucketVersion?: number | undefined;
1500
+ minBucketVersion?: number | undefined;
1501
+ filters?: {
1502
+ seed: string;
1503
+ hashVersion: 2;
1504
+ ranges: [number, number][];
1505
+ attribute?: string | undefined;
1506
+ }[] | undefined;
1507
+ ranges?: [number, number][] | undefined;
1508
+ meta?: {
1509
+ key?: string | undefined;
1510
+ name?: string | undefined;
1511
+ passthrough?: boolean | undefined;
1512
+ }[] | undefined;
1513
+ seed?: string | undefined;
1514
+ name?: string | undefined;
1515
+ phase?: string | undefined;
1516
+ };
1517
+ result: {
1518
+ value: z.core.util.JSONType;
1519
+ variationId: number;
1520
+ key: string;
1521
+ inExperiment: boolean;
1522
+ hashAttribute: string;
1523
+ hashValue: string;
1524
+ featureId: string | null;
1525
+ name?: string | undefined;
1526
+ bucket?: number | undefined;
1527
+ passthrough?: boolean | undefined;
1528
+ hashUsed?: boolean | undefined;
1529
+ stickyBucketUsed?: boolean | undefined;
1530
+ };
1531
+ }[] | undefined;
1532
+ condition?: Record<string, z.core.util.JSONType> | undefined;
1533
+ parentConditions?: {
1534
+ id: string;
1535
+ condition: Record<string, z.core.util.JSONType>;
1536
+ gate?: boolean | undefined;
1537
+ }[] | undefined;
1538
+ weights?: number[] | undefined;
1539
+ coverage?: number | undefined;
1540
+ hashAttribute?: string | undefined;
1541
+ fallbackAttribute?: string | undefined;
1542
+ hashVersion?: 2 | undefined;
1543
+ disableStickyBucketing?: boolean | undefined;
1544
+ bucketVersion?: number | undefined;
1545
+ minBucketVersion?: number | undefined;
1546
+ filters?: {
1547
+ seed: string;
1548
+ hashVersion: 2;
1549
+ ranges: [number, number][];
1550
+ attribute?: string | undefined;
1551
+ }[] | undefined;
1552
+ ranges?: [number, number][] | undefined;
1553
+ meta?: {
1554
+ key?: string | undefined;
1555
+ name?: string | undefined;
1556
+ passthrough?: boolean | undefined;
1557
+ }[] | undefined;
1558
+ seed?: string | undefined;
1559
+ name?: string | undefined;
1560
+ phase?: string | undefined;
1561
+ }[] | undefined;
1562
+ }>;
1563
+ savedGroups: Record<string, {
1564
+ type: "hashed";
1565
+ attributeKey: string;
1566
+ values: string[];
1567
+ } | {
1568
+ type: "list";
1569
+ attributeKey: string;
1570
+ values: (string | number)[];
1571
+ } | {
1572
+ type: "condition";
1573
+ condition: Record<string, z.core.util.JSONType>;
1574
+ }>;
1575
+ experiments: Record<string, {
1576
+ key: string;
1577
+ variations: [z.core.util.JSONType, z.core.util.JSONType, ...z.core.util.JSONType[]];
1578
+ urlPatterns?: {
1579
+ include: boolean;
1580
+ type: "regex" | "simple";
1581
+ pattern: string;
1582
+ }[] | undefined;
1583
+ force?: number | undefined;
1584
+ active?: boolean | undefined;
1585
+ persistQueryString?: boolean | undefined;
1586
+ condition?: Record<string, z.core.util.JSONType> | undefined;
1587
+ parentConditions?: {
1588
+ id: string;
1589
+ condition: Record<string, z.core.util.JSONType>;
1590
+ gate?: boolean | undefined;
1591
+ }[] | undefined;
1592
+ weights?: number[] | undefined;
1593
+ coverage?: number | undefined;
1594
+ hashAttribute?: string | undefined;
1595
+ fallbackAttribute?: string | undefined;
1596
+ hashVersion?: 2 | undefined;
1597
+ disableStickyBucketing?: boolean | undefined;
1598
+ bucketVersion?: number | undefined;
1599
+ minBucketVersion?: number | undefined;
1600
+ filters?: {
1601
+ seed: string;
1602
+ hashVersion: 2;
1603
+ ranges: [number, number][];
1604
+ attribute?: string | undefined;
1605
+ }[] | undefined;
1606
+ ranges?: [number, number][] | undefined;
1607
+ meta?: {
1608
+ key?: string | undefined;
1609
+ name?: string | undefined;
1610
+ passthrough?: boolean | undefined;
1611
+ }[] | undefined;
1612
+ seed?: string | undefined;
1613
+ name?: string | undefined;
1614
+ phase?: string | undefined;
1615
+ }>;
1616
+ };
1617
+ conditions: Record<string, {
1618
+ condition: Record<string, z.core.util.JSONType>;
1619
+ port: string;
1620
+ }[]>;
1621
+ scope: {
1622
+ projectId: string;
1623
+ environment: "sandbox" | "live";
1624
+ };
1625
+ funnelId: string;
1626
+ versionId: string;
1627
+ evaluationRevision: number;
1628
+ expiresAt: string | null;
1629
+ topology: {
1630
+ entry: string;
1631
+ nodes: {
1632
+ id: string;
1633
+ type: "output" | "action" | "split" | "feature" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
1634
+ outputs: Record<string, string>;
1635
+ writes: Record<string, string>;
1636
+ resources: {
1637
+ screenId?: string | undefined;
1638
+ paywallVersionId?: string | undefined;
1639
+ couponId?: string | undefined;
1640
+ couponIds?: string[] | undefined;
1641
+ experimentId?: string | undefined;
1642
+ featureKey?: string | undefined;
1643
+ offeringVersionId?: string | undefined;
1644
+ };
1645
+ }[];
1646
+ };
1647
+ evaluation: {
1648
+ maxTransitions: number;
1649
+ variables: Record<string, {
1650
+ nullable: boolean;
1651
+ type: "string" | "number" | "boolean" | "array" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
1652
+ source: {
1653
+ type: "input";
1654
+ } | {
1655
+ type: "node";
1656
+ } | {
1657
+ type: "attribute" | "parameter";
1658
+ key: string;
1659
+ };
1660
+ enum?: string[] | undefined;
1661
+ items?: {
1662
+ type: "string" | "number" | "boolean" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
1663
+ nullable: boolean;
1664
+ enum?: string[] | undefined;
1665
+ } | undefined;
1666
+ }>;
1667
+ outputSchema: {
1668
+ nullable: boolean;
1669
+ type: "string" | "number" | "boolean" | "array" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
1670
+ enum?: string[] | undefined;
1671
+ items?: {
1672
+ type: "string" | "number" | "boolean" | "strings" | "json" | "offering_version" | "reward" | "paywall_version";
1673
+ nullable: boolean;
1674
+ enum?: string[] | undefined;
1675
+ } | undefined;
1676
+ };
1677
+ terminals: Record<string, {
1678
+ outcome: "failed" | "completed" | "closed" | "ineligible";
1679
+ output: {
1680
+ type: "literal";
1681
+ value: z.core.util.JSONType;
1682
+ } | {
1683
+ type: "variable";
1684
+ key: string;
1685
+ path?: string | undefined;
1686
+ } | {
1687
+ type: "feature";
1688
+ featureKey: string;
1689
+ } | null;
1690
+ }>;
1691
+ };
1692
+ }>;
1693
+ assertFunnel(funnelId: string, controlRevision?: number, versionId?: string): void;
1694
+ destroy(): void;
1695
+ };
1696
+ type ConfigurationSync = ReturnType<typeof createConfigurationSync>;
1697
+
1698
+ export { type ConfigurationStorage as C, type ConfigurationSync as a, type ConfigurationSyncOptions as b, createConfigurationSync as c };