@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.
Files changed (60) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +79 -0
  3. package/README.zh-CN.md +31 -0
  4. package/dist/{ai-usage-WFwbPTiq.d.ts → ai-usage-B6RepnmH.d.ts} +1 -1
  5. package/dist/{api-rZ_QoNQi.d.ts → api-C9P338XT.d.ts} +1547 -6
  6. package/dist/{chunk-5SHVM4AF.js → chunk-2KI63SPJ.js} +2 -2
  7. package/dist/{chunk-7MF2YMN4.js → chunk-2ZJ5CS5Q.js} +1 -1
  8. package/dist/chunk-34I23EKZ.js +1 -0
  9. package/dist/{chunk-XFO4FBFG.js → chunk-5HJMAZ7A.js} +1 -1
  10. package/dist/chunk-7AXCG6NU.js +1 -0
  11. package/dist/chunk-BB5P5HPS.js +1 -0
  12. package/dist/chunk-C2BODHNY.js +1 -0
  13. package/dist/chunk-EIYWDWXP.js +1 -0
  14. package/dist/chunk-LFFBNGXP.js +1 -0
  15. package/dist/{chunk-HDVLCRC6.js → chunk-MHEYMXGZ.js} +2 -2
  16. package/dist/{chunk-EZLLTGV3.js → chunk-ML3BIPM6.js} +1 -1
  17. package/dist/{chunk-KZ63ANBP.js → chunk-O3LZPMS4.js} +1 -1
  18. package/dist/chunk-O4535GJR.js +6 -0
  19. package/dist/{chunk-PKLLZXNM.js → chunk-OEH47Y2L.js} +1 -1
  20. package/dist/chunk-RKREEPCT.js +1 -0
  21. package/dist/{chunk-QVGTHPWT.js → chunk-SJNF6JDJ.js} +1 -1
  22. package/dist/chunk-THGLNE4K.js +1 -0
  23. package/dist/chunk-TUYBXAAK.js +1 -0
  24. package/dist/chunk-ZX2RWS3T.js +1 -0
  25. package/dist/content-FD2Q6XD6.js +1 -0
  26. package/dist/{coupon-Btz_KFKp.d.ts → coupon-DyKA-BRG.d.ts} +8 -0
  27. package/dist/funnel-host-purchase-XW7IF52Y.js +1 -0
  28. package/dist/{funnel-local-client-BYdKGnMb.d.ts → funnel-local-client-CSA9XoC4.d.ts} +3270 -32
  29. package/dist/{funnel-node-evaluation-eLMEZIFz.d.ts → funnel-node-evaluation-Cg-4tcAs.d.ts} +88 -0
  30. package/dist/funnel-process-client-RXgS2i-R.d.ts +23184 -0
  31. package/dist/funnel-runtime-host-I6PJXVRC.js +1 -0
  32. package/dist/index.d.ts +1219 -31
  33. package/dist/index.js +1 -1
  34. package/dist/native-shell.js +1 -1
  35. package/dist/openrouter.d.ts +2 -2
  36. package/dist/openrouter.js +1 -1
  37. package/dist/page.js +1 -1
  38. package/dist/paywall-CGBFHFRU.js +1 -0
  39. package/dist/popup.d.ts +3 -3
  40. package/dist/popup.js +1 -1
  41. package/dist/{presentation-loading-Ctk1djAi.d.ts → presentation-loading-D0A9G_kT.d.ts} +16 -2
  42. package/dist/react-native.d.ts +6 -6
  43. package/dist/react-native.js +1 -1
  44. package/dist/screen-renderer-WOMWOEYL.js +1 -0
  45. package/dist/server.d.ts +2402 -17
  46. package/dist/server.js +1 -1
  47. package/dist/visual.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/chunk-3J24TUO7.js +0 -1
  50. package/dist/chunk-6DTGBDYG.js +0 -1
  51. package/dist/chunk-DUZ2E7BK.js +0 -1
  52. package/dist/chunk-IIYIIXNB.js +0 -1
  53. package/dist/chunk-KRQESEG2.js +0 -6
  54. package/dist/chunk-WMIDEJTZ.js +0 -1
  55. package/dist/chunk-YAVWELIV.js +0 -1
  56. package/dist/content-FM52HLRX.js +0 -1
  57. package/dist/funnel-process-client-C87pmLC9.d.ts +0 -64499
  58. package/dist/funnel-runtime-host-MZKLVLC4.js +0 -1
  59. package/dist/paywall-JL4SXFXT.js +0 -1
  60. package/dist/screen-renderer-TEVGVUT5.js +0 -1
