@tinkerlandai/longplay-sdk 0.10.23 → 0.10.25
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 +1 -0
- package/README.md +79 -0
- package/README.zh-CN.md +31 -0
- package/dist/{ai-usage-WFwbPTiq.d.ts → ai-usage-B6RepnmH.d.ts} +1 -1
- package/dist/{api-rZ_QoNQi.d.ts → api-C9P338XT.d.ts} +1547 -6
- package/dist/{chunk-5SHVM4AF.js → chunk-2KI63SPJ.js} +2 -2
- package/dist/{chunk-7MF2YMN4.js → chunk-2ZJ5CS5Q.js} +1 -1
- package/dist/chunk-34I23EKZ.js +1 -0
- package/dist/{chunk-XFO4FBFG.js → chunk-5HJMAZ7A.js} +1 -1
- package/dist/chunk-7AXCG6NU.js +1 -0
- package/dist/chunk-BB5P5HPS.js +1 -0
- package/dist/chunk-C2BODHNY.js +1 -0
- package/dist/chunk-EIYWDWXP.js +1 -0
- package/dist/chunk-LFFBNGXP.js +1 -0
- package/dist/{chunk-HDVLCRC6.js → chunk-MHEYMXGZ.js} +2 -2
- package/dist/{chunk-EZLLTGV3.js → chunk-ML3BIPM6.js} +1 -1
- package/dist/{chunk-KZ63ANBP.js → chunk-O3LZPMS4.js} +1 -1
- package/dist/chunk-O4535GJR.js +6 -0
- package/dist/{chunk-PKLLZXNM.js → chunk-OEH47Y2L.js} +1 -1
- package/dist/chunk-RKREEPCT.js +1 -0
- package/dist/{chunk-QVGTHPWT.js → chunk-SJNF6JDJ.js} +1 -1
- package/dist/chunk-THGLNE4K.js +1 -0
- package/dist/chunk-TUYBXAAK.js +1 -0
- package/dist/chunk-ZX2RWS3T.js +1 -0
- package/dist/content-FD2Q6XD6.js +1 -0
- package/dist/{coupon-Btz_KFKp.d.ts → coupon-DyKA-BRG.d.ts} +8 -0
- package/dist/funnel-host-purchase-XW7IF52Y.js +1 -0
- package/dist/{funnel-local-client-BYdKGnMb.d.ts → funnel-local-client-CSA9XoC4.d.ts} +3270 -32
- package/dist/{funnel-node-evaluation-eLMEZIFz.d.ts → funnel-node-evaluation-Cg-4tcAs.d.ts} +88 -0
- package/dist/funnel-process-client-RXgS2i-R.d.ts +23184 -0
- package/dist/funnel-runtime-host-I6PJXVRC.js +1 -0
- package/dist/index.d.ts +1219 -31
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +2 -2
- package/dist/openrouter.js +1 -1
- package/dist/page.js +1 -1
- package/dist/paywall-CGBFHFRU.js +1 -0
- package/dist/popup.d.ts +3 -3
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-Ctk1djAi.d.ts → presentation-loading-D0A9G_kT.d.ts} +16 -2
- package/dist/react-native.d.ts +6 -6
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-WOMWOEYL.js +1 -0
- package/dist/server.d.ts +2402 -17
- package/dist/server.js +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3J24TUO7.js +0 -1
- package/dist/chunk-6DTGBDYG.js +0 -1
- package/dist/chunk-DUZ2E7BK.js +0 -1
- package/dist/chunk-IIYIIXNB.js +0 -1
- package/dist/chunk-KRQESEG2.js +0 -6
- package/dist/chunk-WMIDEJTZ.js +0 -1
- package/dist/chunk-YAVWELIV.js +0 -1
- package/dist/content-FM52HLRX.js +0 -1
- package/dist/funnel-process-client-C87pmLC9.d.ts +0 -64499
- package/dist/funnel-runtime-host-MZKLVLC4.js +0 -1
- package/dist/paywall-JL4SXFXT.js +0 -1
- package/dist/screen-renderer-TEVGVUT5.js +0 -1
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-C9P338XT.js';
|
|
4
|
+
import { c as createAiPricing, A as AiUsageContext, a as AiTokenUsage, b as AiTokenQuote } from './ai-usage-B6RepnmH.js';
|
|
5
5
|
import './screen-DRP7nsrQ.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import 'zod/v4';
|
package/dist/openrouter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-
|
|
1
|
+
import"./chunk-ML3BIPM6.js";import"./chunk-5HJMAZ7A.js";import{a as i}from"./chunk-SJNF6JDJ.js";import"./chunk-O4535GJR.js";import"./chunk-MHEYMXGZ.js";import{z as k}from"zod";var c=k.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:A}=await w.read();if(A){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};
|
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-O3LZPMS4.js";import"./chunk-OEH47Y2L.js";import"./chunk-2ZJ5CS5Q.js";import"./chunk-O4535GJR.js";import"./chunk-DSPLGTQI.js";import"./chunk-MHEYMXGZ.js";export{f as createPageExperiments,o as mergeQueryStrings,r as pageAttributes,e as readPayload};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as Ye,c as Je}from"./chunk-JGG4R75K.js";import{c as ze,d as He,e as Be,f as de,g as Qe,h as Ge,i as je,k as We}from"./chunk-ZX2RWS3T.js";import{a as qe,c as Ae,d as Ve,g as Fe}from"./chunk-RKREEPCT.js";import"./chunk-5HJMAZ7A.js";import{a as A}from"./chunk-SJNF6JDJ.js";import{Z as ee}from"./chunk-O4535GJR.js";import{a as z}from"./chunk-DSPLGTQI.js";import{La as te,Na as Me,j as Y,o as Ie,z as Z}from"./chunk-MHEYMXGZ.js";async function Ke(s,n,v){if(n.status!=="complete")throw new A("INVALID_RESPONSE","A verified completed purchase is required");let g=s?Z.parse(s):null;if(await v.onComplete?.(n),!g||!v.check)return;let y=Z.parse(await v.check());if(y.internal_feature_id!==g.internal_feature_id||y.quantity!==g.quantity||g.observation!==void 0&&(y.observation===void 0||y.observation.requirementDigest!==g.observation.requirementDigest||y.observation.authority!==g.observation.authority||Ie(y.observation.subject)!==Ie(g.observation.subject)))throw new A("INVALID_RESPONSE","The access requirement changed");y.allowed&&await v.onAccessGranted?.(y)}var st={none:0,sm:4,md:8,lg:14,full:9999},ct={system:"system-ui,sans-serif",serif:"Georgia,serif",rounded:"ui-rounded,system-ui,sans-serif",mono:"ui-monospace,monospace"};function lt(s){let[n,v,g]=[1,3,5].map(y=>{let x=Number.parseInt(s.slice(y,y+2),16)/255;return x<=.03928?x/12.92:((x+.055)/1.055)**2.4});return .2126*n+.7152*v+.0722*g}function Xe(s){let n=lt(s.primary),v=(n+.05)/.05>1.05/(n+.05)?"#111318":"#FFFFFF",g=`color-mix(in srgb, ${s.text} 22%, ${s.background})`,y=`${st[s.radius]}px`,x=`appearance:none;margin:0;min-height:44px;padding:10px 18px;border:0;border-radius:${y};font:inherit;font-size:15px;font-weight:600;line-height:1.25;cursor:pointer;touch-action:manipulation`;return{root:`width:100%;box-sizing:border-box;background:${s.background};color:${s.text};font:14px/1.5 ${ct[s.font]}`,controls:"display:flex;gap:12px;padding:0 20px 12px;align-items:center;flex-wrap:wrap",message:"flex:1 1 200px;min-width:0;margin:0;font-size:13px",panel:`flex:1 0 100%;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;padding:16px;border:1px solid ${g};border-radius:${y}`,summary:"margin:0;font-size:15px;font-weight:600",terms:"display:flex;flex-direction:column;gap:4px;font-size:13px;opacity:.72",actions:"display:flex;gap:8px;flex-wrap:wrap;margin-top:4px",primary:`${x};background:${s.primary};color:${v}`,secondary:`${x};background:transparent;color:${s.text};box-shadow:inset 0 0 0 1px ${g}`,link:`${x};background:transparent;color:${s.text};opacity:.72;font-weight:500`}}function Re(s){s.style.opacity=s.disabled?".55":"",s.style.cursor=s.disabled?"not-allowed":"pointer"}function Se(s){return Object.entries(s.document.buttons).filter(([,n])=>n.type==="checkout"&&n.product.type==="fixed"&&!ee(n.product,{},s.capabilities)).map(([n])=>n)}async function Rt(s,n,v){let g=We(s.ownerDocument),y=()=>{C.finish("dismissed"),g()},x=()=>y(),C=Qe(s,n,"paywall",()=>{y(),z(n.onDismiss)});n.signal?.throwIfAborted(),n.signal?.addEventListener("abort",x,{once:!0});let H=null,N,b,Te;try{if(C.start(!0),C.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(H=n.check?Z.parse(await C.wait(n.check(),de)):null,H?.allowed)return C.finish("skipped"),n.signal?.removeEventListener("abort",x),g(),await n.onAccessGranted?.(H),{check:H,host:null};let[e,t]=await Promise.allSettled([C.wait(import("./screen-renderer-WOMWOEYL.js")),C.wait(n.start().then(d=>(C.cancelled&&d.destroy(),d)),de)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;Te=e.value,N=t.value,n.signal?.throwIfAborted(),N.signal?.throwIfAborted(),N.signal?.addEventListener("abort",x,{once:!0});let o=N.view??await C.wait(N.refresh(),de);if(!o)throw new A("INVALID_RESPONSE","Paywall presentation is missing");N.signal?.throwIfAborted(),b=o}catch(e){throw C.finish("error",e),n.signal?.removeEventListener("abort",x),N?.signal?.removeEventListener("abort",x),N?.destroy(),g(),e}let r=N,{mountScreenPreview:Ze}=Te,u=s.ownerDocument,pe=new AbortController,L=u.createElement("section"),fe=u.createElement("div"),M=u.createElement("div"),m=u.createElement("p"),f=u.createElement("button"),P=u.createElement("button"),w=u.createElement("dialog"),i=b.document.screen.strings.defaultLocale.startsWith("zh"),et=i?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",tt=i?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",O=Xe(b.document.screen.theme);L.dataset.indianaPaywall="",L.setAttribute("aria-label",b.document.name),L.style.cssText=O.root,M.style.cssText=O.controls,m.style.cssText=O.message,m.setAttribute("role","status"),P.style.cssText=O.link,P.textContent=i?"\u5173\u95ED":"Close",f.style.cssText=O.secondary,f.textContent=i?"\u91CD\u8BD5":"Retry",f.hidden=!0,M.append(m,f,P),L.append(fe,M);let B=b.document.presentation,Q,Oe,me=!1,De=JSON.stringify(b.capabilities);function he(e){if(p)return;b=e;let t=JSON.stringify(e.capabilities);t!==De&&(Q?.updateCapabilities(e.capabilities,Se(e)),De=t),rt(e)}let R;function Ne(){let e=u.defaultView;R?.responsive&&e&&Q?.resizeViewport?.(e.innerHeight,e.innerWidth)}let p=!1,J=!1,E=null,ne=!1,Le=!1,q=!1,ye,we=!1,$,G;function nt(){return J||p||$||we?{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null}:Ae(r)}let S=()=>!p&&!ne&&!$&&n.canInteract?.()!==!1,ge=!1,c=null,U=null;function rt(e){J||E||r.quote||r.operation||(m.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":i?"\u5F53\u524D\u8D26\u53F7\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u65B9\u6848\u3002":"No plans are currently available for this account.")}let be=new Map,re=e=>qe({quote:r.quote,operation:e,requestId:null,pending:!1,destroyed:p,canReselect:r.canReselect});async function ve(e){let t=e.merchantExecution;if(!(!S()||!e.checkoutUrl||n.checkoutNavigation==="after_confirmation"&&re(e).type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||be.get(e.operationId)===e.checkoutUrl)){be.set(e.operationId,e.checkoutUrl);try{n.onCheckoutUrl?await n.onCheckoutUrl(e.checkoutUrl):u.defaultView?.location.assign(e.checkoutUrl)}catch(o){throw be.delete(e.operationId),o}}}let j=(e,t=!1)=>{if(t){let o=e instanceof A?e.code:void 0;o==="CAPABILITY_UNAVAILABLE"||o==="NOT_CONFIGURED"?(c=null,m.textContent=i?"\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."):o==="COMMAND_PENDING"?m.textContent=i?"\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.":m.textContent=i?"\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 m.textContent=e instanceof Error?e.message:i?"\u8BF7\u6C42\u5931\u8D25":"Request failed";f.hidden=c===null,t&&m.scrollIntoView?.({block:"nearest"}),z(t&&v?.quoteError?v.quoteError:n.onError,e)},ie=new WeakMap;function ae(e){J=e;for(let t of U?.querySelectorAll("button")??[])e?(ie.set(t,t.disabled),t.disabled=!0):ie.has(t)&&(t.disabled=ie.get(t),ie.delete(t)),Re(t)}function xe(){m.textContent=i?"\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 it(e){if(n.beforeAction)try{await n.beforeAction()}catch(t){throw c=e,t}}async function _(e){if(J||p)return;if(!S()){xe();return}let t=e===se,o=t?tt:et;ae(!0),f.hidden=!0,m.textContent=o,t&&m.scrollIntoView?.({block:"nearest"});try{if(await it(e),p)return;if(!S()){c=e,f.hidden=!1,xe();return}await e()}catch(d){p||j(d,t)}finally{ae(!1),m.textContent===o&&(m.textContent="")}}async function at(e){await Ke(H,e,n)}function Ue(e){return Ae(r).type==="recording"||re(e).type==="recording"}async function k(e,t=n.checkoutNavigation!=="after_confirmation"){if(p)return;if(!S()){c=async()=>k(await r.read()),f.hidden=!1;return}if(m.textContent=Je(e.status,i),Ue(e)){let a=e.merchantExecution?.type==="purchase"&&e.merchantExecution.recordingStatus==="failed";m.textContent=a?i?"\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.":i?"\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.",f.textContent=i?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",c=async()=>k(await r.read()),f.hidden=!1;return}if(e.problem){let a=e.problem;c=oe,f.textContent=i?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",j(new A(a.code,a.reason==="RESULT_UNKNOWN"?i?"\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.":a.phase==="fulfillment"?i?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":a.code==="CAPABILITY_UNAVAILABLE"?i?"\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.":a.code==="NOT_CONFIGURED"?i?"\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.":i?"\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,a));return}if(e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(m.textContent=i?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),e.status==="complete"){c=null,await at(e);return}if(e.status!=="pending"){if(r.canReselect===!1){m.textContent=i?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",f.textContent=i?"\u67E5\u8BE2\u7ED3\u679C":"Check result",c=async()=>k(await r.read()),f.hidden=!1;return}f.textContent=i?"\u91CD\u8BD5":"Retry",c=null,E=null;return}if(!t&&re(e).type==="checkout"){m.textContent=i?"\u539F\u4ED8\u6B3E\u5C1A\u672A\u5B8C\u6210\uFF0C\u53EF\u7EE7\u7EED\u539F\u6536\u94F6\u53F0\u3002":"Payment is unfinished. Continue the original checkout.",f.textContent=i?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout",c=async()=>k(await r.read(),!0),f.hidden=!1;return}await ve(e);let o=Date.now()+6e5,d=2e3;me=!0,z(n.onObservationChange,!0);try{for(;!p&&Date.now()<o;){if(await Ye(d,u,pe.signal),p)return;if(!S()){c=async()=>k(await r.read()),f.hidden=!1;return}let a=await r.read();if(!t&&re(a).type==="checkout"){await k(a,!1);return}if(!a.problem&&a.status==="pending"&&await ve(a),a.status!=="pending"||a.problem||Ue(a)){await k(a);return}d=Math.min(d*1.5,3e4)}}finally{me=!1,z(n.onObservationChange,!1)}c=async()=>k(await r.read()),f.hidden=!1}async function Ce(){let e=await r.read();if(p)return;if(!S()){c=Ce,f.hidden=!1;return}let t=r.quote;if(t&&Fe(e,{operationId:t.operationId,currency:t.currency},"The original purchase operation changed"),t&&e.status==="pending"&&e.quoteFinalized===!1&&!e.confirmedAt&&!e.checkoutUrl&&!e.nativePurchase&&!e.merchantExecution&&!e.problem&&!r.pendingCancellation){_e(t);return}await k(e)}async function oe(){U?.remove(),U=null,c=oe;let e=await r.confirm();if(!S()){c=oe,f.hidden=!1;return}if(e.problem){await k(e);return}if(e.status==="pending"){if(e.checkoutUrl)await ve(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!n.onPurchase)throw new A("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await n.onPurchase({operation:e,signal:pe.signal})}}c=async()=>k(await r.read()),await k(e,!0)}function _e(e){U?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());m.textContent=t?i?"\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 o=u.createElement("div"),d=u.createElement("button"),a=u.createElement("button"),V=u.createElement("div"),K=u.createElement("p"),T=e.merchantTerms,ce=T?T.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),le=i?"zh-CN":"en",ue=T?.subscriptionTerms?.items??[],X=T?ue.length===1&&ue[0]?.amountMinor===ce&&ue[0]:e.lines.length===1&&e.lines[0]?.catalogAmountMinor===ce&&e.lines[0];K.textContent=e.lines.map(l=>l.productName).join(", ")+" \xB7 "+(ce===null?i?`${Y(T.subtotalMinor-T.discountMinor,e.currency)} + \u5F85\u786E\u8BA4\u7A0E\u8D39`:`${Y(T.subtotalMinor-T.discountMinor,e.currency)} + tax confirmed at checkout`:Y(ce,e.currency)+(X?te(X.interval,le,X.intervalCount??1):"")),d.textContent=i?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",d.disabled=t,a.textContent=i?"\u53D6\u6D88":"Cancel",o.style.cssText=O.panel,K.style.cssText=O.summary,V.style.cssText=O.actions,d.style.cssText=O.primary,a.style.cssText=O.secondary,Re(d),d.onclick=()=>{_(oe)};let $e=async()=>{let l=await r.cancel();p||(o.remove(),U=null,await k(l))};a.onclick=()=>{c=$e,_($e)};let D=u.createElement("div");if(D.style.cssText=O.terms,T){for(let h of ue){if(h===X)continue;let I=u.createElement("p");I.textContent=Y(h.amountMinor,e.currency)+te(h.interval,le,h.intervalCount),D.append(I)}let l=T.subscriptionTerms?.trial;if(l){let h=u.createElement("p");h.textContent=i?`\u8BD5\u7528 ${l.days} \u5929\uFF1B${l.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${l.days}; ${l.cardRequired?"a payment method is required":"no payment method is required"}`,D.append(h)}for(let h of[...T.expectedEffects.map(I=>I.description),...T.requiredConsents.map(I=>I.summary)]){let I=u.createElement("p");I.textContent=h,D.append(I)}}else{for(let l of e.lines){if(l!==X){let h=u.createElement("p");h.textContent=`${l.productName} \xB7 ${Y(l.catalogAmountMinor,e.currency)}${te(l.interval,le,l.intervalCount??1)}`,D.append(h)}for(let h of l.prepaid??[]){let I=u.createElement("p"),F=r.view?.capabilities.plans[l.productVersionId]?.prepaid?.find(ot=>ot.internalFeatureId===h.internal_feature_id);I.textContent=`${F?.name??h.internal_feature_id} \xB7 ${h.quantity} ${i?"\u4EFD":"packs"} \xD7 ${h.terms.units}`,F&&(I.textContent+=te(F.reset==="week"||F.reset==="month"||F.reset==="year"?F.reset:"one_time",le,F.resetCount)),D.append(I)}if(l.trial){let h=u.createElement("p");h.textContent=i?`\u8BD5\u7528 ${l.trial.days} \u5929\uFF1B${l.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${l.trial.days}; ${l.trial.cardRequired?"a payment method is required":"no payment method is required"}`,D.append(h)}}if(!e.charge){let l=u.createElement("p");l.textContent=i?"\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.",D.append(l)}}for(let l of D.children)l.style.margin="0";V.append(d,a),o.append(K,...D.childElementCount?[D]:[],V),M.prepend(o),o.scrollIntoView?.({block:"nearest"}),d.focus({preventScroll:!0}),U=o,c=null}async function se(){if(!E)return;if(c=se,!ge){let t=r.view,o=t?.document.buttons[E.actionId],d=t&&o?.type==="checkout"?ee(o.product,E.selection,t.capabilities):null;if(!d)throw new A("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let a=await n.resolveOfferId?.({actionId:E.actionId,productVersionId:d});if(p)return;a!==void 0&&(E.offerId=a),ge=!0}if(!S()){f.hidden=!1;return}let e=await r.preview(E);p||_e(e)}function W(e="destroy"){p||(p=!0,n.signal?.removeEventListener("abort",x),r.signal?.removeEventListener("abort",x),C.finish("dismissed"),Oe?.(),pe.abort(),R?.destroy(),Q?.destroy(),r.destroy(),w.open&&w.close(),w.remove(),L.remove(),g(),e==="dismiss"&&z(n.onDismiss))}y=W;async function Pe(){if(!q||p||ne||$==="closing"||!$&&!S())return;if(!v){W("dismiss");return}let e=u.createElement("p");e.setAttribute("role","status"),e.textContent=i?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",G||(G=u.createElement("div"),G.style.cssText=M.style.cssText,M.replaceWith(G),fe.inert=!0),G.replaceChildren(e,P),$="closing",P.setAttribute("aria-disabled","true"),P.focus({preventScroll:!0});try{await v.dismiss()}catch(t){p||z(n.onError,t)}p||($="retry",e.textContent=i?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",P.textContent=i?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",P.removeAttribute("aria-label"),P.removeAttribute("aria-disabled"))}P.onclick=()=>{Pe()},w.addEventListener("cancel",e=>{e.preventDefault(),Pe()}),f.onclick=()=>{c&&_(c)};function Ee(e){C.finish("error",e),W()}function ke(){if(!(!Le||q||p||ne||R&&!S()))try{let e=t=>{ye?.(),R&&(w.showModal(),R.responsive&&w.focus({preventScroll:!0}),!t&&n.loading!=="host"&&He(w,R.type,R.responsive)),q=!0};v?v.present(()=>C.present(()=>e(!0))):C.present(e)}catch(e){Ee(e),j(e)}}try{if(B.type==="inline")ye=je(L,s),s.append(L);else{let t={sm:420,md:640,lg:900};w.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in B?t[B.size]+"px":"100vw"}`,w.setAttribute("aria-label",b.document.name),P.textContent="\xD7",P.setAttribute("aria-label",i?"\u5173\u95ED":"Close"),Be(P,b.document.screen.theme),w.append(P,L),s.append(w),R=ze(w,{...b.document.screen,presentation:B},Ne),R.latch(),ye=Ge(w)}Q=Ze(fe,{mode:"live",rendererUrl:r.webViewUrl,title:b.document.name,hostPresentation:()=>R?.type??B.type,onResize:t=>{R?.responsive&&R.setContentHeight(t+(G??M).getBoundingClientRect().height)},onAction(t,o={}){if(!q||p||$)return;if(!S()){xe();return}let d=r.view,a=d?.document.buttons[t];if(!a)return;if(a.type==="close"){_(async()=>{await n.onAction?.(t),W(n.onAction?"action":"dismiss")});return}if(a.type==="action"){c=async()=>{if(a.action.type==="event"){if(!n.onEvent)throw new A("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(a.action.event)}else n.onOpenUrl?await n.onOpenUrl(a.action.url):u.defaultView?.location.assign(a.action.url);await n.onAction?.(t),c=null},_(c);return}if(U&&r.canReselect===!1){m.textContent=i?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",U.scrollIntoView?.({block:"nearest"}),U.querySelector("button")?.focus({preventScroll:!0});return}if((r.quote||E)&&r.canReselect===!1){c=r.quote?Ce:se,_(c);return}let V=d&&ee(a.product,o,d.capabilities);if(!d||!V){j(new A("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(n.onPurchaseIntent){c=null,_(async()=>{let K={actionId:t,productVersionId:V,selection:structuredClone(o),featureQuantities:Me(d.document.screen,V,o,d.capabilities)};we=!0,await n.onPurchaseIntent(K)});return}if(E&&E.actionId!==t){j(new A("COMMAND_PENDING","Finish the current purchase"));return}E||(E={requestId:crypto.randomUUID(),actionId:t,selection:o},ge=!1),_(se)},onEscape:()=>{Pe()},onError:t=>{let o=new Error(t);!q&&!p&&Ee(o),j(o)},onRendered:t=>{t&&w.setAttribute("aria-label",t),Le=!0,ke()}}),Ne(),Q.update(b.document.screen,b.document.screen.strings.defaultLocale,{capabilities:b.capabilities,unavailableActions:Se(b),serverInput:{bindings:[],answers:{}}}),Oe=r.subscribe?.(he),he(r.view??b),await C.wait(Q.ready);let e=r.operation;(r.quote||e&&(e.confirmedAt||e.checkoutUrl||e.status==="complete"))&&(c=Ce,_(c))}catch(e){throw Ee(e),e}return{check:H,host:{get observing(){return me},get recovery(){return nt()},async prepareFallback(){if(J||p||$||we)return{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null};ae(!0);try{let e=await Ve(r);return e.type==="native"&&W(),e}finally{ae(!1)}},setSuspended(e){ne=e,L.hidden=e,e&&w.open?w.close():!e&&!q?ke():!e&&!p&&q&&B.type!=="inline"&&!w.open&&w.showModal()},destroy:W,refresh:async()=>{if(!S()){if(r.view)return r.view;throw new A("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await r.refresh();return he(e),ke(),e}}}}export{Rt as showPaywall};
|
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-DRP7nsrQ.js';
|
|
2
|
-
import { O as Offer, a as OfferUnavailableReason } from './coupon-
|
|
3
|
-
import {
|
|
4
|
-
export { b as PresentationState } from './presentation-loading-
|
|
2
|
+
import { O as Offer, a as OfferUnavailableReason } from './coupon-DyKA-BRG.js';
|
|
3
|
+
import { d as CustomerPageData, a as SurfaceData, P as PresentationLoadingOptions, e as ScreenParameters, f as ScreenRendererInput, S as ScreenAnswers, C as CustomerDataIntent } from './presentation-loading-D0A9G_kT.js';
|
|
4
|
+
export { b as PresentationState } from './presentation-loading-D0A9G_kT.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-2KI63SPJ.js";import"./chunk-ZX2RWS3T.js";import"./chunk-SJNF6JDJ.js";import"./chunk-DSPLGTQI.js";import"./chunk-MHEYMXGZ.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};
|
|
@@ -393,8 +393,8 @@ declare const customerPageDataSchema: z.ZodObject<{
|
|
|
393
393
|
}>;
|
|
394
394
|
status: z.ZodEnum<{
|
|
395
395
|
error: "error";
|
|
396
|
-
idle: "idle";
|
|
397
396
|
loading: "loading";
|
|
397
|
+
idle: "idle";
|
|
398
398
|
ready: "ready";
|
|
399
399
|
}>;
|
|
400
400
|
stale: z.ZodBoolean;
|
|
@@ -517,5 +517,19 @@ type PresentationLoadingOptions = {
|
|
|
517
517
|
/** Abort on unmount or Customer change, including while data is pending. */
|
|
518
518
|
signal?: AbortSignal;
|
|
519
519
|
};
|
|
520
|
+
/** One loading cycle. No authored content or controls are exposed during it. */
|
|
521
|
+
declare function createPresentationLoading(container: HTMLElement | ShadowRoot, options: PresentationLoadingOptions, surface: Surface, onDismiss: () => void): {
|
|
522
|
+
setDismissHandler(handler: () => void): void;
|
|
523
|
+
readonly active: boolean;
|
|
524
|
+
readonly cancelled: boolean;
|
|
525
|
+
start(modal: boolean, locale?: string): void;
|
|
526
|
+
/** Remove the placeholder and reveal in the same turn, before notifying the host. */
|
|
527
|
+
present(show: (hadPlaceholder: boolean) => void): void;
|
|
528
|
+
dismiss: () => void;
|
|
529
|
+
finish: (state: Exclude<PresentationState, {
|
|
530
|
+
state: "loading";
|
|
531
|
+
}>["state"], error?: unknown) => void;
|
|
532
|
+
wait<T>(work: Promise<T>, timeoutMs?: number): Promise<T>;
|
|
533
|
+
};
|
|
520
534
|
|
|
521
|
-
export { type CustomerDataIntent as C, type PresentationLoadingOptions as P, type ScreenAnswers as S, type SurfaceData as a, type PresentationState as b, type CustomerPageData as
|
|
535
|
+
export { type CustomerDataIntent as C, type PresentationLoadingOptions as P, type ScreenAnswers as S, type SurfaceData as a, type PresentationState as b, createPresentationLoading as c, type CustomerPageData as d, type ScreenParameters as e, type ScreenRendererInput as f, screenInputBindingsSchema as s };
|
package/dist/react-native.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 { c as FunnelCommandStorage, F as FunnelRunController,
|
|
1
|
+
import { f as createCustomerClient, d as createFunnelClient } from './funnel-process-client-RXgS2i-R.js';
|
|
2
|
+
export { F as FunnelProcessAdapter, a as FunnelProcessOptions, c as createFunnelProcess } from './funnel-process-client-RXgS2i-R.js';
|
|
3
|
+
import { I as IndianaOptions, d as SessionCredentials, E as Scope, y as createFunnelRunController, u as PaywallStartInput, A as createPaywallSession } from './funnel-local-client-CSA9XoC4.js';
|
|
4
|
+
export { c as FunnelCommandStorage, F as FunnelRunController, q as LocalFunnelClientOptions, r as LongplayError, t as PaywallPurchaseInput, P as PaywallSession, v as PushHost, w as PushJournal, x as createFeatureClient, z as createLocalFunnelClient } from './funnel-local-client-CSA9XoC4.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { J as JsonValue } from './growth-rules-B4YYy64R.js';
|
|
7
7
|
export { C as ConfigurationStorage, b as ConfigurationSyncOptions, c as createConfigurationSync } from './configuration-sync-eEFj_oKG.js';
|
|
8
|
-
import './api-
|
|
8
|
+
import './api-C9P338XT.js';
|
|
9
9
|
import './screen-DRP7nsrQ.js';
|
|
10
10
|
import 'zod/v4';
|
|
11
|
-
import './coupon-
|
|
11
|
+
import './coupon-DyKA-BRG.js';
|
|
12
12
|
|
|
13
13
|
/** The autolinked IndianaBridge module. It accepts Customer credentials only. */
|
|
14
14
|
interface IndianaReactNativeModule {
|
package/dist/react-native.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as S,c as A,d as T}from"./chunk-
|
|
1
|
+
import{b as S,c as A,d as T}from"./chunk-BB5P5HPS.js";import"./chunk-THGLNE4K.js";import{c as b,d as E,e as x,g as L}from"./chunk-TUYBXAAK.js";import{q as C}from"./chunk-LFFBNGXP.js";import"./chunk-RKREEPCT.js";import"./chunk-5HJMAZ7A.js";import{a as r}from"./chunk-SJNF6JDJ.js";import"./chunk-2ZJ5CS5Q.js";import{Da as P}from"./chunk-O4535GJR.js";import"./chunk-DSPLGTQI.js";import{a as R}from"./chunk-MHEYMXGZ.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 A({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return E(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-2KI63SPJ.js";import"./chunk-ZX2RWS3T.js";import"./chunk-SJNF6JDJ.js";import"./chunk-DSPLGTQI.js";import"./chunk-MHEYMXGZ.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};
|