@tinkerlandai/longplay-sdk 0.10.51 → 0.10.52
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.
- package/CHANGELOG.md +6 -0
- package/dist/check-response-AVQ7PY5I.js +1 -0
- package/dist/{chunk-IDDPWGQE.js → chunk-2MDJ3JE5.js} +1 -1
- package/dist/{chunk-SZZIYCXK.js → chunk-3LWZFXLN.js} +1 -1
- package/dist/{chunk-TIOPNTMP.js → chunk-3TV3CVNP.js} +1 -1
- package/dist/{chunk-7GU34JD4.js → chunk-4CRUNNTC.js} +1 -1
- package/dist/{chunk-TIUD3N72.js → chunk-4OSW2Y67.js} +1 -1
- package/dist/{chunk-IVXYLNAF.js → chunk-5YQZEJBM.js} +1 -1
- package/dist/{chunk-FN462OVO.js → chunk-7LHRBNSH.js} +1 -1
- package/dist/{chunk-3ITNAFAH.js → chunk-7Q25R5GL.js} +1 -1
- package/dist/{chunk-LE32WTZ7.js → chunk-7UXQJJFZ.js} +1 -1
- package/dist/{chunk-N3PZMMOO.js → chunk-AFZB2AYU.js} +1 -1
- package/dist/{chunk-US65SQX4.js → chunk-AN7CPDBU.js} +1 -1
- package/dist/{chunk-JDIFYMSA.js → chunk-BBA64POP.js} +1 -1
- package/dist/{chunk-ZDIWOE4Q.js → chunk-BYHBBZIO.js} +1 -1
- package/dist/{chunk-HYX3EDZS.js → chunk-CBOIDISB.js} +1 -1
- package/dist/{chunk-KSME3N3A.js → chunk-CJUVMNDB.js} +1 -1
- package/dist/{chunk-4NO6U4X6.js → chunk-DJYLJBU2.js} +1 -1
- package/dist/{chunk-PJAZ2UP4.js → chunk-EDV6ZNPQ.js} +1 -1
- package/dist/chunk-EJAF6OGO.js +1 -0
- package/dist/{chunk-FRRKTQNZ.js → chunk-FAMPOY6L.js} +1 -1
- package/dist/{chunk-GJSQZGBE.js → chunk-FKC7TJWM.js} +1 -1
- package/dist/{chunk-W3B4GT74.js → chunk-I643NVMZ.js} +1 -1
- package/dist/{chunk-HP6OV6WF.js → chunk-JRHJO4BR.js} +1 -1
- package/dist/{chunk-Y2ASROJH.js → chunk-K644WUOE.js} +1 -1
- package/dist/{chunk-YFLVGOCJ.js → chunk-KVIGHX2B.js} +1 -1
- package/dist/{chunk-VKFLQEW4.js → chunk-KXSZTBAG.js} +1 -1
- package/dist/chunk-L66EXWTK.js +1 -0
- package/dist/{chunk-FYD7CMS7.js → chunk-LDLS2VL2.js} +1 -1
- package/dist/{chunk-67LPUJMN.js → chunk-NVHRWZIZ.js} +1 -1
- package/dist/{chunk-IXXVMGMF.js → chunk-OEUA65JK.js} +1 -1
- package/dist/{chunk-HYCLLEFU.js → chunk-PGZZKX5K.js} +1 -1
- package/dist/{chunk-MQ5LJEWV.js → chunk-POX2ELNS.js} +1 -1
- package/dist/{chunk-3Z3HL42M.js → chunk-PZZLYHKR.js} +2 -2
- package/dist/chunk-QIY6PCYC.js +1 -0
- package/dist/{chunk-OPUIFAQS.js → chunk-RUMGXXVJ.js} +1 -1
- package/dist/{chunk-RFWVXTZ7.js → chunk-S4YBFFFY.js} +1 -1
- package/dist/{chunk-VPYKAEHU.js → chunk-S6MXUFVF.js} +1 -1
- package/dist/{chunk-EGFVGCDG.js → chunk-TSBXPDUQ.js} +1 -1
- package/dist/{chunk-LSHIR6QM.js → chunk-UCDQJB53.js} +1 -1
- package/dist/{chunk-2I2S5ZIH.js → chunk-USM6HOXG.js} +1 -1
- package/dist/{chunk-B4SM2KRI.js → chunk-VGEH7B6S.js} +1 -1
- package/dist/{chunk-A5KU4MMN.js → chunk-VPT5MFDG.js} +2 -2
- package/dist/{chunk-DB5S72HJ.js → chunk-W3V7DTPC.js} +1 -1
- package/dist/{chunk-KCN6OGYG.js → chunk-XI2NNZBS.js} +1 -1
- package/dist/{chunk-3TSFGU4T.js → chunk-XO6GV6O7.js} +1 -1
- package/dist/{chunk-2LEDTNKQ.js → chunk-YGOXUDDF.js} +1 -1
- package/dist/{chunk-PF6PRPRO.js → chunk-YJRO7NXN.js} +1 -1
- package/dist/{chunk-2G23BYBI.js → chunk-ZNOVEJLM.js} +1 -1
- package/dist/{chunk-TNPBYYAX.js → chunk-ZVLZLBDA.js} +1 -1
- package/dist/chunk-ZY4YDPSI.js +1 -0
- package/dist/{content-VTHRQSFT.js → content-2EEYM7U7.js} +1 -1
- package/dist/funnel-host-purchase-UONTZRRJ.js +1 -0
- package/dist/funnel-paywall-prerender-AT4BXZIY.js +1 -0
- package/dist/funnel-route-prediction-Z3J2HSHI.js +1 -0
- package/dist/funnel-route-source-LFE6GSHU.js +1 -0
- package/dist/funnel-runtime-host-7ROIR7CU.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-O6WIWC7T.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-H7NKQ373.js +1 -0
- package/dist/page.js +1 -1
- package/dist/paywall-25MAYQ4B.js +1 -0
- package/dist/paywall-content-7KTEQLRN.js +1 -0
- package/dist/paywall-session-7HGW5IKN.js +1 -0
- package/dist/popup.js +1 -1
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-XZWKIJWF.js +1 -0
- package/dist/server.js +1 -1
- package/dist/{visual-dom-IN6DRNX3.js → visual-dom-5LUN4AHO.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/check-response-MCT5RGOM.js +0 -1
- package/dist/chunk-CGJZIDG3.js +0 -1
- package/dist/chunk-MVUNV5XR.js +0 -1
- package/dist/chunk-TM72XBM5.js +0 -1
- package/dist/funnel-host-purchase-HBQOWEES.js +0 -1
- package/dist/funnel-paywall-prerender-MD4UI2AP.js +0 -1
- package/dist/funnel-route-prediction-XNIKDJIM.js +0 -1
- package/dist/funnel-route-source-EUIA4M3Y.js +0 -1
- package/dist/funnel-runtime-host-NZAV6C5O.js +0 -1
- package/dist/merchant-bridge-contracts-7EHDNPJJ.js +0 -1
- package/dist/operation-contracts-C6CMAO6S.js +0 -1
- package/dist/paywall-DKTGQZDJ.js +0 -1
- package/dist/paywall-content-SML4CL2Q.js +0 -1
- package/dist/paywall-session-YKE2CHHI.js +0 -1
- package/dist/screen-renderer-HW2WXDTR.js +0 -1
- /package/dist/{chunk-WPFTSHP2.js → chunk-CILM5XMH.js} +0 -0
- /package/dist/{chunk-RA7GZ67U.js → chunk-OJM6ORHE.js} +0 -0
- /package/dist/{chunk-XVCSRZX4.js → chunk-PY3AC5KD.js} +0 -0
- /package/dist/{chunk-3Z3HL42M.js.LEGAL.txt → chunk-PZZLYHKR.js.LEGAL.txt} +0 -0
- /package/dist/{chunk-A5KU4MMN.js.LEGAL.txt → chunk-VPT5MFDG.js.LEGAL.txt} +0 -0
package/dist/openrouter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-EDV6ZNPQ.js";import"./chunk-5YQZEJBM.js";import"./chunk-7LHRBNSH.js";import"./chunk-FAMPOY6L.js";import{a as i}from"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-VGEH7B6S.js";import{b as A}from"./chunk-PY3AC5KD.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-KXSZTBAG.js";import"./chunk-JRHJO4BR.js";import"./chunk-3TV3CVNP.js";import"./chunk-PGZZKX5K.js";import"./chunk-CJUVMNDB.js";import"./chunk-7UXQJJFZ.js";import"./chunk-2MDJ3JE5.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.js";import"./chunk-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-5YQZEJBM.js";import"./chunk-FAMPOY6L.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import"./chunk-LDLS2VL2.js";import"./chunk-PY3AC5KD.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-
|
|
1
|
+
import{d as o,e as r,f as e,g as f}from"./chunk-PZZLYHKR.js";import"./chunk-FKC7TJWM.js";import"./chunk-3VUPVXAV.js";import"./chunk-VGEH7B6S.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-QIY6PCYC.js";import"./chunk-4CRUNNTC.js";import"./chunk-W32FI2A2.js";import"./chunk-ZNOVEJLM.js";import"./chunk-UCDQJB53.js";import"./chunk-RUMGXXVJ.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.js";import"./chunk-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-7LHRBNSH.js";import"./chunk-FAMPOY6L.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-VGEH7B6S.js";import"./chunk-PY3AC5KD.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-AN7CPDBU.js";import"./chunk-PGZZKX5K.js";import"./chunk-CJUVMNDB.js";import"./chunk-7UXQJJFZ.js";import"./chunk-2MDJ3JE5.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.js";import"./chunk-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-7LHRBNSH.js";import"./chunk-FAMPOY6L.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-3VUPVXAV.js";import"./chunk-VGEH7B6S.js";import"./chunk-PY3AC5KD.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-S6MXUFVF.js";import"./chunk-KXSZTBAG.js";import"./chunk-JRHJO4BR.js";import"./chunk-K644WUOE.js";import"./chunk-3TV3CVNP.js";import"./chunk-S4YBFFFY.js";import"./chunk-AN7CPDBU.js";import"./chunk-PGZZKX5K.js";import"./chunk-CJUVMNDB.js";import"./chunk-7UXQJJFZ.js";import"./chunk-2MDJ3JE5.js";import"./chunk-UCDQJB53.js";import"./chunk-RUMGXXVJ.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.js";import"./chunk-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-5YQZEJBM.js";import"./chunk-7LHRBNSH.js";import"./chunk-FAMPOY6L.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-3VUPVXAV.js";import"./chunk-VGEH7B6S.js";import"./chunk-PY3AC5KD.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
|
package/dist/popup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a}from"./chunk-
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a}from"./chunk-NVHRWZIZ.js";import"./chunk-ZNOVEJLM.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-PY3AC5KD.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{p as formatCustomerDecimal,r as hostedRendererScript,o as hostedRendererShell,f as inspectCustomHtml,a as mountScreenPreview,x as preparePopup,m as prepareScreen,e as sanitizeCustomHtml,t as showPopup};
|
package/dist/react-native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as S,c as E,d as T}from"./chunk-
|
|
1
|
+
import{b as S,c as E,d as T}from"./chunk-DJYLJBU2.js";import"./chunk-7Q25R5GL.js";import{a as A}from"./chunk-S6MXUFVF.js";import{e as P}from"./chunk-KXSZTBAG.js";import"./chunk-JRHJO4BR.js";import{h as b,i as x,k as L}from"./chunk-W3V7DTPC.js";import{E as C}from"./chunk-XO6GV6O7.js";import"./chunk-I643NVMZ.js";import"./chunk-K644WUOE.js";import"./chunk-3TV3CVNP.js";import"./chunk-S4YBFFFY.js";import"./chunk-AN7CPDBU.js";import"./chunk-PGZZKX5K.js";import"./chunk-CJUVMNDB.js";import"./chunk-7UXQJJFZ.js";import"./chunk-3LWZFXLN.js";import"./chunk-2MDJ3JE5.js";import"./chunk-UCDQJB53.js";import"./chunk-RUMGXXVJ.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.js";import"./chunk-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-5YQZEJBM.js";import"./chunk-7LHRBNSH.js";import"./chunk-FAMPOY6L.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import{a as r}from"./chunk-BYHBBZIO.js";import{h as R}from"./chunk-LDLS2VL2.js";import"./chunk-3VUPVXAV.js";import"./chunk-VGEH7B6S.js";import"./chunk-PY3AC5KD.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-NVHRWZIZ.js";import"./chunk-ZNOVEJLM.js";import"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import"./chunk-ZVLZLBDA.js";import"./chunk-XI2NNZBS.js";import"./chunk-YJRO7NXN.js";import"./chunk-BYHBBZIO.js";import"./chunk-LDLS2VL2.js";import"./chunk-PY3AC5KD.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-
|
|
1
|
+
import{a as pn}from"./chunk-L66EXWTK.js";import{a as I}from"./chunk-USM6HOXG.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-EDV6ZNPQ.js";import{a as xt}from"./chunk-S6MXUFVF.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-KXSZTBAG.js";import"./chunk-JRHJO4BR.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-W3V7DTPC.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-XO6GV6O7.js";import"./chunk-I643NVMZ.js";import{c as h}from"./chunk-K644WUOE.js";import"./chunk-3TV3CVNP.js";import{a as Et,b as _e}from"./chunk-S4YBFFFY.js";import"./chunk-AN7CPDBU.js";import"./chunk-PGZZKX5K.js";import{e as at}from"./chunk-CJUVMNDB.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-7UXQJJFZ.js";import{b as Oe}from"./chunk-3LWZFXLN.js";import{e as ve,i as Ze,l as it}from"./chunk-2MDJ3JE5.js";import"./chunk-UCDQJB53.js";import"./chunk-RUMGXXVJ.js";import"./chunk-CBOIDISB.js";import"./chunk-TSBXPDUQ.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-KVIGHX2B.js";import"./chunk-VILB5M4X.js";import"./chunk-5YQZEJBM.js";import"./chunk-7LHRBNSH.js";import{a as Ne,b as Le}from"./chunk-FAMPOY6L.js";import{o as ue}from"./chunk-POX2ELNS.js";import"./chunk-BBA64POP.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-ZVLZLBDA.js";import{c as Ie}from"./chunk-XI2NNZBS.js";import{e as Xe,h as We}from"./chunk-YJRO7NXN.js";import{a as c}from"./chunk-BYHBBZIO.js";import{h as Y}from"./chunk-LDLS2VL2.js";import"./chunk-3VUPVXAV.js";import"./chunk-VGEH7B6S.js";import{b as u}from"./chunk-PY3AC5KD.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-
|
|
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-
|
|
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-PZZLYHKR.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-FKC7TJWM.js";import"./chunk-3VUPVXAV.js";import"./chunk-VGEH7B6S.js";import{b as o}from"./chunk-PY3AC5KD.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 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-RFWVXTZ7.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-XVCSRZX4.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as validateEntitlementCheck,b as validateResourceCheck};
|
package/dist/chunk-CGJZIDG3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as et}from"./chunk-IXXVMGMF.js";import{a as jn,b as Bn,c as mn,d as wn,e as $e,f as Wn,h as Yn,i as Xn,j as Zn,k as Kn}from"./chunk-7GU34JD4.js";import{b as Fn,c as nt}from"./chunk-TIUD3N72.js";import{a as $n}from"./chunk-W32FI2A2.js";import{c as xn,e as Gn,f as Qn,h as zn,i as Le,j as tn,k as Jn,l as rn}from"./chunk-2G23BYBI.js";import{b as Nn}from"./chunk-W3B4GT74.js";import{K as nn}from"./chunk-LE32WTZ7.js";import{a as Me,d as On}from"./chunk-LSHIR6QM.js";import{c as _n,e as Ln,f as Hn,g as Vn,h as Un,i as Mn}from"./chunk-OPUIFAQS.js";import{b as An}from"./chunk-HYX3EDZS.js";import{B as fn}from"./chunk-EGFVGCDG.js";import{x as kn}from"./chunk-YFLVGOCJ.js";import{t as Sn}from"./chunk-MQ5LJEWV.js";import{C as Tn}from"./chunk-JDIFYMSA.js";import{a as w}from"./chunk-ZDIWOE4Q.js";import{a as Ee}from"./chunk-DSPLGTQI.js";async function yn(t){let{session:b,load:P}=dt(t);try{return await P(),b}catch(n){throw b.destroy(),n}}function dt(t){let b=t.view;if(!b?.paywall)throw new w("INVALID_REQUEST","The current node is not a Paywall");let P=b.paywall.receiptId,n=b.nodeId,g=b.visit,S=b.paywall.resolution,o=b.paywall,_="document"in S?{document:S.document,offering:S.offering,capabilities:S.capabilities}:null;function d(){let i=o.resolution;return"document"in i?i:_&&{...i,document:_.document,offering:_.offering,capabilities:_n(i.capabilities,_.capabilities)}}function C(i){if(!Ln(i,S))throw new w("INVALID_RESPONSE","The pinned Paywall binding changed")}let R=!1,G=new Set,re=null;function y(){let i=d();if(i&&!R)for(let a of G)Ee(a,structuredClone(i))}async function N(){I();let i=d();if(i)return structuredClone(i);if(!re){let a=(async()=>{if("document"in o.resolution||!t.resolvePaywall)throw new w("INVALID_RESPONSE","Public Paywall reader is unavailable");let q=await Fn(t,o.resolution);return I(),C(q),_={document:q.document,offering:q.offering,capabilities:q.capabilities},y(),d()})();re=a;let s=()=>{re===a&&(re=null)};a.then(s,s)}return re.then(a=>structuredClone(a))}let l=new AbortController,E=(t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])).find(i=>i.operation==="submit"&&i.nodeId===n&&i.visit===g&&i.input.type==="paywall_quote")?.requestId??b.paywall.purchaseRequestId,T=0,ne=null,U=new Set,M=null,z=new Map;function Q(i){if(i.purchase&&i.purchase.receiptId!==P)throw new w("INVALID_RESPONSE","Purchase receipt changed");let a=i.run.paywall;return i.purchase??(a?.receiptId===P?a:null)}function I(){if(R)throw new w("IDENTITY_CHANGED","Paywall presentation has closed")}function K(i,a,s){if(I(),a!==T||s!==void 0&&o.quote?.operationId!==s)return!1;let q=o.selectionGeneration??0,f=i.run.paywall;if(f?.receiptId===P){if((f.selectionGeneration??0)<(o.selectionGeneration??0))return!1;C(f.resolution)}let p=Q(i),F=f?.receiptId===P&&(f.selectionGeneration??0)>q,m=F?p?.quote??null:p?.quote??o.quote,Y=p?.operation??(m?.operationId===o.quote?.operationId?o.operation:null);return o.quote&&m&&Un(o.quote,m),m&&Y&&Hn(Y,{operationId:m.operationId,membershipId:fn(m)?m.membershipId:null,...fn(m)?{featureQuantities:m.featureQuantities??{}}:{}},"Purchase operation changed"),(F||m?.operationId!==o.quote?.operationId)&&(T++,f?.receiptId===P&&(E=f.purchaseRequestId)),f?.canReselect===!0&&f.purchaseRequestId===M&&!(t.pendingCommands??[t.pendingCommand]).some(X=>X?.requestId===M)&&(M=null),o={...o,...f?.receiptId===P?f:{},...s!==void 0&&!F&&p?.canReselect!==void 0?{canReselect:p.canReselect}:{},quote:m,operation:Mn(o.operation,Y,!0)},y(),!0}function O(i,a,s){return new Promise((q,f)=>{let p=!1,F=()=>{clearTimeout(j),l.signal.removeEventListener("abort",X)},m=ge=>{p||(p=!0,F(),q(ge))},Y=ge=>{p||(p=!0,F(),f(ge))},X=()=>Y(new w("IDENTITY_CHANGED","Paywall presentation has closed")),j=setTimeout(()=>Y(new w("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,s)),Math.max(0,a-Date.now()));l.signal.addEventListener("abort",X,{once:!0}),l.signal.aborted&&X(),i.then(m,Y)})}function qe(i){return new Promise(a=>{let s=()=>{clearTimeout(q),l.signal.removeEventListener("abort",s),a()},q=setTimeout(s,i);l.signal.addEventListener("abort",s,{once:!0}),l.signal.aborted&&s()})}function he(i,a){I();let s=z.get(i)??t.pendingCommands?.find(p=>p.requestId===i)??t.pendingCommand;if(s?.operation==="submit"&&s.requestId===i&&s.nodeId===n&&s.visit===g){a.type==="paywall_quote"&&s.input.type==="paywall_quote"&&s.input.predecessor&&!a.predecessor&&(a={...a,predecessor:s.input.predecessor});let p=nn.parse(s),F=nn.parse({...s,input:a});if(p.operation!=="submit"||F.operation!=="submit"||JSON.stringify(p.input)!==JSON.stringify(F.input))throw new w("CONFLICT","A purchase request cannot change its input");return z.set(i,p),p}let q=t.view;if(!q||q.nodeId!==n||q.visit!==g||q.paywall?.receiptId!==P)throw new w("PRECONDITION_FAILED","The Paywall visit has changed");let f=nn.parse({operation:"submit",requestId:i,nodeId:n,visit:g,revision:q.revision,input:structuredClone(a)});if(f.operation!=="submit")throw new w("INVALID_REQUEST","A purchase submission is required");return z.set(i,f),f}async function we(i,a){I();let{requestId:s,input:q}=i,f=Date.now()+3e4;U.add(s);try{let p=await O(t.submit(i),f,s);for(;p.run.pendingRequest?.requestId===s&&Date.now()<f&&!R&&(await qe(Math.min(1e3,f-Date.now())),!(R||Date.now()>=f));)p=await O(t.resume(s),f,s);if(R)throw new w("IDENTITY_CHANGED","Paywall presentation has closed");if(p.run.pendingRequest?.requestId===s)throw new w("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,s);if(!K(p,a,q.type==="paywall_confirm"||q.type==="paywall_cancel"?q.operationId:void 0))throw new w("PRECONDITION_FAILED","The purchase selection has changed");M===s&&(M=null)}catch(p){if(M=s,q.type==="paywall_quote"&&t.settle&&!R&&p instanceof w&&p.status!==void 0&&![401,425].includes(p.status)&&!p.retryable&&p.recovery!=="recover_operation")try{if((await O(t.settle(s),f,s)).settlement?.state==="settled"){let m=await O(t.get(),f,s);K(m,a)&&m.run.paywall?.purchaseRequestId===s&&o.canReselect===!0&&z.delete(s)}}catch{}throw p instanceof w&&p.code==="COMMAND_PENDING"&&p.status===void 0&&z.delete(s),p}finally{U.delete(s)}}async function W(i){if(!o.quote)throw new w("INVALID_REQUEST","A quoted purchase is required");let a=i==="confirm"?"paywall_confirm":"paywall_cancel",s=[...z.values(),...t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])].find(f=>f.operation==="submit"&&f.input.type===a&&"operationId"in f.input&&f.input.operationId===o.quote.operationId),q=s?.operation==="submit"&&s.input.type===a&&"operationId"in s.input&&s.input.operationId===o.quote.operationId?s.requestId:crypto.randomUUID();if(await we(he(q,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:o.quote.operationId,...i==="confirm"&&o.quote.merchantTerms?{merchantConfirmation:kn(o.quote.merchantTerms)}:{}}),T),!o.operation)throw new w("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(o.operation)}let le={get view(){return structuredClone(d())},get quote(){return o.quote?structuredClone(o.quote):null},get operation(){return o.operation?structuredClone(o.operation):null},get webViewUrl(){return t.webViewUrl},get locale(){return t.view?.locale??b.locale},get canReselect(){return o.canReselect===!0&&M===null},get recovery(){let i=t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[]),a=t.pendingPurchase;if(a&&(a.receiptId!==P||a.operationId!==o.quote?.operationId))return{type:"recover",operationId:a.operationId,requestId:i[0]?.requestId??null};let s=Me({quote:o.quote,operation:o.operation,requestId:i[0]?.requestId??M??E,pending:U.size>0||i.length>0||M!==null,destroyed:R,canReselect:o.canReselect});return s.type==="recover"&&s.requestId===null&&!R&&t.hasDurableJournal===!0&&!o.quote&&!o.operation&&(o.selectionGeneration??0)===0&&!a&&!i.length&&!U.size&&!E?{type:"native",operationId:null}:s},get pendingCancellation(){return!R&&(t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])).some(i=>i.operation==="submit"&&i.nodeId===n&&i.visit===g&&i.input.type==="paywall_cancel"&&i.input.operationId===o.quote?.operationId)},subscribe(i){return R?()=>{}:(G.add(i),()=>G.delete(i))},async refresh(){I();let i=T,a=await t.get();if(K(a,i),a.run.paywall?.receiptId!==P)throw new w("PRECONDITION_FAILED","Paywall presentation has changed");return N()},preview(i){let a=d();if(!a)return Promise.reject(new w("PRECONDITION_FAILED","Load the Paywall presentation first"));if(E&&E!==i.requestId&&(ne||o.canReselect!==!0))return Promise.reject(new w("COMMAND_PENDING","Retry the original purchase before starting another"));let s=a.document.buttons[i.actionId],q=s?.type==="checkout"?An(s.product,i.selection,a.capabilities):null;if(!q)return Promise.reject(new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let f=Sn(a.document.screen,q,i.selection,a.capabilities),p=E!==i.requestId&&(o.selectionGeneration??0)>0?{operationId:o.quote?.operationId??null,generation:o.selectionGeneration??0}:void 0,F=t.view?.parameters.commerce;if(F&&typeof F=="object"&&!Array.isArray(F)&&F.intent==="subscription_change"&&!i.subscriptionChange)return Promise.reject(new w("INVALID_REQUEST","Choose the existing membership for this subscription change"));if(i.subscriptionChange&&i.nativeOffer)return Promise.reject(new w("INVALID_REQUEST","A web membership change cannot include a store offer"));if(p&&o.canReselect!==!0)return Promise.reject(new w("COMMAND_PENDING","Original purchase requires authoritative termination"));let m;try{m=he(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:q,...Object.keys(f).length?{featureQuantities:f}:{},...p?{predecessor:p}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{},...i.subscriptionChange?{subscriptionChange:i.subscriptionChange}:{}})}catch(j){return Promise.reject(j)}if(E===i.requestId&&ne)return ne;E!==i.requestId&&T++;let Y=T;E=i.requestId;let X=(async()=>{if(await we(m,Y),!o.quote)throw new w("INVALID_RESPONSE","The accepted quote is missing");return Vn(o.quote,{productVersionId:q,featureQuantities:f,subscriptionChange:i.subscriptionChange},"The selected purchase changed"),structuredClone(o.quote)})();return ne=X,X.then(()=>{ne===X&&(ne=null)},j=>{ne===X&&(ne=null),E===i.requestId&&t.pendingCommand?.requestId!==i.requestId&&j instanceof w&&j.status!==void 0&&j.status<500&&![401,425].includes(j.status)&&(E=null)}),X},confirm:()=>W("confirm"),cancel:()=>W("cancel"),async read(){if(I(),!o.quote)throw new w("INVALID_REQUEST","A quoted purchase is required");let i=o.quote.operationId,a=T,s=t.pendingCommands?.find(m=>m.operation==="submit"&&(m.input.type==="paywall_confirm"||m.input.type==="paywall_cancel")&&m.input.operationId===i)??t.pendingCommand;s?.operation==="submit"&&(s.input.type==="paywall_confirm"||s.input.type==="paywall_cancel")&&s.input.operationId===i&&await t.settle?.(s.requestId);let q=await t.get(void 0,{receiptId:P,operationId:i});I();let f=Q(q);if(f?.quote&&f.quote.operationId!==i||f?.operation&&f.operation.operationId!==i)throw new w("INVALID_RESPONSE","Purchase operation changed");let p=K(q,a,i),F=p?o.operation:f?.operation;if(!F)throw new w("INVALID_RESPONSE","The current purchase result is missing");return p&&U.size===0&&!(t.pendingCommands?.length??(t.pendingCommand?1:0))&&(M=null),structuredClone(F)},destroy(){R=!0,L(),G.clear(),l.abort(),z.clear()}},L=t.subscribe(i=>{R||i.nodeId!==n||i.visit!==g||i.paywall?.receiptId!==P||(i.paywall.selectionGeneration??0)<(o.selectionGeneration??0)||(C(i.paywall.resolution),o={...o,resolution:i.paywall.resolution},y())});return{session:le,load:N}}function tt(t){let b=new Set,P=new Set,n=null;async function g(d,C){let R=!1;for(;!t.stopped&&t.key===d&&t.client.pendingCommand?.requestId===C;){if(!t.client.settle)throw new w("COMMAND_PENDING","The original display acknowledgement is still pending");await t.client.settle(C),R=!0,t.client.pendingCommand?.requestId===C&&await new Promise(G=>setTimeout(G,1500))}t.stopped||t.key!==d||(R&&await t.client.get(),!(t.stopped||t.key!==d)&&b.add(d))}function S(d,C){n=C;let R=()=>{n===C&&(n=null),P.delete(d)};return C.then(R,G=>{R(),t.busy||t.fail(G)}),C}function o(d){if(t.reviewing||b.has(d)||P.has(d)||t.stopped)return;P.add(d);let C=async()=>{if(t.reviewing||t.stopped||t.key!==d||b.has(d)){P.delete(d);return}if(t.busy||t.client.pendingCommand){setTimeout(()=>{C()},250);return}let R=(async()=>{if(t.staleRead){if(await t.staleRead,t.stopped||t.key!==d)return;if(t.client.pendingCommand){setTimeout(()=>{C()},250);return}}let G=t.client.view,re=t.expected(),y=re.requestId;try{await t.client.submit({operation:"shown",...re})}catch(N){if(!(N instanceof w)||N.code!=="CONFLICT"||N.status!==409||t.client.pendingCommand)throw N;await t.client.get();let l=t.client.view;if(t.stopped||t.reviewing||t.key!==d||!l||!G||l.id!==G.id||l.source.versionId!==G.source.versionId||l.nodeId!==re.nodeId||l.visit!==re.visit||l.revision<=re.revision||l.stopped||!l.screen&&(!l.paywall||l.paywall.receiptId!==G.paywall?.receiptId)||!["running","waiting"].includes(l.status)||t.client.pendingCommand)throw N;let u=t.expected();y=u.requestId,await t.client.submit({operation:"shown",...u})}await g(d,y)})();S(d,R)};C()}function _(){if(n)return n;let d=t.client.pendingCommand;if(d?.operation!=="shown")return null;let C=t.key;return P.add(C),S(C,(async()=>{await t.client.retry(),await g(C,d.requestId)})())}return{report:o,settled:_,get inFlight(){return n}}}function it(t){let b={},P=new Map;async function n(g){let S=t.client.view,o=S?.screen,_=o?.customerData.nodes[g.nodeId];if(t.stopped||t.busy||!S||!o||!_)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(g.action)){let N=t.document,l=N?Tn(N,g.nodeId):null,u=l?.type==="customer_data"?l.data.outputs?.[g.action]:void 0;u&&o.outputs.includes(u)?await t.perform(()=>t.client.submit({operation:"submit",...t.expected(),input:{type:"screen",output:u,answers:t.answers,selection:g.value?{[g.nodeId]:g.value}:{}}})):await t.onIntent?.(g,S);return}let C=g.action.startsWith("sources_")?_.resources.find(N=>N.key===g.value):null;if(g.action.startsWith("sources_")&&!C)throw new w("INVALID_REQUEST","Choose a current resource");let R=`${S.visit}:${g.nodeId}:${C?.key??""}`,G=P.get(R)??[null],y=b[g.nodeId]??{page:1,after:null,filter:"all",...C?{resourceKey:C.key}:{}};if(g.action==="filter"){let N=g.value;if(!N||!(_.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(N))throw new w("INVALID_REQUEST","Unknown data filter");y={page:1,after:null,filter:N},G.splice(0,G.length,null)}else if(g.action==="next"||g.action==="sources_next"){let N=C?.sources.at(-1),l=C?N?{kind:"ledger",cursor:{at:N.detail[0],id:N.id,type:"source"}}:null:o.dataCursors[g.nodeId];if(!l||!C&&!_.hasNext)return;G[y.page]=l,y={...y,page:y.page+1,after:l}}else if(g.action==="previous"||g.action==="sources_previous"){if(y.page<=1)return;y={...y,page:y.page-1,after:G[y.page-2]??null}}P.set(R,G),b={...b,[g.nodeId]:y},await t.perform(()=>t.client.get({nodeId:S.nodeId,visit:S.visit,revision:S.revision,components:b}))}return{get queries(){return b},intent:n,reset(){b={},P.clear()}}}function rt(t){let{doc:b,holder:P,reviewHolder:n,mountScreenPreview:g}=t,S=!1,o,_=0,d=null,C="",R,G=new Map,re=l=>l?`${l.id}:${l.nodeId}:${l.visit}:${l.revision}:${l.paywall?.quote?.operationId??""}`:"";async function y(l){if(t.stopped||!t.client.review||S&&l===o&&R?.active)return;let u=!S||l!==o;S||(C=re(t.client.view),G.set(C,structuredClone(t.answers))),S=!0,o=l,P.hidden=!0,t.suspend(!0),n.hidden=!1;let E=++_;u&&(R?.finish("dismissed"),d?.destroy(),d=null,n.replaceChildren(),R=tn(n,t.loadingOptions,"funnel",()=>{N()}));let T=u?R:void 0;try{if(T?.start(!1,t.client.view?.locale),E!==_||t.stopped)return;let ne=t.client.review(l),U=await(T?.wait(ne,Le)??ne);if(t.stopped||E!==_||!S)return;if(!U.review)throw new w("INVALID_RESPONSE","Historical projection is missing");d?.destroy(),d=null,T||n.replaceChildren();let M=b.createElement("div"),z=T?rn(M,n):()=>{};n.append(M);let Q=U.run.locale.startsWith("zh"),I=t.chrome;M.style.cssText=I.history;let K=b.createElement("p");K.textContent=Q?"只读回看":"Read-only history",K.style.cssText=I.historyTitle,M.append(K);let O=b.createElement("p");O.style.cssText=I.historyNote,O.textContent=U.review.pages.length?Q?"选择一页查看当时的内容,回看不会改动任何信息。":"Choose a page to see it as it was. Nothing here can be changed.":Q?"还没有可回看的页面。":"There are no earlier pages yet.",M.append(O);let qe=U.review.page?.receiptId,he=b.createElement("div");he.style.cssText=I.historyPages;for(let[le,L]of U.review.pages.entries()){let i=b.createElement("button");i.type="button",i.textContent=Q?`第 ${le+1} 页`:`Page ${le+1}`;let a=qe!==void 0&&L.receiptId===qe;i.style.cssText=a?I.primary:I.secondary,a&&i.setAttribute("aria-current","page"),$e(i,()=>t.chrome.focus),i.onclick=()=>{y(L.receiptId)},he.append(i)}if(he.childElementCount&&M.append(he),U.review.page){let le=U.review.page,L=b.createElement("div");L.inert=!0,L.style.cssText=I.historyPage,M.append(L),d=g(L,{mode:"live",rendererUrl:t.client.webViewUrl,title:le.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{E===_&&!t.stopped&&T?.present(z)},onError:a=>{if(E!==_||t.stopped)return;let s=new Error(a);T?.finish("error",s),d?.destroy(),d=null,M.remove(),t.fail(s)},onEscape:()=>{N()}});let i=d;if(i.update(le.document,U.run.locale,{serverInput:{bindings:le.inputs,answers:le.answers,values:le.values}}),await i.ready,t.stopped||E!==_||!S)return}let we=Q?{issued:"已领取",reserved:"已预留",redeemed:"已使用",expired:"已过期",revoked:"已撤销",unknown:"状态待确认"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},W=b.createElement("div");W.style.cssText=I.historyRecords;for(let le of[...U.review.coupons.map((L,i)=>`${Q?"优惠券":"Coupon"} ${i+1}: ${we[L.status]}`),...U.review.purchases.map((L,i)=>`${Q?"购买":"Purchase"} ${i+1}: ${Kn(L.status,Q)}`)]){let L=b.createElement("p");L.textContent=le,L.style.margin="0",W.append(L)}W.childElementCount&&M.append(W),U.review.page||T?.present(z),t.client.view&&await t.enqueue(t.client.view)}catch(ne){if(E!==_||t.stopped)return;T?.finish("error",ne),d?.destroy(),d=null,n.replaceChildren(),t.fail(ne)}}async function N(){if(!S||t.stopped||!t.client.review)return;let l=++_;R?.finish("dismissed");try{if(await t.client.review(),t.stopped||l!==_)return;S=!1,_++,R?.finish("dismissed"),d?.destroy(),d=null,n.replaceChildren(),n.hidden=!0,P.hidden=!1;let u=t.client.view;re(u)!==C?(G.set(C,structuredClone(t.answers)),t.resetScreen()):(G.delete(C),t.suspend(!1)),u&&await t.enqueue(u)}catch(u){if(l!==_||t.stopped)return;d?.destroy(),d=null,n.replaceChildren(),t.fail(u)}}return{get active(){return S},get receipt(){return o},open:y,exit:N,get drafts(){return new Map([...G].map(([l,u])=>[l,structuredClone(u)]))},stop(){S=!1,_++,R?.finish("dismissed"),d?.destroy(),d=null,n.replaceChildren(),n.hidden=!0,P.hidden=!1}}}var hn=5e3;async function ct(t,b,P){let n=b,g=n.prepared&&et(n.prepared),S=()=>{};function o(){n.prepared&&n.prepared.state!=="adopted"&&g?.release()}let _=()=>n.prepared?.state==="shown"&&!!g?.modal,d=n.client.identitySignal,C;try{C=await Promise.all([import("./screen-renderer-HW2WXDTR.js"),import("./paywall-DKTGQZDJ.js")]),n.signal?.throwIfAborted(),d?.throwIfAborted()}catch(e){throw o(),e}let[{mountScreenPreview:R},{showPaywall:G}]=C,re=(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&n.appManifestRelease?nt({client:n.client,appManifestRelease:n.appManifestRelease,onError:n.onError}):void 0;re?.start();let y=t.ownerDocument,N=zn(y),l=!1,u=y.createElement("section"),E=y.createElement("div"),T=y.createElement("div"),ne=y.createElement("div"),U=y.createElement("button");ne.hidden=!0,U.type="button";let M=y.createElement("p"),z=y.createElement("p"),Q=y.createElement("button"),I=y.createElement("button"),K=y.createElement("button"),O=y.createElement("dialog"),qe,he=!1;u.dataset.indianaFunnel="",u.dataset.longplayCloseOwner="sdk",u.setAttribute("aria-busy","false"),M.setAttribute("role","status"),z.setAttribute("role","alert"),z.hidden=!0,Q.type=I.type=K.type="button",T.append(Q,U,M,z,K,I),u.append(E,ne,T),t.append(u);let we=Bn,W=mn(we),le="",L=(y.documentElement.lang||"").startsWith("zh"),i,a="",s;for(let e of[Q,U,K,I])$e(e,()=>W.focus);function q(){let e=L?"关闭":"Close";I.parentElement===O?(I.textContent="×",I.setAttribute("aria-label",e),Qn(I,we)):(I.textContent=e,I.removeAttribute("aria-label"),I.style.cssText=W.link+";margin-inline-start:auto")}function f(e){let r=e?.screen?.content.document.theme??we,c=JSON.stringify([r.primary,r.background,r.text,r.radius,r.font,I.parentElement===O]);if(c===le)return;le=c,we=r;let H=I.parentElement===O;W=mn(we,H),u.style.cssText=W.root+";min-width:0"+(H?";display:flex;flex-direction:column;min-height:100%":""),T.style.cssText=W.bar+(H?";margin-top:auto":""),T.hidden&&(T.style.display="none"),Q.style.cssText=U.style.cssText=W.secondary,K.style.cssText=W.primary,M.style.cssText=W.status,z.style.cssText=W.alert,q(),wn(Q)}function p(){T.hidden=Q.hidden&&U.hidden&&K.hidden&&z.hidden&&!M.textContent&&(I.hidden||I.parentElement!==T),T.style.display=T.hidden?"none":"flex",i?.responsive&&s!==void 0&&i.setContentHeight(s+T.getBoundingClientRect().height)}f();let F=null,m=null,Y=null,X="",j="",ge=!1,xe="",on="",Ge="",h=!1,ue=0,Qe=!1,gn="",sn=null,an=Promise.resolve(),vn=!n.client.view,J=P,Se,He,ze="",Je,pe=!1,De=null,ve=!1,je=()=>n.client.pendingCommand?.operation==="close",fe=null,ee=null,ln=$n({document:y,run:async()=>{(!m?.observing||n.client.pendingCommand)&&await dn()},delay:()=>{if(!me.pending&&!(h||!Y||!["running","waiting"].includes(Y.status)&&!n.client.pendingCommand)&&!(m?.observing&&!n.client.pendingCommand))return Y.pendingRequest||n.client.pendingCommand?1500:hn},hiddenDelay:()=>!h&&!me.pending&&n.client.pendingCommand?15e3:void 0}),te=null;function un(){return ee&&n.client.hasDurableJournal===!0&&te?.acknowledged===!0&&te.operationId===ee.operationId&&n.client.view?.id===te.runId&&n.client.view?.status==="closed"&&n.client.view.revision===te.revision+1&&!(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0))&&!n.client.pendingPurchase?ee:null}function In(e){let r=e.run.paywall;if(te&&e.settlement?.requestId===te.requestId&&e.settlement.state==="settled"&&e.settlement.operationId===null&&e.run.id===te.runId&&e.run.status==="closed"&&!e.run.pendingRequest&&e.run.revision===te.revision+1&&e.run.nodeId===te.nodeId&&e.run.visit===te.visit&&r?.receiptId===te.receiptId&&r.selectionGeneration===te.selectionGeneration&&(r.quote?.operationId??null)===te.operationId&&(r.operation?.operationId??r.quote?.operationId??null)===te.operationId){let c=te.operationId===null&&r.selectionGeneration===0&&!r.quote&&!r.operation&&!r.purchaseRequestId,H=Me({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect});(c||r.canReselect===!0&&H.type==="native")&&(te.acknowledged=!0)}}let ke=null,Be=new Set,Ie={},Fe=!1,de=(e,r=null)=>{h||(e instanceof w&&e.status===409&&e.reason==="STATE_CHANGED"&&e.recovery==="recover_operation"&&ln.destroy(),ke=r,Fe=!1,z.textContent=Wn(e,L),z.hidden=!1,K.hidden=n.client.pendingCommand===null,p(),Ee(n.onError,e))},me=Nn({client:n.client,document:y,conceal(){h||(be(),J?.finish("dismissed"),u.hidden=!0,l||(l=!0,N()))},async receive(e){h||await ye(n.client.view??e.run)},failed(e){if(!h){if(!me.pending){ve=!1;let r=n.client.view;r&&ye(r).then(()=>de(e),de);return}Ze(),u.parentElement!==t&&t.append(u),u.hidden=!1,Q.hidden=U.hidden=I.hidden=!0,M.textContent="",f(),de(e,n.client.pendingCommand?.requestId??null)}}}),bn=()=>{h||(ke=null,z.textContent=Xn(L),z.hidden=!1,K.hidden=!0,p())};function Te(){let e=n.client.view;if(!e)throw new w("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision}}let A=rt({client:n.client,doc:y,holder:E,reviewHolder:ne,mountScreenPreview:R,loadingOptions:n,get chrome(){return W},get stopped(){return h},get answers(){return Ie},suspend(e){m?.setSuspended(e)},resetScreen(){X="",j="",xe=""},enqueue:ye,fail:de}),Ve=tt({client:n.client,expected:Te,fail:de,get stopped(){return h},get reviewing(){return A.active},get key(){return X},get busy(){return ue},get staleRead(){return sn}}),We=it({client:n.client,expected:Te,perform:Oe,onIntent:n.onCustomerDataIntent,get stopped(){return h},get busy(){return ue},get document(){return F?.document},get answers(){return Ie}}),Ye=e=>`${e.id}:${e.nodeId}:${e.visit}`,Ne=e=>e&&(e.screen||e.paywall)?Ye(e):"";function Pe(){let e=n.client.view;Q.disabled=!A.active&&(ue>0||!!n.client.pendingCommand||!e?.canBack||e.stopped||!["running","waiting"].includes(e.status)||!Ne(e)||j!==Ne(e)),Q.hidden=!A.active&&!e?.canBack,wn(Q);let r=!!m&&!A.active;I.hidden=r&&!J?.active||he&&!A.active,U.hidden=!n.client.review||!A.active&&!e?.canBack;let c=e?.locale.startsWith("zh");M.textContent=r?"":ue>0||e?.pendingRequest?c?"正在处理":"Processing":e?.instruction?.type==="wait"?c?"等待中":"Waiting":"",p()}async function Cn(e){if(!e)return;let r=n.client.view;await e;let c=n.client.view;if(!r||!c||c.id!==r.id||c.nodeId!==r.nodeId||c.visit!==r.visit||c.stopped||!["running","waiting"].includes(c.status))throw new w("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function Oe(e,r=!1,c){if(!((ue||ve||fe||ee)&&!r||h||A.active&&!r)){ue++,u.setAttribute("aria-busy","true"),z.hidden=!0,ke=null,Fe=!1,Pe();try{if(r||await Cn(Ve.inFlight),h)return;let H=await e();h||await ye(n.client.view??H.run)}catch(H){c?.(H)&&n.client.pendingCommand===null?bn():me.pending||de(H,n.client.pendingCommand?.requestId??null)}finally{ue=Math.max(0,ue-1),u.setAttribute("aria-busy",String(ue>0)),h||(K.hidden=n.client.pendingCommand===null,Pe())}}}function Ue(){ln.schedule()}async function dn(){if(!(h||Qe||ue)&&!me.pending){if(A.active){await A.open(A.receipt);return}Qe=!0;try{let e=n.client.pendingCommand;e&&n.client.settle&&await n.client.settle(e.requestId);let r=n.client.view,c=We.queries,H=await n.client.get(r?.screen&&Object.keys(c).length?{nodeId:r.nodeId,visit:r.visit,revision:r.revision,components:c}:void 0);Fe&&!h&&(Fe=!1,z.hidden=!0,p()),!h&&c===We.queries&&await ye(n.client.view??H.run)}catch(e){de(e),Fe=!h}finally{Qe=!1}}}function Xe(e,r,c){if(J?.active){let ce=J;return ce.setDismissHandler(()=>Pn(ce)),ce}let H=tn(t,n,"funnel",()=>Pn(H),jn);return J=H,H.start(e,r,c),H}function Pn(e){h||pe||(pe=!0,e.finish("dismissed"),be(),u.hidden=!0,n.client.view?Re().finally(se):se())}function cn(){clearTimeout(Je?.timeout),Je=void 0}function be(e){he=!1,cn(),Se?.abort(),Se=void 0,F?.destroy(),F=null,m?.destroy(),m=null,He?.(),He=void 0,O.open&&O.close();for(let r of Array.from(E.children))(!e||!r.contains(e))&&r.remove();E.style.cssText="",s=void 0,X="",j="",ge=!1,xe="",Ge=""}function Rn(){let e=y.defaultView;i?.responsive&&e&&F?.resizeViewport?.(e.innerHeight,e.innerWidth)}function Ze(){i?.destroy(),i=void 0,a=""}function Ke(e){let r=e.screen?.presentation;if(!r||r.type==="inline"){O.open&&O.close(),Ze(),I.parentElement!==T&&T.append(I),u.parentElement!==t&&t.append(u);for(let ce of["flex","display","flex-direction","justify-content"])E.style.removeProperty(ce);f(e),p();return}u.parentElement!==O&&(O.append(I,u),t.append(O)),E.style.flex="1 0 auto",E.style.display="flex",E.style.flexDirection="column",E.style.justifyContent="center",f(e);let c=e.screen.content.document,H=JSON.stringify([r,le]);if(H!==a){Ze(),a=H;let ce={sm:420,md:640,lg:900},Ce="size"in r&&!r.backdrop?",0 0 0 100vmax #16142566":"";O.style.cssText=`box-sizing:border-box;padding:0;border:0;overflow:auto;background:${we.background};color:${we.text};`+(r.type==="fullscreen"?"width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;border-radius:0":`width:${ce[r.size]}px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);box-shadow:0 24px 80px #0003${Ce};`+(r.type==="sheet"?"margin:auto auto 0;border-radius:14px 14px 0 0":"border-radius:14px")),i=xn(O,{presentation:r,theme:c.theme,pages:c.pages},Rn),i.latch()}p(),O.setAttribute("aria-label",(qe?.screen===e.screen?.content.document.name?qe?.label:void 0)??F?.document?.name??e.screen?.content.document.name??"Funnel")}async function ot(e){if(h||pe)return;if(me.observe(),me.pending){Y=e;return}if(ve&&(je()||["running","waiting"].includes(e.status))||(Y=e,ke&&n.client.pendingCommand?.requestId!==ke&&(z.hidden=!0,ke=null),L=e.locale.startsWith("zh"),U.textContent=L?"回看":"History",Q.textContent=A.active?L?"返回当前":"Return to current":L?"返回":"Back",q(),K.textContent=L?"重试":"Retry",K.hidden=n.client.pendingCommand===null,Pe(),gn!==`${e.revision}:${e.visit}:${e.status}:${e.stopped}`&&(gn=`${e.revision}:${e.visit}:${e.status}:${e.stopped}`,Ee(n.onState,structuredClone(e))),h||pe))return;if((!e.pendingRequest||ve&&e.status==="closed")&&["closed","ineligible","failed"].includes(e.status)){se();return}if(e.stopped&&_()){se();return}if(e.stopped||n.client.configurationReady===!1){A.stop(),o(),be(),J?.finish("skipped"),u.hidden=!0,Ue();return}if(u.hidden=!1,A.active){Ue();return}let r=Ne(e),c=n.client.view;if(c&&c.revision>e.revision&&Ne(c)!==r)return;let H=!e.instruction&&!e.pendingRequest&&e.nodeType==="screen"&&["running","waiting"].includes(e.status);r!==X&&(X&&J?.finish("dismissed"),be(),X=r,Ie={...e.answers},We.reset());let ce=Ye(e);if(ze===ce){u.hidden=!0;return}if(H&&!r){u.hidden=!0;let $=n.prepared?.state==="shown"?null:Xe(!0,e.locale);!h&&!pe&&Je?.key!==ce&&(cn(),Je={key:ce,timeout:setTimeout(()=>{let v=n.client.view;if(h||!$?.active&&n.prepared?.state!=="shown"||!v||Ye(v)!==ce)return;ze=ce;let B=new Error("Funnel screen preparation timed out");$?.finish("error",B),o(),be(),de(B)},Le)}),Ue();return}cn();let Z=$=>{let v=n.client.view;return!h&&!pe&&!De&&!$.aborted&&n.client.configurationReady!==!1&&!!v&&!v.stopped&&!["closed","ineligible","failed"].includes(v.status)&&Ne(v)===r},Ce=($,v)=>{Z(v)&&(ze=r,J?.finish("error",$),be(),u.hidden=!0,de($))};if(r||((e.instruction&&e.instruction.type!=="evaluate_segment"||!["running","waiting"].includes(e.status))&&o(),Ke(e),e.instruction?.type!=="event"&&e.instruction?.type!=="open_url"&&J?.finish("skipped")),e.screen){o();let $=e.screen.content;if(!F){let oe=e.screen.presentation.type!=="inline",x=Xe(oe,e.locale);if(h||pe)return;let ie=(Se=new AbortController).signal;Ke(e),He=oe?Jn(O):rn(u,t),F=R(E,{mode:"live",closeActions:Array.from(new Set([...n.closeActions??[],...$.document.actions.filter(V=>V.type==="event"&&V.close).map(V=>V.id)])),onAuthoredClose(V){Z(ie)&&(he=V,Pe())},rendererUrl:n.client.webViewUrl,title:$.document.name,...oe?{hostPresentation:()=>i?.type??e.screen.presentation.type}:{},onResize:V=>{s=V,i?.responsive&&i.setContentHeight(V+T.getBoundingClientRect().height)},onAction(V,k={},Ae={}){if(A.active||!Z(ie)||j!==r)return;Ie={...Ie,...Ae};let pn=e.screen?.inputs??[],Dn=Object.fromEntries(pn.filter(({variable:_e})=>Object.hasOwn(Ie,_e)).map(({variable:_e})=>[_e,Ie[_e]]));if(Zn(pn,Dn).length){bn();return}Oe(()=>n.client.submit({operation:"submit",...Te(),input:{type:"screen",output:V,answers:Dn,selection:k}}),!1,_e=>Yn(_e,pn))},onAnswers:V=>{A.active||!Z(ie)||j!==r||(Ie={...Ie,...V})},onCustomerDataIntent:V=>{A.active||!Z(ie)||j!==r||We.intent(V).catch(de)},onEscape:()=>{!Z(ie)||j!==r||A.active||fe||ee||Re()},onError:V=>{let k=new Error(V);j===r?de(k):Ce(k,ie)},onRendered:V=>{if(!(!Z(ie)||j===r))try{x.present(k=>{He?.(),He=void 0,V&&(qe={screen:$.document.name,label:V},O.setAttribute("aria-label",V)),oe&&(O.showModal(),l=!1,i?.responsive&&O.focus({preventScroll:!0}),!k&&n.loading!=="host"&&Gn(O,i?.type??e.screen.presentation.type,i?.responsive)),j=r,ge=oe,Pe()}),Z(ie)&&Ve.report(r)}catch(k){Ce(k,ie)}}}),Rn()}let v={capabilities:e.screen.capabilities,customerData:e.screen.customerData,parameters:e.parameters,serverInput:{bindings:e.screen.inputs,answers:Ie,values:e.screen.values}},B=JSON.stringify([$,e.locale,v.parameters,e.screen.inputs,e.screen.values]);if(B!==xe)F.update($.document,e.locale,v),xe=B,on=JSON.stringify(v.capabilities),Ge=JSON.stringify(v.customerData);else{let oe=JSON.stringify(v.capabilities);oe!==on&&(F.updateCapabilities(v.capabilities),on=oe),JSON.stringify(v.customerData)!==Ge&&(F.updateCustomerData(v.customerData),Ge=JSON.stringify(v.customerData))}let ae=F;if(ae)try{await(J?.wait(ae.ready)??ae.ready)}catch(oe){Se&&Ce(oe,Se.signal)}}else if(e.paywall&&!m){let $=e.paywall.resolution,v="document"in $?$.document:null,B=g,ae=n.mountPaywallControls,oe=null,x=(Se=new AbortController).signal,ie={loading:"host",signal:x,...ae&&{mountControls:k=>ae(k,e)},canInteract:()=>Z(x)&&!A.active&&!fe&&!ee,beforeAction:async()=>{ue++;try{await Cn(Ve.settled()),z.hidden=!0,ke=null,Fe=!1,p()}finally{ue=Math.max(0,ue-1)}},start:()=>yn(n.client),onObservationChange:Ue,onPurchase:n.onPurchase,onCheckoutUrl:n.onCheckoutUrl,resumeCheckout:n.resumeCheckout,allowNewPurchase:n.allowNewPurchase,checkoutNavigation:n.checkoutNavigation,terminateCheckout:n.terminateCheckout,beforeCheckoutReplacement:n.beforeCheckoutReplacement,purchaseConfirmation:n.purchaseConfirmation,confirmOnHostedCheckout:n.confirmOnHostedCheckout,resolveOfferId:n.resolveOfferId,resolveSubscriptionChange:n.resolveSubscriptionChange,claimCoupon:n.claimCoupon,onEvent:n.onEvent,onOpenUrl:k=>n.onOpenUrl?n.onOpenUrl({receiptId:e.paywall.receiptId,url:k,openIn:"same_window"}):y.defaultView?.location.assign(k),onAction:async k=>{if(A.active)return;let Ae=await n.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:k,answers:{}}});await ye(n.client.view??Ae.run)},onError:k=>{j===r?de(k):Ce(k,x)}},V={quoteError:k=>Ee(n.onError,k),loadingLayout:()=>Z(x)?oe?.getLoadingLayout?.():void 0,present(k){Z(x)&&(oe?.present(Ae=>{k(Ae),j=r,ge=!!E.querySelector("dialog[open]"),ge&&(l=!1),Pe()}),Z(x)&&Ve.report(r))},async closeAction(k){h||A.active||await me.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:n.client.view?.revision??e.revision,input:{type:"screen",output:k,answers:{}}})},async dismiss(){if(!(h||x.aborted||A.active||fe||ee||!ve&&!Z(x))){if(ve=!0,(n.resumeCheckout||n.terminateCheckout)&&ut()){Y=n.client.view,se();return}await Re()}}};if(B&&ae)o();else if(B){let k=await B.adopt(e,{options:ie,handoff:V,start:()=>yn(n.client)});k&&Z(x)&&!h?(Ke(e),m=k,J?.active&&J.present(()=>{}),j=r,ge=B.modal,ge&&(l=!1),Pe(),Ve.report(r),A.active&&m.setSuspended(!0)):(k?.destroy(),o())}if(h||pe)return;if(!m){if(oe=Xe(!0,e.locale,v),h||pe)return;Ke(e);let k=await G(E,ie,V).catch(Ae=>(Ce(Ae,x),null));!Z(x)&&!(ve&&!h&&!x.aborted)?k?.host?.destroy():k&&(m=k.host,m?.setSuspended(A.active))}}if(h||pe)return;Pe();let D=e.instruction;if(D&&(D.type==="open_url"||D.type==="event")&&!Be.has(D.receiptId)){let $=y.createElement("button");$.type="button",$.style.cssText=W.primary,$e($,()=>W.focus),E.style.cssText=W.stage,$.textContent=D.type==="open_url"?`${L?"前往":"Continue to"} ${new URL(D.url).host}`:L?"继续":"Continue",$.onclick=()=>{let v=Te(),B=D.type==="open_url"&&!n.onOpenUrl&&D.openIn==="new_window"?st(D.url):null;Oe(async()=>{let ae="success";if(D.type==="open_url")if(n.onOpenUrl)try{ae=await n.onOpenUrl({receiptId:D.receiptId,url:D.url,openIn:D.openIn})===!1?"failed":"opened"}catch(x){Ee(n.onError,x),ae="failed"}else ae=D.openIn==="new_window"&&!B?"failed":"opened";if(D.type==="event"){if(!n.onEvent)throw new w("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(D.event)}if(h||n.client.view?.nodeId!==v.nodeId||n.client.view.visit!==v.visit)throw new w("PRECONDITION_FAILED","The client action visit changed");let oe=await n.client.submit({operation:"submit",...v,input:{type:"client_action",receiptId:D.receiptId,outcome:ae}});return Be.add(D.receiptId),D.type==="open_url"&&!n.onOpenUrl&&D.openIn==="same_window"&&y.defaultView?.location.assign(D.url),oe})},J?.active?J.present(()=>E.replaceChildren($)):E.replaceChildren($)}!e.pendingRequest&&e.status==="completed"&&!Be.has(`complete:${e.id}`)&&(Be.add(`complete:${e.id}`),Ee(n.onComplete,structuredClone(e))),Ue()}function st(e){let r=y.defaultView?.open(e,"_blank")??null;return r&&(r.opener=null),r}function ye(e){return Pe(),an=an.catch(()=>{}).then(async()=>{try{await ot(e)}catch(r){throw J?.active&&(ze=Ye(e),J.finish("error",r),be(),u.hidden=!0),r}}),an}let at=n.client.subscribe(e=>{if(!vn){if(e.stopped&&(ge||_())&&!ve){Y=e,se();return}!ve&&(e.stopped||n.client.configurationReady===!1||X&&j!==X&&(Ne(e)!==X||["closed","ineligible","failed"].includes(e.status)))&&(be(),J?.finish("dismissed"),u.hidden=!0),ye(e).catch(de)}}),lt=n.client.subscribeError?.(e=>{me.pending||de(e)});function ut(){let e=n.client.view,r=e?.paywall;return!!r?.operation&&!!e&&["running","waiting"].includes(e.status)&&On(Me({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect}))}function Re(e){if(De)return De;if(h||!e&&(fe||ee))return Promise.resolve();let r=!e&&je();return!r&&n.client.view&&!["running","waiting"].includes(n.client.view.status)?(Y=n.client.view,se(),Promise.resolve()):(De=Oe(async()=>{let c=r?await n.client.retry():await(e?n.client.submit.bind(n.client):me.submit)({operation:"close",...e??Te()});return e&&In(c),c},!0).then(()=>{let c=n.client.view;c?.status==="closed"&&!je()&&(Y=c,se())}).finally(()=>{De=null}),De)}function se(){En()}function En(e){re?.destroy(),!h&&(h=!0,me.destroy(),S(),o(),n.signal?.removeEventListener("abort",se),d?.removeEventListener("abort",se),J?.finish("dismissed"),ln.destroy(),at(),lt?.(),be(e),Ze(),A.stop(),O.remove(),!e||!u.contains(e)?u.remove():(T.remove(),ne.remove()),!e&&!l&&N(),Ee(n.onDismiss,Y?structuredClone(Y):null))}Q.onclick=()=>{if(!Q.disabled){if(A.active){A.exit();return}Oe(()=>n.client.submit({operation:"back",...Te()}))}},U.onclick=()=>{A.open()},I.onclick=()=>{J?.active?J.dismiss():fe||Re()},K.onclick=()=>{me.pending?me.retry().catch(()=>{}):je()?Re():Oe(()=>n.client.retry())},O.addEventListener("cancel",e=>{e.preventDefault(),J?.active?J.dismiss():fe||Re()}),n.signal?.addEventListener("abort",se,{once:!0}),d?.addEventListener("abort",se,{once:!0});let en=!1;g&&(S=g.onClose(()=>{h||pe||(pe=!0,J?.finish("dismissed"),be(),u.hidden=!0,n.client.view?Re().finally(se):en=!0)}));let qn={destroy:se,refresh:dn,retainPurchaseDialog(){let e=m?.retainPurchaseDialog();if(e)return m=null,En(e.dialog),{dialog:e.dialog,release(){e.release(),u.remove(),l||N()}}},get recovery(){let e=un();if(e)return e;if(!h&&!ue&&!ve&&!fe&&m){let r=m.recovery;if(r.type!=="native")return r}return{type:"recover",operationId:n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??ee?.operationId??null,requestId:n.client.pendingCommand?.requestId??null}},prepareFallback(){if(fe)return fe;let e=un();if(e)return Promise.resolve(e);let r=n.client.pendingPurchase?.operationId??n.client.view?.paywall?.quote?.operationId??ee?.operationId??null,c=()=>({type:"recover",operationId:r,requestId:n.client.pendingCommand?.requestId??null});if(n.client.hasDurableJournal!==!0){let D=m?.recovery;return Promise.resolve(D&&D.type!=="native"&&D.type!=="cancel"?D:c())}let H=(n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[])).some(D=>D.operation==="close");if(h&&!(H||ee&&n.client.view?.status==="closed")||ue||Qe||De||A.active||!m&&!ee&&!H)return Promise.resolve(c());let ce=m,Z=(async()=>{try{if(!ee&&H){let v=await n.client.retry();return await ye(n.client.view??v.run),c()}if(!ee){let v=await ce.prepareFallback();if(v.type!=="native")return v;if(n.client.hasDurableJournal!==!0)return c();ee=v}let D=n.client.pendingCommands??(n.client.pendingCommand?[n.client.pendingCommand]:[]);if(D.length){let v=D.find(ae=>ae.operation==="close");if(!v||!te||v.requestId!==te.requestId)return c();let B=await n.client.retry();In(B),await ye(n.client.view??B.run)}else{let v=n.client.view,B=v?.paywall;if(!v||!B||B.selectionGeneration===void 0||(B.quote?.operationId??null)!==ee.operationId||ee.operationId!==null&&B.canReselect!==!0)return c();let ae=B.selectionGeneration,oe=await n.client.get();await ye(n.client.view??oe.run);let x=n.client.view,ie=x?.paywall;if(!x||!ie||!["running","waiting"].includes(x.status)||x.stopped||x.id!==v.id||x.nodeId!==v.nodeId||x.visit!==v.visit||ie.receiptId!==B.receiptId||ie.selectionGeneration!==ae||(ie.quote?.operationId??null)!==ee.operationId||ee.operationId!==null&&ie.canReselect!==!0||n.client.pendingPurchase||(n.client.pendingCommands?.length??(n.client.pendingCommand?1:0)))return c();let V=Te();te={runId:x.id,operationId:ee.operationId,revision:V.revision,requestId:V.requestId,nodeId:x.nodeId,visit:x.visit,receiptId:ie.receiptId,selectionGeneration:ae,acknowledged:!1},await Re(V)}let $=un();return $?(se(),$):c()}catch(D){return de(D),c()}})();fe=Z;let Ce=()=>{fe===Z&&(fe=null)};return Z.then(Ce,Ce),Z},review:A.open,exitReview:A.exit,get unappliedDrafts(){return A.drafts}};try{let e=n.client.view;if(e)((n.client.viewAgeMs??hn)>=hn||e.instruction?.type==="evaluate_segment")&&(sn=dn().finally(()=>{sn=null})),await ye(e);else{if(u.hidden=!0,h)throw new DOMException("Presentation cancelled","AbortError");let r=en||n.prepared?.state==="shown"?null:Xe(n.client.view?.screen?.presentation.type!=="inline",n.client.view?.locale);if(h||pe&&!en)throw new DOMException("Presentation cancelled","AbortError");let c=n.client.get(),H=await(r?r.wait(c,Le):pt(c,Le));if(vn=!1,en)return h||await Re().finally(se),qn;await ye(n.client.view??H.run)}}catch(e){throw J?.finish("error",e),se(),e}return qn}function pt(t,b){let P;return Promise.race([t,new Promise((n,g)=>{P=setTimeout(()=>g(new Error("Presentation data timed out")),b)})]).finally(()=>clearTimeout(P))}function Kt(t,b,P){return ct(t,b,P)}export{ct as a,Kt as b};
|
package/dist/chunk-MVUNV5XR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as _e}from"./chunk-3ITNAFAH.js";import{a as M}from"./chunk-2I2S5ZIH.js";import{D as ee,F as Ne,c as Re,e as D,j as Ee,u as ke,v as qe,x as Fe,z as Ae}from"./chunk-3TSFGU4T.js";import{a as Se,b as Ce,c as ve}from"./chunk-Y2ASROJH.js";import{K as x}from"./chunk-LE32WTZ7.js";import{a as te}from"./chunk-LSHIR6QM.js";import{i as ne}from"./chunk-OPUIFAQS.js";import{A as X,C as Z,E as Pe}from"./chunk-EGFVGCDG.js";import{x as de}from"./chunk-YFLVGOCJ.js";import{b as Oe}from"./chunk-FN462OVO.js";import{a as l}from"./chunk-ZDIWOE4Q.js";import{h as W}from"./chunk-FYD7CMS7.js";import{b as be}from"./chunk-B4SM2KRI.js";import{b as n}from"./chunk-XVCSRZX4.js";import{a as pe}from"./chunk-DSPLGTQI.js";var g=x.options,Qe=n.discriminatedUnion("operation",[g[1].omit({customerToken:!0}),g[2].omit({customerToken:!0}),g[3].omit({customerToken:!0}),g[4].omit({customerToken:!0}),g[5].omit({customerToken:!0}),g[6].omit({customerToken:!0}),g[7].omit({customerToken:!0}),g[8].omit({customerToken:!0}),Ee.omit({customerToken:!0})]),me=n.strictObject({receiptId:n.uuid(),operationId:n.uuid()}),nt=n.discriminatedUnion("operation",[n.strictObject({operation:n.literal("find_purchase")}),n.strictObject({operation:n.literal("recover_start"),intent:n.enum(["lookup","resume","start"]),start:n.strictObject({requestId:g[0].shape.requestId,funnelId:g[0].shape.funnelId,locale:g[0].shape.locale,parameters:g[0].shape.parameters})}),n.strictObject({operation:n.literal("recover_run"),runId:n.uuid(),funnelId:n.uuid()}),n.strictObject({operation:n.literal("recover_purchase"),runId:n.uuid(),funnelId:n.uuid(),purchase:me}),n.strictObject({operation:n.literal("terminate_checkout"),runId:n.uuid(),funnelId:n.uuid(),purchase:me}),n.strictObject({operation:n.literal("settle_command"),runId:n.uuid(),funnelId:n.uuid(),requestId:n.uuid(),command:n.discriminatedUnion("operation",[g[3].omit({customerToken:!0}),g[4].omit({customerToken:!0}),g[5].omit({customerToken:!0}),g[6].omit({customerToken:!0}),g[7].omit({customerToken:!0})]).optional()}).refine(a=>!a.command||a.requestId===a.command.requestId),n.strictObject({operation:n.literal("run_command"),runId:n.uuid(),funnelId:n.uuid(),command:Qe})]),re=n.strictObject({runId:n.uuid(),funnelId:n.uuid(),versionId:n.uuid(),startRequestId:n.uuid(),runExpiresAt:n.iso.datetime({offset:!0}),status:D.shape.run.shape.status}),j={scope:W,customerId:n.uuid()},je=n.discriminatedUnion("outcome",[n.strictObject({...j,outcome:n.literal("unknown"),target:n.null(),view:n.null(),access:n.null()}),n.strictObject({...j,outcome:n.literal("resolved"),target:re,view:D.shape.run.nullable(),access:n.discriminatedUnion("type",[n.strictObject({type:n.literal("customer")}),n.strictObject({type:n.literal("operation_only"),cause:n.enum(["run_terminal","run_expired","run_revoked","issuer_unavailable"])})])})]).superRefine((a,d)=>{a.outcome==="resolved"&&(a.access.type==="customer"!=(a.view!==null)||a.view&&(a.view.id!==a.target.runId||a.view.source.id!==a.target.funnelId||a.view.source.versionId!==a.target.versionId||a.view.status!==a.target.status||a.view.runExpiresAt!==a.target.runExpiresAt||a.view.credentialExpiresAt!==null))&&d.addIssue({code:"custom",message:"Recovery view and original Run binding differ"})}),Te=n.strictObject({...j,target:re,view:D.shape.run.nullable(),settlement:n.strictObject({requestId:n.uuid(),state:n.enum(["pending","unknown","settled"]),acceptance:n.enum(["accepted","not_accepted","unknown"]),receiptPhase:n.enum(["accepted","processing","done"]).nullable(),basis:n.enum(["receipt","run_terminal","position_advanced","none"]),receiptId:n.uuid().nullable(),operationId:n.uuid().nullable()}),purchase:D.shape.purchase.unwrap().nullable()}).superRefine((a,d)=>{let m=a.settlement;(m.acceptance==="accepted"!=(m.receiptPhase!==null)||m.acceptance==="accepted"&&m.basis!=="receipt"||m.acceptance==="unknown"&&(m.state!=="unknown"||m.basis!=="none")||m.acceptance!=="accepted"&&(m.operationId!==null||m.receiptId!==null)||m.acceptance==="not_accepted"&&(m.state!=="settled"||!["run_terminal","position_advanced"].includes(m.basis))||a.purchase&&(a.purchase.receiptId!==m.receiptId||a.purchase.operation&&a.purchase.operation.operationId!==m.operationId||a.purchase.quote&&a.purchase.quote.operationId!==m.operationId)||a.view&&(a.view.id!==a.target.runId||a.view.source.id!==a.target.funnelId||a.view.source.versionId!==a.target.versionId||a.view.status!==a.target.status||a.view.runExpiresAt!==a.target.runExpiresAt||a.view.credentialExpiresAt!==null))&&d.addIssue({code:"custom",message:"Original command settlement binding differs"})}),Ue=n.strictObject({...j,target:re,purchase:D.shape.purchase.unwrap()}).superRefine((a,d)=>{(!a.purchase.operation||typeof a.purchase.canReselect!="boolean"||a.purchase.quote&&a.purchase.quote.operationId!==a.purchase.operation.operationId)&&d.addIssue({code:"custom",message:"Original purchase proof is incomplete"})}),xe=n.discriminatedUnion("outcome",[n.strictObject({...j,outcome:n.literal("none")}),n.strictObject({...j,outcome:n.literal("blocked")}),n.strictObject({...j,outcome:n.literal("found"),target:re,start:n.strictObject({locale:g[0].shape.locale,parameters:g[0].shape.parameters}),purchase:me})]);var Ye=x.options[0].refine(a=>!a.customer&&!a.customerData),Je=n.strictObject({receiptId:n.uuid(),operationId:n.uuid(),terminal:n.enum(["complete","native"]).nullable()}),De=n.strictObject({schemaVersion:n.literal(1),baseUrl:n.url(),scope:W,customerId:n.uuid(),sessionId:n.uuid(),start:Ye,allowed:n.array(n.enum(["merchant","record_only","indiana","native"])),run:n.strictObject({id:n.uuid(),versionId:n.uuid(),status:Re.shape.status,revision:n.number().int().nonnegative(),runExpiresAt:n.iso.datetime({offset:!0}).optional()}).optional(),purchases:n.array(Je).max(100),operationCommand:n.strictObject({operationId:n.uuid(),intent:n.literal("confirm")}).optional(),journal:n.strictObject({revision:n.number().int().nonnegative(),entry:ke.nullable()})});function He(a){return Fe({...a,namespace:"purchases",identity:[a.scope.projectId,a.scope.environment,a.customerId]})}function Le(a){let d=new URL(a.baseUrl??be).href,m=()=>new l("PURCHASE_STORAGE_INVALID","Purchase recovery storage is unavailable or invalid; native fallback is not authorized");async function P(){a.assertCurrent();try{let v=await a.storage.read();if(a.assertCurrent(),!Number.isSafeInteger(v.revision)||v.revision<0)throw m();let s=v.entry===null?null:De.parse(v.entry);if(s&&(s.baseUrl!==d||s.customerId!==a.customerId||s.scope.projectId!==a.scope.projectId||s.scope.environment!==a.scope.environment))throw new l("SCOPE_MISMATCH","Purchase recovery belongs to another Customer or environment");if(s?.journal.entry&&(s.journal.entry.scope.projectId!==s.scope.projectId||s.journal.entry.scope.environment!==s.scope.environment||s.journal.entry.funnelId!==s.start.funnelId||s.journal.entry.runId!==s.run?.id||s.journal.entry.versionId!==s.run?.versionId)||s?.operationCommand&&!s.purchases.some(E=>E.operationId===s.operationCommand?.operationId))throw m();return{revision:v.revision,entry:s}}catch(v){throw v instanceof l?v:m()}}async function z(v){for(let s=0;s<8;s++){let E=await P(),O=v(structuredClone(E.entry));if(JSON.stringify(O)===JSON.stringify(E.entry))return O;O&&De.parse(O),a.assertCurrent();let R;try{R=await a.storage.write(E.revision,O)}catch{throw m()}if(a.assertCurrent(),R!==null){if(!Number.isSafeInteger(R)||R<=E.revision)throw m();return O}}throw new l("PURCHASE_STORAGE_CONFLICT","Another consumer changed this purchase; recover the original attempt")}return{read:P,update:z,baseUrl:d}}var Ke=5*6e4;function $e(a,d){let m=a.purchases.find(P=>P.type==="checkout");if(!a.actions.includes("continue_checkout")||m?.type!=="checkout"||d!==void 0&&m.operationId!==d)throw new l("PURCHASE_PENDING","No single resumable Checkout is confirmed");return m.checkoutUrl}function kt(a){let d={...a,scope:{...a.scope},executionPolicy:structuredClone(a.executionPolicy)},m=d.session.snapshot();if(!m)throw new l("CUSTOMER_SESSION_REQUIRED","Purchase recovery requires a verified Customer session");let{customerId:P,sessionId:z}=m,v=!1,s=null,E,O=null,R=!1,F,B,Q,k={mode:"idle",status:"idle",actions:["start"],purchases:[]},S=new Map,T=new Map,fe=new AbortController,Y=new Set,H=Oe(d),J=_e(H.request);function L(e){return{code:e instanceof l?e.code:"PURCHASE_RECOVERY_BLOCKED",message:e instanceof Error?e.message:"The original purchase requires server confirmation",...e instanceof l&&e.status!==void 0?{status:e.status}:{}}}function y(){if(v||d.session.snapshot()?.customerId!==P)throw new l("IDENTITY_CHANGED","The original purchase Customer changed")}let h=Le({...d,customerId:P,assertCurrent:y,storage:d.storage??He({baseUrl:d.baseUrl,scope:d.scope,customerId:P})}),Ve=d.session.subscribeIdentity(he);function he(){v||(v=!0,clearTimeout(Q),fe.abort(new l("IDENTITY_CHANGED","Purchase consumer was destroyed")),Ve(),s?.reset(),s=null,O=null,H.dispose(),Y.clear(),S.clear(),T.clear())}function C(e){y();let t=JSON.stringify(e)!==JSON.stringify(k);k=e,clearTimeout(Q),(e.mode==="operation"||e.mode==="run"&&!e.actions.includes("close"))&&["waiting_result","fulfillment","recording"].includes(e.status)&&(Q=setTimeout(()=>{U().catch(()=>{})},5e3)),t&&pe(d.onRecovery,structuredClone(e));for(let r of t?Y:[]){if(v)break;pe(r,structuredClone(e))}return structuredClone(e)}function I(e){if(y(),!e||e.start.requestId!==E)throw new l("PURCHASE_STORAGE_CONFLICT","This purchase was superseded; the old consumer cannot dispatch")}function b(e){let t=[...e.purchases],r=e.journal.entry?.purchase;return r&&!t.some(o=>o.operationId===r.operationId)&&t.push({receiptId:r.receiptId,operationId:r.operationId,terminal:null}),t}function A(e){return e.run&&!["running","waiting"].includes(e.run.status)&&!e.journal.entry?.command&&!e.journal.entry?.closeCommand&&!e.operationCommand&&b(e).every(t=>t.terminal!==null)}function _(e,t){let r=e.journal.entry?.command??e.journal.entry?.closeCommand,o=b(e).map(w=>{let le=S.get(w.operationId);return w.terminal&&!le?{type:w.terminal,operationId:w.operationId}:te({quote:le?.quote??null,operation:le??null,requestId:r?.requestId??null,pending:!1,destroyed:!1,canReselect:T.get(w.operationId)===!0})}),u=o.filter(w=>!["complete","native"].includes(w.type)),i=u[0],c=u.length===1&&i?.operationId?S.get(i.operationId):void 0;if(c&&(i?.type==="checkout"||i?.type==="cancel"))try{ee({allowed:e.allowed.filter(w=>d.executionPolicy.allowed.includes(w))},c.quote)}catch(w){return{mode:t,status:"blocked",actions:["refresh",...t==="run"&&e.run&&["running","waiting"].includes(e.run.status)?["close"]:[]],purchases:o,error:L(w)}}let f;if(t==="operation"&&!r&&i?.type==="cancel"&&c?.quote&&!c.problem&&!c.confirmedAt)try{ee({allowed:e.allowed.filter(w=>d.executionPolicy.allowed.includes(w))},c.quote),Date.parse(c.quote.expiresAt)>Date.now()&&(f={operationId:c.operationId,quote:c.quote})}catch{}let p=o.length>0&&u.length===0,N=A(e)||t==="operation"&&p&&!r&&!e.operationCommand?"complete":i?.type==="checkout"?"checkout":i?.type==="fulfillment"?"fulfillment":i?.type==="recording"?"recording":r||e.operationCommand||i&&i.type!=="cancel"||t==="operation"&&!f?"waiting_result":"ready";return{mode:t,status:N,purchases:o,...f?{confirmation:structuredClone(f)}:{},actions:["refresh",...A(e)?["start"]:[],...t==="run"&&e.run&&["running","waiting"].includes(e.run.status)?["close"]:[],...e.operationCommand?["retry"]:f?["confirm"]:[],...u.length===1&&i?.type==="checkout"?["continue_checkout"]:[]]}}function oe(e){let t=te({quote:e?.quote??null,operation:e??null,requestId:null,pending:!1,destroyed:!1,canReselect:e&&T.get(e.operationId)===!0});return t.type==="complete"||t.type==="native"?t.type:null}function ae(e){if(!e.operation)return;let t=X.parse({...e.operation,...e.operation.quote?{}:e.quote?{quote:e.quote}:{}});if(t.merchantExecution&&t.merchantExecution.customerId!==P)throw new l("SCOPE_MISMATCH","Purchase execution belongs to another Customer");let r=ne(S.get(t.operationId)??null,t);S.set(t.operationId,r),r===t&&T.set(t.operationId,e.canReselect===!0)}async function Ge(e){y();for(let r of[e.purchase,e.run.paywall])r&&ae(r);let t=await h.update(r=>{if(I(r),r.run&&(r.run.id!==e.run.id||r.run.versionId!==e.run.source.versionId))throw new l("SCOPE_MISMATCH","The original purchase Run changed");let o=b(r);for(let u of[e.purchase,e.run.paywall]){let i=u?.operation?.operationId??u?.quote?.operationId;if(!u||!i)continue;let c=o.find(p=>p.operationId===i);if(c&&c.receiptId!==u.receiptId)throw new l("INVALID_RESPONSE","The original purchase Receipt changed");let f=oe(S.get(i));c?c.terminal??=f:o.push({receiptId:u.receiptId,operationId:i,terminal:f})}return{...r,purchases:o,run:r.run&&(r.run.revision>e.run.revision||!["running","waiting"].includes(r.run.status)&&["running","waiting"].includes(e.run.status))?r.run:{id:e.run.id,versionId:e.run.source.versionId,status:e.run.status,revision:e.run.revision,runExpiresAt:e.run.runExpiresAt}}});I(t),t.run&&!["running","waiting"].includes(t.run.status)&&b(t).some(r=>!r.terminal)&&(t=await V(t,!t.journal.entry?.command&&!t.journal.entry?.closeCommand,new Set([e.purchase?.operation?.operationId,e.run.paywall?.operation?.operationId].filter(r=>!!r)))),I(t),C(_(t,"run"))}function Me(){return{async read(){let{entry:e}=await h.read();return I(e),structuredClone(e.journal)},async write(e,t){let r=null;return await h.update(o=>{if(I(o),o.operationCommand&&t?.command&&t.command.operation!=="close")throw new l("PURCHASE_PENDING","Recover the original Operation command before dispatching a Run mutation");return r=null,o.journal.revision!==e?o:(r=e+1,{...o,journal:{revision:r,entry:t}})}),r}}}async function V(e,t=!1,r=new Set){I(e);let o=b(e);for(let i of o){if(i.terminal)continue;let c=r.has(i.operationId)?S.get(i.operationId):void 0;if(c??=await se(e,i),y(),c.operationId!==i.operationId)throw new l("INVALID_RESPONSE","Original Operation changed");if(c.merchantExecution&&c.merchantExecution.customerId!==P)throw new l("SCOPE_MISMATCH","Purchase execution belongs to another Customer");if(t&&!e.operationCommand&&te({quote:c.quote??null,operation:c,requestId:null,pending:!1,destroyed:!1}).type==="cancel"){let f=Z(c)?await J.update({operationId:i.operationId,intent:"cancel"}):await J.attach({operationId:i.operationId,intent:"cancel"});if(c=X.parse(f.operation),y(),c.operationId!==i.operationId)throw new l("INVALID_RESPONSE","Original cancellation Operation changed");c=await se(e,i)}S.set(i.operationId,ne(S.get(i.operationId)??null,c))}let u=await h.update(i=>{I(i);let c=i.operationCommand&&S.get(i.operationCommand.operationId);return{...i,...c&&(c.confirmedAt||c.merchantExecution||!Pe(c))?{operationCommand:void 0}:{},purchases:b(i).map(f=>({...f,terminal:f.terminal??oe(S.get(f.operationId))}))}});return I(u),u}async function G(e){y();let t=await H.request("funnels",e);return y(),t}async function ze(e){try{return await G(e)}catch(t){if(e.operation!=="recover_start"||e.intent!=="start"||!(t instanceof l)||t.status!==400||t.code!=="INVALID_REQUEST")throw t;return G({...e,intent:"resume"})}}async function Be(){let e=M(xe,await G({operation:"find_purchase"}));if(e.customerId!==P||e.scope.projectId!==d.scope.projectId||e.scope.environment!==d.scope.environment)throw new l("SCOPE_MISMATCH","Recovery Customer or environment changed");if(e.outcome!=="found")return e.outcome;let{target:t,purchase:r}=e;return await h.update(o=>o&&!A(o)?o:{schemaVersion:1,baseUrl:h.baseUrl,scope:d.scope,customerId:P,sessionId:z,start:{operation:"start",requestId:t.startRequestId,funnelId:t.funnelId,...e.start},allowed:[...d.executionPolicy.allowed],run:{id:t.runId,versionId:t.versionId,status:t.status,revision:0,runExpiresAt:t.runExpiresAt},purchases:[{...r,terminal:null}],journal:{revision:0,entry:null}}),"found"}let K;function ie(e){let t=K;if(t&&(!t.outcome||e&&t.outcome==="none"&&Date.now()-t.at<Ke))return t.job;let r={at:Date.now(),job:Be().then(o=>(r.outcome=o,r.at=Date.now(),o),o=>{throw K===r&&(K=void 0),o})};return K=r,r.job}async function se(e,t,r="recover_purchase"){let o=M(Ue,await G({operation:r,runId:e.run.id,funnelId:e.start.funnelId,purchase:{receiptId:t.receiptId,operationId:t.operationId}}));if(ue(e,o),o.purchase.receiptId!==t.receiptId||o.purchase.operation?.operationId!==t.operationId)throw new l("INVALID_RESPONSE","Original purchase reference changed");return ae(o.purchase),S.get(t.operationId)}async function Ie(e){for(let t of[e.journal.entry?.command,e.journal.entry?.closeCommand]){if(!t)continue;let r=M(Te,await G({operation:"settle_command",runId:e.run.id,funnelId:e.start.funnelId,requestId:t.requestId,...t.operation==="resume"?{}:{command:t}}));if(ue(e,r),r.settlement.requestId!==t.requestId)throw new l("INVALID_RESPONSE","Original command settlement changed");r.purchase&&ae(r.purchase);let o=await h.update(u=>{I(u);let i=b(u),{receiptId:c,operationId:f}=r.settlement;if(c&&f){let N=i.find(w=>w.operationId===f);if(N&&N.receiptId!==c)throw new l("INVALID_RESPONSE","Original Receipt changed");N||i.push({receiptId:c,operationId:f,terminal:oe(S.get(f))})}let p=r.settlement.state==="settled"?qe(u.journal.entry,t.requestId):u.journal.entry;return{...u,purchases:i,journal:p===u.journal.entry?u.journal:{revision:u.journal.revision+1,entry:p}}});I(o),e=o}return e}function ue(e,t){if(t.customerId!==P||t.scope.projectId!==d.scope.projectId||t.scope.environment!==d.scope.environment||t.target.funnelId!==e.start.funnelId||t.target.startRequestId!==e.start.requestId||e.run&&(t.target.runId!==e.run.id||t.target.versionId!==e.run.versionId))throw new l("SCOPE_MISMATCH","The original recovery binding changed")}async function ce(e,t){if(I(e),e.run&&(e=await Ie(e)),!b(e).length&&A(e))return C(_(e,"operation"));if(!b(e).length)return C({mode:"blocked",status:"blocked",actions:["refresh"],purchases:[],error:L(t)});R=!0;let r=await V(e);return C(_(r,"operation"))}async function $(e,t=!1,r=!0){if(E=e.start.requestId,O=structuredClone({requestId:e.start.requestId,funnelId:e.start.funnelId,locale:e.start.locale,parameters:e.start.parameters}),!s){let o=e.run?{operation:"recover_run",runId:e.run.id,funnelId:e.start.funnelId}:{operation:"recover_start",intent:t?"start":"lookup",start:{requestId:e.start.requestId,funnelId:e.start.funnelId,locale:e.start.locale,parameters:e.start.parameters}},u;try{u=await ze(o)}catch(p){if(!e.run&&p instanceof l&&(p.status===void 0||p.status>=500))return C({mode:"blocked",status:"blocked",actions:["refresh","retry"],purchases:k.purchases,error:L(p)});throw p}let i=M(je,u);if(i.customerId!==P||i.scope.projectId!==d.scope.projectId||i.scope.environment!==d.scope.environment)throw new l("SCOPE_MISMATCH","Recovery Customer or environment changed");if(i.outcome==="unknown")return C({mode:"blocked",status:"blocked",actions:["refresh","retry"],purchases:k.purchases,error:{code:"RESULT_UNKNOWN",message:"The original Start outcome remains unknown; retry only its original input"}});ue(e,i);let c=await h.update(p=>(I(p),{...p,run:{id:i.target.runId,versionId:i.target.versionId,status:i.target.status,revision:i.view?.revision??p.run?.revision??0,runExpiresAt:i.target.runExpiresAt}}));if(I(c),e=c,i.access.type==="operation_only")return ce(e,new l("RUN_RECONCILIATION_REQUIRED","Only the original command and Operation can be recovered"));e=await Ie(e);let f=i.view;if(f.locale!==e.start.locale||!Ae(f.parameters,e.start.parameters))throw new l("INVALID_RESPONSE","The original Start input changed");s=Ne({...d,customerRun:{runId:i.target.runId,customerId:P,startRequestId:e.start.requestId},funnelId:e.start.funnelId,funnelExecutionPolicy:{allowed:e.allowed.filter(p=>d.executionPolicy.allowed.includes(p))},funnelCommandStorage:Me(),onAcceptedResponse:Ge},{scope:i.scope,run:f})}try{await s.get(),s.view?.pendingRequest?.requestId===e.start.requestId&&!s.pendingCommands?.length&&await s.resume(s.view.pendingRequest.requestId);for(let u of s.pendingCommands??[])u.operation!=="close"&&await s.settle?.(u.requestId);s.pendingCommands?.length&&await s.retry(),y();let o=(await h.read()).entry;return I(o),C(_(o,"run"))}catch(o){if(y(),r&&o instanceof l&&(o.status===401||o.status===409&&o.reason==="STATE_CHANGED")){s.reset(),s=null;let u=(await h.read()).entry;return I(u),$(u,!1,!1)}throw o}}function q(e,t="read",r){if(y(),F)return t==="read"||t===B?F:F.then(()=>q(e,t,r),()=>q(e,t,r));clearTimeout(Q);let o=e().catch(u=>{throw!v&&!r?.(u)&&C({mode:"blocked",status:"blocked",actions:["refresh"],purchases:k.purchases,error:L(u)}),u});return F=o,B=t,o.then(()=>{F===o&&(F=void 0,B=void 0)},()=>{F===o&&(F=void 0,B=void 0)}),o}function U(){return q(async()=>{let{entry:e}=await h.read();if(!e||A(e)){if(await ie(!1)==="blocked")return we();({entry:e}=await h.read())}return e?(E&&e.start.requestId!==E&&(s?.reset(),s=null,S.clear(),T.clear(),R=!1),R&&E===e.start.requestId?ce(e,k.error):$(e)):C({mode:"idle",status:"idle",actions:["start"],purchases:[]})})}function we(){return C({mode:"blocked",status:"blocked",actions:["refresh"],purchases:[],error:L(new l("PURCHASE_PENDING","Check the outstanding purchases before starting another"))})}async function ye(){let e=await U();return e.mode==="operation"&&!e.actions.includes("confirm")&&!e.actions.includes("retry")?e:q(async()=>{let t=(await h.read()).entry;if(I(t),!R){if(!s?.view?.paywall?.quote)throw new l("PURCHASE_PENDING","Read the original quote before confirming");let p=s.view.paywall.operation;if(p?.confirmedAt||p?.merchantExecution||p&&!(Z(p)?["prepared","quoted"].includes(p.status):p.status==="pending"))return C(_(t,"run"));if(s.pendingCommands?.length)await s.retry();else{let w=s.view;await s.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:w.nodeId,visit:w.visit,revision:w.revision,input:{type:"paywall_confirm",operationId:w.paywall.quote.operationId,...w.paywall.quote.merchantTerms?{merchantConfirmation:de(w.paywall.quote.merchantTerms)}:{}}})}let N=(await h.read()).entry;return I(N),C(_(N,"run"))}let r=t.operationCommand?.operationId??k.confirmation?.operationId,o=r&&S.get(r);if(!r||!o||t.journal.entry?.command||t.journal.entry?.closeCommand)throw new l("PURCHASE_PENDING","The original Run command must be settled before Operation confirmation");ee({allowed:t.allowed.filter(p=>d.executionPolicy.allowed.includes(p))},o.quote),await h.update(p=>{if(I(p),p.journal.entry?.command||p.journal.entry?.closeCommand||p.operationCommand&&p.operationCommand.operationId!==r)throw new l("PURCHASE_PENDING","Another original command is pending");return{...p,operationCommand:{operationId:r,intent:"confirm"}}});let u={operationId:r,intent:"confirm",...o.quote?.merchantTerms?{merchantConfirmation:de(o.quote.merchantTerms)}:{}},i=Z(o)?await J.update(u):await J.attach(u),c=X.parse(i.operation);if(y(),i.operation.operationId!==r)throw new l("INVALID_RESPONSE","Original confirmation Operation changed");S.set(r,ne(o,c));let f=(await h.read()).entry;return I(f),C(_(await V(f,!1,new Set([r])),"operation"))},"confirm")}async function ge(){y();let{entry:e}=await h.read();return e?A(e)?"finished":"pending":"none"}return{get controller(){return s},get recovery(){return structuredClone(k)},get attempt(){return y(),structuredClone(O)},get identitySignal(){return fe.signal},get customerId(){return P},retained:ge,async findPurchase(){let e=await ge();if(e==="pending")return e;let t=await ie(!0);return y(),t==="none"?e:t},async readPaywall(e){y();let t=Se(e),[r,{readPaywallContent:o},{validateResourceCheck:u}]=await Promise.all([Ce(H.request,"resolvePaywall"),import("./paywall-content-SML4CL2Q.js"),import("./check-response-MCT5RGOM.js")]);y();let i=r.request.parse({selector:t.paywallVersionId?{type:"version",versionId:t.paywallVersionId}:{type:"paywall",paywallId:t.paywallId},commerce:t.commerce,locale:t.locale}),c=await ve(H.request,r,i);u(i,c.paywall.check,c.scope);let f=await o(d,c.paywall);if(y(),t.paywallVersionId?f.id!==t.paywallVersionId:f.paywallId!==t.paywallId)throw new l("INVALID_RESPONSE","The requested Paywall changed");return f},start(e){let t=x.parse({...structuredClone(e),operation:"start",requestId:e.requestId??crypto.randomUUID()});if(t.operation!=="start"||t.customer||t.customerData)throw new l("INVALID_REQUEST","A Customer-owned Funnel start is required");return q(async()=>{let r=(await h.read()).entry;if((!r||A(r))&&await ie(!0)==="blocked")return we();let o=await h.update(u=>{if(u&&!A(u)){if(u.start.funnelId!==t.funnelId)throw new l("PURCHASE_PENDING","Recover the original Funnel before starting another purchase");return u}return{schemaVersion:1,baseUrl:h.baseUrl,scope:d.scope,customerId:P,sessionId:z,start:t,allowed:[...d.executionPolicy.allowed],purchases:[],journal:{revision:0,entry:null}}});if(!o)throw new l("PURCHASE_STORAGE_INVALID","Original start was not retained");return E!==o.start.requestId&&(s?.reset(),s=null,S.clear(),T.clear(),R=!1),R?ce(o,k.error):$(o,!0)},`start:${t.funnelId}`)},refresh:U,confirm:ye,retry:()=>R?ye():q(async()=>{let{entry:e}=await h.read();return e?$(e,!0):C({mode:"idle",status:"idle",actions:["start"],purchases:[]})},"retry"),async close(){return s?.view?q(async()=>{if(!s?.view)throw new l("PURCHASE_PENDING","Recover the original Run before closing");if(s.pendingCommands?.find(r=>r.operation==="close"))await s.retry();else if(["running","waiting"].includes(s.view.status)){let r=s.view;await s.submit({operation:"close",requestId:crypto.randomUUID(),nodeId:r.nodeId,visit:r.visit,revision:r.revision})}let t=(await h.read()).entry;return I(t),C(_(t,"run"))},"close"):U()},async continueCheckout(e,t){let r=t?await q(async()=>{let{entry:o}=await h.read();if(I(o),!o.run||!b(o).some(i=>i.operationId===t&&!i.terminal))throw new l("PURCHASE_PENDING","The original Checkout changed");let u=await V(o);return C(_(u,R?"operation":"run"))},`continue:${t}`,o=>o instanceof l&&o.code==="PURCHASE_PENDING"):await U();y(),await e($e(r,t))},async terminateCheckout(e){let t=await U();if(!t.purchases.find(o=>o.type==="checkout"&&o.operationId===e)||!t.actions.includes("continue_checkout"))throw new l("PURCHASE_PENDING","The original Checkout has changed");return q(async()=>{let{entry:o}=await h.read();I(o);let u=b(o).find(c=>c.operationId===e&&!c.terminal);if(!u||!o.run)throw new l("PURCHASE_PENDING","The original Checkout has changed");await se(o,u,"terminate_checkout");let i=await V(o,!1,new Set([e]));return C(_(i,R?"operation":"run"))},`terminate:${e}`,o=>o instanceof l&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(o.code))},subscribe(e){return Y.add(e),()=>{Y.delete(e)}},destroy:he}}export{He as a,$e as b,kt as c};
|
package/dist/chunk-TM72XBM5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as n,r as t}from"./chunk-3TSFGU4T.js";function u(o,e,a){return n(o,e,a,t)}export{u as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as ne}from"./chunk-CGJZIDG3.js";import{b as J}from"./chunk-IXXVMGMF.js";import"./chunk-N3PZMMOO.js";import"./chunk-2LEDTNKQ.js";import{a as j}from"./chunk-7GU34JD4.js";import{b as ee}from"./chunk-MVUNV5XR.js";import"./chunk-TIUD3N72.js";import"./chunk-W32FI2A2.js";import{f as te,h as re,i as B,j as Y}from"./chunk-2G23BYBI.js";import"./chunk-3ITNAFAH.js";import"./chunk-2I2S5ZIH.js";import"./chunk-3TSFGU4T.js";import"./chunk-W3B4GT74.js";import"./chunk-Y2ASROJH.js";import"./chunk-US65SQX4.js";import"./chunk-HYCLLEFU.js";import"./chunk-KSME3N3A.js";import"./chunk-LE32WTZ7.js";import"./chunk-SZZIYCXK.js";import"./chunk-IDDPWGQE.js";import"./chunk-LSHIR6QM.js";import"./chunk-OPUIFAQS.js";import"./chunk-HYX3EDZS.js";import"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-FN462OVO.js";import"./chunk-FRRKTQNZ.js";import"./chunk-MQ5LJEWV.js";import"./chunk-JDIFYMSA.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import{a as O}from"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-SLUA7ABW.js";import"./chunk-GJSQZGBE.js";import"./chunk-3VUPVXAV.js";import"./chunk-B4SM2KRI.js";import"./chunk-XVCSRZX4.js";import{a as w}from"./chunk-DSPLGTQI.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";function ae(I,e){let i=I.ownerDocument,p=(e.locale??i.documentElement.lang).startsWith("zh"),q=re(i),P=e.retained?.dialog??i.createElement("dialog"),x=i.createElement("section"),h=i.createElement("h2"),d=i.createElement("p"),f=i.createElement("button"),v=i.createElement("button"),t=i.createElement("button");h.textContent=e.retained?.dialog.getAttribute("aria-label")||(p?"购买状态":e.retained?"Purchase status":"Your purchase"),h.style.cssText="margin:0;font-size:20px;line-height:1.3",P.setAttribute("aria-label",h.textContent),e.retained||(P.style.cssText="box-sizing:border-box;width:min(640px,calc(100% - 32px));max-height:calc(100dvh - 32px);border:0;border-radius:16px;background:Canvas;color:CanvasText;padding:0"),x.style.cssText="padding:24px 56px 24px 24px;font:14px/1.5 system-ui,sans-serif",f.textContent="×",f.setAttribute("aria-label",p?"关闭":"Close"),te(f,{background:"Canvas",text:"CanvasText"}),d.setAttribute("role","status"),t.textContent=p?"查询状态":"Check status";for(let o of[f,v,t])o.type="button";for(let o of[v,t])o.style.cssText="min-height:44px;padding:8px 14px;margin-inline-end:8px;border:1px solid ButtonBorder;border-radius:8px;font:inherit;cursor:pointer";x.append(h,f,d,v,t),P.append(x);let s=!1,y=!1,m=e.checking===!0,C=!1,g=e.initialState;function D(o){if(s)return;g=o;let n=g.actions.includes("continue_checkout"),F=e.allowConfirm&&g.actions.includes("confirm");v.hidden=m||!n&&!F,v.disabled=t.disabled=y||m,v.textContent=n?p?"继续付款":"Continue checkout":p?"确认购买":"Confirm purchase",d.textContent=m?p?"正在核对购买状态…":"Checking your purchase…":C||g.status==="blocked"?p?"暂时无法确认购买状态。请重试。":"We couldn’t check your purchase. Try again.":g.status==="complete"?p?"购买已处理。":"Your purchase has been processed.":n?p?"可以继续原订单付款。":"You can continue your original checkout.":p?"正在核对购买状态…":"Checking your purchase…"}async function A(o){if(!(s||y)){y=!0,C=!1,D(g);try{await o()}catch(n){s||(C=!0,w(e.onError,n))}finally{y=!1,D(e.client.recovery)}}}let T=()=>A(e.refresh),N=e.client.subscribe(D);function k(){s||(s=!0,e.signal.removeEventListener("abort",k),i.removeEventListener("visibilitychange",L),N(),e.retained?e.retained.release():(P.remove(),q()),e.onDismiss())}function L(){i.visibilityState==="visible"&&T()}f.onclick=k,P.addEventListener("cancel",o=>{o.preventDefault(),k()}),t.onclick=()=>{T()},v.onclick=()=>{A(async()=>{g.actions.includes("continue_checkout")?await e.client.continueCheckout(o=>{if(e.signal.throwIfAborted(),!s)return e.onCheckoutUrl?e.onCheckoutUrl(o):i.defaultView?.location.assign(o)}):e.allowConfirm&&g.actions.includes("confirm")&&await e.client.confirm()})},e.signal.addEventListener("abort",k,{once:!0}),i.addEventListener("visibilitychange",L),D(g);function S(){s||e.signal.aborted||(e.retained||(I.append(P),P.showModal?P.showModal():P.open=!0),f.focus({preventScroll:!0}))}return e.loading?.active?e.loading.present(S):S(),{destroy:k,refresh:T,update(o){m=!1,D(o)},get recovery(){let o=g.purchases.filter(n=>!["native","complete"].includes(n.type));return structuredClone(o.length===1?o[0]:{type:"recover",operationId:null,requestId:null})},async prepareFallback(){return{type:"recover",operationId:null,requestId:null}},async review(){},async exitReview(){},get unappliedDrafts(){return new Map}}}var M=new WeakMap,W=new WeakMap,K=new WeakSet;function be(I,e){let i=e.prepared,p=()=>{i&&!K.has(i)&&J(i)?.release()},q=M.get(e.client);if(q)return p(),q;let P=t=>({...t,requestId:t.requestId??crypto.randomUUID()}),x=e.allowNewPurchase!==!1&&e.start instanceof Promise?e.start:void 0,h=e.allowNewPurchase===!1||!e.start||e.start instanceof Promise?void 0:P(e.start);h&&i?.state==="ready"&&i.matches(h)&&i.open();let d=i&&(h&&(i.state==="preparing"||["shown","closed"].includes(i.state)&&i.matches(h))||x&&["preparing","ready"].includes(i.state))?i:void 0;d?K.add(d):p();let f=d&&J(d);f?.claim();let v=Promise.resolve().then(async()=>{let t=!1,s,y,m=0,C,g,D=!1,A=()=>{},T=()=>{},N,k=!1,L=!1,S,o=!1,n=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,F=()=>{M.get(e.client)===v&&M.delete(e.client),n.removeEventListener("abort",G),A(),T(),d&&K.delete(d),f?.release()};function Q(){if(S)return S;let r=new Promise(c=>S=c);return W.set(e.client,r),r.then(()=>{W.get(e.client)===r&&W.delete(e.client)}),M.get(e.client)===v&&M.delete(e.client),S}let u=Y(I,e,"funnel",()=>U(),j);function G(){U()}function U(r=!1){if(!t){if(t=!0,u.finish("dismissed"),s){s.destroy();return}if(r&&N){let c=Q();o=!0,N.then(async l=>{l.mode==="run"&&l.status!=="blocked"&&e.client.controller&&e.client.attempt?.requestId===h?.requestId&&await e.client.close()}).catch(()=>{}).finally(()=>{c(),w(e.onDismiss,null)}),F();return}F(),w(e.onDismiss,null)}}let z={destroy:()=>U(),refresh:()=>s?.refresh()??C??Promise.resolve(),get recovery(){return s?.recovery??{type:"recover",operationId:null,requestId:null}},prepareFallback:()=>s?.prepareFallback()??Promise.resolve({type:"recover",operationId:null,requestId:null}),review:(...r)=>s?.review(...r)??Promise.resolve(),exitReview:(...r)=>s?.exitReview(...r)??Promise.resolve(),get unappliedDrafts(){return s?.unappliedDrafts??new Map}};n.addEventListener("abort",G,{once:!0}),f&&(T=f.onClose(()=>{k?t||Q():U(!0)}));try{n.throwIfAborted();let r=e.client.controller?.view?.paywall?.resolution,c=r&&"document"in r?r.document:e.loadingDocument;u.start(!0,h?.locale??e.client.attempt?.locale??c?.screen.strings.defaultLocale,c??null);let l=x?u.wait(x.then(E=>E?P(E):null,()=>null),B):Promise.resolve(h??null);l.catch(()=>{}),d?.state==="shown"?(L=!0,u.present(()=>{})):d&&["preparing","ready"].includes(d.state)&&Promise.all([d.ready,l.catch(()=>null)]).then(([E,a])=>{if(E){if(t||!u.active||!a||!d.matches(a)||!f?.revealable)return f?.release();u.present(()=>{d.open()==="shown"?L=!0:f.release()})}});let R=W.get(e.client);if(R&&await u.wait(R),t)return null;if(n.throwIfAborted(),x){let E=await l;if(t)return null;if(n.throwIfAborted(),!E)return u.finish("skipped"),F(),null;h=E}N=h?e.client.start(h):e.client.refresh();let H=await u.wait(N,B);return t?null:(n.throwIfAborted(),await V(H,u))}catch(r){if(o||S?.(),t)return null;throw u.finish("error",r),F(),w(e.onError,r),r}function X(r=!1){m++;let c=s;s=void 0,y=void 0,A(),A=()=>{};let l=r?c?.retainPurchaseDialog?.():void 0;return c?.destroy(),n.addEventListener("abort",G,{once:!0}),l}function Z(r,c,l=!1){if(t||n.aborted){c?.release();return}let R=++m;s=y=ae(I,{client:e.client,signal:n,loading:u,retained:c,checking:l,locale:e.client.attempt?.locale,onCheckoutUrl:e.onCheckoutUrl,onError:e.onError,refresh:$,initialState:r,allowConfirm:e.allowNewPurchase!==!1,onDismiss(){R===m&&(t=!0,F(),w(e.onDismiss,null))}})}function $(){if(C)return C;if(t||n.aborted)return Promise.resolve();if(!y){let l=X(!0)??f?.retainPurchaseDialog?.();l?Z(e.client.recovery,l,!0):(u=Y(I,e,"funnel",()=>U(),j),u.start(!0,e.client.attempt?.locale))}let r=Promise.resolve().then(async()=>{try{let l=await e.client.refresh();!t&&!n.aborted&&await V(l,u)}catch(l){!t&&!n.aborted&&(w(e.onError,l),await V({...e.client.recovery,mode:"blocked",status:"blocked"},u))}});C=r;let c=()=>{C===r&&(C=void 0)};return r.then(c,c),r}async function V(r,c){let l=e.client.controller;return r.mode==="run"&&r.status!=="blocked"&&l?(y&&X(),ie(l,c?.active?c:void 0)):r.purchases.length||r.status==="blocked"&&k?(y?y.update(r):Z(r,f?.retainPurchaseDialog?.()??u.retainPurchaseDialog()),z):y?(U(),null):(u.finish("skipped"),F(),(L||k)&&(t=!0,w(e.onDismiss,null)),null)}async function ie(r,c){n.removeEventListener("abort",G),k=!0;function l(){!t&&!n.aborted&&!D&&g&&e.client.recovery.status==="complete"&&(D=!0,w(e.onComplete,structuredClone(g)))}function R(a){if(n.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");return e.onCheckoutUrl?e.onCheckoutUrl(a):I.ownerDocument.defaultView?.location.assign(a)}A(),A=e.client.subscribe(l);let H=++m,E=await ne(I,{...e,prepared:d,client:r,signal:n,checkoutNavigation:"after_confirmation",resumeCheckout:a=>e.client.continueCheckout(R,a),terminateCheckout:e.allowNewPurchase===!1?void 0:a=>e.client.terminateCheckout(a),async onCheckoutUrl(a){if(n.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");let b=e.client.recovery;if((!b.actions.includes("continue_checkout")||!b.purchases.some(_=>_.type==="checkout"&&_.checkoutUrl===a))&&(b=await e.client.refresh(),n.throwIfAborted(),t))throw new DOMException("Presentation dismissed","AbortError");if(ee(b)!==a)throw new O("PURCHASE_PENDING","Checkout differs from the original recovery proof");return R(a)},async resolveOfferId(a){if(n.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");let b=e.client.attempt;if(!b)throw new O("PURCHASE_PENDING","Read the original Start before selecting an offer");let _=await e.resolveOfferId?.(a,b);if(n.throwIfAborted(),t)throw new DOMException("Presentation dismissed","AbortError");if(e.client.attempt?.requestId!==b.requestId)throw new O("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting an offer");return _},async resolveSubscriptionChange(a){n.throwIfAborted();let b=e.client.attempt;if(t||!b)throw new O("PURCHASE_PENDING","Read the original Start before selecting a membership");let _=await e.resolveSubscriptionChange?.(a);if(n.throwIfAborted(),t||e.client.attempt?.requestId!==b.requestId)throw new O("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting a membership");return _},onPresentationState(a){H===m&&w(e.onPresentationState,a)},onComplete(a){H===m&&(g=a,l())},onError(a){H===m&&(w(e.onError,a),a instanceof O&&(a.status===401||a.status===409&&a.reason==="STATE_CHANGED"&&a.recovery==="recover_operation")&&!n.aborted&&$().catch(b=>w(e.onError,b)))},onDismiss(a){H===m&&(t=!0,F(),S?.(),w(e.onDismiss,a))}},c);return H!==m||t||n.aborted?(E.destroy(),t||n.aborted?null:z):(s=E,z)}});return M.set(e.client,v),v}export{be as showFunnelPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-IXXVMGMF.js";import"./chunk-N3PZMMOO.js";import"./chunk-2LEDTNKQ.js";import"./chunk-SZZIYCXK.js";import"./chunk-IDDPWGQE.js";import"./chunk-OPUIFAQS.js";import"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-FRRKTQNZ.js";import"./chunk-JDIFYMSA.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-XVCSRZX4.js";import"./chunk-DSPLGTQI.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-N3PZMMOO.js";import"./chunk-2LEDTNKQ.js";import"./chunk-SZZIYCXK.js";import"./chunk-IDDPWGQE.js";import"./chunk-VILB5M4X.js";import"./chunk-PF6PRPRO.js";import"./chunk-XVCSRZX4.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.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-2LEDTNKQ.js";import"./chunk-SZZIYCXK.js";import"./chunk-IDDPWGQE.js";import"./chunk-VILB5M4X.js";import"./chunk-PF6PRPRO.js";import"./chunk-XVCSRZX4.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.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-CGJZIDG3.js";import"./chunk-IXXVMGMF.js";import"./chunk-N3PZMMOO.js";import"./chunk-2LEDTNKQ.js";import"./chunk-7GU34JD4.js";import"./chunk-TIUD3N72.js";import"./chunk-W32FI2A2.js";import"./chunk-2G23BYBI.js";import"./chunk-W3B4GT74.js";import"./chunk-LE32WTZ7.js";import"./chunk-SZZIYCXK.js";import"./chunk-IDDPWGQE.js";import"./chunk-LSHIR6QM.js";import"./chunk-OPUIFAQS.js";import"./chunk-HYX3EDZS.js";import"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-FN462OVO.js";import"./chunk-FRRKTQNZ.js";import"./chunk-MQ5LJEWV.js";import"./chunk-JDIFYMSA.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-SLUA7ABW.js";import"./chunk-GJSQZGBE.js";import"./chunk-B4SM2KRI.js";import"./chunk-XVCSRZX4.js";import"./chunk-DSPLGTQI.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.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-YFLVGOCJ.js";import"./chunk-FRRKTQNZ.js";import"./chunk-KCN6OGYG.js";import"./chunk-FYD7CMS7.js";import"./chunk-XVCSRZX4.js";import"./chunk-WPFTSHP2.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-VKFLQEW4.js";import"./chunk-HP6OV6WF.js";import"./chunk-TIOPNTMP.js";import"./chunk-HYCLLEFU.js";import"./chunk-KSME3N3A.js";import"./chunk-LE32WTZ7.js";import"./chunk-IDDPWGQE.js";import"./chunk-HYX3EDZS.js";import"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-IVXYLNAF.js";import"./chunk-FRRKTQNZ.js";import"./chunk-MQ5LJEWV.js";import"./chunk-JDIFYMSA.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import"./chunk-FYD7CMS7.js";import"./chunk-XVCSRZX4.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
|
package/dist/paywall-DKTGQZDJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Ft,c as qt,d as pt,f as mt,g as Gt,k as Wt}from"./chunk-7GU34JD4.js";import{b as dt}from"./chunk-W32FI2A2.js";import{d as Vt,e as $t,f as Qt,h as ft,i as qe,j as Ht,k as jt,l as Bt}from"./chunk-2G23BYBI.js";import{a as Lt,c as ct,d as Nt,e as _t}from"./chunk-LSHIR6QM.js";import{a as Fe,b as we,d as ut,f as Mt,j as Ut}from"./chunk-OPUIFAQS.js";import{b as de}from"./chunk-HYX3EDZS.js";import{B as S,C as Be,D as Re,E as Oe,y as Dt}from"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-FN462OVO.js";import"./chunk-FRRKTQNZ.js";import{r as Pe,t as ye}from"./chunk-MQ5LJEWV.js";import{i as St}from"./chunk-JDIFYMSA.js";import{c as ue,j as Ae}from"./chunk-TNPBYYAX.js";import{c as lt}from"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import{a as v}from"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-B4SM2KRI.js";import"./chunk-XVCSRZX4.js";import{a as G}from"./chunk-DSPLGTQI.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";async function zt(_,r,x){if(!Re(r))throw new v("INVALID_RESPONSE","A verified completed purchase is required");let k=_?Ae.parse(_):null;if(await x.onComplete?.(r),!k||!x.check)return;let Q=Ae.parse(await x.check());if(Q.internal_feature_id!==k.internal_feature_id||Q.quantity!==k.quantity||k.observation!==void 0&&(Q.observation===void 0||Q.observation.requirementDigest!==k.observation.requirementDigest||Q.observation.authority!==k.observation.authority||lt(Q.observation.subject)!==lt(k.observation.subject)))throw new v("INVALID_RESPONSE","The access requirement changed");Q.allowed&&await x.onAccessGranted?.(Q)}function ht(_){return Object.entries(_.document.buttons).filter(([,r])=>r.type==="checkout"&&r.product.type==="fixed"&&!de(r.product,{},_.capabilities)).map(([r])=>r)}function Yt(_,r){let x=S(r)?void 0:r.lines[0];if(!S(r)&&(r.lines.length!==1||!x))return;let k=S(r)?r.productVersionId:x.productVersionId,{screen:Q,buttons:X}=_.document,R=new Map(S(r)?Object.entries(r.featureQuantities??{}):(x?.prepaid??[]).map(h=>[h.internal_feature_id,h.quantity]));function Z(h,m){if(h.hidden)return!1;if(h.type==="plan_picker"&&_.capabilities.pickers[h.id]?.options.includes(k))return m[h.id]=k,!0;if(h.type==="quantity_picker"){let Y=R.get(h.internalFeatureId);return Y!==void 0&&(!h.bind?.plan||h.bind.plan===k)&&(m[h.id]=Y),!1}if(h.type==="button"&&h.action){let Y=X[h.action];return Y?.type==="checkout"&&Y.product.type==="fixed"&&Y.product.productVersionId===k}if(h.type!=="stack")return!1;let z=h.interaction,i=h.bind?.plan===k;for(let[Y,f]of h.children.entries()){let ie={},L=Z(f,ie);if(z?.type==="toggle"||z?.type==="tabs"){if(!L)continue;return m[h.id]=z.type==="toggle"?Y===0:f.id,Object.assign(m,ie),!0}Object.assign(m,ie),L&&(i=!0,z?.type==="select"&&z.purpose==="product"&&z.pickerId&&f.type==="stack"&&f.bind?.plan===k&&(m[h.id]=f.id,m[z.pickerId]=k))}return i}for(let h of Q.pages){let m={__page:h.id};if(Z(h.root,m))return m}}async function Un(_,r,x){let k=r.focusAtReveal?()=>{}:ft(_.ownerDocument),Q=()=>{R.finish("dismissed"),k()},X=()=>Q(),R=Ht(_,r,"paywall",()=>{Q(),G(r.onDismiss)},Ft);r.signal?.throwIfAborted(),r.signal?.addEventListener("abort",X,{once:!0});let Z=null,h,m,z;try{if(R.start(!0,r.loadingDocument?.screen.strings.defaultLocale,r.loadingDocument??null),R.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(Z=r.check?Ae.parse(await R.wait(r.check(),qe)):null,Z?.allowed)return R.finish("skipped"),r.signal?.removeEventListener("abort",X),k(),await r.onAccessGranted?.(Z),{check:Z,host:null};let[e,n]=await Promise.allSettled([R.wait(import("./screen-renderer-HW2WXDTR.js")),R.wait(r.start().then(a=>(R.cancelled&&a.destroy(),a)),qe)]);if(e.status==="rejected")throw n.status==="fulfilled"&&n.value.destroy(),e.reason;if(n.status==="rejected")throw n.reason;z=e.value,h=n.value,r.signal?.throwIfAborted(),h.signal?.throwIfAborted(),h.signal?.addEventListener("abort",X,{once:!0});let t=h.view??await R.wait(h.refresh(),qe);if(!t)throw new v("INVALID_RESPONSE","Paywall presentation is missing");h.signal?.throwIfAborted(),m=t}catch(e){throw R.finish("error",e),r.signal?.removeEventListener("abort",X),h?.signal?.removeEventListener("abort",X),h?.destroy(),k(),e}let i=h,{mountScreenPreview:Y}=z,f=_.ownerDocument,ie=new AbortController,L=f.createElement("section"),ae=f.createElement("div"),J=f.createElement("div"),Ge=r.mountControls,W=Ge?f.createElement("div"):void 0,p=f.createElement("p"),C=f.createElement("button"),I=f.createElement("button"),E=f.createElement("dialog"),We=i.locale||m.document.screen.strings.defaultLocale,o=We.toLowerCase().startsWith("zh"),Jt=o?"正在处理…":"Processing…",Kt=o?"正在准备报价…":"Preparing your price…",M=qt(m.document.screen.theme);L.dataset.indianaPaywall="",L.setAttribute("aria-label",m.document.name),L.style.cssText=M.root,J.style.cssText=M.controls,p.style.cssText=M.message,p.setAttribute("role","status"),I.style.cssText=M.link,I.textContent=o?"关闭":"Close",C.style.cssText=M.secondary,C.textContent=o?"重试":"Retry",C.hidden=!0,J.append(p,C,I),W&&(W.style.cssText="flex:1 0 100%;min-width:0",W.hidden=!0,J.prepend(W)),L.append(ae,J);let ze=()=>{if(W){let a=!W.childElementCount&&!W.textContent?.trim();W.hidden!==a&&(W.hidden=a)}let e=se??J,n=[...e.children].every(a=>a===p?!p.textContent:a.hidden),t=[...e.children].some(a=>a===I?!1:a===p?!!p.textContent:!a.hidden);e.style.cssText=n?M.controls.replace(/padding:[^;]+/,"padding:0"):t?`${M.controls};${M.pinned}`:M.controls,Xe()},yt=typeof MutationObserver>"u"?void 0:new MutationObserver(ze);yt?.observe(L,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Te=m.document.presentation,Xt=Object.entries(m.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),B,wt,Ye=!1,gt=JSON.stringify(m.capabilities),Je=e=>oe&&!Ce?Object.entries(e.document.buttons).filter(([,n])=>n.type==="checkout").map(([n])=>n):ht(e);function Se(e){if(w)return;m=e;let n=JSON.stringify(e.capabilities);if(n!==gt){let t=!b&&!i.quote&&!i.operation?Fe(e,q,Ct):q;JSON.stringify(t)!==JSON.stringify(q)?(q=t,B?.update(e.document.screen,We,{capabilities:we(e),unavailableActions:Je(e),serverInput:{bindings:[],answers:{}},selection:q})):B?.updateCapabilities(we(e),Je(e)),gt=n}en(e),ke()}let O,Ke=0;function Xe(){let e=f.defaultView;if(!O?.responsive||!e)return;let n=se??J,t=e.innerHeight-(O.type==="modal"?32:0);n.style.maxHeight=`${Math.max(1,t)}px`,n.style.overflowY="auto",n.style.flexShrink="0",Ke=Math.max(1,t-n.getBoundingClientRect().height),B?.resizeViewport?.(Ke,e.innerWidth)}let w=!1,oe=!1,b=null,Ze,De=!1,bt=!1,fe=!1,et,tt=!1,ee,se;function Zt(){return oe||w||ee||tt?{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null}:ct(i)}let A=()=>!w&&!De&&!ee&&r.canInteract?.()!==!1,F,ge=!1,be=!1,u=null,te=null,nt="",pe=()=>r.checkoutNavigation==="after_confirmation"&&!!(r.terminateCheckout||r.resumeCheckout),q={},Ct=new Set,Ce,K=null;function ke(){if(!pe()||!B?.updateCheckoutControls)return;let e=i.quote,n=!K&&!!e&&!!i.operation&&T(i.operation).type==="checkout",t=Object.entries(m.document.buttons).flatMap(([a,c])=>c.type==="checkout"?[{actionId:a,policy:c}]:[]);B.updateCheckoutControls({actions:t.map(({actionId:a})=>a),resume:n?t.filter(({actionId:a,policy:c})=>Me(e,m,a,c.product,q)).map(({actionId:a})=>a):[],resumeLabel:o?"继续付款":"Continue checkout",busy:Ce})}function vt(){te?.remove(),te=null}async function rt(){if(K)return;if(r.resumeCheckout&&i.operation){await r.resumeCheckout(i.operation.operationId);return}let e=await i.read();if(T(e).type!=="checkout")return U(e,!1);A()&&(Ne.delete(e.operationId),await Ue(e))}function Pt(){p.textContent=o?"暂时无法打开付款页面。请重试。":"Couldn’t open checkout. Try again.",C.hidden=!0}async function kt(e=!1){let n=K;if(!n)return;C.hidden=!0;let t=Date.now()+2e4;for(;A();){let a=await i.read();if(a.operationId!==n.operationId)throw new v("PURCHASE_PENDING","The original Checkout changed");if(!A())break;let c=T(a);if(c.type==="native"){K=null,vt(),b=n.selection,F=n.coupon,ge=!1,be=!1,await Ie();return}if(c.type==="complete"||c.type==="fulfillment"||c.type==="recording"){K=null,await U(a,!1);return}if(e&&c.type==="checkout"){e=!1;try{await r.terminateCheckout(n.operationId)}catch(y){G(r.onError,y)}}if(Date.now()>=t)break;await dt(1e3,f,ie.signal)}w||Pt()}async function Et(e,n,t,a){if(u=()=>Et(e,n,t,a),await r.beforeCheckoutReplacement?.(structuredClone(a)),!A())return;let c=i.operation;if(c?.operationId!==e||T(c).type!=="checkout"){u=null,c&&await U(c,!1);return}K={operationId:e,selection:n,coupon:t};let y=!1;try{await r.terminateCheckout(e)}catch(l){if(l instanceof v&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(l.code)){K=null,p.textContent=o?"请继续原订单,或等待它过期后再更换方案。":"Continue your original checkout, or wait for it to expire before changing plans.",G(r.onError,l);return}y=l instanceof v&&(l.status??0)>=500,G(r.onError,l)}A()&&await kt(y)}function Le(e,n,t,a,c){let y=we(e).checkoutCoupons?.[n],l=y?y.products[t]:r.claimCoupon&&c?St(e.capabilities,c,a):void 0;return l?.couponId&&l.planVersionId===t?{id:l.couponId,offerId:l.offerId}:void 0}function en(e){oe||b||i.quote||i.operation||nt&&p.textContent===nt||(p.textContent=Object.values(e.capabilities.plans).some(n=>n.available)?"":o?"当前账号暂无可购买的方案。":"No plans are currently available for this account.")}let Ne=new Map,_e=!1;function Me(e,n,t,a,c,y){if(S(e)){let $=de(a,c,n.capabilities),ce=$&&Le(n,t,$,c,y),he=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0),$e=ye(n.document.screen,e.productVersionId,c,n.capabilities);return $===e.productVersionId&&Object.keys($e).length===Object.keys(e.featureQuantities??{}).length&&Object.entries($e).every(([Qe,He])=>e.featureQuantities?.[Qe]===He)&&(!ce||he?.couponId===ce.id&&(!ce.offerId||he.grantId===ce.offerId))}let l=e.lines.length===1?e.lines[0]:void 0,s=de(a,c,n.capabilities);if(!l||!s||l.productVersionId!==s)return!1;let N=Le(n,t,s,c,y);if((N||we(n).checkoutCoupons?.[t])&&(N?.id??null)!==(e.discount?.couponId??null))return!1;let V;try{V=ye(n.document.screen,s,c,n.capabilities)}catch{return!1}let ne=Object.fromEntries((l.prepaid??[]).map($=>[$.internal_feature_id,$.quantity]));return[...new Set([...Object.keys(V),...Object.keys(ne)])].every($=>(V[$]??0)===(ne[$]??0))}let T=e=>Lt({quote:i.quote,operation:e,requestId:null,pending:!1,destroyed:w,canReselect:i.canReselect});async function Ue(e){let n=e.merchantExecution,t=T(e),a=t.type==="checkout"?t.checkoutUrl:e.checkoutUrl;if(!(!A()||!a||Be(e)&&t.type!=="checkout"||r.checkoutNavigation==="after_confirmation"&&t.type!=="checkout"||n?.type==="purchase"&&!["not_started","pending"].includes(n.paymentStatus)||Ne.get(e.operationId)===a)){Ne.set(e.operationId,a);try{r.onCheckoutUrl?await r.onCheckoutUrl(a):f.defaultView?.location.assign(a)}catch(c){throw Ne.delete(e.operationId),c}}}let le=(e,n=!1)=>{if(e instanceof ut)u=null,p.textContent=e.customerMessage(o);else if(Gt(e))u=null,p.textContent=n?o?"当前无法在此购买,付款尚未开始。请联系商户。":"Purchases aren’t available here right now. Payment hasn’t started. Contact the merchant for help.":mt(e,o);else if(n){let t=e instanceof v?e.code:void 0;t==="CAPABILITY_UNAVAILABLE"||t==="NOT_CONFIGURED"?(u=null,p.textContent=o?"暂时无法为此套餐报价,付款尚未开始。":"Pricing for this plan is unavailable. Payment hasn’t started."):i.canReselect===!0&&!b?p.textContent=o?"未能取得报价,付款尚未开始。请重新选择套餐。":"We couldn’t prepare your price. Payment hasn’t started. Choose a plan again.":t==="COMMAND_PENDING"?p.textContent=o?"仍在准备报价,请重试以查看结果。":"Your price is still being prepared. Retry to check the result.":p.textContent=o?"未能取得报价,付款尚未开始。请重试。":"We couldn’t prepare your price. Payment hasn’t started. Try again."}else p.textContent=e instanceof v&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?mt(e,o):e instanceof v?e.message:o?"操作未完成,请重试。":"This action couldn’t be completed. Try again.";C.hidden=u===null,nt=p.textContent,n&&Ce===void 0&&!O?.responsive&&p.scrollIntoView?.({block:"nearest"}),G(n&&x?.quoteError?x.quoteError:r.onError,e)},Ee=new WeakMap;function xe(e){oe=e,C.disabled=e,B?.updateCapabilities?.(we(m),Je(m));for(let n of te?.querySelectorAll("button")??[])e?(Ee.has(n)||Ee.set(n,n.disabled),n.disabled=!0):Ee.has(n)&&(n.disabled=Ee.get(n),Ee.delete(n)),pt(n)}function it(){p.textContent=o?"暂时无法操作,请稍后重试。":"This action is unavailable right now. Try again in a moment."}async function tn(e){if(r.beforeAction)try{await r.beforeAction()}catch(n){throw n instanceof ut?(b=null,ge=!1,be=!1,u=null):u=e,n}}async function j(e,n){if(oe||w)return;if(!A()){it();return}let t=e===Ie,a=t?Kt:Jt,c=pe()&&n!==void 0;Ce=c?n:void 0,xe(!0),ke(),C.hidden=!0,p.textContent=c?"":a;try{if(e!==At&&(e!==rt||!r.resumeCheckout)&&await tn(e),w)return;if(!A()){u=e,C.hidden=!1,it();return}await e()}catch(y){w||le(y,t)}finally{Ce=void 0,xe(!1),ke(),p.textContent===a&&(p.textContent="")}}async function nn(e){await zt(Z,e,r)}function xt(e){return ct(i).type==="recording"||T(e).type==="recording"}function It(e){let n=e.merchantTerms,t=n?.subscriptionTerms?.items??[],a=n?n.totalMinor:S(e)?e.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),c=n?t.length===1&&t[0]?.amountMinor===a&&t[0]:!S(e)&&e.lines.length===1&&e.lines[0]?.catalogAmountMinor===a&&e.lines[0],y=a===null?ue(n.subtotalMinor-n.discountMinor,e.currency)+(o?" + 待确认税费":" + tax confirmed at checkout"):ue(a,e.currency)+(c?Pe(c.interval,o?"zh-CN":"en",c.intervalCount??1):""),l=S(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(s=>s.productName).join(", ");return{label:l?`${l} · ${y}`:y,recurring:c}}async function U(e,n=r.checkoutNavigation!=="after_confirmation"){if(w)return;if(!A()){u=async()=>U(await i.read()),C.hidden=!1;return}if(p.textContent=Wt(e.status,o),xt(e)){let s=e.merchantExecution?.recordingStatus==="failed";p.textContent=s?o?"付款和商户处理已完成,但交易记录失败。请联系商户修复,勿重复购买。":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":o?"付款和商户处理已完成,正在确认交易记录。请勿重复购买。":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",C.textContent=o?"查询记录":"Check recording",u=async()=>U(await i.read()),C.hidden=!1;return}if(e.problem&&T(e).type!=="native"){let s=e.problem;u=ve,C.textContent=o?"检查并恢复原操作":"Check and recover original purchase",le(new v(s.code,s.reason==="RESULT_UNKNOWN"?o?"付款结果尚未确定,请恢复原操作,暂勿重复购买。":"The payment result is unknown. Recover the original purchase before buying again.":s.phase==="fulfillment"?o?"付款已记录,商户权益处理需要核对。":"Payment was recorded. Access fulfillment needs attention.":s.code==="CAPABILITY_UNAVAILABLE"?o?"商户尚不支持本次购买所需的完整能力,请处理后恢复原操作。":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":s.code==="NOT_CONFIGURED"?o?"付款服务连接需要处理,请联系商户后恢复原操作。":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":o?"原购买操作需要处理,请查询或恢复此操作。":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,s));return}if((e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"||e.merchantExecution?.type==="subscription_change"&&e.merchantExecution.status==="applied")&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(p.textContent=o?"付款已记录,正在等待商户完成处理。":"Payment was recorded. Waiting for merchant fulfillment."),Re(e)&&T(e).type==="complete"){u=null,await nn(e);return}if(!Oe(e)&&T(e).type!=="fulfillment"){if(i.canReselect===!1){p.textContent=o?"正在核对原购买结果":"Checking the original purchase result",C.textContent=o?"查询结果":"Check result",u=async()=>U(await i.read()),C.hidden=!1;return}e.status==="cancelled"?p.textContent=o?"这笔购买已取消,可以重新选择方案。":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(p.textContent=o?"这笔购买未能完成,可以重新选择方案。":"This purchase didn’t go through. Choose a plan to try again."),C.textContent=o?"重试":"Retry",u=null,b=null;return}if(!n&&T(e).type==="checkout"){if(K){Pt();return}if(pe()){p.textContent="",_e=!1,u=null,ke();return}let s=i.quote,N=s?.operationId===e.operationId?It(s).label:"";p.textContent=_e?N?o?`${N} 尚未付款。再次选择该方案即可继续付款。`:`${N} is still unpaid. Choose it again to continue paying.`:o?"之前的购买尚未付款。再次选择该方案即可继续付款。":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",_e=!1,u=null;return}await Ue(e);let t=Date.now(),a=t+6e5,c=2e3,y=T(e).type!=="checkout",l=()=>y&&Date.now()-t<15e3;Ye=!0,G(r.onObservationChange,!0);try{for(;!w&&Date.now()<a;){if(await dt(l()?700:c,f,ie.signal),w)return;if(!A()){u=async()=>U(await i.read()),C.hidden=!1;return}let s=await i.read();if(T(s).type==="checkout"&&(y=!1),!n&&T(s).type==="checkout"){await U(s,!1);return}if(!s.problem&&Oe(s)&&await Ue(s),!Oe(s)||s.problem||xt(s)){await U(s);return}l()||(c=Math.min(c*1.5,3e4))}}finally{Ye=!1,G(r.onObservationChange,!1)}u=async()=>U(await i.read()),C.hidden=!1}async function at(e=!1){let n=await i.read();if(w)return;if(!A()){u=()=>at(e),C.hidden=!1;return}let t=i.quote;if(t&&Mt(n,{operationId:t.operationId,currency:t.currency},"The original purchase operation changed"),t&&(Be(n)?["prepared","quoted"].includes(n.status):n.status==="pending")&&(Be(n)||n.quoteFinalized===!1)&&!n.confirmedAt&&!n.checkoutUrl&&!("nativePurchase"in n&&n.nativePurchase)&&!n.merchantExecution&&!n.problem&&!i.pendingCancellation){if(r.purchaseConfirmation!=="paywall"){e?await ve():u=null;return}setTimeout(Rt,0,t);return}await U(n,e||void 0)}async function At(){await at()}async function ve(){if(i.quote&&!(Date.parse(i.quote.expiresAt)>Date.now()))throw new v("INVALID_REQUEST",o?"此报价已过期,请重新选择套餐。":"This quote has expired. Choose a plan again.");vt(),u=ve;let e=await i.confirm();if(!A()){u=ve,C.hidden=!1;return}if(e.problem){await U(e);return}if(Oe(e)){if(T(e).type==="checkout")await Ue(e);else if(e.execution&&e.execution.provider!=="merchant"||"nativePurchase"in e&&e.nativePurchase){if(!r.onPurchase)throw new v("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await r.onPurchase({operation:e,signal:ie.signal})}}u=async()=>U(await i.read()),await U(e,!0)}function Rt(e){if(w)return;te?.remove();let n=!(Date.parse(e.expiresAt)>Date.now());p.textContent=n?o?"此报价已过期。请先取消,再重新选择。":"This quote has expired. Cancel it, then choose again.":"";let t=f.createElement("div"),a=f.createElement("button"),c=f.createElement("button"),y=f.createElement("div"),l=f.createElement("p"),s=e.merchantTerms,N=o?"zh-CN":"en",V=s?.subscriptionTerms?.items??[],ne=s?s.subscriptionTerms?.trial?.days:S(e)?void 0:e.lines.find(d=>d.trial)?.trial?.days,re=S(e)?s?s.totalMinor:e.totalMinor:ne===void 0?null:s?s.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(d=>d.trial)?0:null,$=(d,g)=>o?`${g} 天试用结束后 ${d}`:`Then ${d} after the ${g}-day trial`,{label:ce,recurring:he}=It(e),$e=S(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(d=>d.productName).join(", "),Qe=re===null?"":`${o?"今天应付":"Due today"} ${ue(re,e.currency)}`;l.textContent=Qe?[$e,Qe].filter(Boolean).join(" · "):ce,a.textContent=S(e)?o?"确认变更":"Confirm change":o?"确认购买":"Confirm purchase",a.disabled=n,c.textContent=o?"取消":"Cancel",t.style.cssText=M.panel,l.style.cssText=M.summary,y.style.cssText=M.actions,a.style.cssText=M.primary,c.style.cssText=M.secondary,pt(a),a.onclick=()=>{j(ve)};let He=async()=>{let d=await i.cancel();w||(t.remove(),te=null,await U(d))};c.onclick=()=>{u=He,j(He)};let H=f.createElement("div");if(H.style.cssText=M.terms,S(e)){for(let[g,P]of Object.entries(e.featureQuantities??{})){let D=i.view?.capabilities.plans[e.productVersionId]?.prepaid?.find(rn=>rn.internalFeatureId===g),je=f.createElement("p");je.textContent=`${D?.name??g} · ${P} ${o?"份":"packs"}${D?` × ${D.terms.units}`:""}`,H.append(je)}for(let[g,P]of[[o?"原订阅抵扣":"Unused subscription credit",e.creditMinor],[o?"新套餐费用":"New plan charge",e.debitMinor],[o?"优惠减免":"Offer savings",s?.discountMinor??e.discountMinor],[o?"税费":"Tax",s?s.taxMinor:e.taxMinor]]){let D=f.createElement("p");D.textContent=`${g}: ${P===null?o?"结账时确认":"Confirmed at checkout":ue(P,e.currency)}`,H.append(D)}let d=f.createElement("p");d.textContent=`${o?"生效时间":"Effective"}: ${e.effectiveAt}`,H.append(d)}if(s){for(let g of V){if(re===null&&g===he)continue;let P=f.createElement("p"),D=ue(g.amountMinor,e.currency)+Pe(g.interval,N,g.intervalCount);P.textContent=re!==null&&ne!==void 0?$(D,ne):D,g.amountAfterOfferMinor!==void 0&&(P.textContent+=` · ${o?"优惠结束后":"After the offer"} ${ue(g.amountAfterOfferMinor,e.currency)}${Pe(g.interval,N,g.intervalCount)}`),H.append(P)}let d=s.subscriptionTerms?.trial;if(d){let g=f.createElement("p");g.textContent=o?`试用 ${d.days} 天;${d.cardRequired?"需要提供付款方式":"无需提供付款方式"}`:`Trial days: ${d.days}; ${d.cardRequired?"a payment method is required":"no payment method is required"}`,H.append(g)}for(let g of[...s.expectedEffects.map(P=>P.description),...s.requiredConsents.map(P=>P.summary)]){let P=f.createElement("p");P.textContent=g,H.append(P)}}else if(!S(e)){for(let d of e.lines){if(re!==null||d!==he){let g=f.createElement("p"),P=`${ue(d.catalogAmountMinor,e.currency)}${Pe(d.interval,N,d.intervalCount??1)}`;g.textContent=re!==null&&d.trial?(e.lines.length>1?`${d.productName} · `:"")+$(P,d.trial.days):`${d.productName} · ${P}`,H.append(g)}for(let g of d.prepaid??[]){let P=f.createElement("p"),D=i.view?.capabilities.plans[d.productVersionId]?.prepaid?.find(je=>je.internalFeatureId===g.internal_feature_id);P.textContent=`${D?.name??g.internal_feature_id} · ${g.quantity} ${o?"份":"packs"} × ${g.terms.units}`,D&&(P.textContent+=Pe(D.reset==="week"||D.reset==="month"||D.reset==="year"?D.reset:"one_time",N,D.resetCount)),H.append(P)}if(d.trial){let g=f.createElement("p");g.textContent=o?`试用 ${d.trial.days} 天;${d.trial.cardRequired?"需要提供付款方式":"无需提供付款方式"}`:`Trial days: ${d.trial.days}; ${d.trial.cardRequired?"a payment method is required":"no payment method is required"}`,H.append(g)}}if(!e.charge){let d=f.createElement("p");d.textContent=o?"目录价格;最终金额以结账时税费和试用规则为准。":"Catalog price; the final charge depends on checkout taxes and trial terms.",H.append(d)}}for(let d of H.children)d.style.margin="0";y.append(a,c),t.append(l,...H.childElementCount?[H]:[],y),J.prepend(t),O?.responsive||t.scrollIntoView?.({block:"nearest"}),a.focus({preventScroll:!0}),te=t,oe&&xe(!0),u=null}async function Ie(){if(!b)return;if(u=Ie,!ge){let t=i.view,a=t?.document.buttons[b.actionId],c=t&&a?.type==="checkout"?de(a.product,b.selection,t.capabilities):null;if(!t||!c)throw new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");if(!be){let l=await r.resolveSubscriptionChange?.({actionId:b.actionId,productVersionId:c,featureQuantities:ye(t.document.screen,c,b.selection,t.capabilities)});if(w)return;l!==void 0&&(b.subscriptionChange=Dt.parse(l)),be=!0}let y=F?.offerId;if(F&&!y){if(!r.claimCoupon)throw new v("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:l}=await r.claimCoupon(F.id,b.requestId);if(w)return;if(!l||l.couponId!==F.id||l.status!=="issued"||!(Date.parse(l.expiresAt)>Date.now()))throw b=null,F=void 0,u=async()=>{Se(await i.refresh()),u=null},new v("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");y=l.id}if(!F&&!t.document.screen.actions.some(l=>l.id===b?.actionId&&typeof l.properties.couponBinding=="string")&&(y=await r.resolveOfferId?.({actionId:b.actionId,productVersionId:c,featureQuantities:ye(t.document.screen,c,b.selection,t.capabilities)})),w)return;y!==void 0&&(b.offerId=y),ge=!0}if(!A()){C.hidden=!1;return}let e;try{e=await i.preview(b)}catch(t){throw i.canReselect===!0&&(b=null,ge=!1,be=!1,F=void 0,u=null),t}if(F&&(S(e)?(()=>{let t=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return t?.couponId!==F.id||t.grantId!==b.offerId})():e.discount?.couponId!==F.id||e.discount.offerId!==b.offerId))throw new v("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(w)return;let n=e.merchantTerms;if(r.purchaseConfirmation!=="paywall"||r.confirmOnHostedCheckout&&A()&&!S(e)&&e.provider==="merchant"&&e.billingSubscriptionId===null&&n?.request.action==="purchase"&&n.request.mode==="subscription"&&n.subscriptionTerms?.trial===null&&n.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){if(!A()){C.hidden=!1;return}if(!(Date.parse(e.expiresAt)>Date.now()))throw new v("INVALID_REQUEST",o?"此报价已过期,请重新选择套餐。":"This quote has expired. Choose a plan again.");let t=Ce?"":o?"正在打开收银台…":"Opening checkout…";p.textContent=t;try{await ve()}catch(a){w||le(a)}finally{p.textContent===t&&(p.textContent="")}return}Rt(e)}function me(e="destroy",n=!1){if(w)return;w=!0;let t=Ze;Ze=void 0,G(t),r.signal?.removeEventListener("abort",X),i.signal?.removeEventListener("abort",X),R.finish("dismissed"),wt?.(),ie.abort(),yt?.disconnect(),B?.destroy(),i.destroy(),E.removeEventListener("cancel",Tt),I.remove(),L.remove(),n||Ot(),e==="dismiss"&&G(r.onDismiss)}function Ot(){O?.destroy(),E.open&&E.close(),E.remove(),k()}Q=me;async function Ve(){if(!fe||w||De||ee==="closing"||!ee&&!A())return;if(!x){me("dismiss");return}let e=f.createElement("p");e.setAttribute("role","status"),e.textContent=o?"正在关闭…":"Closing…",se||(se=f.createElement("div"),se.style.cssText=J.style.cssText,J.replaceWith(se),ae.inert=!0),I.hidden=!1,se.replaceChildren(e,I),ee="closing",I.setAttribute("aria-disabled","true"),I.focus({preventScroll:!0});try{await x.dismiss()}catch(n){w||G(r.onError,n)}w||(ee="retry",e.textContent=o?"未能确认关闭,请重试。":"Could not confirm closure. Try again.",I.textContent=o?"重试关闭":"Retry closing",I.removeAttribute("aria-label"),I.removeAttribute("aria-disabled"))}I.onclick=()=>{Ve()};function Tt(e){e.preventDefault(),Ve()}E.addEventListener("cancel",Tt),C.onclick=()=>{u&&j(u)};function ot(e){R.finish("error",e),me()}function st(){if(!(!bt||fe||w||De||O&&!A()))try{let e=n=>{r.focusAtReveal&&(k=ft(f)),B?.setHidden?.(!1),et?.(),O&&(E.showModal(),O.responsive&&E.focus({preventScroll:!0}),!n&&r.loading!=="host"&&$t(E,O.type,O.responsive)),n&&r.loading!=="host"&&typeof ae.animate=="function"&&!f.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&ae.animate([{opacity:.55},{opacity:1}],{duration:160,easing:"ease-out"}),fe=!0};x?x.present(n=>R.present(t=>e(n??t))):R.present(e)}catch(e){ot(e),le(e)}}try{if(Te.type==="inline"?(ze(),et=Bt(L,_),_.append(L)):(E.setAttribute("aria-label",m.document.name),I.textContent="×",I.setAttribute("aria-label",o?"关闭":"Close"),Qt(I,m.document.screen.theme),I.hidden=Ut(m.document),E.append(I,L),_.append(E),O=Vt(E,{...m.document.screen,presentation:Te},Xe),O.latch(),O.responsive&&(L.style.display="flex",L.style.flexDirection="column",L.style.maxHeight="100%",ae.style.overflow="clip",ae.style.minHeight="0"),et=jt(E)),Ge&&W){let t=Ge(W);if(typeof t=="function"&&(w?G(t):Ze=t),w)throw new DOMException("Presentation cancelled","AbortError");ze()}B=Y(ae,{mode:"live",loadingLayout:()=>R.getLoadingLayout?.()??x?.loadingLayout?.(),rendererUrl:"bundled",title:m.document.name,closeActions:Xt,onAuthoredClose(t){ee||w||(I.hidden=t)},hostPresentation:()=>O?.type??Te.type,reportContentHeight:O?.responsive,onResize:t=>{if(!O?.responsive)return;let a=Math.min(t,Ke);ae.style.height=`${a}px`,O.setContentHeight(a+(se??J).getBoundingClientRect().height)},onSelection(t){for(let[a,c]of Object.entries(t))typeof c=="number"&&typeof q[a]=="number"&&q[a]!==c&&Ct.add(a);q=t,ke()},onAction(t,a={},c,y){if(!fe||w||ee)return;let l=i.view,s=l?.document.buttons[t];if(!s)return;if(s.type==="close"&&x&&r.resumeCheckout&&i.operation&&Nt(T(i.operation))){Ve();return}if(oe)return;if(!A()){it();return}if(s.type==="close"){j(async()=>{x?.closeAction?await x.closeAction(t):await r.onAction?.(t),me(r.onAction?"action":"dismiss")});return}if(s.type==="action"){u=async()=>{if(s.action.type==="event"){if(!r.onEvent)throw new v("EVENT_HANDLER_REQUIRED","Provide the event handler");await r.onEvent(s.action.event)}else r.onOpenUrl?await r.onOpenUrl(s.action.url):f.defaultView?.location.assign(s.action.url);await r.onAction?.(t),u=null},j(u);return}if(r.allowNewPurchase===!1){pe()&&l&&i.quote&&i.operation&&T(i.operation).type==="checkout"&&Me(i.quote,l,t,s.product,a,y)?j(rt,t):p.textContent=o?"当前只能继续原订单。":"Only your original checkout is available.";return}if(te&&i.canReselect===!1){p.textContent=o?"请先确认或取消当前购买。":"Confirm or cancel the current purchase first.",O?.responsive||te.scrollIntoView?.({block:"nearest"}),te.querySelector("button")?.focus({preventScroll:!0});return}if(pe()&&K){K.selection.actionId===t&&j(()=>kt(!0),t);return}if(pe()&&r.terminateCheckout&&l&&i.quote&&i.operation&&i.canReselect===!1&&T(i.operation).type==="checkout"){if(Me(i.quote,l,t,s.product,a,y)){j(rt,t);return}let V=de(s.product,a,l.capabilities),ne;try{if(!V)throw new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");ne=ye(l.document.screen,V,a,l.capabilities)}catch(he){le(he);return}let re=i.operation.operationId,$={actionId:t,requestId:crypto.randomUUID(),selection:structuredClone(a)},ce=Le(l,t,V,a,y);j(()=>Et(re,$,ce,{actionId:t,productVersionId:V,selection:$.selection,featureQuantities:ne}),t);return}if((i.quote||b)&&i.canReselect===!1){let V=!!l&&!!i.quote&&Me(i.quote,l,t,s.product,a,y);_e=!!i.quote&&!V,u=i.quote?()=>at(V):Ie,j(u);return}let N=l&&de(s.product,a,l.capabilities);if(!l||!N){le(new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(r.onPurchaseIntent){u=null,j(async()=>{let V={actionId:t,productVersionId:N,selection:structuredClone(a),featureQuantities:ye(l.document.screen,N,a,l.capabilities)};tt=!0,await r.onPurchaseIntent(V)});return}if(b&&b.actionId!==t){le(new v("COMMAND_PENDING","Finish the current purchase"));return}b||(F=Le(l,t,N,a,y),b={requestId:crypto.randomUUID(),actionId:t,selection:structuredClone(a)},ge=!1,be=!1),j(Ie,t)},onEscape:()=>{Ve()},onError:t=>{let a=new Error(t);!fe&&!w&&ot(a),le(a)},onRendered:t=>{t&&E.setAttribute("aria-label",t),bt=!0,st()}}),B.setHidden?.(!0),Xe();let e=pe()&&!!i.quote&&!!i.operation&&T(i.operation).type==="checkout";q=i.quote?Yt(m,i.quote)??Fe(m,{}):Fe(m,{}),B.update(m.document.screen,We,{capabilities:we(m),unavailableActions:ht(m),serverInput:{bindings:[],answers:{}},...Object.keys(q).length?{selection:q}:{}}),wt=i.subscribe?.(Se),Se(i.view??m),await R.wait(B.ready);let n=i.operation;!e&&(i.quote||n&&(n.confirmedAt||n.checkoutUrl||Re(n)))&&(u=At,j(u))}catch(e){throw ot(e),e}return{check:Z,host:{get observing(){return Ye},get recovery(){return Zt()},async prepareFallback(){if(oe||w||ee||tt)return{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null};xe(!0);try{let e=await _t(i);return e.type==="native"&&me(),e}finally{xe(!1)}},setSuspended(e){De=e,L.hidden=e,e&&E.open?E.close():!e&&!fe?st():!e&&!w&&fe&&Te.type!=="inline"&&!E.open&&E.showModal()},destroy:me,retainPurchaseDialog(){if(!(w||!E.open||!E.isConnected))return me("destroy",!0),{dialog:E,release:Ot}},refresh:async()=>{if(!A()){if(i.view)return i.view;throw new v("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await i.refresh();return Se(e),st(),e}}}}export{Un as showPaywall};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./chunk-US65SQX4.js";import"./chunk-HYCLLEFU.js";import"./chunk-KSME3N3A.js";import"./chunk-LE32WTZ7.js";import"./chunk-IDDPWGQE.js";import"./chunk-HYX3EDZS.js";import"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-FN462OVO.js";import"./chunk-FRRKTQNZ.js";import"./chunk-MQ5LJEWV.js";import"./chunk-JDIFYMSA.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-3VUPVXAV.js";import"./chunk-B4SM2KRI.js";import"./chunk-XVCSRZX4.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-VPYKAEHU.js";import"./chunk-VKFLQEW4.js";import"./chunk-HP6OV6WF.js";import"./chunk-Y2ASROJH.js";import"./chunk-TIOPNTMP.js";import"./chunk-RFWVXTZ7.js";import"./chunk-US65SQX4.js";import"./chunk-HYCLLEFU.js";import"./chunk-KSME3N3A.js";import"./chunk-LE32WTZ7.js";import"./chunk-IDDPWGQE.js";import"./chunk-LSHIR6QM.js";import"./chunk-OPUIFAQS.js";import"./chunk-HYX3EDZS.js";import"./chunk-EGFVGCDG.js";import"./chunk-YFLVGOCJ.js";import"./chunk-VILB5M4X.js";import"./chunk-IVXYLNAF.js";import"./chunk-FN462OVO.js";import"./chunk-FRRKTQNZ.js";import"./chunk-MQ5LJEWV.js";import"./chunk-JDIFYMSA.js";import"./chunk-TNPBYYAX.js";import"./chunk-KCN6OGYG.js";import"./chunk-PF6PRPRO.js";import"./chunk-ZDIWOE4Q.js";import"./chunk-FYD7CMS7.js";import"./chunk-3VUPVXAV.js";import"./chunk-B4SM2KRI.js";import"./chunk-XVCSRZX4.js";import"./chunk-DSPLGTQI.js";import"./chunk-A5KU4MMN.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
|