@tinkerlandai/longplay-sdk 0.10.40 → 0.10.42

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 (121) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +57 -1
  3. package/README.zh-CN.md +5 -1
  4. package/dist/{ai-usage-DXwAGTxT.d.ts → ai-usage-B-qsCn-k.d.ts} +1 -1
  5. package/dist/{api-r6FfVQpg.d.ts → api-DpRb_Pd3.d.ts} +52 -0
  6. package/dist/check-response-OIBVUP72.js +1 -0
  7. package/dist/chunk-2EVGXJ4R.js +1 -0
  8. package/dist/chunk-3SXPCVIP.js +1 -0
  9. package/dist/chunk-3WTVQ6OV.js +1 -0
  10. package/dist/{chunk-LSPHUA7V.js → chunk-5JRBCW6V.js} +1 -1
  11. package/dist/chunk-5TJISOWN.js +1 -0
  12. package/dist/{chunk-X6ONZGRY.js → chunk-67SIVUOS.js} +1 -1
  13. package/dist/chunk-6XRXHFM6.js +1 -0
  14. package/dist/chunk-7MYS52FL.js +1 -0
  15. package/dist/chunk-ABXCDVC7.js +1 -0
  16. package/dist/{chunk-2DPNSTCN.js → chunk-AC53CUJE.js} +1 -1
  17. package/dist/chunk-ANXDWUPK.js +1 -0
  18. package/dist/chunk-AQONMY2H.js +1 -0
  19. package/dist/chunk-ASL7TJFU.js +1 -0
  20. package/dist/{chunk-ORMQJAQE.js → chunk-AV2WZSII.js} +1 -1
  21. package/dist/chunk-B4AELNLE.js +1 -0
  22. package/dist/{chunk-O4KXODTJ.js → chunk-C4NG6RVA.js} +1 -1
  23. package/dist/chunk-CALDEF4M.js +1 -0
  24. package/dist/chunk-CSLTAXC7.js +1 -0
  25. package/dist/chunk-CWD36SJO.js +1 -0
  26. package/dist/chunk-DCZWNTG2.js +1 -0
  27. package/dist/chunk-DGZCD3AY.js +1 -0
  28. package/dist/{chunk-57GPGWSK.js → chunk-FTGRTYBL.js} +1 -1
  29. package/dist/chunk-HLCDAU5A.js +1 -0
  30. package/dist/{chunk-CZ4TQCUV.js → chunk-HTXB2WVI.js} +1 -1
  31. package/dist/chunk-JWTA2OCB.js +1 -0
  32. package/dist/{chunk-VC2HPREX.js → chunk-KEF6HIFK.js} +1 -1
  33. package/dist/chunk-KP4QI4RX.js +1 -0
  34. package/dist/{chunk-FCDWCQYC.js → chunk-LSVTH3TS.js} +1 -1
  35. package/dist/chunk-LUGZNBIW.js +1 -0
  36. package/dist/{chunk-YLPQLD2A.js → chunk-LZ3OJYBY.js} +1 -1
  37. package/dist/{chunk-5DZJCFNQ.js → chunk-MEDW4N3F.js} +1 -1
  38. package/dist/{chunk-7QDT6DO7.js → chunk-MPD3UIY4.js} +1 -1
  39. package/dist/chunk-MWICFZUF.js +1 -0
  40. package/dist/{chunk-POCDWUD3.js → chunk-NVF54BDR.js} +1 -1
  41. package/dist/{chunk-C2KT5ZFU.js → chunk-O6CUNETH.js} +1 -1
  42. package/dist/chunk-OXXPMJRJ.js +1 -0
  43. package/dist/{chunk-P6C3PNMQ.js → chunk-P6TNBX2S.js} +1 -1
  44. package/dist/{chunk-EREQZWGI.js → chunk-PBZSOTKZ.js} +1 -1
  45. package/dist/chunk-QHWR5UHD.js +1 -0
  46. package/dist/{chunk-33ZVZOSC.js → chunk-RDUKCMST.js} +1 -1
  47. package/dist/{chunk-ASDJTOGM.js → chunk-RJY5CUTB.js} +1 -1
  48. package/dist/chunk-S7A3IBAF.js +10 -0
  49. package/dist/{chunk-QZTTKH2H.js → chunk-SVLEVNHP.js} +1 -1
  50. package/dist/{chunk-WLGLQJ6M.js → chunk-TL67SYPH.js} +1 -1
  51. package/dist/{chunk-YY445FBU.js → chunk-UJMP7AMY.js} +1 -1
  52. package/dist/{chunk-67AY54E2.js → chunk-V65FSNYO.js} +1 -1
  53. package/dist/chunk-VILB5M4X.js +1 -0
  54. package/dist/{chunk-RV6UAUK2.js → chunk-ZICZN6WO.js} +1 -1
  55. package/dist/{configuration-sync-BHrAf-ql.d.ts → configuration-sync-7ruSsSrL.d.ts} +150 -1
  56. package/dist/content-KSIF5AXD.js +1 -0
  57. package/dist/funnel-host-purchase-YNC4LQJS.js +1 -0
  58. package/dist/{funnel-local-client-DR8OpKGU.d.ts → funnel-local-client-BMxDQWE6.d.ts} +51987 -22983
  59. package/dist/{funnel-node-evaluation-COxXtZEQ.d.ts → funnel-node-evaluation-COIh1hKs.d.ts} +3 -0
  60. package/dist/funnel-paywall-prerender-DAAQUEEZ.js +1 -0
  61. package/dist/{funnel-process-client-C87U4r_G.d.ts → funnel-process-client-DNR9nHs8.d.ts} +7338 -3163
  62. package/dist/funnel-route-prediction-XGCMCIKA.js +1 -0
  63. package/dist/funnel-route-source-O76QSUYU.js +1 -0
  64. package/dist/funnel-runtime-host-WPU42YVT.js +1 -0
  65. package/dist/index.d.ts +273 -22
  66. package/dist/index.js +1 -1
  67. package/dist/merchant-bridge-contracts-FB63H7NE.js +1 -0
  68. package/dist/native-shell.js +1 -1
  69. package/dist/openrouter.d.ts +2 -2
  70. package/dist/openrouter.js +1 -1
  71. package/dist/operation-contracts-YSFIINLK.js +1 -0
  72. package/dist/page.d.ts +1 -1
  73. package/dist/page.js +1 -1
  74. package/dist/paywall-PZ4BBEFG.js +1 -0
  75. package/dist/paywall-content-5IWLT7YD.js +1 -0
  76. package/dist/paywall-session-K7GPR3UF.js +1 -0
  77. package/dist/popup.d.ts +2 -2
  78. package/dist/popup.js +1 -1
  79. package/dist/{presentation-loading-B_v5XZtM.d.ts → presentation-loading-B2OeFzRN.d.ts} +1 -0
  80. package/dist/react-native.d.ts +6 -6
  81. package/dist/react-native.js +1 -1
  82. package/dist/screen-renderer-RDXKWHYE.js +1 -0
  83. package/dist/server.d.ts +34204 -17797
  84. package/dist/server.js +1 -1
  85. package/dist/{visual-dom-5LUN4AHO.js → visual-dom-IN6DRNX3.js} +1 -1
  86. package/dist/visual.js +1 -1
  87. package/package.json +1 -1
  88. package/dist/check-response-DRQCUWDW.js +0 -1
  89. package/dist/chunk-3NCMYTNG.js +0 -1
  90. package/dist/chunk-4TEZZZYK.js +0 -1
  91. package/dist/chunk-6PG3AS3G.js +0 -1
  92. package/dist/chunk-AZFWG352.js +0 -1
  93. package/dist/chunk-BYP4KVB3.js +0 -10
  94. package/dist/chunk-C3GYAKIU.js +0 -1
  95. package/dist/chunk-ESAHTG3Y.js +0 -1
  96. package/dist/chunk-GC6JBIRQ.js +0 -1
  97. package/dist/chunk-IJKAQNK6.js +0 -1
  98. package/dist/chunk-IOJVF52Q.js +0 -1
  99. package/dist/chunk-OOD2VDDP.js +0 -1
  100. package/dist/chunk-P23JOPR5.js +0 -1
  101. package/dist/chunk-PJS7M6X3.js +0 -1
  102. package/dist/chunk-PZOQV6MU.js +0 -1
  103. package/dist/chunk-RFNIGJOL.js +0 -1
  104. package/dist/chunk-RULQQ7WI.js +0 -1
  105. package/dist/chunk-U7GH4VME.js +0 -1
  106. package/dist/chunk-VOKEZHAH.js +0 -1
  107. package/dist/chunk-XDOKFAE6.js +0 -1
  108. package/dist/chunk-Y6HL2IY2.js +0 -1
  109. package/dist/content-QUEVNSXD.js +0 -1
  110. package/dist/funnel-host-purchase-LMVMJNUO.js +0 -1
  111. package/dist/funnel-paywall-prerender-LGUSHEP3.js +0 -1
  112. package/dist/funnel-runtime-host-H5FM67UC.js +0 -1
  113. package/dist/merchant-bridge-contracts-LZSQYE3O.js +0 -1
  114. package/dist/operation-contracts-O7TCDGV4.js +0 -1
  115. package/dist/paywall-UANWOKKC.js +0 -1
  116. package/dist/paywall-content-CHPX2P77.js +0 -1
  117. package/dist/paywall-session-3BNUC5ZE.js +0 -1
  118. package/dist/screen-renderer-FFVZ64MR.js +0 -1
  119. /package/dist/{chunk-RGEBK6UF.js → chunk-GPJF3T43.js} +0 -0
  120. /package/dist/{chunk-OJM6ORHE.js → chunk-RA7GZ67U.js} +0 -0
  121. /package/dist/{chunk-CILM5XMH.js → chunk-WPFTSHP2.js} +0 -0