@@ -1 +0,0 @@
1
- import{b as a}from"./chunk-DUZ2E7BK.js";import"./chunk-JGG4R75K.js";import"./chunk-6DTGBDYG.js";import"./chunk-YAVWELIV.js";import"./chunk-XFO4FBFG.js";import"./chunk-QVGTHPWT.js";import"./chunk-SLUA7ABW.js";import"./chunk-PKLLZXNM.js";import"./chunk-KRQESEG2.js";import"./chunk-DSPLGTQI.js";import"./chunk-HDVLCRC6.js";export{a as showFunnelRun};
@@ -1 +0,0 @@
1
- import{b as We,c as Ye}from"./chunk-JGG4R75K.js";import{c as Fe,d as ze,e as He,f as ue,g as Be,h as Qe,i as Ge,k as je}from"./chunk-6DTGBDYG.js";import{c as Me,f as qe,g as Ie,h as Ve}from"./chunk-YAVWELIV.js";import"./chunk-XFO4FBFG.js";import{a as I}from"./chunk-QVGTHPWT.js";import{Z as ee}from"./chunk-KRQESEG2.js";import{a as z}from"./chunk-DSPLGTQI.js";import{La as te,Na as _e,j as Y,o as ke,z as Z}from"./chunk-HDVLCRC6.js";async function Je(s,n,v){if(n.status!=="complete")throw new I("INVALID_RESPONSE","A verified completed purchase is required");let w=s?Z.parse(s):null;if(await v.onComplete?.(n),!w||!v.check)return;let h=Z.parse(await v.check());if(h.internal_feature_id!==w.internal_feature_id||h.quantity!==w.quantity||w.observation!==void 0&&(h.observation===void 0||h.observation.requirementDigest!==w.observation.requirementDigest||h.observation.authority!==w.observation.authority||ke(h.observation.subject)!==ke(w.observation.subject)))throw new I("INVALID_RESPONSE","The access requirement changed");h.allowed&&await v.onAccessGranted?.(h)}var ot={none:0,sm:4,md:8,lg:14,full:9999},st={system:"system-ui,sans-serif",serif:"Georgia,serif",rounded:"ui-rounded,system-ui,sans-serif",mono:"ui-monospace,monospace"};function ct(s){let[n,v,w]=[1,3,5].map(h=>{let x=Number.parseInt(s.slice(h,h+2),16)/255;return x<=.03928?x/12.92:((x+.055)/1.055)**2.4});return .2126*n+.7152*v+.0722*w}function Ke(s){let n=ct(s.primary),v=(n+.05)/.05>1.05/(n+.05)?"#111318":"#FFFFFF",w=`color-mix(in srgb, ${s.text} 22%, ${s.background})`,h=`${ot[s.radius]}px`,x=`appearance:none;margin:0;min-height:44px;padding:10px 18px;border:0;border-radius:${h};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 ${st[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 ${w};border-radius:${h}`,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 ${w}`,link:`${x};background:transparent;color:${s.text};opacity:.72;font-weight:500`}}function Ae(s){s.style.opacity=s.disabled?".55":"",s.style.cursor=s.disabled?"not-allowed":"pointer"}function Re(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 At(s,n,v){let w=je(s.ownerDocument),h=()=>{C.finish("dismissed"),w()},x=()=>h(),C=Be(s,n,"paywall",()=>{h(),z(n.onDismiss)});n.signal?.throwIfAborted(),n.signal?.addEventListener("abort",x,{once:!0});let H=null,N,b,Se;try{if(C.start(!0),C.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(H=n.check?Z.parse(await C.wait(n.check(),ue)):null,H?.allowed)return C.finish("skipped"),n.signal?.removeEventListener("abort",x),w(),await n.onAccessGranted?.(H),{check:H,host:null};let[e,t]=await Promise.allSettled([C.wait(import("./screen-renderer-TEVGVUT5.js")),C.wait(n.start().then(i=>(C.cancelled&&i.destroy(),i)),ue)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;Se=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(),ue);if(!o)throw new I("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(),w(),e}let r=N,{mountScreenPreview:Xe}=Se,u=s.ownerDocument,de=new AbortController,L=u.createElement("section"),pe=u.createElement("div"),M=u.createElement("div"),p=u.createElement("p"),f=u.createElement("button"),P=u.createElement("button"),y=u.createElement("dialog"),a=b.document.screen.strings.defaultLocale.startsWith("zh"),Ze=a?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",et=a?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",T=Ke(b.document.screen.theme);L.dataset.indianaPaywall="",L.setAttribute("aria-label",b.document.name),L.style.cssText=T.root,M.style.cssText=T.controls,p.style.cssText=T.message,p.setAttribute("role","status"),P.style.cssText=T.link,P.textContent=a?"\u5173\u95ED":"Close",f.style.cssText=T.secondary,f.textContent=a?"\u91CD\u8BD5":"Retry",f.hidden=!0,M.append(p,f,P),L.append(pe,M);let B=b.document.presentation,Q,Te,fe=!1,Oe=JSON.stringify(b.capabilities);function me(e){if(d)return;b=e;let t=JSON.stringify(e.capabilities);t!==Oe&&(Q?.updateCapabilities(e.capabilities,Re(e)),Oe=t),nt(e)}let A;function De(){let e=u.defaultView;A?.responsive&&e&&Q?.resizeViewport?.(e.innerHeight,e.innerWidth)}let d=!1,J=!1,E=null,ne=!1,Ne=!1,q=!1,he,ye=!1,_,G;function tt(){return J||d||_||ye?{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null}:Ie(r)}let R=()=>!d&&!ne&&!_&&n.canInteract?.()!==!1,we=!1,c=null,U=null;function nt(e){J||E||r.quote||r.operation||(p.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":a?"\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;async function ge(e){let t=e.merchantExecution;if(!(!R()||!e.checkoutUrl||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 I?e.code:void 0;o==="CAPABILITY_UNAVAILABLE"||o==="NOT_CONFIGURED"?(c=null,p.textContent=a?"\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"?p.textContent=a?"\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.":p.textContent=a?"\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 p.textContent=e instanceof Error?e.message:a?"\u8BF7\u6C42\u5931\u8D25":"Request failed";f.hidden=c===null,t&&p.scrollIntoView?.({block:"nearest"}),z(t&&v?.quoteError?v.quoteError:n.onError,e)},re=new WeakMap;function ie(e){J=e;for(let t of U?.querySelectorAll("button")??[])e?(re.set(t,t.disabled),t.disabled=!0):re.has(t)&&(t.disabled=re.get(t),re.delete(t)),Ae(t)}function ve(){p.textContent=a?"\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 rt(e){if(n.beforeAction)try{await n.beforeAction()}catch(t){throw c=e,t}}async function $(e){if(J||d)return;if(!R()){ve();return}let t=e===oe,o=t?et:Ze;ie(!0),f.hidden=!0,p.textContent=o,t&&p.scrollIntoView?.({block:"nearest"});try{if(await rt(e),d)return;if(!R()){c=e,f.hidden=!1,ve();return}await e()}catch(i){d||j(i,t)}finally{ie(!1),p.textContent===o&&(p.textContent="")}}async function it(e){await Je(H,e,n)}function Le(e){return Ie(r).type==="recording"||qe({quote:r.quote,operation:e,requestId:null,pending:!1,destroyed:!1,canReselect:r.canReselect}).type==="recording"}async function O(e){if(d)return;if(!R()){c=async()=>O(await r.read()),f.hidden=!1;return}if(p.textContent=Ye(e.status,a),Le(e)){let i=e.merchantExecution?.type==="purchase"&&e.merchantExecution.recordingStatus==="failed";p.textContent=i?a?"\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.":a?"\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=a?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",c=async()=>O(await r.read()),f.hidden=!1;return}if(e.problem){let i=e.problem;c=ae,f.textContent=a?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",j(new I(i.code,i.reason==="RESULT_UNKNOWN"?a?"\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.":i.phase==="fulfillment"?a?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":i.code==="CAPABILITY_UNAVAILABLE"?a?"\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.":i.code==="NOT_CONFIGURED"?a?"\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.":a?"\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,i));return}if(e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(p.textContent=a?"\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 it(e);return}if(e.status!=="pending"){if(r.canReselect===!1){p.textContent=a?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",f.textContent=a?"\u67E5\u8BE2\u7ED3\u679C":"Check result",c=async()=>O(await r.read()),f.hidden=!1;return}f.textContent=a?"\u91CD\u8BD5":"Retry",c=null,E=null;return}await ge(e);let t=Date.now()+6e5,o=2e3;fe=!0,z(n.onObservationChange,!0);try{for(;!d&&Date.now()<t;){if(await We(o,u,de.signal),d)return;if(!R()){c=async()=>O(await r.read()),f.hidden=!1;return}let i=await r.read();if(!i.problem&&i.status==="pending"&&await ge(i),i.status!=="pending"||i.problem||Le(i)){await O(i);return}o=Math.min(o*1.5,3e4)}}finally{fe=!1,z(n.onObservationChange,!1)}c=async()=>O(await r.read()),f.hidden=!1}async function xe(){let e=await r.read();if(d)return;if(!R()){c=xe,f.hidden=!1;return}let t=r.quote;if(t&&Me(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){Ue(t);return}await O(e)}async function ae(){U?.remove(),U=null,c=ae;let e=await r.confirm();if(!R()){c=ae,f.hidden=!1;return}if(e.problem){await O(e);return}if(e.status==="pending"){if(e.checkoutUrl)await ge(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!n.onPurchase)throw new I("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await n.onPurchase({operation:e,signal:de.signal})}}c=async()=>O(await r.read()),await O(e)}function Ue(e){U?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());p.textContent=t?a?"\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"),i=u.createElement("button"),g=u.createElement("button"),V=u.createElement("div"),K=u.createElement("p"),S=e.merchantTerms,se=S?S.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),ce=a?"zh-CN":"en",le=S?.subscriptionTerms?.items??[],X=S?le.length===1&&le[0]?.amountMinor===se&&le[0]:e.lines.length===1&&e.lines[0]?.catalogAmountMinor===se&&e.lines[0];K.textContent=e.lines.map(l=>l.productName).join(", ")+" \xB7 "+(se===null?a?`${Y(S.subtotalMinor-S.discountMinor,e.currency)} + \u5F85\u786E\u8BA4\u7A0E\u8D39`:`${Y(S.subtotalMinor-S.discountMinor,e.currency)} + tax confirmed at checkout`:Y(se,e.currency)+(X?te(X.interval,ce,X.intervalCount??1):"")),i.textContent=a?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",i.disabled=t,g.textContent=a?"\u53D6\u6D88":"Cancel",o.style.cssText=T.panel,K.style.cssText=T.summary,V.style.cssText=T.actions,i.style.cssText=T.primary,g.style.cssText=T.secondary,Ae(i),i.onclick=()=>{$(ae)};let $e=async()=>{let l=await r.cancel();d||(o.remove(),U=null,await O(l))};g.onclick=()=>{c=$e,$($e)};let D=u.createElement("div");if(D.style.cssText=T.terms,S){for(let m of le){if(m===X)continue;let k=u.createElement("p");k.textContent=Y(m.amountMinor,e.currency)+te(m.interval,ce,m.intervalCount),D.append(k)}let l=S.subscriptionTerms?.trial;if(l){let m=u.createElement("p");m.textContent=a?`\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(m)}for(let m of[...S.expectedEffects.map(k=>k.description),...S.requiredConsents.map(k=>k.summary)]){let k=u.createElement("p");k.textContent=m,D.append(k)}}else{for(let l of e.lines){if(l!==X){let m=u.createElement("p");m.textContent=`${l.productName} \xB7 ${Y(l.catalogAmountMinor,e.currency)}${te(l.interval,ce,l.intervalCount??1)}`,D.append(m)}for(let m of l.prepaid??[]){let k=u.createElement("p"),F=r.view?.capabilities.plans[l.productVersionId]?.prepaid?.find(at=>at.internalFeatureId===m.internal_feature_id);k.textContent=`${F?.name??m.internal_feature_id} \xB7 ${m.quantity} ${a?"\u4EFD":"packs"} \xD7 ${m.terms.units}`,F&&(k.textContent+=te(F.reset==="week"||F.reset==="month"||F.reset==="year"?F.reset:"one_time",ce,F.resetCount)),D.append(k)}if(l.trial){let m=u.createElement("p");m.textContent=a?`\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(m)}}if(!e.charge){let l=u.createElement("p");l.textContent=a?"\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(i,g),o.append(K,...D.childElementCount?[D]:[],V),M.prepend(o),o.scrollIntoView?.({block:"nearest"}),i.focus({preventScroll:!0}),U=o,c=null}async function oe(){if(!E)return;if(c=oe,!we){let t=r.view,o=t?.document.buttons[E.actionId],i=t&&o?.type==="checkout"?ee(o.product,E.selection,t.capabilities):null;if(!i)throw new I("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let g=await n.resolveOfferId?.({actionId:E.actionId,productVersionId:i});if(d)return;g!==void 0&&(E.offerId=g),we=!0}if(!R()){f.hidden=!1;return}let e=await r.preview(E);d||Ue(e)}function W(e="destroy"){d||(d=!0,n.signal?.removeEventListener("abort",x),r.signal?.removeEventListener("abort",x),C.finish("dismissed"),Te?.(),de.abort(),A?.destroy(),Q?.destroy(),r.destroy(),y.open&&y.close(),y.remove(),L.remove(),w(),e==="dismiss"&&z(n.onDismiss))}h=W;async function Ce(){if(!q||d||ne||_==="closing"||!_&&!R())return;if(!v){W("dismiss");return}let e=u.createElement("p");e.setAttribute("role","status"),e.textContent=a?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",G||(G=u.createElement("div"),G.style.cssText=M.style.cssText,M.replaceWith(G),pe.inert=!0),G.replaceChildren(e,P),_="closing",P.setAttribute("aria-disabled","true"),P.focus({preventScroll:!0});try{await v.dismiss()}catch(t){d||z(n.onError,t)}d||(_="retry",e.textContent=a?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",P.textContent=a?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",P.removeAttribute("aria-label"),P.removeAttribute("aria-disabled"))}P.onclick=()=>{Ce()},y.addEventListener("cancel",e=>{e.preventDefault(),Ce()}),f.onclick=()=>{c&&$(c)};function Pe(e){C.finish("error",e),W()}function Ee(){if(!(!Ne||q||d||ne||A&&!R()))try{let e=t=>{he?.(),A&&(y.showModal(),A.responsive&&y.focus({preventScroll:!0}),!t&&n.loading!=="host"&&ze(y,A.type,A.responsive)),q=!0};v?v.present(()=>C.present(()=>e(!0))):C.present(e)}catch(e){Pe(e),j(e)}}try{if(B.type==="inline")he=Ge(L,s),s.append(L);else{let t={sm:420,md:640,lg:900};y.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"}`,y.setAttribute("aria-label",b.document.name),P.textContent="\xD7",P.setAttribute("aria-label",a?"\u5173\u95ED":"Close"),He(P,b.document.screen.theme),y.append(P,L),s.append(y),A=Fe(y,{...b.document.screen,presentation:B},De),A.latch(),he=Qe(y)}Q=Xe(pe,{mode:"live",rendererUrl:r.webViewUrl,title:b.document.name,hostPresentation:()=>A?.type??B.type,onResize:t=>{A?.responsive&&A.setContentHeight(t+(G??M).getBoundingClientRect().height)},onAction(t,o={}){if(!q||d||_)return;if(!R()){ve();return}let i=r.view,g=i?.document.buttons[t];if(!g)return;if(g.type==="close"){$(async()=>{await n.onAction?.(t),W(n.onAction?"action":"dismiss")});return}if(g.type==="action"){c=async()=>{if(g.action.type==="event"){if(!n.onEvent)throw new I("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(g.action.event)}else n.onOpenUrl?await n.onOpenUrl(g.action.url):u.defaultView?.location.assign(g.action.url);await n.onAction?.(t),c=null},$(c);return}if(U&&r.canReselect===!1){p.textContent=a?"\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?xe:oe,$(c);return}let V=i&&ee(g.product,o,i.capabilities);if(!i||!V){j(new I("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:_e(i.document.screen,V,o,i.capabilities)};ye=!0,await n.onPurchaseIntent(K)});return}if(E&&E.actionId!==t){j(new I("COMMAND_PENDING","Finish the current purchase"));return}E||(E={requestId:crypto.randomUUID(),actionId:t,selection:o},we=!1),$(oe)},onEscape:()=>{Ce()},onError:t=>{let o=new Error(t);!q&&!d&&Pe(o),j(o)},onRendered:t=>{t&&y.setAttribute("aria-label",t),Ne=!0,Ee()}}),De(),Q.update(b.document.screen,b.document.screen.strings.defaultLocale,{capabilities:b.capabilities,unavailableActions:Re(b),serverInput:{bindings:[],answers:{}}}),Te=r.subscribe?.(me),me(r.view??b),await C.wait(Q.ready);let e=r.operation;(r.quote||e&&(e.confirmedAt||e.checkoutUrl||e.status==="complete"))&&(c=xe,$(c))}catch(e){throw Pe(e),e}return{check:H,host:{get observing(){return fe},get recovery(){return tt()},async prepareFallback(){if(J||d||_||ye)return{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null};ie(!0);try{let e=await Ve(r);return e.type==="native"&&W(),e}finally{ie(!1)}},setSuspended(e){ne=e,L.hidden=e,e&&y.open?y.close():!e&&!q?Ee():!e&&!d&&q&&B.type!=="inline"&&!y.open&&y.showModal()},destroy:W,refresh:async()=>{if(!R()){if(r.view)return r.view;throw new I("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await r.refresh();return me(e),Ee(),e}}}}export{At as showPaywall};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-5SHVM4AF.js";import"./chunk-6DTGBDYG.js";import"./chunk-QVGTHPWT.js";import"./chunk-DSPLGTQI.js";import"./chunk-HDVLCRC6.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};