@tinkerlandai/longplay-sdk 0.10.96 → 0.10.98

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 (106) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +23 -6
  3. package/README.zh-CN.md +9 -3
  4. package/dist/check-response-RG4OLOMY.js +1 -0
  5. package/dist/{chunk-F4AIEI5N.js → chunk-2VAQ56S2.js} +1 -1
  6. package/dist/{chunk-7NCZ6XU7.js → chunk-2VK44BOH.js} +1 -1
  7. package/dist/{chunk-Y3W5G4BF.js → chunk-2XX7L5VK.js} +1 -1
  8. package/dist/{chunk-UGATOG2T.js → chunk-355B3KPL.js} +1 -1
  9. package/dist/{chunk-6XRQR43F.js → chunk-3I6OZU2J.js} +1 -1
  10. package/dist/{chunk-7ZAM4YRK.js → chunk-45PGU2HW.js} +1 -1
  11. package/dist/{chunk-BT7IC765.js → chunk-4AJTBYKE.js} +1 -1
  12. package/dist/{chunk-KCG7GZXO.js → chunk-6HOH7LOK.js} +1 -1
  13. package/dist/{chunk-EQUVI5QU.js → chunk-6RQJNL7B.js} +1 -1
  14. package/dist/{chunk-3XH64DN3.js → chunk-6WOVMXJE.js} +1 -1
  15. package/dist/{chunk-CKMSSBJM.js → chunk-AHXR2QO2.js} +1 -1
  16. package/dist/{chunk-C4KLIT5L.js → chunk-CKUMSWUN.js} +1 -1
  17. package/dist/{chunk-LQV7EC5H.js → chunk-CNV22MDH.js} +1 -1
  18. package/dist/{chunk-XSJGNM2C.js → chunk-CV67DHPD.js} +1 -1
  19. package/dist/{chunk-67WFVDTV.js → chunk-DCKPSRMT.js} +1 -1
  20. package/dist/chunk-DS2AOHZY.js +1 -0
  21. package/dist/{chunk-2OBXRQMW.js → chunk-EEJPKNED.js} +1 -1
  22. package/dist/{chunk-Y6KA56V2.js → chunk-F467W5SE.js} +1 -1
  23. package/dist/{chunk-LFR2LWYC.js → chunk-FEZWUYEK.js} +1 -1
  24. package/dist/{chunk-6CNAIAG2.js → chunk-GGWIHM2N.js} +1 -1
  25. package/dist/{chunk-TE2F4PML.js → chunk-GJTXTEZG.js} +1 -1
  26. package/dist/{chunk-A5WUQLAO.js → chunk-GRY5G7X3.js} +1 -1
  27. package/dist/{chunk-7CZEXBQY.js → chunk-HHKX7P4Q.js} +1 -1
  28. package/dist/{chunk-FYUMVOCV.js → chunk-HN46A5SD.js} +1 -1
  29. package/dist/chunk-IESVRPTI.js +1 -0
  30. package/dist/{chunk-XLGNBPGF.js → chunk-JHVEOUIF.js} +1 -1
  31. package/dist/{chunk-7QPCNDIY.js → chunk-JSRB6RDU.js} +1 -1
  32. package/dist/{chunk-B6TDAH7X.js → chunk-JYE7LLEH.js} +2 -2
  33. package/dist/{chunk-MOIVJERE.js → chunk-JZYZHMCT.js} +1 -1
  34. package/dist/{chunk-DLORK3P2.js → chunk-L42BXSWX.js} +1 -1
  35. package/dist/{chunk-VXNN3RV3.js → chunk-LRJJNIUQ.js} +1 -1
  36. package/dist/{chunk-KCUE2VFJ.js → chunk-O33ABKTL.js} +1 -1
  37. package/dist/{chunk-6VVQWTHV.js → chunk-OC3IODWG.js} +1 -1
  38. package/dist/{chunk-PWE3ZWLR.js → chunk-OI4KRTEM.js} +1 -1
  39. package/dist/{chunk-3532HSBP.js → chunk-OILQZX5V.js} +1 -1
  40. package/dist/{chunk-CO6HDNOC.js → chunk-OJ6CPUN4.js} +1 -1
  41. package/dist/{chunk-MYG5MAKQ.js → chunk-ORQ5RR4J.js} +1 -1
  42. package/dist/chunk-PVNZFREQ.js +1 -0
  43. package/dist/{chunk-Y55OBV7D.js → chunk-Q7TQHM5N.js} +1 -1
  44. package/dist/{chunk-BOT6ZDLK.js → chunk-QNJPFX5F.js} +1 -1
  45. package/dist/{chunk-CHRNCOXJ.js → chunk-RXHGIDNM.js} +1 -1
  46. package/dist/{chunk-ME6QTD5Y.js → chunk-SEBMCCXY.js} +1 -1
  47. package/dist/{chunk-7JJGSLXD.js → chunk-SK73TK7R.js} +1 -1
  48. package/dist/{chunk-SX7U2ONB.js → chunk-UFO6XHFZ.js} +1 -1
  49. package/dist/{chunk-DUS5V65Z.js → chunk-VCRDA5R3.js} +1 -1
  50. package/dist/{chunk-KX67ZM7H.js → chunk-VID3LHBO.js} +1 -1
  51. package/dist/{chunk-FYMVNLQN.js → chunk-VPT5MFDG.js} +2 -2
  52. package/dist/{chunk-PUDTOCQF.js → chunk-WEORY7PV.js} +1 -1
  53. package/dist/{chunk-S2S4ROGY.js → chunk-XF746ACV.js} +1 -1
  54. package/dist/{chunk-XAPMQRVJ.js → chunk-YRVK3UDS.js} +1 -1
  55. package/dist/{chunk-FPJ3FE26.js → chunk-YTBCR2KU.js} +1 -1
  56. package/dist/{content-EV62FGPW.js → content-N7THX3DD.js} +1 -1
  57. package/dist/funnel-host-purchase-FQLL3MCD.js +1 -0
  58. package/dist/funnel-host-purchase-entry-ONAAZZV6.js +1 -0
  59. package/dist/funnel-host-recovery-paywall-WYK3N5WY.js +1 -0
  60. package/dist/{funnel-paywall-copies-LPOTYSTS.js → funnel-paywall-copies-4K6FMGCP.js} +1 -1
  61. package/dist/{funnel-paywall-pins-source-ZK2DZWY3.js → funnel-paywall-pins-source-MJIRVW5F.js} +1 -1
  62. package/dist/funnel-paywall-prerender-WEB5AEVM.js +1 -0
  63. package/dist/funnel-route-prediction-YOS2OMCA.js +1 -0
  64. package/dist/funnel-route-source-WZ35NDNG.js +1 -0
  65. package/dist/funnel-runtime-host-TYQ4CQ7T.js +1 -0
  66. package/dist/index.d.ts +13 -17
  67. package/dist/index.js +1 -1
  68. package/dist/merchant-bridge-contracts-DPNCMPVN.js +1 -0
  69. package/dist/native-shell.js +1 -1
  70. package/dist/openrouter.js +1 -1
  71. package/dist/operation-contracts-NLZ5ENTM.js +1 -0
  72. package/dist/page.js +1 -1
  73. package/dist/paywall-UGS2LKLH.js +1 -0
  74. package/dist/paywall-content-Y4SCPZRG.js +1 -0
  75. package/dist/paywall-session-J2VVRCZF.js +1 -0
  76. package/dist/popup.d.ts +2 -2
  77. package/dist/popup.js +1 -1
  78. package/dist/{presentation-loading-CU4c-koG.d.ts → presentation-loading-EAIPC1d3.d.ts} +2 -2
  79. package/dist/react-native.js +1 -1
  80. package/dist/screen-renderer-4VYPU7X6.js +1 -0
  81. package/dist/server.js +1 -1
  82. package/dist/{visual-dom-KUABNJV6.js → visual-dom-5LUN4AHO.js} +1 -1
  83. package/dist/visual.js +1 -1
  84. package/package.json +1 -1
  85. package/dist/check-response-XGOTG3KL.js +0 -1
  86. package/dist/chunk-5HWHBCVN.js +0 -1
  87. package/dist/chunk-JDXX5XN5.js +0 -1
  88. package/dist/chunk-XNICYGGP.js +0 -1
  89. package/dist/funnel-host-purchase-6BBAZXCX.js +0 -1
  90. package/dist/funnel-host-purchase-entry-5UDZJJBN.js +0 -1
  91. package/dist/funnel-host-recovery-paywall-AK4CJGGB.js +0 -1
  92. package/dist/funnel-paywall-prerender-YPVUTJTO.js +0 -1
  93. package/dist/funnel-route-prediction-Q4HMRAVQ.js +0 -1
  94. package/dist/funnel-route-source-HYWJWEM3.js +0 -1
  95. package/dist/funnel-runtime-host-D54WIMXD.js +0 -1
  96. package/dist/merchant-bridge-contracts-OIYML3DE.js +0 -1
  97. package/dist/operation-contracts-YJM6772C.js +0 -1
  98. package/dist/paywall-DWBIV43F.js +0 -1
  99. package/dist/paywall-content-S6A2WLIX.js +0 -1
  100. package/dist/paywall-session-R3WV3BSU.js +0 -1
  101. package/dist/screen-renderer-HJOKBOZH.js +0 -1
  102. /package/dist/{chunk-FRK6322O.js → chunk-CILM5XMH.js} +0 -0
  103. /package/dist/{chunk-B6TDAH7X.js.LEGAL.txt → chunk-JYE7LLEH.js.LEGAL.txt} +0 -0
  104. /package/dist/{chunk-KV5MZ4NI.js → chunk-OJM6ORHE.js} +0 -0
  105. /package/dist/{chunk-W22ESUYY.js → chunk-TDOPU2RH.js} +0 -0
  106. /package/dist/{chunk-FYMVNLQN.js.LEGAL.txt → chunk-VPT5MFDG.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import"./chunk-Y6KA56V2.js";import"./chunk-SX7U2ONB.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import{a as i}from"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import{b as A}from"./chunk-W22ESUYY.js";import"./chunk-WOT6VMZA.js";var c=A.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function f(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await f({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:k}=await w.read();if(k){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,f as trackOpenRouterUsage};
1
+ import"./chunk-F467W5SE.js";import"./chunk-UFO6XHFZ.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import{a as i}from"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import{b as A}from"./chunk-TDOPU2RH.js";import"./chunk-WOT6VMZA.js";var c=A.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function f(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await f({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:k}=await w.read();if(k){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,f as trackOpenRouterUsage};
@@ -0,0 +1 @@
1
+ import{e as o}from"./chunk-AHXR2QO2.js";import"./chunk-YTBCR2KU.js";import"./chunk-EEJPKNED.js";import"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-UFO6XHFZ.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-FEZWUYEK.js";import"./chunk-TDOPU2RH.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
package/dist/page.js CHANGED
@@ -1 +1 @@
1
- import{d as o,e as r,f as e,g as f}from"./chunk-B6TDAH7X.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
1
+ import{d as o,e as r,f as e,g as f}from"./chunk-JYE7LLEH.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-YRVK3UDS.js";import"./chunk-RXHGIDNM.js";import"./chunk-W32FI2A2.js";import"./chunk-OJ6CPUN4.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showPaywall};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-L42BXSWX.js";import"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-OI4KRTEM.js";import"./chunk-AHXR2QO2.js";import"./chunk-YTBCR2KU.js";import"./chunk-XF746ACV.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-EEJPKNED.js";import"./chunk-WEORY7PV.js";import"./chunk-L42BXSWX.js";import"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-UFO6XHFZ.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
package/dist/popup.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { b as ScreenAction, c as ScreenNode, d as ScreenInteractivity, e as ScreenDocument } from './screen-Pv_pViF6.js';
2
2
  import { O as Offer, a as OfferUnavailableReason } from './coupon-kfkIVf9n.js';
3
- import { e as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, f as ScreenParameters, g as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent, D as DialogHost } from './presentation-loading-CU4c-koG.js';
4
- export { d as PresentationState } from './presentation-loading-CU4c-koG.js';
3
+ import { e as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, f as ScreenParameters, g as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent, D as DialogHost } from './presentation-loading-EAIPC1d3.js';
4
+ export { d as PresentationState } from './presentation-loading-EAIPC1d3.js';
5
5
  import { WindowLike } from 'dompurify';
6
6
  import 'zod';
7
7
 
package/dist/popup.js CHANGED
@@ -1 +1 @@
1
- import{a as _,b as z,c as M,d as U,e as W,f as q,g as V,h as j,i as S}from"./chunk-LQV7EC5H.js";import{a as H,b as x,d as y,f as C,g as A,m as E}from"./chunk-CO6HDNOC.js";import"./chunk-Y3W5G4BF.js";import{D as b}from"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-W22ESUYY.js";import{a as p}from"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";function O(m,r,n){let d=m.ownerDocument,s=d.defaultView;if(!s)throw new Error("Preview container has no browser window");let l=!1,u=!1,f=0,c,i=d.createElement("div");i.style.cssText="width:100%;min-width:0";let v=(e,F)=>{c=S(e,{mode:"live",rendererUrl:n.rendererUrl,title:n.title??r.name,onPageChange:n.onPageChange,onAction:(R,I)=>p(n.onAction,R,I),onError:n.onError,...F}),c.update(r,n.locale,{capabilities:n.capabilities,customerData:n.customerData})},h=r.presentation;if(h.type==="inline")return m.append(i),v(i,{onContentHeight(e){f=e,p(n.onContentHeight,e,m.clientHeight)}}),{presentation:"inline",inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),i.remove())}};let t=d.createElement("dialog");t.lang=n.locale,t.dir=b(n.locale)?"rtl":"ltr",t.setAttribute("aria-label",r.name),t.style.cssText=H(n.host,h,r.theme);let a=d.createElement("button");a.type="button",a.textContent="×",a.setAttribute("aria-label",n.closeLabel),A(a,r.theme);let g=e=>{u&&!l&&p(n.onDismiss,e)};a.addEventListener("click",()=>g("close_button"));let D=()=>c?.resizeViewport(s.innerHeight||800,s.innerWidth||1024),o;if(n.host==="funnel"){let e=d.createElement("section");e.style.cssText="min-width:0;display:flex;flex-direction:column;min-height:100%",i.style.cssText+=";flex:1 0 auto;display:flex;flex-direction:column;justify-content:center",e.append(i),t.append(a,e),o=y(t,r,D)}else i.setAttribute("aria-label",r.name),o=y(t,r,D),t.append(i),t.prepend(a);let L=n.host==="content"&&o.responsive?x(t,()=>g("close_button"),()=>!0,n.closeLabel):void 0;t.addEventListener("cancel",e=>{e.preventDefault(),g("escape")});let w=e=>s.requestAnimationFrame?s.requestAnimationFrame(e):s.setTimeout(e,0),P=()=>{u&&!l&&p(n.onContentHeight,f,t.clientHeight)},T=E(t);return m.append(t),v(i,{viewportHeight:o.responsive?s.innerHeight||800:void 0,...o.responsive?{viewportWidth:s.innerWidth||1024,hostPresentation:()=>o.type}:{},...n.host!=="content"?{closeActions:n.closeActions??r.actions.filter(e=>e.close).map(e=>e.id),onAuthoredClose(e){a.hidden=e}}:{},onResize(e){o.responsive&&(i.style.height=`${e}px`,i.style.overflow="clip",o.setContentHeight(e)),w(P)},onContentHeight(e){f=e},onRendered(e){e&&t.setAttribute("aria-label",e),!(u||l)&&(u=!0,T(),o.latch(),t.showModal(),o.responsive&&t.focus({preventScroll:!0}),C(t,o.type,o.responsive),w(P))},onEscape:()=>g("escape")}),{get presentation(){return o.type},inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),L?.(),o.destroy(),t.open&&t.close(),t.remove())}}}export{q as formatCustomerDecimal,z as hostedRendererScript,_ as hostedRendererShell,U as inspectCustomHtml,O as mountDialogPreview,S as mountScreenPreview,j as preparePopup,W as prepareScreen,M as sanitizeCustomHtml,V as showPopup};
1
+ import{a as _,b as z,c as M,d as U,e as W,f as q,g as V,h as j,i as S}from"./chunk-CNV22MDH.js";import{a as H,b as x,d as y,f as C,g as A,m as E}from"./chunk-OJ6CPUN4.js";import"./chunk-2XX7L5VK.js";import{D as b}from"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-TDOPU2RH.js";import{a as p}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function O(m,r,n){let d=m.ownerDocument,s=d.defaultView;if(!s)throw new Error("Preview container has no browser window");let l=!1,u=!1,f=0,c,i=d.createElement("div");i.style.cssText="width:100%;min-width:0";let v=(e,F)=>{c=S(e,{mode:"live",rendererUrl:n.rendererUrl,title:n.title??r.name,onPageChange:n.onPageChange,onAction:(R,I)=>p(n.onAction,R,I),onError:n.onError,...F}),c.update(r,n.locale,{capabilities:n.capabilities,customerData:n.customerData})},h=r.presentation;if(h.type==="inline")return m.append(i),v(i,{onContentHeight(e){f=e,p(n.onContentHeight,e,m.clientHeight)}}),{presentation:"inline",inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),i.remove())}};let t=d.createElement("dialog");t.lang=n.locale,t.dir=b(n.locale)?"rtl":"ltr",t.setAttribute("aria-label",r.name),t.style.cssText=H(n.host,h,r.theme);let a=d.createElement("button");a.type="button",a.textContent="×",a.setAttribute("aria-label",n.closeLabel),A(a,r.theme);let g=e=>{u&&!l&&p(n.onDismiss,e)};a.addEventListener("click",()=>g("close_button"));let D=()=>c?.resizeViewport(s.innerHeight||800,s.innerWidth||1024),o;if(n.host==="funnel"){let e=d.createElement("section");e.style.cssText="min-width:0;display:flex;flex-direction:column;min-height:100%",i.style.cssText+=";flex:1 0 auto;display:flex;flex-direction:column;justify-content:center",e.append(i),t.append(a,e),o=y(t,r,D)}else i.setAttribute("aria-label",r.name),o=y(t,r,D),t.append(i),t.prepend(a);let L=n.host==="content"&&o.responsive?x(t,()=>g("close_button"),()=>!0,n.closeLabel):void 0;t.addEventListener("cancel",e=>{e.preventDefault(),g("escape")});let w=e=>s.requestAnimationFrame?s.requestAnimationFrame(e):s.setTimeout(e,0),P=()=>{u&&!l&&p(n.onContentHeight,f,t.clientHeight)},T=E(t);return m.append(t),v(i,{viewportHeight:o.responsive?s.innerHeight||800:void 0,...o.responsive?{viewportWidth:s.innerWidth||1024,hostPresentation:()=>o.type}:{},...n.host!=="content"?{closeActions:n.closeActions??r.actions.filter(e=>e.close).map(e=>e.id),onAuthoredClose(e){a.hidden=e}}:{},onResize(e){o.responsive&&(i.style.height=`${e}px`,i.style.overflow="clip",o.setContentHeight(e)),w(P)},onContentHeight(e){f=e},onRendered(e){e&&t.setAttribute("aria-label",e),!(u||l)&&(u=!0,T(),o.latch(),t.showModal(),o.responsive&&t.focus({preventScroll:!0}),C(t,o.type,o.responsive),w(P))},onEscape:()=>g("escape")}),{get presentation(){return o.type},inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),L?.(),o.destroy(),t.open&&t.close(),t.remove())}}}export{q as formatCustomerDecimal,z as hostedRendererScript,_ as hostedRendererShell,U as inspectCustomHtml,O as mountDialogPreview,S as mountScreenPreview,j as preparePopup,W as prepareScreen,M as sanitizeCustomHtml,V as showPopup};
@@ -1031,8 +1031,8 @@ type PresentationState = {
1031
1031
  error: unknown;
1032
1032
  });