@@ -0,0 +1 @@
1
+ import{a,b,c}from"./chunk-CSLTAXC7.js";import"./chunk-DGZCD3AY.js";import"./chunk-CALDEF4M.js";import"./chunk-ASL7TJFU.js";import"./chunk-VILB5M4X.js";import"./chunk-3SXPCVIP.js";import"./chunk-GPJF3T43.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as predictFunnelStart,c as predictedPaywallLoadingDocument,b as predictionRefusal};
@@ -0,0 +1 @@
1
+ import{a as e,b as o,c as n}from"./chunk-DGZCD3AY.js";import"./chunk-CALDEF4M.js";import"./chunk-ASL7TJFU.js";import"./chunk-VILB5M4X.js";import"./chunk-3SXPCVIP.js";import"./chunk-GPJF3T43.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{e as FUNNEL_ROUTE_LIMITS,o as funnelRouteSchema,n as projectFunnelRoute};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-3WTVQ6OV.js";import"./chunk-JWTA2OCB.js";import"./chunk-CSLTAXC7.js";import"./chunk-DGZCD3AY.js";import"./chunk-HTXB2WVI.js";import"./chunk-KEF6HIFK.js";import"./chunk-W32FI2A2.js";import"./chunk-P6TNBX2S.js";import"./chunk-DCZWNTG2.js";import"./chunk-CALDEF4M.js";import"./chunk-ASL7TJFU.js";import"./chunk-B4AELNLE.js";import"./chunk-AQONMY2H.js";import"./chunk-RDUKCMST.js";import"./chunk-KP4QI4RX.js";import"./chunk-5TJISOWN.js";import"./chunk-VILB5M4X.js";import"./chunk-LUGZNBIW.js";import"./chunk-LSVTH3TS.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-SLUA7ABW.js";import"./chunk-O6CUNETH.js";import"./chunk-ZICZN6WO.js";import"./chunk-GPJF3T43.js";import"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
package/dist/index.d.ts CHANGED
@@ -1,20 +1,79 @@
1
1
  import { z } from 'zod';
