@tinkerlandai/longplay-sdk 0.10.40 → 0.10.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +57 -1
- package/README.zh-CN.md +5 -1
- package/dist/{ai-usage-DXwAGTxT.d.ts → ai-usage-B-qsCn-k.d.ts} +1 -1
- package/dist/{api-r6FfVQpg.d.ts → api-DpRb_Pd3.d.ts} +52 -0
- package/dist/check-response-OIBVUP72.js +1 -0
- package/dist/chunk-2EVGXJ4R.js +1 -0
- package/dist/chunk-3SXPCVIP.js +1 -0
- package/dist/chunk-3WTVQ6OV.js +1 -0
- package/dist/{chunk-LSPHUA7V.js → chunk-5JRBCW6V.js} +1 -1
- package/dist/chunk-5TJISOWN.js +1 -0
- package/dist/{chunk-X6ONZGRY.js → chunk-67SIVUOS.js} +1 -1
- package/dist/chunk-6XRXHFM6.js +1 -0
- package/dist/chunk-7MYS52FL.js +1 -0
- package/dist/chunk-ABXCDVC7.js +1 -0
- package/dist/{chunk-2DPNSTCN.js → chunk-AC53CUJE.js} +1 -1
- package/dist/chunk-ANXDWUPK.js +1 -0
- package/dist/chunk-AQONMY2H.js +1 -0
- package/dist/chunk-ASL7TJFU.js +1 -0
- package/dist/{chunk-ORMQJAQE.js → chunk-AV2WZSII.js} +1 -1
- package/dist/chunk-B4AELNLE.js +1 -0
- package/dist/{chunk-O4KXODTJ.js → chunk-C4NG6RVA.js} +1 -1
- package/dist/chunk-CALDEF4M.js +1 -0
- package/dist/chunk-CSLTAXC7.js +1 -0
- package/dist/chunk-CWD36SJO.js +1 -0
- package/dist/chunk-DCZWNTG2.js +1 -0
- package/dist/chunk-DGZCD3AY.js +1 -0
- package/dist/{chunk-57GPGWSK.js → chunk-FTGRTYBL.js} +1 -1
- package/dist/chunk-HLCDAU5A.js +1 -0
- package/dist/{chunk-CZ4TQCUV.js → chunk-HTXB2WVI.js} +1 -1
- package/dist/chunk-JWTA2OCB.js +1 -0
- package/dist/{chunk-VC2HPREX.js → chunk-KEF6HIFK.js} +1 -1
- package/dist/chunk-KP4QI4RX.js +1 -0
- package/dist/{chunk-FCDWCQYC.js → chunk-LSVTH3TS.js} +1 -1
- package/dist/chunk-LUGZNBIW.js +1 -0
- package/dist/{chunk-YLPQLD2A.js → chunk-LZ3OJYBY.js} +1 -1
- package/dist/{chunk-5DZJCFNQ.js → chunk-MEDW4N3F.js} +1 -1
- package/dist/{chunk-7QDT6DO7.js → chunk-MPD3UIY4.js} +1 -1
- package/dist/chunk-MWICFZUF.js +1 -0
- package/dist/{chunk-POCDWUD3.js → chunk-NVF54BDR.js} +1 -1
- package/dist/{chunk-C2KT5ZFU.js → chunk-O6CUNETH.js} +1 -1
- package/dist/chunk-OXXPMJRJ.js +1 -0
- package/dist/{chunk-P6C3PNMQ.js → chunk-P6TNBX2S.js} +1 -1
- package/dist/{chunk-EREQZWGI.js → chunk-PBZSOTKZ.js} +1 -1
- package/dist/chunk-QHWR5UHD.js +1 -0
- package/dist/{chunk-33ZVZOSC.js → chunk-RDUKCMST.js} +1 -1
- package/dist/{chunk-ASDJTOGM.js → chunk-RJY5CUTB.js} +1 -1
- package/dist/chunk-S7A3IBAF.js +10 -0
- package/dist/{chunk-QZTTKH2H.js → chunk-SVLEVNHP.js} +1 -1
- package/dist/{chunk-WLGLQJ6M.js → chunk-TL67SYPH.js} +1 -1
- package/dist/{chunk-YY445FBU.js → chunk-UJMP7AMY.js} +1 -1
- package/dist/{chunk-67AY54E2.js → chunk-V65FSNYO.js} +1 -1
- package/dist/chunk-VILB5M4X.js +1 -0
- package/dist/{chunk-RV6UAUK2.js → chunk-ZICZN6WO.js} +1 -1
- package/dist/{configuration-sync-BHrAf-ql.d.ts → configuration-sync-7ruSsSrL.d.ts} +150 -1
- package/dist/content-KSIF5AXD.js +1 -0
- package/dist/funnel-host-purchase-YNC4LQJS.js +1 -0
- package/dist/{funnel-local-client-DR8OpKGU.d.ts → funnel-local-client-BMxDQWE6.d.ts} +51987 -22983
- package/dist/{funnel-node-evaluation-COxXtZEQ.d.ts → funnel-node-evaluation-COIh1hKs.d.ts} +3 -0
- package/dist/funnel-paywall-prerender-DAAQUEEZ.js +1 -0
- package/dist/{funnel-process-client-C87U4r_G.d.ts → funnel-process-client-DNR9nHs8.d.ts} +7338 -3163
- package/dist/funnel-route-prediction-XGCMCIKA.js +1 -0
- package/dist/funnel-route-source-O76QSUYU.js +1 -0
- package/dist/funnel-runtime-host-WPU42YVT.js +1 -0
- package/dist/index.d.ts +273 -22
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-FB63H7NE.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-YSFIINLK.js +1 -0
- package/dist/page.d.ts +1 -1
- package/dist/page.js +1 -1
- package/dist/paywall-PZ4BBEFG.js +1 -0
- package/dist/paywall-content-5IWLT7YD.js +1 -0
- package/dist/paywall-session-K7GPR3UF.js +1 -0
- package/dist/popup.d.ts +2 -2
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-B_v5XZtM.d.ts → presentation-loading-B2OeFzRN.d.ts} +1 -0
- package/dist/react-native.d.ts +6 -6
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-RDXKWHYE.js +1 -0
- package/dist/server.d.ts +34204 -17797
- package/dist/server.js +1 -1
- package/dist/{visual-dom-5LUN4AHO.js → visual-dom-IN6DRNX3.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/check-response-DRQCUWDW.js +0 -1
- package/dist/chunk-3NCMYTNG.js +0 -1
- package/dist/chunk-4TEZZZYK.js +0 -1
- package/dist/chunk-6PG3AS3G.js +0 -1
- package/dist/chunk-AZFWG352.js +0 -1
- package/dist/chunk-BYP4KVB3.js +0 -10
- package/dist/chunk-C3GYAKIU.js +0 -1
- package/dist/chunk-ESAHTG3Y.js +0 -1
- package/dist/chunk-GC6JBIRQ.js +0 -1
- package/dist/chunk-IJKAQNK6.js +0 -1
- package/dist/chunk-IOJVF52Q.js +0 -1
- package/dist/chunk-OOD2VDDP.js +0 -1
- package/dist/chunk-P23JOPR5.js +0 -1
- package/dist/chunk-PJS7M6X3.js +0 -1
- package/dist/chunk-PZOQV6MU.js +0 -1
- package/dist/chunk-RFNIGJOL.js +0 -1
- package/dist/chunk-RULQQ7WI.js +0 -1
- package/dist/chunk-U7GH4VME.js +0 -1
- package/dist/chunk-VOKEZHAH.js +0 -1
- package/dist/chunk-XDOKFAE6.js +0 -1
- package/dist/chunk-Y6HL2IY2.js +0 -1
- package/dist/content-QUEVNSXD.js +0 -1
- package/dist/funnel-host-purchase-LMVMJNUO.js +0 -1
- package/dist/funnel-paywall-prerender-LGUSHEP3.js +0 -1
- package/dist/funnel-runtime-host-H5FM67UC.js +0 -1
- package/dist/merchant-bridge-contracts-LZSQYE3O.js +0 -1
- package/dist/operation-contracts-O7TCDGV4.js +0 -1
- package/dist/paywall-UANWOKKC.js +0 -1
- package/dist/paywall-content-CHPX2P77.js +0 -1
- package/dist/paywall-session-3BNUC5ZE.js +0 -1
- package/dist/screen-renderer-FFVZ64MR.js +0 -1
- /package/dist/{chunk-RGEBK6UF.js → chunk-GPJF3T43.js} +0 -0
- /package/dist/{chunk-OJM6ORHE.js → chunk-RA7GZ67U.js} +0 -0
- /package/dist/{chunk-CILM5XMH.js → chunk-WPFTSHP2.js} +0 -0
package/dist/openrouter.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenRouter } from '@openrouter/sdk';
|
|
2
2
|
import { ChatUsage } from '@openrouter/sdk/models';
|
|
3
|
-
import { F as FoundationApi } from './api-
|
|
4
|
-
import { c as createAiPricing, A as AiUsageContext, a as AiTokenUsage, b as AiTokenQuote } from './ai-usage-
|
|
3
|
+
import { F as FoundationApi } from './api-DpRb_Pd3.js';
|
|
4
|
+
import { c as createAiPricing, A as AiUsageContext, a as AiTokenUsage, b as AiTokenQuote } from './ai-usage-B-qsCn-k.js';
|
|
5
5
|
import './screen-qUBRsUi9.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import 'zod/v4';
|
package/dist/openrouter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-UJMP7AMY.js";import"./chunk-FTGRTYBL.js";import"./chunk-LUGZNBIW.js";import"./chunk-LSVTH3TS.js";import{a as i}from"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-ZICZN6WO.js";import{b as A}from"./chunk-GPJF3T43.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-MEDW4N3F.js";import"./chunk-LZ3OJYBY.js";import"./chunk-AV2WZSII.js";import"./chunk-PBZSOTKZ.js";import"./chunk-HLCDAU5A.js";import"./chunk-DCZWNTG2.js";import"./chunk-ASL7TJFU.js";import"./chunk-RDUKCMST.js";import"./chunk-KP4QI4RX.js";import"./chunk-5TJISOWN.js";import"./chunk-VILB5M4X.js";import"./chunk-FTGRTYBL.js";import"./chunk-LSVTH3TS.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import"./chunk-6XRXHFM6.js";import"./chunk-GPJF3T43.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
|
package/dist/page.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as ConfigurationSync } from './configuration-sync-7ruSsSrL.js';
|
|
2
2
|
import { J as JsonValue, R as Result } from './growth-rules-B4YYy64R.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import './screen-qUBRsUi9.js';
|
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-AC53CUJE.js";import"./chunk-O6CUNETH.js";import"./chunk-3VUPVXAV.js";import"./chunk-ZICZN6WO.js";import"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Qt,c as jt,d as pt,f as mt,g as Bt,k as Ft}from"./chunk-HTXB2WVI.js";import{b as dt}from"./chunk-W32FI2A2.js";import{d as _t,e as Mt,f as Ut,h as ft,i as qe,j as $t,k as Vt,l as Ht}from"./chunk-P6TNBX2S.js";import{a as Tt,c as lt,d as St,e as Dt}from"./chunk-B4AELNLE.js";import{a as Fe,b as me,d as ut,f as Nt,j as Lt}from"./chunk-AQONMY2H.js";import{b as ue}from"./chunk-RDUKCMST.js";import{B as I,C as Be,D as Re,E as Oe,y as Ot}from"./chunk-KP4QI4RX.js";import"./chunk-5TJISOWN.js";import"./chunk-VILB5M4X.js";import"./chunk-LUGZNBIW.js";import"./chunk-LSVTH3TS.js";import{r as be,t as pe}from"./chunk-7MYS52FL.js";import{i as Rt}from"./chunk-MWICFZUF.js";import{c as le,j as Ae}from"./chunk-CWD36SJO.js";import{c as ct}from"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import{a as P}from"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-ZICZN6WO.js";import"./chunk-GPJF3T43.js";import{a as G}from"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";async function qt(_,a,D){if(!Re(a))throw new P("INVALID_RESPONSE","A verified completed purchase is required");let k=_?Ae.parse(_):null;if(await D.onComplete?.(a),!k||!D.check)return;let U=Ae.parse(await D.check());if(U.internal_feature_id!==k.internal_feature_id||U.quantity!==k.quantity||k.observation!==void 0&&(U.observation===void 0||U.observation.requirementDigest!==k.observation.requirementDigest||U.observation.authority!==k.observation.authority||ct(U.observation.subject)!==ct(k.observation.subject)))throw new P("INVALID_RESPONSE","The access requirement changed");U.allowed&&await D.onAccessGranted?.(U)}function ht(_){return Object.entries(_.document.buttons).filter(([,a])=>a.type==="checkout"&&a.product.type==="fixed"&&!ue(a.product,{},_.capabilities)).map(([a])=>a)}function Gt(_,a){let D=I(a)?void 0:a.lines[0];if(!I(a)&&(a.lines.length!==1||!D))return;let k=I(a)?a.productVersionId:D.productVersionId,{screen:U,buttons:X}=_.document,A=new Map(I(a)?Object.entries(a.featureQuantities??{}):(D?.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=A.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,d]of h.children.entries()){let re={},N=Z(d,re);if(z?.type==="toggle"||z?.type==="tabs"){if(!N)continue;return m[h.id]=z.type==="toggle"?Y===0:d.id,Object.assign(m,re),!0}Object.assign(m,re),N&&(i=!0,z?.type==="select"&&z.purpose==="product"&&z.pickerId&&d.type==="stack"&&d.bind?.plan===k&&(m[h.id]=d.id,m[z.pickerId]=k))}return i}for(let h of U.pages){let m={__page:h.id};if(Z(h.root,m))return m}}async function _n(_,a,D){let k=a.focusAtReveal?()=>{}:ft(_.ownerDocument),U=()=>{A.finish("dismissed"),k()},X=()=>U(),A=$t(_,a,"paywall",()=>{U(),G(a.onDismiss)},Qt);a.signal?.throwIfAborted(),a.signal?.addEventListener("abort",X,{once:!0});let Z=null,h,m,z;try{if(A.start(!0,a.loadingDocument?.screen.strings.defaultLocale,a.loadingDocument??null),A.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(Z=a.check?Ae.parse(await A.wait(a.check(),qe)):null,Z?.allowed)return A.finish("skipped"),a.signal?.removeEventListener("abort",X),k(),await a.onAccessGranted?.(Z),{check:Z,host:null};let[e,t]=await Promise.allSettled([A.wait(import("./screen-renderer-RDXKWHYE.js")),A.wait(a.start().then(r=>(A.cancelled&&r.destroy(),r)),qe)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;z=e.value,h=t.value,a.signal?.throwIfAborted(),h.signal?.throwIfAborted(),h.signal?.addEventListener("abort",X,{once:!0});let n=h.view??await A.wait(h.refresh(),qe);if(!n)throw new P("INVALID_RESPONSE","Paywall presentation is missing");h.signal?.throwIfAborted(),m=n}catch(e){throw A.finish("error",e),a.signal?.removeEventListener("abort",X),h?.signal?.removeEventListener("abort",X),h?.destroy(),k(),e}let i=h,{mountScreenPreview:Y}=z,d=_.ownerDocument,re=new AbortController,N=d.createElement("section"),he=d.createElement("div"),J=d.createElement("div"),Ge=a.mountControls,W=Ge?d.createElement("div"):void 0,f=d.createElement("p"),C=d.createElement("button"),E=d.createElement("button"),R=d.createElement("dialog"),We=i.locale||m.document.screen.strings.defaultLocale,o=We.toLowerCase().startsWith("zh"),Wt=o?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",zt=o?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",M=jt(m.document.screen.theme);N.dataset.indianaPaywall="",N.setAttribute("aria-label",m.document.name),N.style.cssText=M.root,J.style.cssText=M.controls,f.style.cssText=M.message,f.setAttribute("role","status"),E.style.cssText=M.link,E.textContent=o?"\u5173\u95ED":"Close",C.style.cssText=M.secondary,C.textContent=o?"\u91CD\u8BD5":"Retry",C.hidden=!0,J.append(f,C,E),W&&(W.style.cssText="flex:1 0 100%;min-width:0",W.hidden=!0,J.prepend(W)),N.append(he,J);let ze=()=>{if(W){let r=!W.childElementCount&&!W.textContent?.trim();W.hidden!==r&&(W.hidden=r)}let e=ae??J,t=[...e.children].every(r=>r===f?!f.textContent:r.hidden),n=[...e.children].some(r=>r===E?!1:r===f?!!f.textContent:!r.hidden);e.style.cssText=t?M.controls.replace(/padding:[^;]+/,"padding:0"):n?`${M.controls};${M.pinned}`:M.controls,Xe()},yt=typeof MutationObserver>"u"?void 0:new MutationObserver(ze);yt?.observe(N,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let Te=m.document.presentation,Yt=Object.entries(m.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),B,wt,Ye=!1,gt=JSON.stringify(m.capabilities),Je=e=>ie&&!Ce?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):ht(e);function Se(e){if(w)return;m=e;let t=JSON.stringify(e.capabilities);if(t!==gt){let n=!b&&!i.quote&&!i.operation?Fe(e,q,Ct):q;JSON.stringify(n)!==JSON.stringify(q)?(q=n,B?.update(e.document.screen,We,{capabilities:me(e),unavailableActions:Je(e),serverInput:{bindings:[],answers:{}},selection:q})):B?.updateCapabilities(me(e),Je(e)),gt=t}Xt(e),ve()}let x,Ke=0;function Xe(){let e=d.defaultView;if(!x?.responsive||!e)return;let t=ae??J,n=e.innerHeight-(x.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",Ke=Math.max(1,n-t.getBoundingClientRect().height),B?.resizeViewport?.(Ke,e.innerWidth)}let w=!1,ie=!1,b=null,Ze,De=!1,bt=!1,de=!1,et,tt=!1,ee,ae;function Jt(){return ie||w||ee||tt?{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null}:lt(i)}let O=()=>!w&&!De&&!ee&&a.canInteract?.()!==!1,F,ye=!1,we=!1,p=null,te=null,nt="",fe=()=>a.checkoutNavigation==="after_confirmation"&&!!(a.terminateCheckout||a.resumeCheckout),q={},Ct=new Set,Ce,K=null;function ve(){if(!fe()||!B?.updateCheckoutControls)return;let e=i.quote,t=!K&&!!e&&!!i.operation&&T(i.operation).type==="checkout",n=Object.entries(m.document.buttons).flatMap(([r,c])=>c.type==="checkout"?[{actionId:r,policy:c}]:[]);B.updateCheckoutControls({actions:n.map(({actionId:r})=>r),resume:t?n.filter(({actionId:r,policy:c})=>Me(e,m,r,c.product,q)).map(({actionId:r})=>r):[],resumeLabel:o?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout",busy:Ce})}function vt(){te?.remove(),te=null}async function rt(){if(K)return;if(a.resumeCheckout&&i.operation){await a.resumeCheckout(i.operation.operationId);return}let e=await i.read();if(T(e).type!=="checkout")return $(e,!1);O()&&(Le.delete(e.operationId),await Ue(e))}function Pt(){f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u4ED8\u6B3E\u9875\u9762\u3002\u8BF7\u91CD\u8BD5\u3002":"Couldn\u2019t open checkout. Try again.",C.hidden=!0}async function kt(e=!1){let t=K;if(!t)return;C.hidden=!0;let n=Date.now()+2e4;for(;O();){let r=await i.read();if(r.operationId!==t.operationId)throw new P("PURCHASE_PENDING","The original Checkout changed");if(!O())break;let c=T(r);if(c.type==="native"){K=null,vt(),b=t.selection,F=t.coupon,ye=!1,we=!1,await xe();return}if(c.type==="complete"||c.type==="fulfillment"||c.type==="recording"){K=null,await $(r,!1);return}if(e&&c.type==="checkout"){e=!1;try{await a.terminateCheckout(t.operationId)}catch(g){G(a.onError,g)}}if(Date.now()>=n)break;await dt(1e3,d,re.signal)}w||Pt()}async function Kt(e,t,n){K={operationId:e,selection:t,coupon:n};let r=!1;try{await a.terminateCheckout(e)}catch(c){if(c instanceof P&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(c.code)){K=null,f.textContent=o?"\u8BF7\u7EE7\u7EED\u539F\u8BA2\u5355\uFF0C\u6216\u7B49\u5F85\u5B83\u8FC7\u671F\u540E\u518D\u66F4\u6362\u65B9\u6848\u3002":"Continue your original checkout, or wait for it to expire before changing plans.",G(a.onError,c);return}r=c instanceof P&&(c.status??0)>=500,G(a.onError,c)}O()&&await kt(r)}function Ne(e,t,n,r,c){let g=me(e).checkoutCoupons?.[t],l=g?g.products[n]:a.claimCoupon&&c?Rt(e.capabilities,c,r):void 0;return l?.couponId&&l.planVersionId===n?{id:l.couponId,offerId:l.offerId}:void 0}function Xt(e){ie||b||i.quote||i.operation||nt&&f.textContent===nt||(f.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":o?"\u5F53\u524D\u8D26\u53F7\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u65B9\u6848\u3002":"No plans are currently available for this account.")}let Le=new Map,_e=!1;function Me(e,t,n,r,c,g){if(I(e)){let H=ue(r,c,t.capabilities),ce=H&&Ne(t,n,H,c,g),Ie=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0),Ve=pe(t.document.screen,e.productVersionId,c,t.capabilities);return H===e.productVersionId&&Object.keys(Ve).length===Object.keys(e.featureQuantities??{}).length&&Object.entries(Ve).every(([He,Qe])=>e.featureQuantities?.[He]===Qe)&&(!ce||Ie?.couponId===ce.id&&(!ce.offerId||Ie.grantId===ce.offerId))}let l=e.lines.length===1?e.lines[0]:void 0,s=ue(r,c,t.capabilities);if(!l||!s||l.productVersionId!==s)return!1;let L=Ne(t,n,s,c,g);if((L||me(t).checkoutCoupons?.[n])&&(L?.id??null)!==(e.discount?.couponId??null))return!1;let V;try{V=pe(t.document.screen,s,c,t.capabilities)}catch{return!1}let se=Object.fromEntries((l.prepaid??[]).map(H=>[H.internal_feature_id,H.quantity]));return[...new Set([...Object.keys(V),...Object.keys(se)])].every(H=>(V[H]??0)===(se[H]??0))}let T=e=>Tt({quote:i.quote,operation:e,requestId:null,pending:!1,destroyed:w,canReselect:i.canReselect});async function Ue(e){let t=e.merchantExecution,n=T(e),r=n.type==="checkout"?n.checkoutUrl:e.checkoutUrl;if(!(!O()||!r||Be(e)&&n.type!=="checkout"||a.checkoutNavigation==="after_confirmation"&&n.type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||Le.get(e.operationId)===r)){Le.set(e.operationId,r);try{a.onCheckoutUrl?await a.onCheckoutUrl(r):d.defaultView?.location.assign(r)}catch(c){throw Le.delete(e.operationId),c}}}let oe=(e,t=!1)=>{if(e instanceof ut)p=null,f.textContent=e.customerMessage(o);else if(Bt(e))p=null,f.textContent=t?o?"\u5F53\u524D\u65E0\u6CD5\u5728\u6B64\u8D2D\u4E70\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u3002":"Purchases aren\u2019t available here right now. Payment hasn\u2019t started. Contact the merchant for help.":mt(e,o);else if(t){let n=e instanceof P?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(p=null,f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u4E3A\u6B64\u5957\u9910\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002":"Pricing for this plan is unavailable. Payment hasn\u2019t started."):i.canReselect===!0&&!b?f.textContent=o?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u65B0\u9009\u62E9\u5957\u9910\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Choose a plan again.":n==="COMMAND_PENDING"?f.textContent=o?"\u4ECD\u5728\u51C6\u5907\u62A5\u4EF7\uFF0C\u8BF7\u91CD\u8BD5\u4EE5\u67E5\u770B\u7ED3\u679C\u3002":"Your price is still being prepared. Retry to check the result.":f.textContent=o?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u8BD5\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Try again."}else f.textContent=e instanceof P&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?mt(e,o):e instanceof P?e.message:o?"\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002":"This action couldn\u2019t be completed. Try again.";C.hidden=p===null,nt=f.textContent,t&&!x?.responsive&&f.scrollIntoView?.({block:"nearest"}),G(t&&D?.quoteError?D.quoteError:a.onError,e)},Pe=new WeakMap;function ke(e){ie=e,C.disabled=e,B?.updateCapabilities?.(me(m),Je(m));for(let t of te?.querySelectorAll("button")??[])e?(Pe.has(t)||Pe.set(t,t.disabled),t.disabled=!0):Pe.has(t)&&(t.disabled=Pe.get(t),Pe.delete(t)),pt(t)}function it(){f.textContent=o?"\u6682\u65F6\u65E0\u6CD5\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"This action is unavailable right now. Try again in a moment."}async function Zt(e){if(a.beforeAction)try{await a.beforeAction()}catch(t){throw t instanceof ut?(b=null,ye=!1,we=!1,p=null):p=e,t}}async function j(e,t){if(ie||w)return;if(!O()){it();return}let n=e===xe,r=n?zt:Wt,c=fe()&&t!==void 0;Ce=c?t:void 0,ke(!0),ve(),C.hidden=!0,f.textContent=c?"":r;try{if(e!==It&&(e!==rt||!a.resumeCheckout)&&await Zt(e),w)return;if(!O()){p=e,C.hidden=!1,it();return}await e()}catch(g){w||oe(g,n&&!c)}finally{Ce=void 0,ke(!1),ve(),f.textContent===r&&(f.textContent="")}}async function en(e){await qt(Z,e,a)}function Et(e){return lt(i).type==="recording"||T(e).type==="recording"}function xt(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],r=t?t.totalMinor:I(e)?e.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),c=t?n.length===1&&n[0]?.amountMinor===r&&n[0]:!I(e)&&e.lines.length===1&&e.lines[0]?.catalogAmountMinor===r&&e.lines[0],g=r===null?le(t.subtotalMinor-t.discountMinor,e.currency)+(o?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):le(r,e.currency)+(c?be(c.interval,o?"zh-CN":"en",c.intervalCount??1):""),l=I(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(s=>s.productName).join(", ");return{label:l?`${l} \xB7 ${g}`:g,recurring:c}}async function $(e,t=a.checkoutNavigation!=="after_confirmation"){if(w)return;if(!O()){p=async()=>$(await i.read()),C.hidden=!1;return}if(f.textContent=Ft(e.status,o),Et(e)){let s=e.merchantExecution?.recordingStatus==="failed";f.textContent=s?o?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u4F46\u4EA4\u6613\u8BB0\u5F55\u5931\u8D25\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u4FEE\u590D\uFF0C\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":o?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u8BB0\u5F55\u3002\u8BF7\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",C.textContent=o?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",p=async()=>$(await i.read()),C.hidden=!1;return}if(e.problem&&T(e).type!=="native"){let s=e.problem;p=Ee,C.textContent=o?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",oe(new P(s.code,s.reason==="RESULT_UNKNOWN"?o?"\u4ED8\u6B3E\u7ED3\u679C\u5C1A\u672A\u786E\u5B9A\uFF0C\u8BF7\u6062\u590D\u539F\u64CD\u4F5C\uFF0C\u6682\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"The payment result is unknown. Recover the original purchase before buying again.":s.phase==="fulfillment"?o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":s.code==="CAPABILITY_UNAVAILABLE"?o?"\u5546\u6237\u5C1A\u4E0D\u652F\u6301\u672C\u6B21\u8D2D\u4E70\u6240\u9700\u7684\u5B8C\u6574\u80FD\u529B\uFF0C\u8BF7\u5904\u7406\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"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?"\u4ED8\u6B3E\u670D\u52A1\u8FDE\u63A5\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u8054\u7CFB\u5546\u6237\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":o?"\u539F\u8D2D\u4E70\u64CD\u4F5C\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u67E5\u8BE2\u6216\u6062\u590D\u6B64\u64CD\u4F5C\u3002":"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)&&(f.textContent=o?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),Re(e)&&T(e).type==="complete"){p=null,await en(e);return}if(!Oe(e)&&T(e).type!=="fulfillment"){if(i.canReselect===!1){f.textContent=o?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",C.textContent=o?"\u67E5\u8BE2\u7ED3\u679C":"Check result",p=async()=>$(await i.read()),C.hidden=!1;return}e.status==="cancelled"?f.textContent=o?"\u8FD9\u7B14\u8D2D\u4E70\u5DF2\u53D6\u6D88\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(f.textContent=o?"\u8FD9\u7B14\u8D2D\u4E70\u672A\u80FD\u5B8C\u6210\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase didn\u2019t go through. Choose a plan to try again."),C.textContent=o?"\u91CD\u8BD5":"Retry",p=null,b=null;return}if(!t&&T(e).type==="checkout"){if(K){Pt();return}if(fe()){f.textContent="",_e=!1,p=null,ve();return}let s=i.quote,L=s?.operationId===e.operationId?xt(s).label:"";f.textContent=_e?L?o?`${L} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${L} is still unpaid. Choose it again to continue paying.`:o?"\u4E4B\u524D\u7684\u8D2D\u4E70\u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",_e=!1,p=null;return}await Ue(e);let n=Date.now(),r=n+6e5,c=2e3,g=T(e).type!=="checkout",l=()=>g&&Date.now()-n<15e3;Ye=!0,G(a.onObservationChange,!0);try{for(;!w&&Date.now()<r;){if(await dt(l()?700:c,d,re.signal),w)return;if(!O()){p=async()=>$(await i.read()),C.hidden=!1;return}let s=await i.read();if(T(s).type==="checkout"&&(g=!1),!t&&T(s).type==="checkout"){await $(s,!1);return}if(!s.problem&&Oe(s)&&await Ue(s),!Oe(s)||s.problem||Et(s)){await $(s);return}l()||(c=Math.min(c*1.5,3e4))}}finally{Ye=!1,G(a.onObservationChange,!1)}p=async()=>$(await i.read()),C.hidden=!1}async function at(e=!1){let t=await i.read();if(w)return;if(!O()){p=()=>at(e),C.hidden=!1;return}let n=i.quote;if(n&&Nt(t,{operationId:n.operationId,currency:n.currency},"The original purchase operation changed"),n&&(Be(t)?["prepared","quoted"].includes(t.status):t.status==="pending")&&(Be(t)||t.quoteFinalized===!1)&&!t.confirmedAt&&!t.checkoutUrl&&!("nativePurchase"in t&&t.nativePurchase)&&!t.merchantExecution&&!t.problem&&!i.pendingCancellation){At(n);return}await $(t,e||void 0)}async function It(){await at()}async function Ee(){vt(),p=Ee;let e=await i.confirm();if(!O()){p=Ee,C.hidden=!1;return}if(e.problem){await $(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(!a.onPurchase)throw new P("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await a.onPurchase({operation:e,signal:re.signal})}}p=async()=>$(await i.read()),await $(e,!0)}function At(e){te?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());f.textContent=t?o?"\u6B64\u62A5\u4EF7\u5DF2\u8FC7\u671F\u3002\u8BF7\u5148\u53D6\u6D88\uFF0C\u518D\u91CD\u65B0\u9009\u62E9\u3002":"This quote has expired. Cancel it, then choose again.":"";let n=d.createElement("div"),r=d.createElement("button"),c=d.createElement("button"),g=d.createElement("div"),l=d.createElement("p"),s=e.merchantTerms,L=o?"zh-CN":"en",V=s?.subscriptionTerms?.items??[],se=s?s.subscriptionTerms?.trial?.days:I(e)?void 0:e.lines.find(u=>u.trial)?.trial?.days,ne=I(e)?s?s.totalMinor:e.totalMinor:se===void 0?null:s?s.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(u=>u.trial)?0:null,H=(u,y)=>o?`${y} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${u}`:`Then ${u} after the ${y}-day trial`,{label:ce,recurring:Ie}=xt(e),Ve=I(e)?i.view?.capabilities.plans[e.productVersionId]?.name??"":e.lines.map(u=>u.productName).join(", "),He=ne===null?"":`${o?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${le(ne,e.currency)}`;l.textContent=He?[Ve,He].filter(Boolean).join(" \xB7 "):ce,r.textContent=I(e)?o?"\u786E\u8BA4\u53D8\u66F4":"Confirm change":o?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",r.disabled=t,c.textContent=o?"\u53D6\u6D88":"Cancel",n.style.cssText=M.panel,l.style.cssText=M.summary,g.style.cssText=M.actions,r.style.cssText=M.primary,c.style.cssText=M.secondary,pt(r),r.onclick=()=>{j(Ee)};let Qe=async()=>{let u=await i.cancel();w||(n.remove(),te=null,await $(u))};c.onclick=()=>{p=Qe,j(Qe)};let Q=d.createElement("div");if(Q.style.cssText=M.terms,I(e)){for(let[y,v]of Object.entries(e.featureQuantities??{})){let S=i.view?.capabilities.plans[e.productVersionId]?.prepaid?.find(tn=>tn.internalFeatureId===y),je=d.createElement("p");je.textContent=`${S?.name??y} \xB7 ${v} ${o?"\u4EFD":"packs"}${S?` \xD7 ${S.terms.units}`:""}`,Q.append(je)}for(let[y,v]of[[o?"\u539F\u8BA2\u9605\u62B5\u6263":"Unused subscription credit",e.creditMinor],[o?"\u65B0\u5957\u9910\u8D39\u7528":"New plan charge",e.debitMinor],[o?"\u4F18\u60E0\u51CF\u514D":"Offer savings",s?.discountMinor??e.discountMinor],[o?"\u7A0E\u8D39":"Tax",s?s.taxMinor:e.taxMinor]]){let S=d.createElement("p");S.textContent=`${y}: ${v===null?o?"\u7ED3\u8D26\u65F6\u786E\u8BA4":"Confirmed at checkout":le(v,e.currency)}`,Q.append(S)}let u=d.createElement("p");u.textContent=`${o?"\u751F\u6548\u65F6\u95F4":"Effective"}: ${e.effectiveAt}`,Q.append(u)}if(s){for(let y of V){if(ne===null&&y===Ie)continue;let v=d.createElement("p"),S=le(y.amountMinor,e.currency)+be(y.interval,L,y.intervalCount);v.textContent=ne!==null&&se!==void 0?H(S,se):S,y.amountAfterOfferMinor!==void 0&&(v.textContent+=` \xB7 ${o?"\u4F18\u60E0\u7ED3\u675F\u540E":"After the offer"} ${le(y.amountAfterOfferMinor,e.currency)}${be(y.interval,L,y.intervalCount)}`),Q.append(v)}let u=s.subscriptionTerms?.trial;if(u){let y=d.createElement("p");y.textContent=o?`\u8BD5\u7528 ${u.days} \u5929\uFF1B${u.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${u.days}; ${u.cardRequired?"a payment method is required":"no payment method is required"}`,Q.append(y)}for(let y of[...s.expectedEffects.map(v=>v.description),...s.requiredConsents.map(v=>v.summary)]){let v=d.createElement("p");v.textContent=y,Q.append(v)}}else if(!I(e)){for(let u of e.lines){if(ne!==null||u!==Ie){let y=d.createElement("p"),v=`${le(u.catalogAmountMinor,e.currency)}${be(u.interval,L,u.intervalCount??1)}`;y.textContent=ne!==null&&u.trial?(e.lines.length>1?`${u.productName} \xB7 `:"")+H(v,u.trial.days):`${u.productName} \xB7 ${v}`,Q.append(y)}for(let y of u.prepaid??[]){let v=d.createElement("p"),S=i.view?.capabilities.plans[u.productVersionId]?.prepaid?.find(je=>je.internalFeatureId===y.internal_feature_id);v.textContent=`${S?.name??y.internal_feature_id} \xB7 ${y.quantity} ${o?"\u4EFD":"packs"} \xD7 ${y.terms.units}`,S&&(v.textContent+=be(S.reset==="week"||S.reset==="month"||S.reset==="year"?S.reset:"one_time",L,S.resetCount)),Q.append(v)}if(u.trial){let y=d.createElement("p");y.textContent=o?`\u8BD5\u7528 ${u.trial.days} \u5929\uFF1B${u.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${u.trial.days}; ${u.trial.cardRequired?"a payment method is required":"no payment method is required"}`,Q.append(y)}}if(!e.charge){let u=d.createElement("p");u.textContent=o?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",Q.append(u)}}for(let u of Q.children)u.style.margin="0";g.append(r,c),n.append(l,...Q.childElementCount?[Q]:[],g),J.prepend(n),x?.responsive||n.scrollIntoView?.({block:"nearest"}),r.focus({preventScroll:!0}),te=n,ie&&ke(!0),p=null}async function xe(){if(!b)return;if(p=xe,!ye){let n=i.view,r=n?.document.buttons[b.actionId],c=n&&r?.type==="checkout"?ue(r.product,b.selection,n.capabilities):null;if(!n||!c)throw new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");if(!we){let l=await a.resolveSubscriptionChange?.({actionId:b.actionId,productVersionId:c,featureQuantities:pe(n.document.screen,c,b.selection,n.capabilities)});if(w)return;l!==void 0&&(b.subscriptionChange=Ot.parse(l)),we=!0}let g=F?.offerId;if(F&&!g){if(!a.claimCoupon)throw new P("CAPABILITY_UNAVAILABLE","Coupon claiming is unavailable");let{offer:l}=await a.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,p=async()=>{Se(await i.refresh()),p=null},new P("COUPON_UNAVAILABLE","This Coupon is no longer available for this purchase");g=l.id}if(!F&&!n.document.screen.actions.some(l=>l.id===b?.actionId&&typeof l.properties.couponBinding=="string")&&(g=await a.resolveOfferId?.({actionId:b.actionId,productVersionId:c,featureQuantities:pe(n.document.screen,c,b.selection,n.capabilities)})),w)return;g!==void 0&&(b.offerId=g),ye=!0}if(!O()){C.hidden=!1;return}let e;try{e=await i.preview(b)}catch(n){throw i.canReselect===!0&&(b=null,ye=!1,we=!1,F=void 0,p=null),n}if(F&&(I(e)?(()=>{let n=e.merchantTerms?.discount??(e.execution.provider==="merchant"?e.execution.discount:void 0);return n?.couponId!==F.id||n.grantId!==b.offerId})():e.discount?.couponId!==F.id||e.discount.offerId!==b.offerId))throw new P("INVALID_RESPONSE","The quote did not apply the Coupon selected on this Paywall");if(w)return;let t=e.merchantTerms;if(a.confirmOnHostedCheckout&&O()&&!I(e)&&e.provider==="merchant"&&e.billingSubscriptionId===null&&t?.request.action==="purchase"&&t.request.mode==="subscription"&&t.subscriptionTerms?.trial===null&&t.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){let n=Ce?"":o?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";f.textContent=n;try{await Ee()}catch(r){w||oe(r)}finally{f.textContent===n&&(f.textContent="")}return}At(e)}function ge(e="destroy"){if(w)return;w=!0;let t=Ze;Ze=void 0,G(t),a.signal?.removeEventListener("abort",X),i.signal?.removeEventListener("abort",X),A.finish("dismissed"),wt?.(),re.abort(),yt?.disconnect(),x?.destroy(),B?.destroy(),i.destroy(),R.open&&R.close(),R.remove(),N.remove(),k(),e==="dismiss"&&G(a.onDismiss)}U=ge;async function $e(){if(!de||w||De||ee==="closing"||!ee&&!O())return;if(!D){ge("dismiss");return}let e=d.createElement("p");e.setAttribute("role","status"),e.textContent=o?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",ae||(ae=d.createElement("div"),ae.style.cssText=J.style.cssText,J.replaceWith(ae),he.inert=!0),E.hidden=!1,ae.replaceChildren(e,E),ee="closing",E.setAttribute("aria-disabled","true"),E.focus({preventScroll:!0});try{await D.dismiss()}catch(t){w||G(a.onError,t)}w||(ee="retry",e.textContent=o?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",E.textContent=o?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",E.removeAttribute("aria-label"),E.removeAttribute("aria-disabled"))}E.onclick=()=>{$e()},R.addEventListener("cancel",e=>{e.preventDefault(),$e()}),C.onclick=()=>{p&&j(p)};function ot(e){A.finish("error",e),ge()}function st(){if(!(!bt||de||w||De||x&&!O()))try{let e=t=>{a.focusAtReveal&&(k=ft(d)),B?.setHidden?.(!1),et?.(),x&&(R.showModal(),x.responsive&&R.focus({preventScroll:!0}),!t&&a.loading!=="host"&&Mt(R,x.type,x.responsive)),de=!0};D?D.present(()=>A.present(()=>e(!0))):A.present(e)}catch(e){ot(e),oe(e)}}try{if(Te.type==="inline"?(ze(),et=Ht(N,_),_.append(N)):(R.setAttribute("aria-label",m.document.name),E.textContent="\xD7",E.setAttribute("aria-label",o?"\u5173\u95ED":"Close"),Ut(E,m.document.screen.theme),E.hidden=Lt(m.document),R.append(E,N),_.append(R),x=_t(R,{...m.document.screen,presentation:Te},Xe),x.latch(),x.responsive&&(N.style.display="flex",N.style.flexDirection="column",N.style.maxHeight="100%",he.style.overflow="clip",he.style.minHeight="0"),et=Vt(R)),Ge&&W){let n=Ge(W);if(typeof n=="function"&&(w?G(n):Ze=n),w)throw new DOMException("Presentation cancelled","AbortError");ze()}B=Y(he,{mode:"live",rendererUrl:i.webViewUrl,title:m.document.name,closeActions:Yt,onAuthoredClose(n){ee||w||(E.hidden=n)},hostPresentation:()=>x?.type??Te.type,reportContentHeight:x?.responsive,onResize:n=>{if(!x?.responsive)return;let r=Math.min(n,Ke);he.style.height=`${r}px`,x.setContentHeight(r+(ae??J).getBoundingClientRect().height)},onSelection(n){for(let[r,c]of Object.entries(n))typeof c=="number"&&typeof q[r]=="number"&&q[r]!==c&&Ct.add(r);q=n,ve()},onAction(n,r={},c,g){if(!de||w||ee)return;let l=i.view,s=l?.document.buttons[n];if(!s)return;if(s.type==="close"&&D&&a.resumeCheckout&&i.operation&&St(T(i.operation))){$e();return}if(ie)return;if(!O()){it();return}if(s.type==="close"){j(async()=>{await a.onAction?.(n),ge(a.onAction?"action":"dismiss")});return}if(s.type==="action"){p=async()=>{if(s.action.type==="event"){if(!a.onEvent)throw new P("EVENT_HANDLER_REQUIRED","Provide the event handler");await a.onEvent(s.action.event)}else a.onOpenUrl?await a.onOpenUrl(s.action.url):d.defaultView?.location.assign(s.action.url);await a.onAction?.(n),p=null},j(p);return}if(a.allowNewPurchase===!1){fe()&&l&&i.quote&&i.operation&&T(i.operation).type==="checkout"&&Me(i.quote,l,n,s.product,r,g)?j(rt,n):f.textContent=o?"\u5F53\u524D\u53EA\u80FD\u7EE7\u7EED\u539F\u8BA2\u5355\u3002":"Only your original checkout is available.";return}if(te&&i.canReselect===!1){f.textContent=o?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",x?.responsive||te.scrollIntoView?.({block:"nearest"}),te.querySelector("button")?.focus({preventScroll:!0});return}if(fe()&&K){K.selection.actionId===n&&j(()=>kt(!0),n);return}if(fe()&&a.terminateCheckout&&l&&i.quote&&i.operation&&i.canReselect===!1&&T(i.operation).type==="checkout"){if(Me(i.quote,l,n,s.product,r,g)){j(rt,n);return}let V=ue(s.product,r,l.capabilities);try{if(!V)throw new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");pe(l.document.screen,V,r,l.capabilities)}catch(ce){oe(ce);return}let se=i.operation.operationId,ne={actionId:n,requestId:crypto.randomUUID(),selection:structuredClone(r)},H=Ne(l,n,V,r,g);j(()=>Kt(se,ne,H),n);return}if((i.quote||b)&&i.canReselect===!1){let V=!!l&&!!i.quote&&Me(i.quote,l,n,s.product,r,g);_e=!!i.quote&&!V,p=i.quote?()=>at(V):xe,j(p);return}let L=l&&ue(s.product,r,l.capabilities);if(!l||!L){oe(new P("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(a.onPurchaseIntent){p=null,j(async()=>{let V={actionId:n,productVersionId:L,selection:structuredClone(r),featureQuantities:pe(l.document.screen,L,r,l.capabilities)};tt=!0,await a.onPurchaseIntent(V)});return}if(b&&b.actionId!==n){oe(new P("COMMAND_PENDING","Finish the current purchase"));return}b||(F=Ne(l,n,L,r,g),b={requestId:crypto.randomUUID(),actionId:n,selection:structuredClone(r)},ye=!1,we=!1),j(xe,n)},onEscape:()=>{$e()},onError:n=>{let r=new Error(n);!de&&!w&&ot(r),oe(r)},onRendered:n=>{n&&R.setAttribute("aria-label",n),bt=!0,st()}}),B.setHidden?.(!0),Xe();let e=fe()&&!!i.quote&&!!i.operation&&T(i.operation).type==="checkout";q=i.quote?Gt(m,i.quote)??Fe(m,{}):Fe(m,{}),B.update(m.document.screen,We,{capabilities:me(m),unavailableActions:ht(m),serverInput:{bindings:[],answers:{}},...Object.keys(q).length?{selection:q}:{}}),wt=i.subscribe?.(Se),Se(i.view??m),await A.wait(B.ready);let t=i.operation;!e&&(i.quote||t&&(t.confirmedAt||t.checkoutUrl||Re(t)))&&(p=It,j(p))}catch(e){throw ot(e),e}return{check:Z,host:{get observing(){return Ye},get recovery(){return Jt()},async prepareFallback(){if(ie||w||ee||tt)return{type:"recover",operationId:i.operation?.operationId??i.quote?.operationId??null,requestId:null};ke(!0);try{let e=await Dt(i);return e.type==="native"&&ge(),e}finally{ke(!1)}},setSuspended(e){De=e,N.hidden=e,e&&R.open?R.close():!e&&!de?st():!e&&!w&&de&&Te.type!=="inline"&&!R.open&&R.showModal()},destroy:ge,refresh:async()=>{if(!O()){if(i.view)return i.view;throw new P("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await i.refresh();return Se(e),st(),e}}}}export{_n as showPaywall};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as a}from"./chunk-67SIVUOS.js";import"./chunk-PBZSOTKZ.js";import"./chunk-HLCDAU5A.js";import"./chunk-DCZWNTG2.js";import"./chunk-ASL7TJFU.js";import"./chunk-RDUKCMST.js";import"./chunk-KP4QI4RX.js";import"./chunk-5TJISOWN.js";import"./chunk-VILB5M4X.js";import"./chunk-LUGZNBIW.js";import"./chunk-LSVTH3TS.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-3VUPVXAV.js";import"./chunk-ZICZN6WO.js";import"./chunk-GPJF3T43.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-QHWR5UHD.js";import"./chunk-MEDW4N3F.js";import"./chunk-LZ3OJYBY.js";import"./chunk-NVF54BDR.js";import"./chunk-AV2WZSII.js";import"./chunk-MPD3UIY4.js";import"./chunk-67SIVUOS.js";import"./chunk-PBZSOTKZ.js";import"./chunk-HLCDAU5A.js";import"./chunk-DCZWNTG2.js";import"./chunk-ASL7TJFU.js";import"./chunk-B4AELNLE.js";import"./chunk-AQONMY2H.js";import"./chunk-RDUKCMST.js";import"./chunk-KP4QI4RX.js";import"./chunk-5TJISOWN.js";import"./chunk-VILB5M4X.js";import"./chunk-FTGRTYBL.js";import"./chunk-LUGZNBIW.js";import"./chunk-LSVTH3TS.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-3VUPVXAV.js";import"./chunk-ZICZN6WO.js";import"./chunk-GPJF3T43.js";import"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
|
package/dist/popup.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as ScreenAction, c as ScreenNode, d as ScreenInteractivity, e as ScreenDocument } from './screen-qUBRsUi9.js';
|
|
2
2
|
import { O as Offer, a as OfferUnavailableReason } from './coupon-kfkIVf9n.js';
|
|
3
|
-
import { e as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, f as ScreenParameters, g as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent } from './presentation-loading-
|
|
4
|
-
export { d as PresentationState } from './presentation-loading-
|
|
3
|
+
import { e as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, f as ScreenParameters, g as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent } from './presentation-loading-B2OeFzRN.js';
|
|
4
|
+
export { d as PresentationState } from './presentation-loading-B2OeFzRN.js';
|
|
5
5
|
import { WindowLike } from 'dompurify';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
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-S7A3IBAF.js";import"./chunk-P6TNBX2S.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-GPJF3T43.js";import"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.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.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { f as createCustomerClient, d as createFunnelClient } from './funnel-process-client-
|
|
2
|
-
export { F as FunnelProcessAdapter, a as FunnelProcessOptions, c as createFunnelProcess } from './funnel-process-client-
|
|
3
|
-
import { I as IndianaOptions,
|
|
4
|
-
export { F as FunnelCommandStorage,
|
|
1
|
+
import { f as createCustomerClient, d as createFunnelClient } from './funnel-process-client-DNR9nHs8.js';
|
|
2
|
+
export { F as FunnelProcessAdapter, a as FunnelProcessOptions, c as createFunnelProcess } from './funnel-process-client-DNR9nHs8.js';
|
|
3
|
+
import { I as IndianaOptions, S as SessionCredentials, N as Scope, B as createFunnelRunController, x as PaywallStartInput, l as createPaywallSession } from './funnel-local-client-BMxDQWE6.js';
|
|
4
|
+
export { F as FunnelCommandStorage, g as FunnelRunController, u as LocalFunnelClientOptions, v as LongplayError, w as PaywallPurchaseInput, P as PaywallSession, y as PushHost, z as PushJournal, A as createFeatureClient, D as createLocalFunnelClient } from './funnel-local-client-BMxDQWE6.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { J as JsonValue } from './growth-rules-B4YYy64R.js';
|
|
7
|
-
export {
|
|
8
|
-
import './api-
|
|
7
|
+
export { a as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-7ruSsSrL.js';
|
|
8
|
+
import './api-DpRb_Pd3.js';
|
|
9
9
|
import './screen-qUBRsUi9.js';
|
|
10
10
|
import 'zod/v4';
|
|
11
11
|
import './coupon-kfkIVf9n.js';
|
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-SVLEVNHP.js";import"./chunk-RJY5CUTB.js";import{a as A}from"./chunk-QHWR5UHD.js";import{e as P}from"./chunk-MEDW4N3F.js";import"./chunk-LZ3OJYBY.js";import{h as b,i as x,k as L}from"./chunk-2EVGXJ4R.js";import{E as C}from"./chunk-ANXDWUPK.js";import"./chunk-NVF54BDR.js";import"./chunk-AV2WZSII.js";import"./chunk-MPD3UIY4.js";import"./chunk-67SIVUOS.js";import"./chunk-PBZSOTKZ.js";import"./chunk-HLCDAU5A.js";import"./chunk-DCZWNTG2.js";import"./chunk-CALDEF4M.js";import"./chunk-ASL7TJFU.js";import"./chunk-B4AELNLE.js";import"./chunk-AQONMY2H.js";import"./chunk-RDUKCMST.js";import"./chunk-KP4QI4RX.js";import"./chunk-5TJISOWN.js";import"./chunk-VILB5M4X.js";import"./chunk-FTGRTYBL.js";import"./chunk-LUGZNBIW.js";import"./chunk-LSVTH3TS.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import{a as r}from"./chunk-TL67SYPH.js";import{h as R}from"./chunk-6XRXHFM6.js";import"./chunk-3VUPVXAV.js";import"./chunk-ZICZN6WO.js";import"./chunk-GPJF3T43.js";import"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.js";import"./chunk-WOT6VMZA.js";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-S7A3IBAF.js";import"./chunk-P6TNBX2S.js";import"./chunk-7MYS52FL.js";import"./chunk-MWICFZUF.js";import"./chunk-CWD36SJO.js";import"./chunk-5JRBCW6V.js";import"./chunk-3SXPCVIP.js";import"./chunk-TL67SYPH.js";import"./chunk-6XRXHFM6.js";import"./chunk-GPJF3T43.js";import"./chunk-DSPLGTQI.js";import"./chunk-C4NG6RVA.js";import"./chunk-WPFTSHP2.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};
|