1033
1033
  type PresentationLoadingOptions = {
1034
- /** "host" lets the merchant render its own placeholder. Defaults to "sdk". */
1035
- loading?: "sdk" | "host";
1034
+ /** "notice" keeps the page usable until content is ready; "host" delegates feedback. */
1035
+ loading?: "sdk" | "host" | "notice";
1036
1036
  /** First-screen lifecycle, independent of purchase or command processing. */
1037
1037
  onPresentationState?: (state: PresentationState) => void;
1038
1038
  /** Abort on unmount or Customer change, including while data is pending. */
@@ -1 +1 @@
1
- import{b as S,c as E,d as T}from"./chunk-6CNAIAG2.js";import"./chunk-XLGNBPGF.js";import{a as A}from"./chunk-PWE3ZWLR.js";import{e as P}from"./chunk-CKMSSBJM.js";import"./chunk-FPJ3FE26.js";import{h as b,i as x,k as L}from"./chunk-3XH64DN3.js";import{E as C}from"./chunk-MYG5MAKQ.js";import"./chunk-F4AIEI5N.js";import"./chunk-S2S4ROGY.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-2OBXRQMW.js";import"./chunk-PUDTOCQF.js";import"./chunk-DLORK3P2.js";import"./chunk-7QPCNDIY.js";import"./chunk-BT7IC765.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-SX7U2ONB.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import{a as r}from"./chunk-UGATOG2T.js";import{h as R}from"./chunk-LFR2LWYC.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
1
+ import{b as S,c as E,d as T}from"./chunk-GGWIHM2N.js";import"./chunk-JHVEOUIF.js";import{a as A}from"./chunk-OI4KRTEM.js";import{e as P}from"./chunk-AHXR2QO2.js";import"./chunk-YTBCR2KU.js";import{h as b,i as x,k as L}from"./chunk-6WOVMXJE.js";import{E as C}from"./chunk-ORQ5RR4J.js";import"./chunk-2VAQ56S2.js";import"./chunk-XF746ACV.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-EEJPKNED.js";import"./chunk-WEORY7PV.js";import"./chunk-L42BXSWX.js";import"./chunk-JSRB6RDU.js";import"./chunk-4AJTBYKE.js";import"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import"./chunk-DCKPSRMT.js";import"./chunk-VID3LHBO.js";import"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-UFO6XHFZ.js";import"./chunk-SK73TK7R.js";import"./chunk-O33ABKTL.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import{a as r}from"./chunk-355B3KPL.js";import{h as R}from"./chunk-FEZWUYEK.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-CNV22MDH.js";import"./chunk-OJ6CPUN4.js";import"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import"./chunk-VCRDA5R3.js";import"./chunk-QNJPFX5F.js";import"./chunk-GRY5G7X3.js";import"./chunk-355B3KPL.js";import"./chunk-FEZWUYEK.js";import"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as pn}from"./chunk-JDXX5XN5.js";import{a as I}from"./chunk-EQUVI5QU.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-Y6KA56V2.js";import{a as xt}from"./chunk-PWE3ZWLR.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-CKMSSBJM.js";import"./chunk-FPJ3FE26.js";import{a as Te,b as ae,c as yt,d as It,e as wt,f as xe,g as vt,h as Me,i as dn,j as ln,k as mn}from"./chunk-3XH64DN3.js";import{B as V,C as N,d as ft,e as ht,k as gt,l as z,m as St,p as Ct,q as Rt,r as bt,s as At,t as Ot,y as pe,z as Tt}from"./chunk-MYG5MAKQ.js";import"./chunk-F4AIEI5N.js";import{c as h}from"./chunk-S2S4ROGY.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-2OBXRQMW.js";import{a as Et,b as _e}from"./chunk-PUDTOCQF.js";import"./chunk-DLORK3P2.js";import"./chunk-7QPCNDIY.js";import{e as at}from"./chunk-BT7IC765.js";import{B as pt,C as de,D as Z,E as lt,J as mt,a as et,e as q,j as Re,k as st,l as ct,q as ut,r as dt,s as be,t as Ae}from"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import{A as W,B as oe,C as tt,D as Se,E as ie,G as se,H as Ce,M as j,O as ce,P as nt,R as Ee,S as rt,T as ot,f as Ge,g as je,j as we,r as ze,s as Ke,u as an,v as sn,y as cn,z as X}from"./chunk-67WFVDTV.js";import{b as Oe}from"./chunk-KX67ZM7H.js";import{e as ve,i as Ze,l as it}from"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-SX7U2ONB.js";import"./chunk-7JJGSLXD.js";import{a as Ne,b as Le}from"./chunk-KCUE2VFJ.js";import{o as ue}from"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-DUS5V65Z.js";import{c as Ie}from"./chunk-BOT6ZDLK.js";import{e as Xe,h as We}from"./chunk-A5WUQLAO.js";import{a as c}from"./chunk-UGATOG2T.js";import{h as Y}from"./chunk-LFR2LWYC.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import{a as Ye}from"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";var _t=4,Mt=[...tt,"requirement_checks","native_offers","preparations","benefit_claims","authorizations","business_results","checkout_termination"],In=u.enum(Mt),ee=(e,n)=>u.array(e).max(n).refine(t=>new Set(t).size===t.length,"Declarations must be unique"),ke=u.strictObject({...se.shape,bridgeVersion:u.literal(_t),capabilities:ee(In,Mt.length),checkKinds:ee(u.enum(["access","metered","credit"]),3),preparationActions:ee(u.enum(["purchase","subscription_change","refund"]),3),authorizationKinds:ee(u.enum(["auto_topup"]),1),nextActionTypes:ee(u.enum(["redirect","authenticate"]),2),resultEvents:ee(u.enum(["benefit.claimed","authorization.updated"]),2)}).superRefine((e,n)=>{e.capabilities.includes("catalog")!==(e.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(e.capabilities.includes("billing_records")!==e.billingEvents.length>0||new Set(e.billingEvents).size!==e.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare unique supported billing events"});let t=r=>e.capabilities.includes(r),o=(r,a)=>n.addIssue({code:"custom",path:[r],message:a});t("requirement_checks")!==e.checkKinds.length>0&&o("checkKinds","Declare the supported Check kinds"),t("preparations")!==e.preparationActions.length>0&&o("preparationActions","Declare the supported preparation actions"),t("authorizations")!==e.authorizationKinds.length>0&&o("authorizationKinds","Declare the supported authorization kinds"),t("business_results")!==e.resultEvents.length>0&&o("resultEvents","Declare the supported non-financial results");for(let[r,a,s]of[["purchases","purchase","purchase.completed"],["subscription_changes","subscription_change","subscription.change.completed"],["refunds","refund","refund.updated"]])t(r)&&(!t("operation_status")||!t("billing_records")||!t("preparations")||!e.preparationActions.includes(a)||!e.billingEvents.includes(s))&&o("capabilities",`${r} requires preparation, original lookup and its billing result`);t("purchases")&&!e.billingEvents.includes("purchase.closed")&&o("billingEvents","Purchase execution requires its terminal closure result"),t("checkout_termination")&&(!t("operation_status")||!t("billing_records")||!e.billingEvents.includes("purchase.closed"))&&o("capabilities","Checkout termination requires original lookup and purchase.closed"),t("subscription_changes")&&!e.billingEvents.includes("subscription.change.closed")&&o("billingEvents","Subscription change execution requires its terminal closure result");for(let[r,a]of[["benefit_claims","benefit.claimed"],["authorizations","authorization.updated"]])t(r)&&(!t("operation_status")||!t("business_results")||!e.resultEvents.includes(a))&&o("capabilities",`${r} requires original lookup and its non-financial result`)}),K={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":u.strictObject({}),"requirement.check":$e,"operation.prepare":ze,"benefit.claim":Ue,"operation.read":qe,"purchase.terminate":j},wn={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":ke,"requirement.check":Qe,"operation.prepare":Ke,"benefit.claim":Ve,"operation.read":He,"purchase.terminate":j.extend({outcome:u.enum(["requested","already_paid"])})},Gn=u.enum(["bridge.ping","bridge.describe","requirement.check","operation.prepare","benefit.claim","operation.read","purchase.terminate"]);function $(e,n){return u.strictObject({bridgeVersion:u.literal(_t),requestId:u.uuid(),scope:Ce,command:u.literal(e),data:n})}var kt=u.discriminatedUnion("command",[$("bridge.ping",K["bridge.ping"]),$("bridge.describe",K["bridge.describe"]),$("requirement.check",K["requirement.check"]),$("operation.prepare",K["operation.prepare"]),$("benefit.claim",K["benefit.claim"]),$("operation.read",K["operation.read"]),$("purchase.terminate",K["purchase.terminate"])]),Be=u.strictObject({code:u.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:u.string().min(1).max(500),retryable:u.boolean(),recovery:u.string().min(1).max(80),effect:u.enum(["none","unknown"])}).refine(e=>e.effect!=="unknown"||!e.retryable&&e.recovery==="recover_operation","Unknown effects require original-operation recovery");function Bt(e){let n={bridgeVersion:u.literal(4),requestId:u.uuid(),scope:Ce,command:u.literal(e)};return u.union([u.strictObject({...n,data:wn[e]}),u.strictObject({...n,error:Be})])}var Pt="X-Indiana-Bridge-Signature",Q="X-Indiana-Bridge-Key-Id";function vn(e){return new TextEncoder().encode(e)}function Dt(e){return Uint8Array.from(atob(e.replaceAll("-","+").replaceAll("_","/")),n=>n.charCodeAt(0))}function Ft(e,n,t,o){return vn(`indiana-merchant-bridge:${o}
1
+ import{a as pn}from"./chunk-DS2AOHZY.js";import{a as I}from"./chunk-6RQJNL7B.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-F467W5SE.js";import{a as xt}from"./chunk-OI4KRTEM.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-AHXR2QO2.js";import"./chunk-YTBCR2KU.js";import{a as Te,b as ae,c as yt,d as It,e as wt,f as xe,g as vt,h as Me,i as dn,j as ln,k as mn}from"./chunk-6WOVMXJE.js";import{B as V,C as N,d as ft,e as ht,k as gt,l as z,m as St,p as Ct,q as Rt,r as bt,s as At,t as Ot,y as pe,z as Tt}from"./chunk-ORQ5RR4J.js";import"./chunk-2VAQ56S2.js";import{c as h}from"./chunk-XF746ACV.js";import"./chunk-Q7TQHM5N.js";import"./chunk-JZYZHMCT.js";import"./chunk-EEJPKNED.js";import{a as Et,b as _e}from"./chunk-WEORY7PV.js";import"./chunk-L42BXSWX.js";import"./chunk-JSRB6RDU.js";import{e as at}from"./chunk-4AJTBYKE.js";import{B as pt,C as de,D as Z,E as lt,J as mt,a as et,e as q,j as Re,k as st,l as ct,q as ut,r as dt,s as be,t as Ae}from"./chunk-SEBMCCXY.js";import"./chunk-3I6OZU2J.js";import"./chunk-OILQZX5V.js";import{A as W,B as oe,C as tt,D as Se,E as ie,G as se,H as Ce,M as j,O as ce,P as nt,R as Ee,S as rt,T as ot,f as Ge,g as je,j as we,r as ze,s as Ke,u as an,v as sn,y as cn,z as X}from"./chunk-DCKPSRMT.js";import{b as Oe}from"./chunk-VID3LHBO.js";import{e as ve,i as Ze,l as it}from"./chunk-OC3IODWG.js";import"./chunk-VILB5M4X.js";import"./chunk-UFO6XHFZ.js";import"./chunk-SK73TK7R.js";import{a as Ne,b as Le}from"./chunk-O33ABKTL.js";import{o as ue}from"./chunk-2XX7L5VK.js";import"./chunk-HN46A5SD.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-VCRDA5R3.js";import{c as Ie}from"./chunk-QNJPFX5F.js";import{e as Xe,h as We}from"./chunk-GRY5G7X3.js";import{a as c}from"./chunk-355B3KPL.js";import{h as Y}from"./chunk-FEZWUYEK.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import{a as Ye}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var _t=4,Mt=[...tt,"requirement_checks","native_offers","preparations","benefit_claims","authorizations","business_results","checkout_termination"],In=u.enum(Mt),ee=(e,n)=>u.array(e).max(n).refine(t=>new Set(t).size===t.length,"Declarations must be unique"),ke=u.strictObject({...se.shape,bridgeVersion:u.literal(_t),capabilities:ee(In,Mt.length),checkKinds:ee(u.enum(["access","metered","credit"]),3),preparationActions:ee(u.enum(["purchase","subscription_change","refund"]),3),authorizationKinds:ee(u.enum(["auto_topup"]),1),nextActionTypes:ee(u.enum(["redirect","authenticate"]),2),resultEvents:ee(u.enum(["benefit.claimed","authorization.updated"]),2)}).superRefine((e,n)=>{e.capabilities.includes("catalog")!==(e.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(e.capabilities.includes("billing_records")!==e.billingEvents.length>0||new Set(e.billingEvents).size!==e.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare unique supported billing events"});let t=r=>e.capabilities.includes(r),o=(r,a)=>n.addIssue({code:"custom",path:[r],message:a});t("requirement_checks")!==e.checkKinds.length>0&&o("checkKinds","Declare the supported Check kinds"),t("preparations")!==e.preparationActions.length>0&&o("preparationActions","Declare the supported preparation actions"),t("authorizations")!==e.authorizationKinds.length>0&&o("authorizationKinds","Declare the supported authorization kinds"),t("business_results")!==e.resultEvents.length>0&&o("resultEvents","Declare the supported non-financial results");for(let[r,a,s]of[["purchases","purchase","purchase.completed"],["subscription_changes","subscription_change","subscription.change.completed"],["refunds","refund","refund.updated"]])t(r)&&(!t("operation_status")||!t("billing_records")||!t("preparations")||!e.preparationActions.includes(a)||!e.billingEvents.includes(s))&&o("capabilities",`${r} requires preparation, original lookup and its billing result`);t("purchases")&&!e.billingEvents.includes("purchase.closed")&&o("billingEvents","Purchase execution requires its terminal closure result"),t("checkout_termination")&&(!t("operation_status")||!t("billing_records")||!e.billingEvents.includes("purchase.closed"))&&o("capabilities","Checkout termination requires original lookup and purchase.closed"),t("subscription_changes")&&!e.billingEvents.includes("subscription.change.closed")&&o("billingEvents","Subscription change execution requires its terminal closure result");for(let[r,a]of[["benefit_claims","benefit.claimed"],["authorizations","authorization.updated"]])t(r)&&(!t("operation_status")||!t("business_results")||!e.resultEvents.includes(a))&&o("capabilities",`${r} requires original lookup and its non-financial result`)}),K={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":u.strictObject({}),"requirement.check":$e,"operation.prepare":ze,"benefit.claim":Ue,"operation.read":qe,"purchase.terminate":j},wn={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":ke,"requirement.check":Qe,"operation.prepare":Ke,"benefit.claim":Ve,"operation.read":He,"purchase.terminate":j.extend({outcome:u.enum(["requested","already_paid"])})},Gn=u.enum(["bridge.ping","bridge.describe","requirement.check","operation.prepare","benefit.claim","operation.read","purchase.terminate"]);function $(e,n){return u.strictObject({bridgeVersion:u.literal(_t),requestId:u.uuid(),scope:Ce,command:u.literal(e),data:n})}var kt=u.discriminatedUnion("command",[$("bridge.ping",K["bridge.ping"]),$("bridge.describe",K["bridge.describe"]),$("requirement.check",K["requirement.check"]),$("operation.prepare",K["operation.prepare"]),$("benefit.claim",K["benefit.claim"]),$("operation.read",K["operation.read"]),$("purchase.terminate",K["purchase.terminate"])]),Be=u.strictObject({code:u.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:u.string().min(1).max(500),retryable:u.boolean(),recovery:u.string().min(1).max(80),effect:u.enum(["none","unknown"])}).refine(e=>e.effect!=="unknown"||!e.retryable&&e.recovery==="recover_operation","Unknown effects require original-operation recovery");function Bt(e){let n={bridgeVersion:u.literal(4),requestId:u.uuid(),scope:Ce,command:u.literal(e)};return u.union([u.strictObject({...n,data:wn[e]}),u.strictObject({...n,error:Be})])}var Pt="X-Indiana-Bridge-Signature",Q="X-Indiana-Bridge-Key-Id";function vn(e){return new TextEncoder().encode(e)}function Dt(e){return Uint8Array.from(atob(e.replaceAll("-","+").replaceAll("_","/")),n=>n.charCodeAt(0))}function Ft(e,n,t,o){return vn(`indiana-merchant-bridge:${o}
2
2
  ${n}
3
3
  POST
4
4
  ${W}
@@ -1 +1 @@
1
- import{b as a,c as b}from"./chunk-KV5MZ4NI.js";import"./chunk-J6KIN4RH.js";import"./chunk-WOT6VMZA.js";export{b as applyVisualVariation,a as safeVisualMutation};
1
+ import{b as a,c as b}from"./chunk-OJM6ORHE.js";import"./chunk-J6KIN4RH.js";import"./chunk-WOT6VMZA.js";export{b as applyVisualVariation,a as safeVisualMutation};
package/dist/visual.js CHANGED
@@ -1 +1 @@
1
- import{a as pe,c as fe}from"./chunk-KV5MZ4NI.js";import{b as le}from"./chunk-J6KIN4RH.js";import{a as Ve,b as ce,c as de,d as ue}from"./chunk-SLUA7ABW.js";import{a as J,b as F,c as ge,e as me}from"./chunk-B6TDAH7X.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import{b as o}from"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import{c as te,e as ie,g as M}from"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";var K="indiana-visual-diagnostics-v1",Ae=o.strictObject({environmentId:o.string().uuid(),release:o.string().regex(/^[a-f0-9]{64}$/).nullable(),generation:o.string().regex(/^[a-f0-9]{64}$/).nullable(),publishedGeneration:o.string().regex(/^[a-f0-9]{64}$/).nullable(),checkedAt:o.string().datetime(),origin:o.string().url(),pathname:o.string().max(2048),urlMatches:o.boolean(),stopped:o.boolean(),rows:o.array(o.strictObject({changeId:o.string().regex(/^[a-f0-9]{64}$/),experimentKey:o.string().max(256),variationKey:o.string().max(256),inExperiment:o.boolean(),fingerprint:o.string().regex(/^[a-f0-9]{64}$/),status:o.enum(["inactive","waiting","partial","applied","mismatch","no_changes","unavailable","error"]),total:o.number().int().min(0).max(600),applied:o.number().int().min(0).max(600)})).max(100)});function ye(e){let l=n=>Array.isArray(n)?"["+n.map(l).join(",")+"]":n&&typeof n=="object"?"{"+Object.entries(n).filter(([,c])=>c!==void 0).sort(([c],[y])=>c.localeCompare(y)).map(([c,y])=>JSON.stringify(c)+":"+l(y)).join(",")+"}":JSON.stringify(n);return l({css:e.css,js:e.js,domMutations:e.domMutations,...e.renderGuard?{renderGuard:e.renderGuard}:{}})}function he(e){let l=new URL(e.baseUrl),n=l.origin==="https://api.longplayai.com"||l.origin==="https://api.dev.longplayai.com"?l.hostname.slice(4):void 0,c=e.origins??(n?[`https://console.${n}`]:[]),y=new Set(c.filter(t=>{try{let i=new URL(t);return i.origin===t&&(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))}catch{return!1}})),v=!1,I=!1,k=0,T=async t=>{if(v||I||!t.source||!y.has(t.origin)||!t.data||typeof t.data!="object")return;let i=t.data;if(!(i.channel!==K||i.type!=="inspect"||i.environmentId!==e.environmentId||typeof i.nonce!="string"||!/^[a-f0-9-]{36}$/i.test(i.nonce)||typeof i.changeId!="string"||!/^[a-f0-9]{64}$/.test(i.changeId)||typeof i.url!="string"||i.url.length>2048||Date.now()-k<250)){try{if(new URL(i.url).origin!==location.origin)return}catch{return}I=!0,k=Date.now();try{let x=await e.inspect(i.changeId,i.url);!v&&x.rows.some(S=>S.changeId===i.changeId)&&t.source.postMessage({channel:K,type:"result",nonce:i.nonce,snapshot:x},t.origin)}finally{I=!1}}},u=t=>{T(t).catch(()=>{})};return window.addEventListener("message",u),()=>{v=!0,window.removeEventListener("message",u)}}var R=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=(e,l)=>typeof e=="string"&&e.length<=l,Ee=e=>typeof e=="string"&&(["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e));function ke(e){if(!R(e)||!E(e.css??"",1e5)||!E(e.js??"",1e5)||!Array.isArray(e.domMutations??[])||Array.isArray(e.domMutations)&&e.domMutations.length>200)throw new Error("Invalid visual variation");let l=e.domMutations??[];for(let n of l)if(!R(n)||!E(n.selector,2048)||!n.selector||!Ee(n.attribute)||!["set","append","remove"].includes(String(n.action))||n.value!==void 0&&!E(n.value,5e4)||n.parentSelector!==void 0&&!E(n.parentSelector,2048)||n.insertBeforeSelector!==void 0&&!E(n.insertBeforeSelector,2048))throw new Error("Invalid visual mutation");return{css:e.css??"",js:e.js??"",domMutations:l,...e.renderGuard===void 0?{}:{renderGuard:le(e.renderGuard)}}}function q(e){if(!R(e)||typeof e.environmentId!="string"||typeof e.trackExposures!="boolean"||!/^[-a-f0-9]{36}$/i.test(e.environmentId)||typeof e.generation!="string"||!/^[a-f0-9]{64}$/.test(e.generation)||!Array.isArray(e.experiments)||e.experiments.length>100||!R(e.savedGroups))throw new Error("Invalid visual experiment payload");let l=e.experiments.map(n=>{if(!R(n)||!["key","changeId"].every(c=>typeof n[c]=="string"&&n[c])||!/^[a-f0-9]{64}$/.test(String(n.changeId))||["namespace","status","groups","url"].some(c=>Object.hasOwn(n,c))||n.hashVersion!==void 0&&n.hashVersion!==2||!Array.isArray(n.variations)||n.variations.length<2||n.variations.length>20||n.urlPatterns!==void 0&&!Array.isArray(n.urlPatterns))throw new Error("Invalid visual experiment");return{...n,variations:n.variations.map(ke)}});return{...e,experiments:l}}var ve=6e4;function qe(e){let l=se(e.baseUrl);if(e.appManifestRelease!==void 0&&!/^[a-f0-9]{64}$/.test(e.appManifestRelease))throw new Error("Invalid IAM manifest digest");if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("Invalid App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),c=F(n),y=F(n),v=`${l}/api/v1/visual-experiments/${e.environmentId}`,I=e.appManifestRelease?`${v}?iam=${e.appManifestRelease}`:v,k=re(e.deviceIdCookie??"indiana_did"),T=ae(),u=null,t=!1,i=!1,x="",S={...e.attributes??{}},G,B,D=0,H=-1/0,$,m=new Map,O=new Map,C=new Set,z=ge({endpoint:`${v}/events`,fetch:n,log:e.log,label:"Visual exposure"}),P=z.flush,W,b;function j(){clearTimeout(W),b?.remove(),b=void 0}function Y(s,d){let f=M(s,d);C.has(f)||e.trackExposures===!1||u?.trackExposures===!1||t||(C.add(f),z.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:k,...T?{sessionId:T}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:s.key,variationKey:d.key}))}function we(s){if(!u||t)return;let d=new Set,f={onExperimentViewed:(r,p)=>{d.add(M(r,p))},url:location.href,attributes:{...me(k,location),...S,indianaAppManifestRelease:e.appManifestRelease??null},savedGroups:te(u.savedGroups),log:e.log},h=new Set;for(let r of u.experiments){if(de(`${e.environmentId}:${r.key}`))continue;let p=r;try{let a=ie(p,f);if(O.set(r.changeId,a),!a.inExperiment)continue;h.add(r.changeId);let w=JSON.stringify([a.key,a.value]),U=m.get(r.changeId);if(U?.signature===w){d.has(M(p,a))&&s.push(()=>{U.applied()&&Y(p,a)});continue}m.get(r.changeId)?.revert(),m.delete(r.changeId);let A=fe(a.value,{requireUniqueTargets:!!e.appManifestRelease&&Array.isArray(r.condition?.$and)&&r.condition.$and.some(g=>g!==null&&typeof g=="object"&&!Array.isArray(g)&&g.indianaAppManifestRelease===e.appManifestRelease),boundVariations:r.variations,allowJs:e.disableJsInjection===!1,nonce:e.nonce,onApplied:()=>{d.has(M(p,a))&&Y(p,a)},onError:g=>e.log?.("Visual experiment stopped",{experiment:r.key,changeId:r.changeId,variation:a.key,error:String(g)}),onTargetStatus:e.log?g=>e.log?.("Visual target status changed",{experiment:r.key,changeId:r.changeId,variation:a.key,...g}):void 0});m.set(r.changeId,{signature:w,revert:A.revert,applied:()=>A.applied,inspect:()=>A.inspect()})}catch(a){e.log?.("Skipping visual experiment",{experiment:r.key,error:String(a)})}}for(let[r,p]of m)h.has(r)||(p.revert(),m.delete(r));j()}let V=()=>{let s=[];pe(()=>we(s));for(let d of s)d()};async function _(){let s=++D,d;try{d=await c.read(I,J)}catch(h){if(t||s!==D)return!1;throw h}let f=q(d);if(f.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Visual payload scope changed");return t||s!==D?!1:(u=f,H=performance.now(),!0)}async function Q(){!await _()||t||(N(),V())}function L(){clearTimeout($),$=setTimeout(()=>{if(document.visibilityState==="hidden")return L();Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()})},ve)}let X=()=>{t||document.visibilityState==="hidden"||performance.now()-H<ve||(clearTimeout($),Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()}))},Ie=()=>{x!==location.href&&(x=location.href,V())},Z=()=>{P(!0)},N=()=>{G||t||(G=oe(Ie),addEventListener("pagehide",Z),x=location.href)};async function ee(s,d){let f=location.href,h=u,r=[],p=null;if(!t)try{let a=q(await y.read(I,J));a.environmentId===e.environmentId&&(p=a.generation)}catch{}for(let a of h?.experiments??[]){if(s&&a.changeId!==s)continue;let w=O.get(a.changeId);if(!w)continue;let U=new TextEncoder().encode(ye(w.value)),A=[...new Uint8Array(await crypto.subtle.digest("SHA-256",U))].map(be=>be.toString(16).padStart(2,"0")).join(""),g=m.get(a.changeId)?.inspect()??{status:"inactive",total:0,applied:0};r.push({changeId:a.changeId,experimentKey:a.key,variationKey:w.key,inExperiment:w.inExperiment,fingerprint:A,...g})}return{environmentId:e.environmentId,release:e.appManifestRelease??null,generation:h?.generation??null,publishedGeneration:p,checkedAt:new Date().toISOString(),origin:location.origin,pathname:location.pathname,urlMatches:location.href===f&&(!d||d===f)&&h===u,stopped:t,rows:r}}let ne,xe=ue(()=>{i&&!t&&V()});return{async start(){if(!(i||t)){i=!0,e.appManifestRelease&&(B=ce(e.appManifestRelease)),e.antiFlicker&&(b=document.createElement("style"),e.nonce&&(b.nonce=e.nonce),b.textContent="body { visibility: hidden !important }",document.head.append(b),W=setTimeout(j,Math.min(3e3,Math.max(0,e.antiFlickerTimeout??1e3))));try{if(!await _()||t)return;N(),V()}finally{j(),t||(L(),document.addEventListener("visibilitychange",X),ne=he({environmentId:e.environmentId,baseUrl:l,origins:e.diagnosticsOrigins,inspect:ee}))}}},async refresh(){t||await _()&&(i&&N(),V())},setAttributes(s){S={...s},V()},flush:()=>P(),getDiagnostics:ee,getResults(){return new Map(O)},get generation(){return u?.generation??null},destroy(){t=!0,clearTimeout($),document.removeEventListener("visibilitychange",X),xe(),ne?.(),D++,c.destroy(),y.destroy(),G?.(),B?.destroy(),removeEventListener("pagehide",Z),j();for(let s of m.values())s.revert();m.clear(),P(!0),u=null,O.clear(),C.clear(),S={}}}}export{qe as createVisualExperiments,Ve as loadAppManifestRelease};
1
+ import{a as pe,c as fe}from"./chunk-OJM6ORHE.js";import{b as le}from"./chunk-J6KIN4RH.js";import{a as Ve,b as ce,c as de,d as ue}from"./chunk-SLUA7ABW.js";import{a as J,b as F,c as ge,e as me}from"./chunk-JYE7LLEH.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-2VK44BOH.js";import"./chunk-5MRSFLQA.js";import{b as o}from"./chunk-TDOPU2RH.js";import"./chunk-DSPLGTQI.js";import{c as te,e as ie,g as M}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var K="indiana-visual-diagnostics-v1",Ae=o.strictObject({environmentId:o.string().uuid(),release:o.string().regex(/^[a-f0-9]{64}$/).nullable(),generation:o.string().regex(/^[a-f0-9]{64}$/).nullable(),publishedGeneration:o.string().regex(/^[a-f0-9]{64}$/).nullable(),checkedAt:o.string().datetime(),origin:o.string().url(),pathname:o.string().max(2048),urlMatches:o.boolean(),stopped:o.boolean(),rows:o.array(o.strictObject({changeId:o.string().regex(/^[a-f0-9]{64}$/),experimentKey:o.string().max(256),variationKey:o.string().max(256),inExperiment:o.boolean(),fingerprint:o.string().regex(/^[a-f0-9]{64}$/),status:o.enum(["inactive","waiting","partial","applied","mismatch","no_changes","unavailable","error"]),total:o.number().int().min(0).max(600),applied:o.number().int().min(0).max(600)})).max(100)});function ye(e){let l=n=>Array.isArray(n)?"["+n.map(l).join(",")+"]":n&&typeof n=="object"?"{"+Object.entries(n).filter(([,c])=>c!==void 0).sort(([c],[y])=>c.localeCompare(y)).map(([c,y])=>JSON.stringify(c)+":"+l(y)).join(",")+"}":JSON.stringify(n);return l({css:e.css,js:e.js,domMutations:e.domMutations,...e.renderGuard?{renderGuard:e.renderGuard}:{}})}function he(e){let l=new URL(e.baseUrl),n=l.origin==="https://api.longplayai.com"||l.origin==="https://api.dev.longplayai.com"?l.hostname.slice(4):void 0,c=e.origins??(n?[`https://console.${n}`]:[]),y=new Set(c.filter(t=>{try{let i=new URL(t);return i.origin===t&&(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))}catch{return!1}})),v=!1,I=!1,k=0,T=async t=>{if(v||I||!t.source||!y.has(t.origin)||!t.data||typeof t.data!="object")return;let i=t.data;if(!(i.channel!==K||i.type!=="inspect"||i.environmentId!==e.environmentId||typeof i.nonce!="string"||!/^[a-f0-9-]{36}$/i.test(i.nonce)||typeof i.changeId!="string"||!/^[a-f0-9]{64}$/.test(i.changeId)||typeof i.url!="string"||i.url.length>2048||Date.now()-k<250)){try{if(new URL(i.url).origin!==location.origin)return}catch{return}I=!0,k=Date.now();try{let x=await e.inspect(i.changeId,i.url);!v&&x.rows.some(S=>S.changeId===i.changeId)&&t.source.postMessage({channel:K,type:"result",nonce:i.nonce,snapshot:x},t.origin)}finally{I=!1}}},u=t=>{T(t).catch(()=>{})};return window.addEventListener("message",u),()=>{v=!0,window.removeEventListener("message",u)}}var R=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=(e,l)=>typeof e=="string"&&e.length<=l,Ee=e=>typeof e=="string"&&(["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e));function ke(e){if(!R(e)||!E(e.css??"",1e5)||!E(e.js??"",1e5)||!Array.isArray(e.domMutations??[])||Array.isArray(e.domMutations)&&e.domMutations.length>200)throw new Error("Invalid visual variation");let l=e.domMutations??[];for(let n of l)if(!R(n)||!E(n.selector,2048)||!n.selector||!Ee(n.attribute)||!["set","append","remove"].includes(String(n.action))||n.value!==void 0&&!E(n.value,5e4)||n.parentSelector!==void 0&&!E(n.parentSelector,2048)||n.insertBeforeSelector!==void 0&&!E(n.insertBeforeSelector,2048))throw new Error("Invalid visual mutation");return{css:e.css??"",js:e.js??"",domMutations:l,...e.renderGuard===void 0?{}:{renderGuard:le(e.renderGuard)}}}function q(e){if(!R(e)||typeof e.environmentId!="string"||typeof e.trackExposures!="boolean"||!/^[-a-f0-9]{36}$/i.test(e.environmentId)||typeof e.generation!="string"||!/^[a-f0-9]{64}$/.test(e.generation)||!Array.isArray(e.experiments)||e.experiments.length>100||!R(e.savedGroups))throw new Error("Invalid visual experiment payload");let l=e.experiments.map(n=>{if(!R(n)||!["key","changeId"].every(c=>typeof n[c]=="string"&&n[c])||!/^[a-f0-9]{64}$/.test(String(n.changeId))||["namespace","status","groups","url"].some(c=>Object.hasOwn(n,c))||n.hashVersion!==void 0&&n.hashVersion!==2||!Array.isArray(n.variations)||n.variations.length<2||n.variations.length>20||n.urlPatterns!==void 0&&!Array.isArray(n.urlPatterns))throw new Error("Invalid visual experiment");return{...n,variations:n.variations.map(ke)}});return{...e,experiments:l}}var ve=6e4;function qe(e){let l=se(e.baseUrl);if(e.appManifestRelease!==void 0&&!/^[a-f0-9]{64}$/.test(e.appManifestRelease))throw new Error("Invalid IAM manifest digest");if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("Invalid App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),c=F(n),y=F(n),v=`${l}/api/v1/visual-experiments/${e.environmentId}`,I=e.appManifestRelease?`${v}?iam=${e.appManifestRelease}`:v,k=re(e.deviceIdCookie??"indiana_did"),T=ae(),u=null,t=!1,i=!1,x="",S={...e.attributes??{}},G,B,D=0,H=-1/0,$,m=new Map,O=new Map,C=new Set,z=ge({endpoint:`${v}/events`,fetch:n,log:e.log,label:"Visual exposure"}),P=z.flush,W,b;function j(){clearTimeout(W),b?.remove(),b=void 0}function Y(s,d){let f=M(s,d);C.has(f)||e.trackExposures===!1||u?.trackExposures===!1||t||(C.add(f),z.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:k,...T?{sessionId:T}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:s.key,variationKey:d.key}))}function we(s){if(!u||t)return;let d=new Set,f={onExperimentViewed:(r,p)=>{d.add(M(r,p))},url:location.href,attributes:{...me(k,location),...S,indianaAppManifestRelease:e.appManifestRelease??null},savedGroups:te(u.savedGroups),log:e.log},h=new Set;for(let r of u.experiments){if(de(`${e.environmentId}:${r.key}`))continue;let p=r;try{let a=ie(p,f);if(O.set(r.changeId,a),!a.inExperiment)continue;h.add(r.changeId);let w=JSON.stringify([a.key,a.value]),U=m.get(r.changeId);if(U?.signature===w){d.has(M(p,a))&&s.push(()=>{U.applied()&&Y(p,a)});continue}m.get(r.changeId)?.revert(),m.delete(r.changeId);let A=fe(a.value,{requireUniqueTargets:!!e.appManifestRelease&&Array.isArray(r.condition?.$and)&&r.condition.$and.some(g=>g!==null&&typeof g=="object"&&!Array.isArray(g)&&g.indianaAppManifestRelease===e.appManifestRelease),boundVariations:r.variations,allowJs:e.disableJsInjection===!1,nonce:e.nonce,onApplied:()=>{d.has(M(p,a))&&Y(p,a)},onError:g=>e.log?.("Visual experiment stopped",{experiment:r.key,changeId:r.changeId,variation:a.key,error:String(g)}),onTargetStatus:e.log?g=>e.log?.("Visual target status changed",{experiment:r.key,changeId:r.changeId,variation:a.key,...g}):void 0});m.set(r.changeId,{signature:w,revert:A.revert,applied:()=>A.applied,inspect:()=>A.inspect()})}catch(a){e.log?.("Skipping visual experiment",{experiment:r.key,error:String(a)})}}for(let[r,p]of m)h.has(r)||(p.revert(),m.delete(r));j()}let V=()=>{let s=[];pe(()=>we(s));for(let d of s)d()};async function _(){let s=++D,d;try{d=await c.read(I,J)}catch(h){if(t||s!==D)return!1;throw h}let f=q(d);if(f.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Visual payload scope changed");return t||s!==D?!1:(u=f,H=performance.now(),!0)}async function Q(){!await _()||t||(N(),V())}function L(){clearTimeout($),$=setTimeout(()=>{if(document.visibilityState==="hidden")return L();Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()})},ve)}let X=()=>{t||document.visibilityState==="hidden"||performance.now()-H<ve||(clearTimeout($),Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()}))},Ie=()=>{x!==location.href&&(x=location.href,V())},Z=()=>{P(!0)},N=()=>{G||t||(G=oe(Ie),addEventListener("pagehide",Z),x=location.href)};async function ee(s,d){let f=location.href,h=u,r=[],p=null;if(!t)try{let a=q(await y.read(I,J));a.environmentId===e.environmentId&&(p=a.generation)}catch{}for(let a of h?.experiments??[]){if(s&&a.changeId!==s)continue;let w=O.get(a.changeId);if(!w)continue;let U=new TextEncoder().encode(ye(w.value)),A=[...new Uint8Array(await crypto.subtle.digest("SHA-256",U))].map(be=>be.toString(16).padStart(2,"0")).join(""),g=m.get(a.changeId)?.inspect()??{status:"inactive",total:0,applied:0};r.push({changeId:a.changeId,experimentKey:a.key,variationKey:w.key,inExperiment:w.inExperiment,fingerprint:A,...g})}return{environmentId:e.environmentId,release:e.appManifestRelease??null,generation:h?.generation??null,publishedGeneration:p,checkedAt:new Date().toISOString(),origin:location.origin,pathname:location.pathname,urlMatches:location.href===f&&(!d||d===f)&&h===u,stopped:t,rows:r}}let ne,xe=ue(()=>{i&&!t&&V()});return{async start(){if(!(i||t)){i=!0,e.appManifestRelease&&(B=ce(e.appManifestRelease)),e.antiFlicker&&(b=document.createElement("style"),e.nonce&&(b.nonce=e.nonce),b.textContent="body { visibility: hidden !important }",document.head.append(b),W=setTimeout(j,Math.min(3e3,Math.max(0,e.antiFlickerTimeout??1e3))));try{if(!await _()||t)return;N(),V()}finally{j(),t||(L(),document.addEventListener("visibilitychange",X),ne=he({environmentId:e.environmentId,baseUrl:l,origins:e.diagnosticsOrigins,inspect:ee}))}}},async refresh(){t||await _()&&(i&&N(),V())},setAttributes(s){S={...s},V()},flush:()=>P(),getDiagnostics:ee,getResults(){return new Map(O)},get generation(){return u?.generation??null},destroy(){t=!0,clearTimeout($),document.removeEventListener("visibilitychange",X),xe(),ne?.(),D++,c.destroy(),y.destroy(),G?.(),B?.destroy(),removeEventListener("pagehide",Z),j();for(let s of m.values())s.revert();m.clear(),P(!0),u=null,O.clear(),C.clear(),S={}}}}export{qe as createVisualExperiments,Ve as loadAppManifestRelease};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkerlandai/longplay-sdk",
3
- "version": "0.10.96",
3
+ "version": "0.10.98",
4
4
  "description": "Framework-independent Longplay SDK for customer identity, entitlements, credits, offers and growth surfaces.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-PUDTOCQF.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-W22ESUYY.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as validateEntitlementCheck,b as validateResourceCheck};
@@ -1 +0,0 @@
1
- import{a as Se,b as Re}from"./chunk-7CZEXBQY.js";import{d as We,e as te}from"./chunk-MOIVJERE.js";import{a as Ue}from"./chunk-UGATOG2T.js";import{a as k}from"./chunk-DSPLGTQI.js";var rn=5*6e4,tn=15e3,Ge=new WeakMap;function dn(u){return Ge.get(u)}var V=u=>Array.isArray(u)?u.map(V):u&&typeof u=="object"?Object.fromEntries(Object.keys(u).sort().map(n=>[n,V(u[n])])):u,L=(u,n)=>JSON.stringify(V(u))===JSON.stringify(V(n)),ae=u=>JSON.stringify(V([u.funnelId,u.locale??null,u.parameters??{}])),an=["onObservationChange","onPurchaseIntent","onPurchase","onCheckoutUrl","resumeCheckout","allowNewPurchase","checkoutNavigation","terminateCheckout","beforeCheckoutReplacement","purchaseConfirmation","confirmOnHostedCheckout","resolveOfferId","prepareSubscriptionChange","resolveSubscriptionChange","onOpenUrl","onEvent","onAction","onComplete","onError"];function on(u,n,I){let O=e=>structuredClone({funnelId:e.funnelId,locale:e.locale,parameters:e.parameters}),g,_="",T=n.start instanceof Promise?void 0:O(n.start),j=T?.funnelId??n.funnelId,oe=e=>e?.parameters?.commerce,J=Promise.resolve(n.start).then(e=>e?O(e):void 0),le=n.maxAgeMs??rn,Ae=new AbortController,y=AbortSignal.any([Ae.signal,n.client.identitySignal,...n.signal?[n.signal]:[]]),ie=()=>d("released","aborted"),t="preparing",ke,U,se=()=>{},W=0,b=null,v=null,C=null,w=null,h,x,E,Ve=new Map,P=null,G=new Set,F=new Map,ce,_e=new Promise(e=>ce=e),B,ue=new Promise(e=>B=e),de,Be=new Promise(e=>de=e);function K(e,r){t!==e&&(t=e,ke=r,k(n.onState,e))}function Ke(){y.removeEventListener("abort",ie),Q(),v?.destroy(),v=null,b?.remove(),b=null,C=null}function d(e,r){["adopted","unavailable","released","closed"].includes(t)||(K(e,r),Ke(),ce(!1),B(!1),$(!1),de(null))}function N(e){t!=="shown"&&d("unavailable",e)}let f,fe=!1,D=n.client.paywallCopies,pe,Ee=new Promise(e=>pe=e),we=!1,S=!1,ye,z=!1,X=n.whenPurchasePending==="recover"&&!I,$,ze=new Promise(e=>$=e);function Xe(e){if(!X||f||!e||!w||!E||!R(w,E.commerce)||!["preparing","ready","shown"].includes(t))return!1;let r={savedAt:Date.now(),funnelId:e,context:E,resolution:structuredClone(w)};return f=r,ge(r),ne(),!0}function me(e){return!X||!f||!["preparing","ready","shown"].includes(t)?!1:(S=!0,ye=e,t==="shown"&&De(),!0)}function Fe(){S=!1,ye=void 0,z=!1}function De(){let e=f?.context.locale??n.locale??"";v?.setPurchaseRecovery(e.startsWith("zh")?"正在查询原订单…":"Checking your purchase…")}function ge(e){Ee.then(r=>{r&&D&&D.write(r,e).catch(()=>{})})}function He(e){Ee.then(async r=>{if(!r||!D)return;let o=await D.read(r);y.aborted||fe||o&&("presented"in o||j&&o.funnelId!==j)||await D.write(r,e)}).catch(()=>{})}let he=e=>`error:${e?.code??e?.name??"unknown"}`,Pe=u.ownerDocument.defaultView,M=!I,Oe=null,H=!1,$e=e=>e.storageArea===Pe?.localStorage&&(e.key===null||e.key.startsWith("indiana.funnel.purchases.")),xe=e=>{$e(e)&&Y()},Qe=I?()=>{}:n.client.subscribe(()=>Y());function Q(){M&&(M=!1,Pe?.removeEventListener("storage",xe),Qe(),se())}let ve=()=>M&&(t==="ready"||t==="preparing");function be(e){(t==="ready"||t==="preparing")&&d("unavailable",e)}function Y(){if(t==="ready"&&Date.now()-W>=le)return Q();H=!0,Oe??=(async()=>{for(;H&&Ne();){H=!1;try{if(await n.client.retained()==="pending"){if(S)continue;me("purchase_pending")?z=!0:be("purchase_pending")}else z&&ve()&&Fe()}catch(e){y.aborted?d("released","aborted"):be(he(e))}}})().finally(()=>{Oe=null,H&&Ne()&&Y()})}function Ne(){return!!g&&(!S||z)&&ve()}I||Pe?.addEventListener("storage",xe),y.addEventListener("abort",ie,{once:!0});let Me=I?Promise.resolve("none"):n.client.findPurchase();Me.catch(()=>{});let Z;function ee(e){let r=Z?.paywallVersionId??n.paywallVersionId??f?.resolution.id??w?.id,o=JSON.stringify(V([r??null,e])),i=Ve.get(o);return i||(i=n.client.readPaywall({paywallVersionId:r,...r?{}:{paywallId:Z?.paywallId??n.paywallId},...e}),Ve.set(o,i)),i}function R(e,r){let o=Object.values(e.capabilities.plans),i=Object.values(e.document.buttons).some(a=>a.type==="checkout");return i&&o.length===0?!1:r.intent==="subscription_change"&&i?o.some(a=>a.available):o.every(a=>a.available)}function Ie(e,r){if(w&&!te(e,w))return d("unavailable","paywall_changed"),!1;w=e,E=r,$(!0);for(let o of F.keys())k(o,structuredClone(e));return!0}function qe(e,r){if(!(!w||!["preparing","ready","shown"].includes(t))){if(!te(e,w))return N("paywall_changed");if(!R(e,r.commerce))return N("plan_unavailable");Ie(e,r)}}async function q(){let e=await Be;if(!e)throw new Ue("PURCHASE_PENDING","The purchase did not start; open it again");return e}let Ye={get view(){return P?P.view:w},get signal(){return P?.signal??n.client.identitySignal},get quote(){return P?.quote??null},get operation(){return P?.operation??null},webViewUrl:"bundled",get canReselect(){return P?.canReselect},get recovery(){return P?.recovery},get pendingCancellation(){return P?.pendingCancellation},subscribe(e){return F.set(e,P?.subscribe?.(e)??(()=>{})),()=>{F.get(e)?.(),F.delete(e)}},refresh:async()=>P?P.refresh():structuredClone(w),preview:async e=>(await q()).preview(e),confirm:async()=>(await q()).confirm(),cancel:async()=>(await q()).cancel(),read:async()=>(await q()).read(),destroy(){P?.destroy()}},Le=n.onPurchaseIntent&&(e=>n.onPurchaseIntent(e)),p={options:{},handoff:{}},Te={loading:"host",focusAtReveal:!0,settleMotionAtReveal:!0,signal:n.client.identitySignal,...n.mountControls&&{mountControls:n.mountControls},start:async()=>Ye,canInteract:()=>p.options.canInteract?p.options.canInteract():!["unavailable","released","closed"].includes(t),async beforeAction(e){if(e?.purchaseIntent&&t!=="adopted"&&Le)return;let r=t!=="adopted",o=w?.capabilities,i=await q();if(r&&!L(i.view?.capabilities,o))throw new We;await p.options.beforeAction?.()}};for(let e of an)Object.defineProperty(Te,e,{enumerable:!0,get:()=>e==="onPurchaseIntent"?p.options.onPurchaseIntent??Le:p.options[e]});function ne(){t!=="preparing"||!C||!v||!f&&(!g||!L(E?.commerce,oe(g))||E?.locale!==g.locale)||(K("ready"),ce(!0))}let je={present(e){if(p.handoff.present)return p.handoff.present(e);t==="preparing"&&(C=e,W=Date.now(),ne())},async dismiss(){if(p.handoff.dismiss)return p.handoff.dismiss();d("closed");for(let e of[...G])k(e)},async closeAction(e){if(p.handoff.closeAction)return p.handoff.closeAction(e);p.options.onAction?await p.options.onAction(e):await je.dismiss()},quoteError(e){p.handoff.quoteError?p.handoff.quoteError(e):k(p.options.onError,e)}};async function Ze(e,r){let o=n.funnelId??T?.funnelId??(await Promise.resolve(n.start).catch(()=>null))?.funnelId;if(o)try{let{pins:i}=await e.funnelPaywallPins(o),a=i.paywalls[r]??[];return a.length===1?a[0]:void 0}catch{return}}async function en(){if(n.paywallVersionId)return{paywallVersionId:n.paywallVersionId,paywallId:n.paywallId};if(n.paywallId)return{paywallVersionId:n.configuration?await Ze(n.configuration,n.paywallId):void 0,paywallId:n.paywallId};let e=n.configuration;if(!e)return d("unavailable","paywall_missing"),null;let r=await Promise.resolve(n.start).catch(()=>null);if(!r||t!=="preparing")return null;let o=()=>Se(e,{funnelId:r.funnelId,customerId:n.client.customerId,parameters:r.parameters??{}});if(U=await o(),t!=="preparing")return null;let i=U;if(i.type!=="paywall")return d("unavailable",Re(i)??"route"),null;let a=!1;return se=e.subscribe(()=>{a||!ve()||(a=!0,o().then(c=>{!(c.type==="unavailable"&&!["funnel_stopped","route_unavailable"].includes(c.reason))&&(c.type!=="paywall"||c.paywallVersionId!==i.paywallVersionId)&&be("route_changed")}).finally(()=>a=!1))}),M||se(),{paywallVersionId:i.paywallVersionId}}(async()=>{try{let[{showPaywall:e},r]=await Promise.all([import("./paywall-DWBIV43F.js"),en()]),o=n.commerce??oe(T),i=n.locale??T?.locale,a=r&&o&&i?JSON.stringify(V([r.paywallVersionId??null,r.paywallId??null,{commerce:o,locale:i}])):null;if(pe(a),y.throwIfAborted(),t!=="preparing"||!r)return;if(!o)return d("unavailable","commerce_missing");if(!i)return d("unavailable","locale_missing");Z=r;let c={commerce:o,locale:i},m=a?await D?.read(a).catch(()=>null):null,l=!j||m?.funnelId===j;if(we=!!m&&"presented"in m&&l,y.throwIfAborted(),t!=="preparing"||we)return;m&&!("presented"in m)&&l&&R(m.resolution,m.context.commerce)&&(f=m),B(!!f);let s;if(f){let Ce=f.context;c=Ce,s=structuredClone(f.resolution),ee(Ce).then(nn=>qe(nn,Ce),()=>{})}else s=await ee(c);if(y.throwIfAborted(),t!=="preparing"||(!R(s,c.commerce)&&n.start instanceof Promise&&!h&&await J,!f&&h&&!L(c,h)&&(c=h,s=await ee(c)),y.throwIfAborted(),t!=="preparing"))return;if(!R(s,c.commerce))return d("unavailable","plan_unavailable");if(!Ie(s,c))return;b=u.ownerDocument.createElement("div"),u.append(b);let A=setTimeout(()=>t==="preparing"&&d("unavailable","timeout"),tn);_e.then(()=>clearTimeout(A));let re=await e(b,Te,je);if(!re.host||y.aborted||t!=="preparing"){re.host?.destroy(),d(y.aborted?"released":"unavailable","error");return}v=re.host,ne()}catch(e){d(y.aborted?"released":"unavailable",he(e))}finally{pe(null),B(!1),$(!1)}})(),J.then(async e=>{let r=l=>{He(null),N(l)},o=async()=>{let l=await Me;return l==="pending"?"purchase_pending":l==="found"?"original_purchase":l==="blocked"?"purchase_blocked":void 0},i=async l=>!l||l==="purchase_blocked"||!X?!1:(await ue,me(l)?!0:await ze&&Xe(e?.funnelId??await n.client.pendingFunnel().catch(()=>null)??void 0)&&me(l));if(!e)return X&&await i(await o().catch(()=>{}))?void 0:r("gated");let a=e,c=oe(a),m=n.commerce??c;if(!L(c&&{...c,intent:void 0},m&&{...m,intent:void 0})||n.locale!==void 0&&a.locale!==n.locale)return r("start_mismatch");if(!c)return r("commerce_missing");h={commerce:c,locale:a.locale},x=a,f&&["preparing","ready","shown"].includes(t)&&(g=a,_=ae(a));try{let l=await o();if(await i(l)){g=void 0,_="";return}if(l)return r(l);if(!["preparing","ready","shown"].includes(t))return;if(n.configuration&&(n.paywallId||n.paywallVersionId)){let s=await Se(n.configuration,{funnelId:a.funnelId,customerId:n.client.customerId,parameters:a.parameters??{}});y.throwIfAborted();let A=s.type==="unknown"||s.type==="unavailable"&&s.reason!=="funnel_stopped";if(s.type==="paywall"?f?s.paywallId!==f.resolution.paywallId:n.paywallVersionId?s.paywallVersionId!==n.paywallVersionId:s.paywallId!==n.paywallId:!A)return r(Re(s)??"route_changed")}if(M&&(H=!1,await n.client.retained()==="pending")){if(await i("purchase_pending")){g=void 0,_="";return}return r("purchase_pending")}if(await ue,we){g=a,_=ae(a);return}if(Z||n.paywallId||n.paywallVersionId||w){let s=await ee(h);if(y.throwIfAborted(),He(R(s,h.commerce)?{savedAt:Date.now(),funnelId:a.funnelId,context:h,resolution:s}:null),f)qe(s,h);else{if(t!=="preparing")return;if(w){if(!R(s,h.commerce))return d("unavailable","plan_unavailable");if(!Ie(s,h))return}}}}catch(l){return y.aborted?d("released","aborted"):N(he(l))}["preparing","ready","shown"].includes(t)&&(g=a,_=ae(a),ne(),H&&Y())},()=>N("gated"));let Je={get state(){return t},get reason(){return ke??ye},ready:_e,local:ue,get start(){return g},get prediction(){return U?structuredClone(U):void 0},matches:e=>g?ae(e)===_:!!f&&e.funnelId===f.funnelId&&e.locale===f.context.locale,open(){if(t==="preparing")return"pending";if(t!=="ready"||!C)return!1;if(Date.now()-W>=le)return d("unavailable","expired"),!1;let e=C;return C=null,Q(),K("shown"),S&&De(),e(),"shown"},destroy(){Ae.abort()}};return Ge.set(Je,{onClose(e){return t==="closed"?(k(e),()=>{}):(G.add(e),()=>{G.delete(e)})},claim(){Q()},remember(e){fe=!0;let r=structuredClone(e);J.then(()=>{!x||!h||ge({savedAt:Date.now(),funnelId:x.funnelId,context:h,resolution:r})},()=>{})},withhold(){fe=!0,J.then(()=>{x&&ge({savedAt:Date.now(),funnelId:x.funnelId,presented:"nothing"})},()=>{})},async adopt(e,r){let o=e.paywall?.resolution,i=e.paywall&&!e.paywall.quote&&!e.paywall.operation&&!e.paywall.purchaseRequestId&&!(e.paywall.selectionGeneration??0);if(t!=="shown"||!v||!w||!o||!i||e.source.id!==g?.funnelId||e.locale!==g?.locale||!L(e.parameters??{},g?.parameters??{})||!["running","waiting"].includes(e.status)||!te(o,w))return null;let a;try{a=await r.start()}catch{return null}if(t!=="shown"||!v)return a.destroy(),null;S&&(v.clearPurchaseRecovery(),Fe()),P=a,p.options=r.options,p.handoff=r.handoff;for(let[l]of F)F.set(l,a.subscribe?.(l)??(()=>{})),a.view&&k(l,structuredClone(a.view));y.removeEventListener("abort",ie),K("adopted"),de(a),G.clear();let c=v,m=b;return v=null,b=null,C=null,new Proxy(c,{get(l,s){return s==="destroy"?()=>{l.destroy(),m?.remove()}:s==="retainPurchaseDialog"?()=>{let A=l.retainPurchaseDialog();if(A)return{dialog:A.dialog,release(){A.release(),m?.remove()}}}:Reflect.get(l,s,l)}})},retainPurchaseDialog(){if(t!=="shown")return;let e=v?.retainPurchaseDialog();if(!e)return;let r=b;return v=null,b=null,d("released"),{dialog:e.dialog,release(){e.release(),r?.remove()}}},get modal(){return w?.document.presentation.type!=="inline"},mountsControls:!!n.mountControls,get revealable(){return t==="ready"&&!!C&&Date.now()-W<le},get recovering(){return S},release(){d("released")}}),Je}function fn(u,n){let I=n.run.parameters??{},O=I?.commerce;return on(u,{client:n.client,start:{funnelId:n.run.source.id,locale:n.run.locale,parameters:I},paywallVersionId:n.paywallVersionId,...O&&{commerce:O},locale:n.run.locale,signal:n.signal},{run:!0})}export{rn as a,dn as b,on as c,fn as d};
@@ -1 +0,0 @@
1
- import{o as n,r as t}from"./chunk-MYG5MAKQ.js";function u(o,e,a){return n(o,e,a,t)}export{u as a};
@@ -1 +0,0 @@
1
- import{b as ce}from"./chunk-TE2F4PML.js";import{b as W,d as oe}from"./chunk-5HWHBCVN.js";import{b as ue}from"./chunk-KCG7GZXO.js";import{a as se}from"./chunk-XAPMQRVJ.js";import{a as X}from"./chunk-CHRNCOXJ.js";import{b as ie}from"./chunk-XSJGNM2C.js";import{k as H,l as Y}from"./chunk-CO6HDNOC.js";import{a as g}from"./chunk-UGATOG2T.js";import{a as h}from"./chunk-DSPLGTQI.js";var D=new WeakMap,V=new WeakMap,Z=new WeakSet;function be(R,e){let w=e.hostPaywallTarget?void 0:e.prepared,$=()=>{e.prepared&&!Z.has(e.prepared)&&W(e.prepared)?.release()},ee=D.get(e.client);if(ee)return $(),ee;let te=n=>({...n,requestId:n.requestId??crypto.randomUUID()}),N=e.allowNewPurchase!==!1&&e.start instanceof Promise?e.start:void 0,m=e.allowNewPurchase===!1||!e.start||e.start instanceof Promise?void 0:te(e.start);m&&w?.state==="ready"&&w.matches(m)&&w.open();let f=w&&(m&&(w.state==="preparing"||["shown","closed"].includes(w.state)&&w.matches(m))||N&&["preparing","ready"].includes(w.state)||w.state==="shown"&&W(w)?.recovering)?w:void 0;f?Z.add(f):$();let P=f&&W(f);P?.claim();let z=()=>!!P?.recovering&&f?.state==="shown",T=Promise.resolve().then(async()=>{let n=!1,c,b=!1,j,C=0,S,I,U=!1,E=()=>{},re=()=>{},_,B=!1,J=!1,O,ne=!1,a=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,v=()=>{D.get(e.client)===T&&D.delete(e.client),a.removeEventListener("abort",F),E(),re(),f&&Z.delete(f),P?.release()};function ae(){if(O)return O;let t=new Promise(o=>O=o);return V.set(e.client,t),t.then(()=>{V.get(e.client)===t&&V.delete(e.client)}),D.get(e.client)===T&&D.delete(e.client),O}let l=Y(R,e,"funnel",()=>k(),X);function F(){k()}function k(t=!1){if(!n){if(n=!0,l.finish("dismissed"),c){c.destroy();return}if(t&&_){let o=ae();ne=!0,_.then(async s=>{s.mode==="run"&&s.status!=="blocked"&&e.client.controller&&e.client.attempt?.requestId===m?.requestId&&await e.client.close()}).catch(()=>{}).finally(()=>{o(),h(e.onDismiss,null)}),v();return}v(),h(e.onDismiss,null)}}let q={destroy:()=>k(),refresh:()=>S??(b?Q():c?.refresh())??Promise.resolve(),get recovery(){return c?.recovery??{type:"recover",operationId:null,requestId:null}},prepareFallback:()=>c?.prepareFallback()??Promise.resolve({type:"recover",operationId:null,requestId:null}),review:(...t)=>c?.review(...t)??Promise.resolve(),exitReview:(...t)=>c?.exitReview(...t)??Promise.resolve(),get unappliedDrafts(){return c?.unappliedDrafts??new Map}};a.addEventListener("abort",F,{once:!0}),P&&(re=P.onClose(()=>{B?n||ae():k(!0)}));try{a.throwIfAborted();let t=e.client.controller?.view?.paywall?.resolution,o=t&&"document"in t?t.document:e.loadingDocument;l.start(!0,m?.locale??e.client.attempt?.locale??o?.screen.strings.defaultLocale,o??null);let s=N?l.wait(N.then(r=>r?te(r):null,()=>null),H):Promise.resolve(m??null);s.catch(()=>{}),f?.state==="shown"?(J=!0,l.present(()=>{})):f&&["preparing","ready"].includes(f.state)&&Promise.all([f.ready,s.catch(()=>null)]).then(([r,i])=>{if(r){if(n||!l.active||!i||!f.matches(i)||!P?.revealable)return P?.release();l.present(()=>{f.open()==="shown"?J=!0:P.release()})}});let d=V.get(e.client);if(d&&await l.wait(d),n)return null;if(a.throwIfAborted(),N){let r=await s;if(n)return null;if(a.throwIfAborted(),!r&&!z())return l.finish("skipped"),v(),null;m=r??void 0}_=m?e.client.start(m):e.client.refresh({reuseRecentRead:!0});let u=await l.wait(_,H);return n?null:(a.throwIfAborted(),await le(u,l))}catch(t){if(ne||O?.(),n)return null;throw l.finish("error",t),v(),h(e.onError,t),t}function K(t=!1){C++;let o=c;c=void 0,E(),E=()=>{};let s=t?o?.retainPurchaseDialog?.():void 0;return o?.destroy(),a.addEventListener("abort",F,{once:!0}),s}function x(t){b=!0;let o=e.client.attempt?.locale??m?.locale,s=o?.startsWith("zh"),d=t?s?"正在查询原订单…":"Checking your purchase…":s?"暂时无法确认原订单,请重试。":"Could not check your original purchase. Try again.",u=t?void 0:()=>{Q()};c?.setPurchaseRecovery?.(d,u)||(c&&K(),l.active||(l=Y(R,e,"funnel",()=>k(),X),l.start(!0,o,e.loadingDocument??null)),l.setPurchaseRecovery(d,u))}function Q(){if(S)return S;if(n||a.aborted)return Promise.resolve();j??=c?.recoveryPaywall,a.addEventListener("abort",F,{once:!0}),x(!0);let t=Promise.resolve().then(async()=>{try{let s=await l.wait(e.client.refresh(),H);!n&&!a.aborted&&await le(s,l)}catch(s){!n&&!a.aborted&&(h(e.onError,s),x(!1))}});S=t;let o=()=>{S===t&&(S=void 0)};return t.then(o,o),t}async function le(t,o){let s=e.client.controller;if(t.mode==="run"&&t.status!=="blocked"&&s)return b&&c&&K(),b=!1,j=void 0,de(s,o?.active?o:void 0);if(t.mode==="operation"&&t.purchases.length){z()||x(!0);let d=await l.wait(e.client.recoverPurchasePaywall(j).then(u=>((n||a.aborted)&&u?.destroy(),u)),H).catch(u=>(!n&&!a.aborted&&h(e.onError,u),null));if(n||a.aborted)return null;if(d){if(n||a.aborted)return d.destroy(),null;let u=K(!0)??P?.retainPurchaseDialog?.()??l.retainPurchaseDialog();P?.release();let r=m,i=ue({client:e.client,session:d,start:e.allowNewPurchase===!1||!r?void 0:async()=>{let{requestId:p,...G}=r;return G},signal:a}),y=()=>{!n&&!a.aborted&&!U&&I&&e.client.recovery.status==="complete"&&(U=!0,h(e.onComplete,structuredClone(I)))},A=await se(R,{signal:a,loading:"host",start:async()=>i.session,checkoutNavigation:"after_confirmation",allowNewPurchase:!1,resumeCheckout:p=>e.client.continueCheckout(L,p),...i.prepare&&{prepareUpgradeReplacement:i.prepare,terminateCheckout:p=>e.client.terminateCheckout(p),beforeCheckoutReplacement:e.beforeCheckoutReplacement,purchaseConfirmation:e.purchaseConfirmation,confirmOnHostedCheckout:e.confirmOnHostedCheckout,claimCoupon:e.claimCoupon,prepareSubscriptionChange:e.prepareSubscriptionChange,resolveSubscriptionChange:e.resolveSubscriptionChange,onPurchase:e.onPurchase,onCheckoutUrl:L,async resolveOfferId(p){let G=e.client.attempt;if(!G)throw new g("PURCHASE_PENDING","Read the new Start before selecting an offer");return e.resolveOfferId?.(p,G)},onComplete(){I=structuredClone(e.client.controller?.view)??I,E(),E=e.client.subscribe(y),y()}},onError:e.onError,onDismiss:()=>{n||k()}},{retainedDialog:u,present(p){l.active?l.present(p):p(!!u)},async dismiss(){k()}});if(!A.host||n||a.aborted)return A.host?.destroy(),u?.release(),v(),null;let M=A.host;return b=!1,c={destroy(){M.destroy(),v(),h(e.onDismiss,null)},refresh:async()=>{await M.refresh()},get recovery(){return M.recovery},prepareFallback:()=>M.prepareFallback(),review:async()=>{},exitReview:async()=>{},unappliedDrafts:new Map},q}}return t.purchases.length||b?(z()&&P?.release(),x(!1),q):(l.finish("skipped"),v(),(J||B)&&(n=!0,h(e.onDismiss,null)),null)}function L(t){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");return e.onCheckoutUrl?e.onCheckoutUrl(t):R.ownerDocument.defaultView?.location.assign(t)}async function de(t,o){a.removeEventListener("abort",F),B=!0;function s(){!n&&!a.aborted&&!b&&!U&&I&&e.client.recovery.status==="complete"&&(U=!0,h(e.onComplete,structuredClone(I)))}E(),E=e.client.subscribe(s);let d=++C,u=await ce(R,{...e,prepared:f,client:t,signal:a,prepareNextPaywall:({run:r,paywallVersionId:i})=>oe(R,{client:e.client,run:r,paywallVersionId:i,signal:a}),checkoutNavigation:"after_confirmation",resumeCheckout:r=>e.client.continueCheckout(L,r),terminateCheckout:e.allowNewPurchase===!1?void 0:r=>e.client.terminateCheckout(r),async onCheckoutUrl(r){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let i=e.client.recovery;if((!i.actions.includes("continue_checkout")||!i.purchases.some(y=>y.type==="checkout"&&y.checkoutUrl===r))&&(i=await e.client.refresh(),a.throwIfAborted(),n))throw new DOMException("Presentation dismissed","AbortError");if(ie(i)!==r)throw new g("PURCHASE_PENDING","Checkout differs from the original recovery proof");return L(r)},async resolveOfferId(r){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let i=e.client.attempt;if(!i)throw new g("PURCHASE_PENDING","Read the original Start before selecting an offer");let y=await e.resolveOfferId?.(r,i);if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");if(e.client.attempt?.requestId!==i.requestId)throw new g("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting an offer");return y},async resolveSubscriptionChange(r,...i){a.throwIfAborted();let y=e.client.attempt;if(n||!y)throw new g("PURCHASE_PENDING","Read the original Start before selecting a membership");let A=e.resolveSubscriptionChange?await e.resolveSubscriptionChange(r,...i):await i[0]?.();if(a.throwIfAborted(),n||e.client.attempt?.requestId!==y.requestId)throw new g("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting a membership");return A},onPresentationState(r){d===C&&h(e.onPresentationState,r)},onComplete(r){d===C&&(I=r,s())},onError(r){d===C&&(h(e.onError,r),r instanceof g&&(r.status===401||r.status===409&&r.reason==="STATE_CHANGED"&&r.recovery==="recover_operation")&&!a.aborted&&Q().catch(i=>h(e.onError,i)))},onDismiss(r){d===C&&(n=!0,v(),O?.(),h(e.onDismiss,r))}},o);return d!==C||n||a.aborted?(u.destroy(),n||a.aborted?null:q):(c=u,q)}});return D.set(e.client,T),T}export{be as a};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-XNICYGGP.js";import"./chunk-TE2F4PML.js";import"./chunk-5HWHBCVN.js";import"./chunk-KCG7GZXO.js";import"./chunk-XAPMQRVJ.js";import"./chunk-C4KLIT5L.js";import"./chunk-CHRNCOXJ.js";import"./chunk-7CZEXBQY.js";import"./chunk-VXNN3RV3.js";import"./chunk-XSJGNM2C.js";import"./chunk-7ZAM4YRK.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-CO6HDNOC.js";import"./chunk-XLGNBPGF.js";import"./chunk-EQUVI5QU.js";import"./chunk-MYG5MAKQ.js";import"./chunk-F4AIEI5N.js";import"./chunk-S2S4ROGY.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-DLORK3P2.js";import"./chunk-7QPCNDIY.js";import"./chunk-BT7IC765.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelPurchase};
@@ -1 +0,0 @@
1
- import{a as M}from"./chunk-XNICYGGP.js";import"./chunk-TE2F4PML.js";import{a as D,c as I}from"./chunk-5HWHBCVN.js";import"./chunk-KCG7GZXO.js";import"./chunk-XAPMQRVJ.js";import"./chunk-C4KLIT5L.js";import"./chunk-CHRNCOXJ.js";import"./chunk-7CZEXBQY.js";import"./chunk-VXNN3RV3.js";import"./chunk-XSJGNM2C.js";import"./chunk-7ZAM4YRK.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-CO6HDNOC.js";import"./chunk-XLGNBPGF.js";import"./chunk-EQUVI5QU.js";import"./chunk-MYG5MAKQ.js";import"./chunk-F4AIEI5N.js";import"./chunk-S2S4ROGY.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-DLORK3P2.js";import"./chunk-7QPCNDIY.js";import"./chunk-BT7IC765.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import{a as E}from"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";var k=.8;function q(f,r){let y=f.ownerDocument,w=new AbortController,c=AbortSignal.any([w.signal,r.client.identitySignal,...r.signal?[r.signal]:[]]),a,d,m,H=r.maxAgeMs??D,u=e=>E(r.onEvent,{at:performance.now(),...e});function P(e){e?.copy.destroy(),e?.select(void 0)}function b(){clearTimeout(m);let e=[a,d];a=d=void 0,e.forEach(P)}function O(){let e,t=new Promise(i=>{e=i}),l,s={select:e},o=I(f,{...r,start:t,signal:c,onState(i){u({type:"copy",state:i,...o.reason!==void 0&&{reason:o.reason},...l!==void 0&&{local:l}}),s.watch?.(i),E(r.onState,i)}});return s.copy=o,o.local.then(i=>l=i),s}function g(e){a=e,e.copy.ready.then(t=>{t&&a===e&&F()})}function p(){a||c.aborted||!f.isConnected||y.visibilityState==="hidden"||g(O())}function F(){clearTimeout(m),m=setTimeout(()=>{if(!a||d||c.aborted)return;let e=d=O();e.copy.ready.then(t=>{if(d===e){if(d=void 0,!t||!a)return P(e);P(a),a=e,u({type:"renewed"}),F()}})},H*k)}function S(){y.visibilityState==="hidden"?b():p()}function N(){y.removeEventListener("visibilitychange",S),b()}function T(e){let t=e?.parameters?.commerce;return e?.funnelId===r.funnelId&&e.locale===r.locale&&t?.provider===r.commerce.provider&&t.currency===r.commerce.currency&&t.intent===r.commerce.intent}return c.aborted||(c.addEventListener("abort",N,{once:!0}),y.addEventListener("visibilitychange",S),p()),{open(e){if(c.aborted)return Promise.resolve(null);let t=a;a=void 0,clearTimeout(m);let l=d;d=void 0,l&&g(l);let s=t?.copy,o=e.start,i=!e.hostPaywallTarget&&e.allowNewPurchase!==!1&&(o instanceof Promise||T(o)),C=!1,A=!1,h=n=>{A||(A=!0,u({type:"result",revealed:C,adopted:n}))},x=!1,v=n=>{x||(x=!0,h(!1),u({type:"end",outcome:n}))};u({type:"open",copy:s?.state??"none",used:!!s&&i}),t&&i?t.watch=n=>{n==="shown"?C=!0:n==="adopted"?h(!0):n!=="preparing"&&n!=="ready"&&h(!1)}:h(!1),i||s?.destroy(),t?.select(i?o instanceof Promise?o.then(n=>{if(n&&!T(n)){s?.destroy();return}return n}):o:void 0);let R=M(f,{...e,client:r.client,prepared:i?s:void 0,signal:c,onDismiss(n){return v("dismissed"),queueMicrotask(p),e.onDismiss?.(n)}});return R.then(n=>{n||v("nothing"),p()},()=>{v("error"),p()}),R},destroy(){w.abort()}}}export{q as createFunnelPurchaseEntry};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-KCG7GZXO.js";import"./chunk-XAPMQRVJ.js";import"./chunk-C4KLIT5L.js";import"./chunk-CHRNCOXJ.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-CO6HDNOC.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as mountFunnelRecoveryPaywall,b as replaceableOriginalSession};
@@ -1 +0,0 @@
1
- import{a,b,c,d}from"./chunk-5HWHBCVN.js";import"./chunk-7CZEXBQY.js";import"./chunk-VXNN3RV3.js";import"./chunk-MOIVJERE.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-KCUE2VFJ.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase,d as prerenderRunPaywall};
@@ -1 +0,0 @@
1
- import{a,b,c}from"./chunk-7CZEXBQY.js";import"./chunk-VXNN3RV3.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-A5WUQLAO.js";import"./chunk-W22ESUYY.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as predictFunnelStart,c as predictedPaywallLoadingDocument,b as predictionRefusal};
@@ -1 +0,0 @@
1
- import{a as e,b as o,c as n}from"./chunk-VXNN3RV3.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-A5WUQLAO.js";import"./chunk-W22ESUYY.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{e as FUNNEL_ROUTE_LIMITS,o as funnelRouteSchema,n as projectFunnelRoute};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-TE2F4PML.js";import"./chunk-5HWHBCVN.js";import"./chunk-C4KLIT5L.js";import"./chunk-CHRNCOXJ.js";import"./chunk-7CZEXBQY.js";import"./chunk-VXNN3RV3.js";import"./chunk-7ZAM4YRK.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-CO6HDNOC.js";import"./chunk-F4AIEI5N.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-KX67ZM7H.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
@@ -1 +0,0 @@
1
- import{P as r,Q as m,j as e}from"./chunk-67WFVDTV.js";import"./chunk-KCUE2VFJ.js";import"./chunk-BOT6ZDLK.js";import"./chunk-LFR2LWYC.js";import"./chunk-W22ESUYY.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{m as merchantBridgeCommerceSchema,r as merchantBridgeOperationSchema,e as merchantOperationLookupSchema};
@@ -1 +0,0 @@
1
- import{e as o}from"./chunk-CKMSSBJM.js";import"./chunk-FPJ3FE26.js";import"./chunk-2OBXRQMW.js";import"./chunk-7QPCNDIY.js";import"./chunk-BT7IC765.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-SX7U2ONB.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-LFR2LWYC.js";import"./chunk-W22ESUYY.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-XAPMQRVJ.js";import"./chunk-CHRNCOXJ.js";import"./chunk-W32FI2A2.js";import"./chunk-CO6HDNOC.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-VILB5M4X.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as showPaywall};
@@ -1 +0,0 @@
1
- import{b as a}from"./chunk-DLORK3P2.js";import"./chunk-7QPCNDIY.js";import"./chunk-BT7IC765.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-PWE3ZWLR.js";import"./chunk-CKMSSBJM.js";import"./chunk-FPJ3FE26.js";import"./chunk-S2S4ROGY.js";import"./chunk-Y55OBV7D.js";import"./chunk-MOIVJERE.js";import"./chunk-2OBXRQMW.js";import"./chunk-PUDTOCQF.js";import"./chunk-DLORK3P2.js";import"./chunk-7QPCNDIY.js";import"./chunk-BT7IC765.js";import"./chunk-ME6QTD5Y.js";import"./chunk-6XRQR43F.js";import"./chunk-3532HSBP.js";import"./chunk-67WFVDTV.js";import"./chunk-6VVQWTHV.js";import"./chunk-VILB5M4X.js";import"./chunk-SX7U2ONB.js";import"./chunk-7JJGSLXD.js";import"./chunk-KCUE2VFJ.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-3VUPVXAV.js";import"./chunk-7NCZ6XU7.js";import"./chunk-5MRSFLQA.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-LQV7EC5H.js";import"./chunk-CO6HDNOC.js";import"./chunk-Y3W5G4BF.js";import"./chunk-FYUMVOCV.js";import"./chunk-DUS5V65Z.js";import"./chunk-BOT6ZDLK.js";import"./chunk-A5WUQLAO.js";import"./chunk-UGATOG2T.js";import"./chunk-LFR2LWYC.js";import"./chunk-W22ESUYY.js";import"./chunk-DSPLGTQI.js";import"./chunk-FYMVNLQN.js";import"./chunk-FRK6322O.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
File without changes
File without changes
File without changes