2
- import { S as ScreenAnswers, P as PresentationLoadingOptions, s as screenInputBindingsSchema, a as SurfaceData, b as PaywallLoadingDocument, C as CustomerDataIntent, c as createPresentationLoading } from './presentation-loading-B_v5XZtM.js';
3
- export { d as PresentationState } from './presentation-loading-B_v5XZtM.js';
2
+ import { S as ScreenAnswers, P as PresentationLoadingOptions, s as screenInputBindingsSchema, a as SurfaceData, b as PaywallLoadingDocument, C as CustomerDataIntent, c as createPresentationLoading } from './presentation-loading-B2OeFzRN.js';
3
+ export { d as PresentationState } from './presentation-loading-B2OeFzRN.js';
4
4
  import { J as JsonValue } from './growth-rules-B4YYy64R.js';
5
5
  import { S as StackNode, a as ScreenSelection } from './screen-qUBRsUi9.js';
6
- import { P as PaywallSession, S as SubscriptionOperation, F as FunnelCommandStorage, s as scopeSchema, a as FunnelStartInput, I as IndianaOptions, b as SessionCredentials, c as FunnelExecutionPolicy, d as PaywallRecovery, e as SubscriptionAttachQuote, f as FunnelRunController, g as PaywallResolution, h as FunnelRunView, i as IamFunnelEntryDelivery, j as FunnelProcessRunView, k as createPaywallSession$1 } from './funnel-local-client-DR8OpKGU.js';
7
- export { C as CustomerSession, l as FeatureClient, m as FeatureClientOptions, n as FunnelControllerResponse, o as FunnelPendingEntry, p as FunnelPurchaseRecovery, q as FunnelRuntimeResponse, r as FunnelSegmentPrediction, L as LocalFunnelClient, t as LocalFunnelClientOptions, u as LongplayError, v as PaywallPurchaseInput, w as PaywallStartInput, x as PushHost, y as PushJournal, z as createFeatureClient, A as createFunnelRunController, B as createLocalFunnelClient, D as getPaywallRecovery, E as preparePaywallFallback } from './funnel-local-client-DR8OpKGU.js';
6
+ import { C as ConfigurationSync } from './configuration-sync-7ruSsSrL.js';
7
+ export { a as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-7ruSsSrL.js';
8
+ import { P as PaywallSession, a as PaywallOperation, b as PaywallSubscriptionChange, F as FunnelCommandStorage, s as scopeSchema, c as FunnelStartInput, I as IndianaOptions, S as SessionCredentials, d as FunnelExecutionPolicy, e as PaywallRecovery, f as PaywallQuote, g as FunnelRunController, h as PaywallResolution, i as FunnelRunView, j as IamFunnelEntryDelivery, k as FunnelProcessRunView, l as createPaywallSession$1 } from './funnel-local-client-BMxDQWE6.js';
9
+ export { C as CustomerSession, m as FeatureClient, n as FeatureClientOptions, o as FunnelControllerResponse, p as FunnelPendingEntry, q as FunnelPurchaseRecovery, r as FunnelRuntimeResponse, t as FunnelSegmentPrediction, L as LocalFunnelClient, u as LocalFunnelClientOptions, v as LongplayError, w as PaywallPurchaseInput, x as PaywallStartInput, y as PushHost, z as PushJournal, A as createFeatureClient, B as createFunnelRunController, D as createLocalFunnelClient, E as getPaywallRecovery, G as isPaywallOperationComplete, H as isPaywallOperationPending, J as isPaywallUpdateOperation, K as isPaywallUpdateQuote, M as preparePaywallFallback } from './funnel-local-client-BMxDQWE6.js';
8
10
  import { C as CouponInput, O as Offer } from './coupon-kfkIVf9n.js';
9
11
  export { a as OfferUnavailableReason } from './coupon-kfkIVf9n.js';
10
- import { E as EntitlementCheckResult, M as MerchantBridgeManifest } from './funnel-node-evaluation-COxXtZEQ.js';
11
- export { a as EntitlementCheckInput, b as EntitlementCheckObservation, c as EntitlementRequirement, F as FunnelNodeEvaluationContext, e as evaluateFunnelNode } from './funnel-node-evaluation-COxXtZEQ.js';
12
- import { c as createFunnelProcess } from './funnel-process-client-C87U4r_G.js';
13
- export { F as FunnelProcessAdapter, a as FunnelProcessOptions, b as FunnelResourceSource, I as LongplayFeatureOptions, d as createFunnelClient, e as createLongplay } from './funnel-process-client-C87U4r_G.js';
14
- export { C as ConfigurationStorage, a as ConfigurationSync, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-BHrAf-ql.js';
15
- import './api-r6FfVQpg.js';
12
+ import { E as EntitlementCheckResult, M as MerchantBridgeManifest } from './funnel-node-evaluation-COIh1hKs.js';
13
+ export { a as EntitlementCheckInput, b as EntitlementCheckObservation, c as EntitlementRequirement, F as FunnelNodeEvaluationContext, e as evaluateFunnelNode } from './funnel-node-evaluation-COIh1hKs.js';
14
+ import { c as createFunnelProcess } from './funnel-process-client-DNR9nHs8.js';
15
+ export { F as FunnelProcessAdapter, a as FunnelProcessOptions, b as FunnelResourceSource, I as LongplayFeatureOptions, d as createFunnelClient, e as createLongplay } from './funnel-process-client-DNR9nHs8.js';
16
+ import './api-DpRb_Pd3.js';
16
17
  import 'zod/v4';
17
18
 
19
+ /** Opt-in geometry; documents without responsive fields retain their host's legacy sizing. */
20
+ declare const screenPresentationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ desktopWidth: z.ZodOptional<z.ZodObject<{
22
+ min: z.ZodNumber;
23
+ max: z.ZodNumber;
24
+ viewport: z.ZodNumber;
25
+ }, z.core.$strict>>;
26
+ mobile: z.ZodOptional<z.ZodEnum<{
27
+ sheet: "sheet";
28
+ fullscreen: "fullscreen";
29
+ }>>;
30
+ backdrop: z.ZodOptional<z.ZodEnum<{
31
+ none: "none";
32
+ scrim: "scrim";
33
+ dim: "dim";
34
+ "strong-dim": "strong-dim";
35
+ blur: "blur";
36
+ }>>;
37
+ type: z.ZodLiteral<"modal">;
38
+ position: z.ZodOptional<z.ZodEnum<{
39
+ center: "center";
40
+ top: "top";
41
+ bottom: "bottom";
42
+ }>>;
43
+ size: z.ZodEnum<{
44
+ sm: "sm";
45
+ md: "md";
46
+ lg: "lg";
47
+ }>;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ desktopWidth: z.ZodOptional<z.ZodObject<{
50
+ min: z.ZodNumber;
51
+ max: z.ZodNumber;
52
+ viewport: z.ZodNumber;
53
+ }, z.core.$strict>>;
54
+ mobile: z.ZodOptional<z.ZodEnum<{
55
+ sheet: "sheet";
56
+ fullscreen: "fullscreen";
57
+ }>>;
58
+ backdrop: z.ZodOptional<z.ZodEnum<{
59
+ none: "none";
60
+ scrim: "scrim";
61
+ dim: "dim";
62
+ "strong-dim": "strong-dim";
63
+ blur: "blur";
64
+ }>>;
65
+ type: z.ZodLiteral<"sheet">;
66
+ size: z.ZodEnum<{
67
+ sm: "sm";
68
+ md: "md";
69
+ lg: "lg";
70
+ }>;
71
+ }, z.core.$strict>, z.ZodObject<{
72
+ type: z.ZodLiteral<"fullscreen">;
73
+ }, z.core.$strict>, z.ZodObject<{
74
+ type: z.ZodLiteral<"inline">;
75
+ }, z.core.$strict>], "type">;
76
+
18
77
  /** Currency always comes from business data; locale only controls notation. No currency conversion. */
19
78
  declare function formatCouponMoney(cents: number, currency: string, locale?: string): string;
20
79
  declare function formatCouponDiscount(discount: CouponInput["discount"], locale?: string): string;
@@ -30,6 +89,30 @@ declare const funnelOpenInSchema: z.ZodEnum<{
30
89
  }>;
31
90
  type FunnelOpenIn = z.infer<typeof funnelOpenInSchema>;
32
91
 
92
+ type FunnelRoutePrediction = {
93
+ /** The Version the prediction was computed for; a Run on another Version can differ. */
94
+ versionId: string;
95
+ /** Visited node IDs, entry first. */
96
+ path: string[];
97
+ } & ({
98
+ type: "paywall";
99
+ paywallId: string;
100
+ paywallVersionId: string;
101
+ presentation: z.infer<typeof screenPresentationSchema>;
102
+ } | {
103
+ type: "screen";
104
+ surface: "page" | "popup" | "onboarding";
105
+ presentation: z.infer<typeof screenPresentationSchema>;
106
+ } | {
107
+ type: "external_page";
108
+ } | {
109
+ type: "end";
110
+ outcome: "completed" | "closed" | "ineligible" | "failed";
111
+ } | {
112
+ type: "unknown";
113
+ reason: "server_step" | "server_attribute" | "invalid_parameters" | "transition_limit";
114
+ });
115
+
33
116
  declare const contentVersionSchema: z.ZodObject<{
34
117
  id: z.ZodUUID;
35
118
  kind: z.ZodEnum<{
@@ -296,6 +379,34 @@ declare function prepareContent$1(container: HTMLElement, options: ContentHostOp
296
379
  updateCapabilities(data: SurfaceData): void;
297
380
  }>;
298
381
 
382
+ /**
383
+ * The first screen a Run of a Funnel would present for one Customer and Start, computed on this
384
+ * device from the Funnel's published route. Nothing is recorded: no Run, exposure, Sticky assignment or
385
+ * Coupon. `unavailable` means no prediction could be made (no published route, a paused Funnel,
386
+ * unreadable configuration). The Run started at the click still decides; use this for loading
387
+ * states and pre-rendering only.
388
+ */
389
+ type FunnelStartPrediction = {
390
+ funnelId: string;
391
+ } & (FunnelRoutePrediction | {
392
+ type: "unavailable";
393
+ reason: string;
394
+ versionId?: undefined;
395
+ path: [];
396
+ });
397
+ declare function predictFunnelStart$1(configuration: ConfigurationSync, input: {
398
+ funnelId: string;
399
+ /** The Customer whose Run it would be: the session's Customer ID. */
400
+ customerId: string;
401
+ /** The Start parameters the click would send. */
402
+ parameters?: Record<string, JsonValue>;
403
+ }): Promise<FunnelStartPrediction>;
404
+ /**
405
+ * The published design of the predicted first Paywall, for a loading state drawn before the Run
406
+ * presents. Null when the first screen is not a Paywall or its public file is unavailable.
407
+ */
408
+ declare function predictedPaywallLoadingDocument$1(configuration: ConfigurationSync, prediction: FunnelStartPrediction): Promise<PaywallLoadingDocument | null>;
409
+
299
410
  /** Display intent only. The merchant still authorizes any subsequent purchase. */
300
411
  type PaywallPurchaseIntent = {
301
412
  actionId: string;
@@ -321,7 +432,7 @@ type PaywallHostOptions = PresentationLoadingOptions & {
321
432
  /** Hand selection to the host instead of creating a quote or commercial operation. */
322
433
  onPurchaseIntent?: (intent: PaywallPurchaseIntent) => unknown | Promise<unknown>;
323
434
  onPurchase?: (request: {
324
- operation: SubscriptionOperation;
435
+ operation: PaywallOperation;
325
436
  signal: AbortSignal;
326
437
  }) => unknown | Promise<unknown>;
327
438
  onCheckoutUrl?: (url: string) => unknown;
@@ -346,6 +457,12 @@ type PaywallHostOptions = PresentationLoadingOptions & {
346
457
  productVersionId: string;
347
458
  featureQuantities: Readonly<Record<string, number>>;
348
459
  }) => string | undefined | Promise<string | undefined>;
460
+ /** Selects the existing membership to change. The server authorizes the original membership and target. */
461
+ resolveSubscriptionChange?: (purchase: {
462
+ actionId: string;
463
+ productVersionId: string;
464
+ featureQuantities: Readonly<Record<string, number>>;
465
+ }) => PaywallSubscriptionChange | undefined | Promise<PaywallSubscriptionChange | undefined>;
349
466
  /**
350
467
  * Opt in to the Coupon an authored purchase button is bound to: the SDK claims it for the
351
468
  * Customer at the click and quotes with that offer instead of calling `resolveOfferId`.
@@ -357,7 +474,7 @@ type PaywallHostOptions = PresentationLoadingOptions & {
357
474
  onEvent?: (name: string) => unknown;
358
475
  /** An authored non-purchase button completed its action. */
359
476
  onAction?: (actionId: string) => unknown | Promise<unknown>;
360
- onComplete?: (operation: SubscriptionOperation) => unknown;
477
+ onComplete?: (operation: PaywallOperation) => unknown;
361
478
  onAccessGranted?: (check: EntitlementCheckResult) => unknown;
362
479
  onDismiss?: () => unknown;
363
480
  onError?: (error: unknown) => unknown;
@@ -556,6 +673,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
556
673
  discountMinor: z.ZodNumber;
557
674
  trialDays: z.ZodNullable<z.ZodNumber>;
558
675
  }, z.core.$strict>>;
676
+ subscriptionChange: z.ZodOptional<z.ZodObject<{
677
+ membershipId: z.ZodUUID;
678
+ timing: z.ZodEnum<{
679
+ immediate: "immediate";
680
+ renewal: "renewal";
681
+ }>;
682
+ }, z.core.$strict>>;
559
683
  predecessor: z.ZodOptional<z.ZodObject<{
560
684
  operationId: z.ZodNullable<z.ZodUUID>;
561
685
  generation: z.ZodNumber;
@@ -563,6 +687,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
563
687
  }, z.core.$strict>, z.ZodObject<{
564
688
  type: z.ZodLiteral<"paywall_confirm">;
565
689
  operationId: z.ZodUUID;
690
+ merchantConfirmation: z.ZodOptional<z.ZodObject<{
691
+ quoteTermsDigest: z.ZodString;
692
+ consents: z.ZodArray<z.ZodObject<{
693
+ reference: z.ZodString;
694
+ version: z.ZodString;
695
+ }, z.core.$strict>>;
696
+ }, z.core.$strict>>;
566
697
  }, z.core.$strict>, z.ZodObject<{
567
698
  type: z.ZodLiteral<"paywall_cancel">;
568
699
  operationId: z.ZodUUID;
@@ -639,6 +770,10 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
639
770
  discountMinor: number;
640
771
  trialDays: number | null;
641
772
  } | undefined;
773
+ subscriptionChange?: {
774
+ membershipId: string;
775
+ timing: "immediate" | "renewal";
776
+ } | undefined;
642
777
  predecessor?: {
643
778
  operationId: string | null;
644
779
  generation: number;
@@ -646,6 +781,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
646
781
  } | {
647
782
  type: "paywall_confirm";
648
783
  operationId: string;
784
+ merchantConfirmation?: {
785
+ quoteTermsDigest: string;
786
+ consents: {
787
+ reference: string;
788
+ version: string;
789
+ }[];
790
+ } | undefined;
649
791
  } | {
650
792
  type: "paywall_cancel";
651
793
  operationId: string;
@@ -764,6 +906,10 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
764
906
  discountMinor: number;
765
907
  trialDays: number | null;
766
908
  } | undefined;
909
+ subscriptionChange?: {
910
+ membershipId: string;
911
+ timing: "immediate" | "renewal";
912
+ } | undefined;
767
913
  predecessor?: {
768
914
  operationId: string | null;
769
915
  generation: number;
@@ -771,6 +917,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
771
917
  } | {
772
918
  type: "paywall_confirm";
773
919
  operationId: string;
920
+ merchantConfirmation?: {
921
+ quoteTermsDigest: string;
922
+ consents: {
923
+ reference: string;
924
+ version: string;
925
+ }[];
926
+ } | undefined;
774
927
  } | {
775
928
  type: "paywall_cancel";
776
929
  operationId: string;
@@ -917,6 +1070,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
917
1070
  discountMinor: z.ZodNumber;
918
1071
  trialDays: z.ZodNullable<z.ZodNumber>;
919
1072
  }, z.core.$strict>>;
1073
+ subscriptionChange: z.ZodOptional<z.ZodObject<{
1074
+ membershipId: z.ZodUUID;
1075
+ timing: z.ZodEnum<{
1076
+ immediate: "immediate";
1077
+ renewal: "renewal";
1078
+ }>;
1079
+ }, z.core.$strict>>;
920
1080
  predecessor: z.ZodOptional<z.ZodObject<{
921
1081
  operationId: z.ZodNullable<z.ZodUUID>;
922
1082
  generation: z.ZodNumber;
@@ -924,6 +1084,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
924
1084
  }, z.core.$strict>, z.ZodObject<{
925
1085
  type: z.ZodLiteral<"paywall_confirm">;
926
1086
  operationId: z.ZodUUID;
1087
+ merchantConfirmation: z.ZodOptional<z.ZodObject<{
1088
+ quoteTermsDigest: z.ZodString;
1089
+ consents: z.ZodArray<z.ZodObject<{
1090
+ reference: z.ZodString;
1091
+ version: z.ZodString;
1092
+ }, z.core.$strict>>;
1093
+ }, z.core.$strict>>;
927
1094
  }, z.core.$strict>, z.ZodObject<{
928
1095
  type: z.ZodLiteral<"paywall_cancel">;
929
1096
  operationId: z.ZodUUID;
@@ -1000,6 +1167,10 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1000
1167
  discountMinor: number;
1001
1168
  trialDays: number | null;
1002
1169
  } | undefined;
1170
+ subscriptionChange?: {
1171
+ membershipId: string;
1172
+ timing: "immediate" | "renewal";
1173
+ } | undefined;
1003
1174
  predecessor?: {
1004
1175
  operationId: string | null;
1005
1176
  generation: number;
@@ -1007,6 +1178,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1007
1178
  } | {
1008
1179
  type: "paywall_confirm";
1009
1180
  operationId: string;
1181
+ merchantConfirmation?: {
1182
+ quoteTermsDigest: string;
1183
+ consents: {
1184
+ reference: string;
1185
+ version: string;
1186
+ }[];
1187
+ } | undefined;
1010
1188
  } | {
1011
1189
  type: "paywall_cancel";
1012
1190
  operationId: string;
@@ -1125,6 +1303,10 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1125
1303
  discountMinor: number;
1126
1304
  trialDays: number | null;
1127
1305
  } | undefined;
1306
+ subscriptionChange?: {
1307
+ membershipId: string;
1308
+ timing: "immediate" | "renewal";
1309
+ } | undefined;
1128
1310
  predecessor?: {
1129
1311
  operationId: string | null;
1130
1312
  generation: number;
@@ -1132,6 +1314,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1132
1314
  } | {
1133
1315
  type: "paywall_confirm";
1134
1316
  operationId: string;
1317
+ merchantConfirmation?: {
1318
+ quoteTermsDigest: string;
1319
+ consents: {
1320
+ reference: string;
1321
+ version: string;
1322
+ }[];
1323
+ } | undefined;
1135
1324
  } | {
1136
1325
  type: "paywall_cancel";
1137
1326
  operationId: string;
@@ -1261,6 +1450,10 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1261
1450
  discountMinor: number;
1262
1451
  trialDays: number | null;
1263
1452
  } | undefined;
1453
+ subscriptionChange?: {
1454
+ membershipId: string;
1455
+ timing: "immediate" | "renewal";
1456
+ } | undefined;
1264
1457
  predecessor?: {
1265
1458
  operationId: string | null;
1266
1459
  generation: number;
@@ -1268,6 +1461,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1268
1461
  } | {
1269
1462
  type: "paywall_confirm";
1270
1463
  operationId: string;
1464
+ merchantConfirmation?: {
1465
+ quoteTermsDigest: string;
1466
+ consents: {
1467
+ reference: string;
1468
+ version: string;
1469
+ }[];
1470
+ } | undefined;
1271
1471
  } | {
1272
1472
  type: "paywall_cancel";
1273
1473
  operationId: string;
@@ -1397,6 +1597,10 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1397
1597
  discountMinor: number;
1398
1598
  trialDays: number | null;
1399
1599
  } | undefined;
1600
+ subscriptionChange?: {
1601
+ membershipId: string;
1602
+ timing: "immediate" | "renewal";
1603
+ } | undefined;
1400
1604
  predecessor?: {
1401
1605
  operationId: string | null;
1402
1606
  generation: number;
@@ -1404,6 +1608,13 @@ declare const funnelPurchaseEntrySchema: z.ZodObject<{
1404
1608
  } | {
1405
1609
  type: "paywall_confirm";
1406
1610
  operationId: string;
1611
+ merchantConfirmation?: {
1612
+ quoteTermsDigest: string;
1613
+ consents: {
1614
+ reference: string;
1615
+ version: string;
1616
+ }[];
1617
+ } | undefined;
1407
1618
  } | {
1408
1619
  type: "paywall_cancel";
1409
1620
  operationId: string;
@@ -1491,7 +1702,7 @@ type FunnelPurchaseState = {
1491
1702
  purchases: readonly PaywallRecovery[];
1492
1703
  confirmation?: {
1493
1704
  operationId: string;
1494
- quote: SubscriptionAttachQuote;
1705
+ quote: PaywallQuote;
1495
1706
  };
1496
1707
  error?: {
1497
1708
  code: string;
@@ -1512,6 +1723,8 @@ declare function createFunnelPurchaseClient(input: FunnelPurchaseOptions): {
1512
1723
  readonly recovery: FunnelPurchaseState;
1513
1724
  readonly attempt: FunnelPurchaseAttempt | null;
1514
1725
  readonly identitySignal: AbortSignal;
1726
+ /** The session's Customer: the identity a Run of this client buckets by. */
1727
+ readonly customerId: string;
1515
1728
  /**
1516
1729
  * Storage only, no request: whether a new Start would begin afresh ("none", "finished") or
1517
1730
  * recover a pending original purchase ("pending"), an unpaid Checkout included.
@@ -1535,6 +1748,7 @@ declare function createFunnelPurchaseClient(input: FunnelPurchaseOptions): {
1535
1748
  commerce: {
1536
1749
  provider: string;
1537
1750
  currency: string;
1751
+ intent?: "subscription_change";
1538
1752
  };
1539
1753
  locale: string;
1540
1754
  }): Promise<PaywallResolution>;
@@ -1558,6 +1772,11 @@ declare function createFunnelPurchaseClient(input: FunnelPurchaseOptions): {
1558
1772
  type FunnelPurchaseClient = ReturnType<typeof createFunnelPurchaseClient>;
1559
1773
 
1560
1774
  type Start = Omit<FunnelPurchaseStart, "requestId">;
1775
+ type Commerce = {
1776
+ provider: string;
1777
+ currency: string;
1778
+ intent?: "subscription_change";
1779
+ };
1561
1780
  type PreparedState = "preparing" | "ready" | "unavailable" | "shown" | "adopted" | "released" | "closed";
1562
1781
  /**
1563
1782
  * A Funnel purchase Paywall rendered before the Customer asks for it. Passing it as `prepared` to
@@ -1579,6 +1798,12 @@ interface PreparedFunnelPurchase {
1579
1798
  readonly ready: Promise<boolean>;
1580
1799
  /** The Start it was rendered for, once known. */
1581
1800
  readonly start?: Start;
1801
+ /**
1802
+ * The first screen predicted from the Funnel's route when no Paywall was given. A popup, page,
1803
+ * end or unknown route leaves the copy unavailable with a `first_screen_*` or `route_*` reason;
1804
+ * the app can still draw a matching loading state from it.
1805
+ */
1806
+ readonly prediction?: FunnelStartPrediction;
1582
1807
  /** Whether a Start with this input would present this Paywall. */
1583
1808
  matches(start: Start): boolean;
1584
1809
  /**
@@ -1604,14 +1829,19 @@ declare function prerenderFunnelPurchase$1(container: HTMLElement, input: {
1604
1829
  * once and it becomes ready only with a Start. Null leaves it unavailable.
1605
1830
  */
1606
1831
  start: Start | Promise<Start | null | undefined>;
1607
- /** The Paywall the Funnel presents first: an exact Version or its current published one. */
1832
+ /**
1833
+ * The Paywall the Funnel presents first: an exact Version or its current published one. Omit
1834
+ * both and pass `configuration` to have the SDK predict it for this Customer and Start.
1835
+ */
1608
1836
  paywallVersionId?: string;
1609
1837
  paywallId?: string;
1838
+ /**
1839
+ * Predicts the first Paywall from the Funnel's published route when no Paywall is given. The
1840
+ * prediction waits for the final Start (its parameters decide the route) and records nothing.
1841
+ */
1842
+ configuration?: ConfigurationSync;
1610
1843
  /** Required while `start` is a promise: the Start's commerce and locale. */
1611
- commerce?: {
1612
- provider: string;
1613
- currency: string;
1614
- };
1844
+ commerce?: Commerce;
1615
1845
  locale?: string;
1616
1846
  maxAgeMs?: number;
1617
1847
  signal?: AbortSignal;
@@ -1641,6 +1871,7 @@ type FunnelHostOptions = PresentationLoadingOptions & {
1641
1871
  terminateCheckout?: PaywallHostOptions["terminateCheckout"];
1642
1872
  confirmOnHostedCheckout?: PaywallHostOptions["confirmOnHostedCheckout"];
1643
1873
  resolveOfferId?: PaywallHostOptions["resolveOfferId"];
1874
+ resolveSubscriptionChange?: PaywallHostOptions["resolveSubscriptionChange"];
1644
1875
  claimCoupon?: PaywallHostOptions["claimCoupon"];
1645
1876
  /**
1646
1877
  * Opens an external page or a Paywall link. Return `false` (or throw) when the page could not be
@@ -1684,11 +1915,18 @@ declare function showObservedFunnelRun(container: HTMLElement, input: FunnelHost
1684
1915
  }>;
1685
1916
 
1686
1917
  type FunnelPurchaseHostOptions = Omit<FunnelHostOptions, "client" | "checkoutNavigation" | "resolveOfferId" | "resumeCheckout" | "terminateCheckout"> & {
1687
- /** An already available Paywall design for the first frame. */
1918
+ /**
1919
+ * An already available Paywall design for the first frame, such as the predicted first
1920
+ * Paywall's (`predictedPaywallLoadingDocument`).
1921
+ */
1688
1922
  loadingDocument?: PaywallLoadingDocument;
1689
1923
  client: FunnelPurchaseClient;
1690
- /** Omit to recover only; no new attempt is allocated. */
1691
- start?: FunnelPurchaseStart;
1924
+ /**
1925
+ * Omit to recover only; no new attempt is allocated. A promise (the merchant's own checks still
1926
+ * running) shows the loading state at once and starts the Run when it settles; `null`,
1927
+ * `undefined` or a rejection ends the presentation without a Run, reported as `skipped`.
1928
+ */
1929
+ start?: FunnelPurchaseStart | Promise<FunnelPurchaseStart | null | undefined>;
1692
1930
  resolveOfferId?: (purchase: Parameters<NonNullable<FunnelHostOptions["resolveOfferId"]>>[0], attempt: FunnelPurchaseAttempt) => ReturnType<NonNullable<FunnelHostOptions["resolveOfferId"]>>;
1693
1931
  };
1694
1932
  type Host = Awaited<ReturnType<typeof showObservedFunnelRun>>;
@@ -1982,6 +2220,7 @@ declare function showPaywall(container: HTMLElement, options: PaywallHostOptions
1982
2220
  amountMinor: string;
1983
2221
  interval: "free" | "week" | "month" | "year" | "one_time";
1984
2222
  intervalCount: number;
2223
+ featureQuantities?: Record<string, number> | undefined;
1985
2224
  }[];
1986
2225
  } | null;
1987
2226
  observation?: {
@@ -2020,6 +2259,7 @@ declare function showPaywall(container: HTMLElement, options: PaywallHostOptions
2020
2259
  amountMinor: string;
2021
2260
  interval: "free" | "week" | "month" | "year" | "one_time";
2022
2261
  intervalCount: number;
2262
+ featureQuantities?: Record<string, number> | undefined;
2023
2263
  }[];
2024
2264
  } | null;
2025
2265
  observation?: {
@@ -2341,6 +2581,7 @@ declare function showPaywall(container: HTMLElement, options: PaywallHostOptions
2341
2581
  amountMinor: string;
2342
2582
  interval: "free" | "week" | "month" | "year" | "one_time";
2343
2583
  intervalCount: number;
2584
+ featureQuantities?: Record<string, number> | undefined;
2344
2585
  }[];
2345
2586
  } | null;
2346
2587
  observation?: {
@@ -2386,6 +2627,7 @@ declare function showPaywall(container: HTMLElement, options: PaywallHostOptions
2386
2627
  amountMinor: string;
2387
2628
  interval: "free" | "week" | "month" | "year" | "one_time";
2388
2629
  intervalCount: number;
2630
+ featureQuantities?: Record<string, number> | undefined;
2389
2631
  }[];
2390
2632
  } | null;
2391
2633
  observation?: {
@@ -2459,6 +2701,15 @@ declare function prerenderFunnelPurchase(...args: Parameters<typeof prerenderFun
2459
2701
  */
2460
2702
  declare function preloadFunnelPurchase(): Promise<void>;
2461
2703
 
2704
+ /**
2705
+ * Which first screen a Run of a Funnel would present for this Customer and Start, computed on the
2706
+ * device from the Funnel's published route. Records nothing; the Run started at the click
2707
+ * decides. Use it for loading states and pre-rendering.
2708
+ */
2709
+ declare function predictFunnelStart(...args: Parameters<typeof predictFunnelStart$1>): Promise<FunnelStartPrediction>;
2710
+ /** The published design of a predicted first Paywall, for a loading state. */
2711
+ declare function predictedPaywallLoadingDocument(...args: Parameters<typeof predictedPaywallLoadingDocument$1>): Promise<PaywallLoadingDocument | null>;
2712
+
2462
2713
  declare function mountContent(...args: Parameters<typeof mountContent$1>): Promise<{
2463
2714
  destroy: () => void;
2464
2715
  show: () => void;
@@ -2477,4 +2728,4 @@ declare function prepareContent(...args: Parameters<typeof prepareContent$1>): P
2477
2728
  updateCapabilities(data: SurfaceData): void;
2478
2729
  }>;
2479
2730
 
2480
- export { type ContentActionIntent, type ContentHostOptions, EntitlementCheckResult, FunnelCommandStorage, FunnelExecutionPolicy, type FunnelHostOptions, type FunnelPurchaseAttempt, type FunnelPurchaseClient, type FunnelPurchaseEntry, type FunnelPurchaseHostOptions, type FunnelPurchaseOptions, type FunnelPurchaseStart, type FunnelPurchaseState, type FunnelPurchaseStorage, FunnelRunController, type IamFunnelEntriesOptions, type IamFunnelProcessEntriesOptions, IndianaOptions as LongplayOptions, MerchantBridgeError, type MerchantBridgeOptions, Offer, type PaywallHostOptions, PaywallLoadingDocument, type PaywallPurchaseIntent, PaywallRecovery, PaywallSession, type PreparedFunnelPurchase, type PreparedState, PresentationLoadingOptions, SessionCredentials, createBrowserFunnelCommandStorage, createBrowserFunnelPurchaseStorage, createFunnelPageExperiments, createFunnelProcess, createFunnelPurchaseClient, createIamFunnelEntries, createIamFunnelProcessEntries, createMerchantBridge, createPaywallSession, formatCouponDiscount, formatCouponMoney, formatCouponTerms, mountContent, preloadFunnelPurchase, preloadPaywall, prepareContent, prerenderFunnelPurchase, showFunnelPurchase, showFunnelRun, showPaywall };
2731
+ export { ConfigurationSync, type ContentActionIntent, type ContentHostOptions, EntitlementCheckResult, FunnelCommandStorage, FunnelExecutionPolicy, type FunnelHostOptions, type FunnelPurchaseAttempt, type FunnelPurchaseClient, type FunnelPurchaseEntry, type FunnelPurchaseHostOptions, type FunnelPurchaseOptions, type FunnelPurchaseStart, type FunnelPurchaseState, type FunnelPurchaseStorage, FunnelRunController, type FunnelStartPrediction, type IamFunnelEntriesOptions, type IamFunnelProcessEntriesOptions, IndianaOptions as LongplayOptions, MerchantBridgeError, type MerchantBridgeOptions, Offer, type PaywallHostOptions, PaywallLoadingDocument, PaywallOperation, type PaywallPurchaseIntent, PaywallQuote, PaywallRecovery, PaywallSession, PaywallSubscriptionChange, type PreparedFunnelPurchase, type PreparedState, PresentationLoadingOptions, SessionCredentials, createBrowserFunnelCommandStorage, createBrowserFunnelPurchaseStorage, createFunnelPageExperiments, createFunnelProcess, createFunnelPurchaseClient, createIamFunnelEntries, createIamFunnelProcessEntries, createMerchantBridge, createPaywallSession, formatCouponDiscount, formatCouponMoney, formatCouponTerms, mountContent, predictFunnelStart, predictedPaywallLoadingDocument, preloadFunnelPurchase, preloadPaywall, prepareContent, prerenderFunnelPurchase, showFunnelPurchase, showFunnelRun, showPaywall };