@tinkerlandai/longplay-sdk 0.10.73 → 0.10.75

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 (90) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/check-response-LYK2HZFK.js +1 -0
  3. package/dist/{chunk-XOX4O4A7.js → chunk-3ZYWGEBY.js} +1 -1
  4. package/dist/{chunk-TY4PJ2AG.js → chunk-464CINQK.js} +1 -1
  5. package/dist/{chunk-NPDRXDI7.js → chunk-4G52SO64.js} +1 -1
  6. package/dist/{chunk-WX55MS2F.js → chunk-52GS4CLH.js} +1 -1
  7. package/dist/{chunk-GNRFL6KF.js → chunk-5SNUVXZ7.js} +1 -1
  8. package/dist/{chunk-SOUVNTG4.js → chunk-62MMCXIA.js} +1 -1
  9. package/dist/{chunk-4DMVOAXB.js → chunk-66SRWQES.js} +1 -1
  10. package/dist/{chunk-PLXNTIX4.js → chunk-B7CFFTJI.js} +1 -1
  11. package/dist/{chunk-CN2INQIX.js → chunk-BB6PDBS4.js} +1 -1
  12. package/dist/chunk-CIVRE5G5.js +1 -0
  13. package/dist/{chunk-E3DRXDDQ.js → chunk-CJJ4R645.js} +1 -1
  14. package/dist/{chunk-ZZ4X4DMO.js → chunk-CLV4ROBM.js} +1 -1
  15. package/dist/{chunk-XJTEGBPR.js → chunk-CWBL2S3A.js} +1 -1
  16. package/dist/{chunk-SUAUY6IF.js → chunk-DIFM44US.js} +1 -1
  17. package/dist/{chunk-2XTBFJN4.js → chunk-DMMD4TMS.js} +1 -1
  18. package/dist/{chunk-V53RJR3S.js → chunk-DRCBHEC6.js} +1 -1
  19. package/dist/{chunk-HLK7L2RV.js → chunk-E4B7243C.js} +1 -1
  20. package/dist/{chunk-DCPRELJA.js → chunk-EQJIC52H.js} +1 -1
  21. package/dist/{chunk-4ZIA22MI.js → chunk-EU7KLHEE.js} +1 -1
  22. package/dist/{chunk-WG2DKREQ.js → chunk-FINCNJBH.js} +1 -1
  23. package/dist/{chunk-MSRPJSCY.js → chunk-FMDLTDLK.js} +1 -1
  24. package/dist/{chunk-KLPRVDHS.js → chunk-H3LBNH34.js} +1 -1
  25. package/dist/{chunk-MQ3543DO.js → chunk-HQ6MQWFY.js} +1 -1
  26. package/dist/{chunk-UG5RBIWP.js → chunk-IEYSWIRA.js} +1 -1
  27. package/dist/{chunk-T3JVQBQT.js → chunk-KCRL2BDG.js} +1 -1
  28. package/dist/{chunk-7XQKSA4R.js → chunk-KRJ7D25I.js} +1 -1
  29. package/dist/{chunk-H4RDA4MD.js → chunk-KSRJEMYQ.js} +1 -1
  30. package/dist/{chunk-DKEQCWIR.js → chunk-L33UXXE4.js} +2 -2
  31. package/dist/{chunk-Y4MFO2FU.js → chunk-LYTPUZOW.js} +1 -1
  32. package/dist/{chunk-PHUD42K4.js → chunk-M3E3ZAHR.js} +1 -1
  33. package/dist/{chunk-OHPNHCQS.js → chunk-MWTSCBSY.js} +1 -1
  34. package/dist/{chunk-MCFHMWLX.js → chunk-NUIKM2BY.js} +1 -1
  35. package/dist/{chunk-QLUP7E5M.js → chunk-PZPONSBE.js} +1 -1
  36. package/dist/{chunk-SZPHTRYE.js → chunk-Q6SK6G7T.js} +1 -1
  37. package/dist/{chunk-NE64O6U6.js → chunk-QJLVJLVX.js} +1 -1
  38. package/dist/{chunk-O273JQ7U.js → chunk-QLMQI6SX.js} +1 -1
  39. package/dist/{chunk-AVXJB4O6.js → chunk-RM6RSLKI.js} +1 -1
  40. package/dist/{chunk-JFQBHUUN.js → chunk-SHJUMRYM.js} +1 -1
  41. package/dist/{chunk-GWREHUOB.js → chunk-STASMAS7.js} +1 -1
  42. package/dist/{chunk-HQWZWHHM.js → chunk-SUUBL2WC.js} +1 -1
  43. package/dist/{chunk-EK5U2JOM.js → chunk-TQKNQGWV.js} +1 -1
  44. package/dist/{chunk-SSVSXSYE.js → chunk-TZTWXL53.js} +1 -1
  45. package/dist/chunk-WAPQ6BX4.js +1 -0
  46. package/dist/{chunk-724YT3J5.js → chunk-WPPT4PS7.js} +1 -1
  47. package/dist/{chunk-7KQWJBFQ.js → chunk-X6ZYJHX4.js} +1 -1
  48. package/dist/{chunk-VVZLNTWC.js → chunk-XSEYXS4X.js} +1 -1
  49. package/dist/{chunk-KWOB5LYC.js → chunk-YMTCZWZG.js} +1 -1
  50. package/dist/{chunk-LM6TMEMB.js → chunk-ZLRQ6X3A.js} +1 -1
  51. package/dist/{content-RJTGQ5OG.js → content-PFD22VB5.js} +1 -1
  52. package/dist/funnel-host-purchase-A7RIV3VL.js +1 -0
  53. package/dist/funnel-host-recovery-paywall-QWUEMOMW.js +1 -0
  54. package/dist/{funnel-paywall-copies-E7GHHCVL.js → funnel-paywall-copies-43CVL4UQ.js} +1 -1
  55. package/dist/funnel-paywall-prerender-LFK2J34G.js +1 -0
  56. package/dist/funnel-route-prediction-DXMYNMCA.js +1 -0
  57. package/dist/funnel-route-source-2OGRCZKX.js +1 -0
  58. package/dist/funnel-runtime-host-BMOLGYXZ.js +1 -0
  59. package/dist/index.d.ts +13 -1
  60. package/dist/index.js +1 -1
  61. package/dist/merchant-bridge-contracts-MEMS65CV.js +1 -0
  62. package/dist/openrouter.js +1 -1
  63. package/dist/operation-contracts-L3CZMIL6.js +1 -0
  64. package/dist/page.js +1 -1
  65. package/dist/paywall-ZP5X27ZZ.js +1 -0
  66. package/dist/paywall-content-5SVZLU5S.js +1 -0
  67. package/dist/paywall-session-NKWC4TGU.js +1 -0
  68. package/dist/popup.js +1 -1
  69. package/dist/react-native.js +1 -1
  70. package/dist/screen-renderer-IKROGLA7.js +1 -0
  71. package/dist/server.js +1 -1
  72. package/dist/visual.js +1 -1
  73. package/package.json +9 -10
  74. package/dist/check-response-2VZGH33N.js +0 -1
  75. package/dist/chunk-VWVLWUBX.js +0 -1
  76. package/dist/chunk-ZUBDANL4.js +0 -1
  77. package/dist/funnel-host-purchase-HBKEI5SU.js +0 -1
  78. package/dist/funnel-host-recovery-paywall-FVRMHF6K.js +0 -1
  79. package/dist/funnel-paywall-prerender-BU4VSPDB.js +0 -1
  80. package/dist/funnel-route-prediction-6IXHGQYB.js +0 -1
  81. package/dist/funnel-route-source-CALCHIZL.js +0 -1
  82. package/dist/funnel-runtime-host-GF6XCCO3.js +0 -1
  83. package/dist/merchant-bridge-contracts-2TYLNFKF.js +0 -1
  84. package/dist/operation-contracts-KYYM2PJO.js +0 -1
  85. package/dist/paywall-KGICSTDM.js +0 -1
  86. package/dist/paywall-content-7NCG5I7S.js +0 -1
  87. package/dist/paywall-session-AEDGMP7W.js +0 -1
  88. package/dist/screen-renderer-AVHPHFXT.js +0 -1
  89. /package/dist/{chunk-35JZDDF3.js → chunk-7RUOZL6C.js} +0 -0
  90. /package/dist/{chunk-DKEQCWIR.js.LEGAL.txt → chunk-L33UXXE4.js.LEGAL.txt} +0 -0
package/dist/popup.js CHANGED
@@ -1 +1 @@
1
- import{a as _,b as z,c as M,d as U,e as W,f as q,g as V,h as j,i as S}from"./chunk-NE64O6U6.js";import{a as H,b as x,d as y,f as C,g as A,m as E}from"./chunk-VVZLNTWC.js";import"./chunk-HQWZWHHM.js";import{D as b}from"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-35JZDDF3.js";import{a as p}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function O(m,r,n){let d=m.ownerDocument,s=d.defaultView;if(!s)throw new Error("Preview container has no browser window");let l=!1,u=!1,f=0,c,i=d.createElement("div");i.style.cssText="width:100%;min-width:0";let v=(e,F)=>{c=S(e,{mode:"live",rendererUrl:n.rendererUrl,title:n.title??r.name,onPageChange:n.onPageChange,onAction:(R,I)=>p(n.onAction,R,I),onError:n.onError,...F}),c.update(r,n.locale,{capabilities:n.capabilities,customerData:n.customerData})},h=r.presentation;if(h.type==="inline")return m.append(i),v(i,{onContentHeight(e){f=e,p(n.onContentHeight,e,m.clientHeight)}}),{presentation:"inline",inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),i.remove())}};let t=d.createElement("dialog");t.lang=n.locale,t.dir=b(n.locale)?"rtl":"ltr",t.setAttribute("aria-label",r.name),t.style.cssText=H(n.host,h,r.theme);let a=d.createElement("button");a.type="button",a.textContent="×",a.setAttribute("aria-label",n.closeLabel),A(a,r.theme);let g=e=>{u&&!l&&p(n.onDismiss,e)};a.addEventListener("click",()=>g("close_button"));let D=()=>c?.resizeViewport(s.innerHeight||800,s.innerWidth||1024),o;if(n.host==="funnel"){let e=d.createElement("section");e.style.cssText="min-width:0;display:flex;flex-direction:column;min-height:100%",i.style.cssText+=";flex:1 0 auto;display:flex;flex-direction:column;justify-content:center",e.append(i),t.append(a,e),o=y(t,r,D)}else i.setAttribute("aria-label",r.name),o=y(t,r,D),t.append(i),t.prepend(a);let L=n.host==="content"&&o.responsive?x(t,()=>g("close_button"),()=>!0,n.closeLabel):void 0;t.addEventListener("cancel",e=>{e.preventDefault(),g("escape")});let w=e=>s.requestAnimationFrame?s.requestAnimationFrame(e):s.setTimeout(e,0),P=()=>{u&&!l&&p(n.onContentHeight,f,t.clientHeight)},T=E(t);return m.append(t),v(i,{viewportHeight:o.responsive?s.innerHeight||800:void 0,...o.responsive?{viewportWidth:s.innerWidth||1024,hostPresentation:()=>o.type}:{},...n.host!=="content"?{closeActions:n.closeActions??r.actions.filter(e=>e.close).map(e=>e.id),onAuthoredClose(e){a.hidden=e}}:{},onResize(e){o.responsive&&(i.style.height=`${e}px`,i.style.overflow="clip",o.setContentHeight(e)),w(P)},onContentHeight(e){f=e},onRendered(e){e&&t.setAttribute("aria-label",e),!(u||l)&&(u=!0,T(),o.latch(),t.showModal(),o.responsive&&t.focus({preventScroll:!0}),C(t,o.type,o.responsive),w(P))},onEscape:()=>g("escape")}),{get presentation(){return o.type},inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),L?.(),o.destroy(),t.open&&t.close(),t.remove())}}}export{q as formatCustomerDecimal,z as hostedRendererScript,_ as hostedRendererShell,U as inspectCustomHtml,O as mountDialogPreview,S as mountScreenPreview,j as preparePopup,W as prepareScreen,M as sanitizeCustomHtml,V as showPopup};
1
+ import{a as _,b as z,c as M,d as U,e as W,f as q,g as V,h as j,i as S}from"./chunk-QJLVJLVX.js";import{a as H,b as x,d as y,f as C,g as A,m as E}from"./chunk-XSEYXS4X.js";import"./chunk-SUUBL2WC.js";import{D as b}from"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import{a as p}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function O(m,r,n){let d=m.ownerDocument,s=d.defaultView;if(!s)throw new Error("Preview container has no browser window");let l=!1,u=!1,f=0,c,i=d.createElement("div");i.style.cssText="width:100%;min-width:0";let v=(e,F)=>{c=S(e,{mode:"live",rendererUrl:n.rendererUrl,title:n.title??r.name,onPageChange:n.onPageChange,onAction:(R,I)=>p(n.onAction,R,I),onError:n.onError,...F}),c.update(r,n.locale,{capabilities:n.capabilities,customerData:n.customerData})},h=r.presentation;if(h.type==="inline")return m.append(i),v(i,{onContentHeight(e){f=e,p(n.onContentHeight,e,m.clientHeight)}}),{presentation:"inline",inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),i.remove())}};let t=d.createElement("dialog");t.lang=n.locale,t.dir=b(n.locale)?"rtl":"ltr",t.setAttribute("aria-label",r.name),t.style.cssText=H(n.host,h,r.theme);let a=d.createElement("button");a.type="button",a.textContent="×",a.setAttribute("aria-label",n.closeLabel),A(a,r.theme);let g=e=>{u&&!l&&p(n.onDismiss,e)};a.addEventListener("click",()=>g("close_button"));let D=()=>c?.resizeViewport(s.innerHeight||800,s.innerWidth||1024),o;if(n.host==="funnel"){let e=d.createElement("section");e.style.cssText="min-width:0;display:flex;flex-direction:column;min-height:100%",i.style.cssText+=";flex:1 0 auto;display:flex;flex-direction:column;justify-content:center",e.append(i),t.append(a,e),o=y(t,r,D)}else i.setAttribute("aria-label",r.name),o=y(t,r,D),t.append(i),t.prepend(a);let L=n.host==="content"&&o.responsive?x(t,()=>g("close_button"),()=>!0,n.closeLabel):void 0;t.addEventListener("cancel",e=>{e.preventDefault(),g("escape")});let w=e=>s.requestAnimationFrame?s.requestAnimationFrame(e):s.setTimeout(e,0),P=()=>{u&&!l&&p(n.onContentHeight,f,t.clientHeight)},T=E(t);return m.append(t),v(i,{viewportHeight:o.responsive?s.innerHeight||800:void 0,...o.responsive?{viewportWidth:s.innerWidth||1024,hostPresentation:()=>o.type}:{},...n.host!=="content"?{closeActions:n.closeActions??r.actions.filter(e=>e.close).map(e=>e.id),onAuthoredClose(e){a.hidden=e}}:{},onResize(e){o.responsive&&(i.style.height=`${e}px`,i.style.overflow="clip",o.setContentHeight(e)),w(P)},onContentHeight(e){f=e},onRendered(e){e&&t.setAttribute("aria-label",e),!(u||l)&&(u=!0,T(),o.latch(),t.showModal(),o.responsive&&t.focus({preventScroll:!0}),C(t,o.type,o.responsive),w(P))},onEscape:()=>g("escape")}),{get presentation(){return o.type},inspect:()=>c?.inspect?.()??Promise.resolve(null),destroy(){l||(l=!0,c?.destroy(),L?.(),o.destroy(),t.open&&t.close(),t.remove())}}}export{q as formatCustomerDecimal,z as hostedRendererScript,_ as hostedRendererShell,U as inspectCustomHtml,O as mountDialogPreview,S as mountScreenPreview,j as preparePopup,W as prepareScreen,M as sanitizeCustomHtml,V as showPopup};
@@ -1 +1 @@
1
- import{b as S,c as E,d as T}from"./chunk-PHUD42K4.js";import"./chunk-MCFHMWLX.js";import{a as A}from"./chunk-MSRPJSCY.js";import{e as P}from"./chunk-JFQBHUUN.js";import"./chunk-T3JVQBQT.js";import{h as b,i as x,k as L}from"./chunk-MQ3543DO.js";import{E as C}from"./chunk-4ZIA22MI.js";import"./chunk-CN2INQIX.js";import"./chunk-KWOB5LYC.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-XOX4O4A7.js";import"./chunk-PLXNTIX4.js";import"./chunk-H4RDA4MD.js";import"./chunk-2XTBFJN4.js";import"./chunk-SZPHTRYE.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-AVXJB4O6.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-E3DRXDDQ.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import{a as r}from"./chunk-HLK7L2RV.js";import{h as R}from"./chunk-GNRFL6KF.js";import"./chunk-3VUPVXAV.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
1
+ import{b as S,c as E,d as T}from"./chunk-M3E3ZAHR.js";import"./chunk-NUIKM2BY.js";import{a as A}from"./chunk-FMDLTDLK.js";import{e as P}from"./chunk-SHJUMRYM.js";import"./chunk-KCRL2BDG.js";import{h as b,i as x,k as L}from"./chunk-HQ6MQWFY.js";import{E as C}from"./chunk-EU7KLHEE.js";import"./chunk-BB6PDBS4.js";import"./chunk-YMTCZWZG.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-3ZYWGEBY.js";import"./chunk-B7CFFTJI.js";import"./chunk-KSRJEMYQ.js";import"./chunk-DMMD4TMS.js";import"./chunk-Q6SK6G7T.js";import"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import"./chunk-DRCBHEC6.js";import"./chunk-RM6RSLKI.js";import"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-CJJ4R645.js";import"./chunk-ZLRQ6X3A.js";import"./chunk-66SRWQES.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import{a as r}from"./chunk-E4B7243C.js";import{h as R}from"./chunk-5SNUVXZ7.js";import"./chunk-3VUPVXAV.js";import"./chunk-DIFM44US.js";import"./chunk-5MRSFLQA.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";function k(t,d){let n,a=0,m=-1,l,i=!1,y=()=>{if(i)throw new r("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new r("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},o=()=>new r("IDENTITY_CHANGED","Customer identity changed during the native operation"),h=d.subscribeIdentity(()=>{a++,m=-1;let e=a;n&&t.nativeModule&&n.then(c=>t.nativeModule.reset(c,e)).catch(()=>{})}),I=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let c=await n;if(e.instanceId!==c)return;if(e.kind==="credential"){let w=a,f=null;try{if(!i&&e.revision===w){let N=await d.access();!i&&a===w&&(f=N)}}finally{await t.nativeModule.provideCredential(c,e.requestId,f)}return}let s=!1,u=a;try{if(i||e.revision!==u||!t.onNativeAction)throw o();await t.onNativeAction(e.action),s=!i&&a===u}finally{await t.nativeModule.acknowledge(c,e.requestId,s)}})().catch(()=>{})});async function p(e,c={}){let s=y();if(d.snapshot()&&!t.nativeEvents)throw new r("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let u=a,w=await d.access();if(i||a!==u)throw o();if(!n){let v=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=v,v.catch(()=>{n===v&&(n=void 0)})}let f=await n;if(i||a!==u)throw o();if(m!==u){if(!l||l.epoch!==u){let O=(async()=>{if(await s.identify(f,JSON.stringify({revision:u,credentials:w})),i||a!==u)throw await s.reset(f,u),o();m=u})();l={epoch:u,task:O}}let v=l;try{await v.task}finally{l===v&&(l=void 0)}}let N=await s.invoke(f,e,JSON.stringify(c));if(i||a!==u)throw o();try{return JSON.parse(N)}catch{throw new r("INVALID_RESPONSE","Native host returned invalid JSON")}}async function g(e,c){let s=await p(e,c);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new r("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return g("showFunnel",{runToken:e})},showPaywall(e){return g("showPaywall",e)},showContent(e){return g("showContent",e)},purchaseSubscription(e,c){return p("purchaseSubscription",{operationId:e,accepted:c})},switchSubscription(e,c){return p("switchSubscription",{operationId:e,accepted:c})},restorePurchases(){return p("restorePurchases")},manageSubscriptions(e){return p("manageSubscriptions",e?{productId:e}:{})},async dismiss(){a++,m=-1,n&&await y().reset(await n,a)},async destroy(){i||(i=!0,a++,h(),I?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var M=P.trackUsage.request.shape.command,U=P.trackUsage.response;function F(t){let d=R.parse(t.scope),n=S({...t,scope:d}),a={...t,scope:d,session:n.session},m=k(t,n.session),l=0,i=!1;n.subscribeIdentity(()=>{l++});let y=()=>{if(i)throw new r("CLOSED","SDK client was destroyed");let o=n.session.peek();if(!o)throw new r("UNAUTHENTICATED","Identify the Customer first");return o};return{...n,native:m,async destroy(){i||(i=!0,l++,n.destroy(),await m.destroy())},funnel(){return E({...a,customerToken:y()})},resumeFunnel(o){return y(),C({...a,runToken:o})},paywall(o){return A(a,{...o,customerToken:y()})},async trackUsage(o){if(y(),!t.usageReporter)throw new r("INVALID_REQUEST","Configure your authenticated backend usageReporter");let h=M.parse(o),I=l,p;try{p=await t.usageReporter(h)}catch(e){throw I!==l?new r("IDENTITY_CHANGED","Customer identity changed during usage reporting"):e}if(I!==l)throw new r("IDENTITY_CHANGED","Customer identity changed during usage reporting");let g=U.parse(p);if(g.scope.projectId!==d.projectId||g.scope.environment!==d.environment)throw new r("INVALID_RESPONSE","Usage response scope differs");return g}}}export{r as LongplayError,x as createConfigurationSync,b as createFeatureClient,T as createFunnelProcess,L as createLocalFunnelClient,F as createLongplayReactNative};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-QJLVJLVX.js";import"./chunk-XSEYXS4X.js";import"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import"./chunk-CWBL2S3A.js";import"./chunk-X6ZYJHX4.js";import"./chunk-FINCNJBH.js";import"./chunk-E4B7243C.js";import"./chunk-5SNUVXZ7.js";import"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as pn}from"./chunk-ZUBDANL4.js";import{a as I}from"./chunk-ZZ4X4DMO.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-GWREHUOB.js";import{a as xt}from"./chunk-MSRPJSCY.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-JFQBHUUN.js";import"./chunk-T3JVQBQT.js";import{a as Te,b as ae,c as yt,d as It,e as wt,f as xe,g as vt,h as Me,i as dn,j as ln,k as mn}from"./chunk-MQ3543DO.js";import{B as V,C as N,d as ft,e as ht,k as gt,l as z,m as St,p as Ct,q as Rt,r as bt,s as At,t as Ot,y as pe,z as Tt}from"./chunk-4ZIA22MI.js";import"./chunk-CN2INQIX.js";import{c as h}from"./chunk-KWOB5LYC.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-XOX4O4A7.js";import{a as Et,b as _e}from"./chunk-PLXNTIX4.js";import"./chunk-H4RDA4MD.js";import"./chunk-2XTBFJN4.js";import{e as at}from"./chunk-SZPHTRYE.js";import{B as pt,C as de,D as Z,E as lt,J as mt,a as et,e as q,j as Re,k as st,l as ct,q as ut,r as dt,s as be,t as Ae}from"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import{A as W,B as oe,C as tt,D as Se,E as ie,G as se,H as Ce,M as j,O as ce,P as nt,R as Ee,S as rt,T as ot,f as Ge,g as je,j as we,r as ze,s as Ke,u as an,v as sn,y as cn,z as X}from"./chunk-V53RJR3S.js";import{b as Oe}from"./chunk-AVXJB4O6.js";import{e as ve,i as Ze,l as it}from"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-E3DRXDDQ.js";import"./chunk-LM6TMEMB.js";import{a as Ne,b as Le}from"./chunk-4DMVOAXB.js";import{o as ue}from"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-XJTEGBPR.js";import{c as Ie}from"./chunk-7KQWJBFQ.js";import{e as Xe,h as We}from"./chunk-WG2DKREQ.js";import{a as c}from"./chunk-HLK7L2RV.js";import{h as Y}from"./chunk-GNRFL6KF.js";import"./chunk-3VUPVXAV.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import{a as Ye}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var _t=4,Mt=[...tt,"requirement_checks","native_offers","preparations","benefit_claims","authorizations","business_results","checkout_termination"],In=u.enum(Mt),ee=(e,n)=>u.array(e).max(n).refine(t=>new Set(t).size===t.length,"Declarations must be unique"),ke=u.strictObject({...se.shape,bridgeVersion:u.literal(_t),capabilities:ee(In,Mt.length),checkKinds:ee(u.enum(["access","metered","credit"]),3),preparationActions:ee(u.enum(["purchase","subscription_change","refund"]),3),authorizationKinds:ee(u.enum(["auto_topup"]),1),nextActionTypes:ee(u.enum(["redirect","authenticate"]),2),resultEvents:ee(u.enum(["benefit.claimed","authorization.updated"]),2)}).superRefine((e,n)=>{e.capabilities.includes("catalog")!==(e.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(e.capabilities.includes("billing_records")!==e.billingEvents.length>0||new Set(e.billingEvents).size!==e.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare unique supported billing events"});let t=r=>e.capabilities.includes(r),o=(r,a)=>n.addIssue({code:"custom",path:[r],message:a});t("requirement_checks")!==e.checkKinds.length>0&&o("checkKinds","Declare the supported Check kinds"),t("preparations")!==e.preparationActions.length>0&&o("preparationActions","Declare the supported preparation actions"),t("authorizations")!==e.authorizationKinds.length>0&&o("authorizationKinds","Declare the supported authorization kinds"),t("business_results")!==e.resultEvents.length>0&&o("resultEvents","Declare the supported non-financial results");for(let[r,a,s]of[["purchases","purchase","purchase.completed"],["subscription_changes","subscription_change","subscription.change.completed"],["refunds","refund","refund.updated"]])t(r)&&(!t("operation_status")||!t("billing_records")||!t("preparations")||!e.preparationActions.includes(a)||!e.billingEvents.includes(s))&&o("capabilities",`${r} requires preparation, original lookup and its billing result`);t("purchases")&&!e.billingEvents.includes("purchase.closed")&&o("billingEvents","Purchase execution requires its terminal closure result"),t("checkout_termination")&&(!t("operation_status")||!t("billing_records")||!e.billingEvents.includes("purchase.closed"))&&o("capabilities","Checkout termination requires original lookup and purchase.closed"),t("subscription_changes")&&!e.billingEvents.includes("subscription.change.closed")&&o("billingEvents","Subscription change execution requires its terminal closure result");for(let[r,a]of[["benefit_claims","benefit.claimed"],["authorizations","authorization.updated"]])t(r)&&(!t("operation_status")||!t("business_results")||!e.resultEvents.includes(a))&&o("capabilities",`${r} requires original lookup and its non-financial result`)}),K={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":u.strictObject({}),"requirement.check":$e,"operation.prepare":ze,"benefit.claim":Ue,"operation.read":qe,"purchase.terminate":j},wn={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":ke,"requirement.check":Qe,"operation.prepare":Ke,"benefit.claim":Ve,"operation.read":He,"purchase.terminate":j.extend({outcome:u.enum(["requested","already_paid"])})},Gn=u.enum(["bridge.ping","bridge.describe","requirement.check","operation.prepare","benefit.claim","operation.read","purchase.terminate"]);function $(e,n){return u.strictObject({bridgeVersion:u.literal(_t),requestId:u.uuid(),scope:Ce,command:u.literal(e),data:n})}var kt=u.discriminatedUnion("command",[$("bridge.ping",K["bridge.ping"]),$("bridge.describe",K["bridge.describe"]),$("requirement.check",K["requirement.check"]),$("operation.prepare",K["operation.prepare"]),$("benefit.claim",K["benefit.claim"]),$("operation.read",K["operation.read"]),$("purchase.terminate",K["purchase.terminate"])]),Be=u.strictObject({code:u.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:u.string().min(1).max(500),retryable:u.boolean(),recovery:u.string().min(1).max(80),effect:u.enum(["none","unknown"])}).refine(e=>e.effect!=="unknown"||!e.retryable&&e.recovery==="recover_operation","Unknown effects require original-operation recovery");function Bt(e){let n={bridgeVersion:u.literal(4),requestId:u.uuid(),scope:Ce,command:u.literal(e)};return u.union([u.strictObject({...n,data:wn[e]}),u.strictObject({...n,error:Be})])}var Pt="X-Indiana-Bridge-Signature",Q="X-Indiana-Bridge-Key-Id";function vn(e){return new TextEncoder().encode(e)}function Dt(e){return Uint8Array.from(atob(e.replaceAll("-","+").replaceAll("_","/")),n=>n.charCodeAt(0))}function Ft(e,n,t,o){return vn(`indiana-merchant-bridge:${o}
1
+ import{a as pn}from"./chunk-WAPQ6BX4.js";import{a as I}from"./chunk-CLV4ROBM.js";import{a as fn,b as hn,c as gn,d as yn}from"./chunk-STASMAS7.js";import{a as xt}from"./chunk-FMDLTDLK.js";import{a as Ue,b as Ve,c as qe,d as He,e as m}from"./chunk-SHJUMRYM.js";import"./chunk-KCRL2BDG.js";import{a as Te,b as ae,c as yt,d as It,e as wt,f as xe,g as vt,h as Me,i as dn,j as ln,k as mn}from"./chunk-HQ6MQWFY.js";import{B as V,C as N,d as ft,e as ht,k as gt,l as z,m as St,p as Ct,q as Rt,r as bt,s as At,t as Ot,y as pe,z as Tt}from"./chunk-EU7KLHEE.js";import"./chunk-BB6PDBS4.js";import{c as h}from"./chunk-YMTCZWZG.js";import"./chunk-464CINQK.js";import"./chunk-EQJIC52H.js";import"./chunk-3ZYWGEBY.js";import{a as Et,b as _e}from"./chunk-B7CFFTJI.js";import"./chunk-KSRJEMYQ.js";import"./chunk-DMMD4TMS.js";import{e as at}from"./chunk-Q6SK6G7T.js";import{B as pt,C as de,D as Z,E as lt,J as mt,a as et,e as q,j as Re,k as st,l as ct,q as ut,r as dt,s as be,t as Ae}from"./chunk-LYTPUZOW.js";import"./chunk-TZTWXL53.js";import"./chunk-H3LBNH34.js";import{A as W,B as oe,C as tt,D as Se,E as ie,G as se,H as Ce,M as j,O as ce,P as nt,R as Ee,S as rt,T as ot,f as Ge,g as je,j as we,r as ze,s as Ke,u as an,v as sn,y as cn,z as X}from"./chunk-DRCBHEC6.js";import{b as Oe}from"./chunk-RM6RSLKI.js";import{e as ve,i as Ze,l as it}from"./chunk-TQKNQGWV.js";import"./chunk-VILB5M4X.js";import"./chunk-CJJ4R645.js";import"./chunk-ZLRQ6X3A.js";import{a as Ne,b as Le}from"./chunk-66SRWQES.js";import{o as ue}from"./chunk-SUUBL2WC.js";import"./chunk-4G52SO64.js";import{i as un,k as $e,l as Qe,m as Je}from"./chunk-CWBL2S3A.js";import{c as Ie}from"./chunk-X6ZYJHX4.js";import{e as Xe,h as We}from"./chunk-FINCNJBH.js";import{a as c}from"./chunk-E4B7243C.js";import{h as Y}from"./chunk-5SNUVXZ7.js";import"./chunk-3VUPVXAV.js";import"./chunk-DIFM44US.js";import"./chunk-5MRSFLQA.js";import{b as u}from"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import{a as Ye}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var _t=4,Mt=[...tt,"requirement_checks","native_offers","preparations","benefit_claims","authorizations","business_results","checkout_termination"],In=u.enum(Mt),ee=(e,n)=>u.array(e).max(n).refine(t=>new Set(t).size===t.length,"Declarations must be unique"),ke=u.strictObject({...se.shape,bridgeVersion:u.literal(_t),capabilities:ee(In,Mt.length),checkKinds:ee(u.enum(["access","metered","credit"]),3),preparationActions:ee(u.enum(["purchase","subscription_change","refund"]),3),authorizationKinds:ee(u.enum(["auto_topup"]),1),nextActionTypes:ee(u.enum(["redirect","authenticate"]),2),resultEvents:ee(u.enum(["benefit.claimed","authorization.updated"]),2)}).superRefine((e,n)=>{e.capabilities.includes("catalog")!==(e.catalog!=="none")&&n.addIssue({code:"custom",path:["catalog"],message:"Catalog declaration differs from its capability"}),(e.capabilities.includes("billing_records")!==e.billingEvents.length>0||new Set(e.billingEvents).size!==e.billingEvents.length)&&n.addIssue({code:"custom",path:["billingEvents"],message:"Declare unique supported billing events"});let t=r=>e.capabilities.includes(r),o=(r,a)=>n.addIssue({code:"custom",path:[r],message:a});t("requirement_checks")!==e.checkKinds.length>0&&o("checkKinds","Declare the supported Check kinds"),t("preparations")!==e.preparationActions.length>0&&o("preparationActions","Declare the supported preparation actions"),t("authorizations")!==e.authorizationKinds.length>0&&o("authorizationKinds","Declare the supported authorization kinds"),t("business_results")!==e.resultEvents.length>0&&o("resultEvents","Declare the supported non-financial results");for(let[r,a,s]of[["purchases","purchase","purchase.completed"],["subscription_changes","subscription_change","subscription.change.completed"],["refunds","refund","refund.updated"]])t(r)&&(!t("operation_status")||!t("billing_records")||!t("preparations")||!e.preparationActions.includes(a)||!e.billingEvents.includes(s))&&o("capabilities",`${r} requires preparation, original lookup and its billing result`);t("purchases")&&!e.billingEvents.includes("purchase.closed")&&o("billingEvents","Purchase execution requires its terminal closure result"),t("checkout_termination")&&(!t("operation_status")||!t("billing_records")||!e.billingEvents.includes("purchase.closed"))&&o("capabilities","Checkout termination requires original lookup and purchase.closed"),t("subscription_changes")&&!e.billingEvents.includes("subscription.change.closed")&&o("billingEvents","Subscription change execution requires its terminal closure result");for(let[r,a]of[["benefit_claims","benefit.claimed"],["authorizations","authorization.updated"]])t(r)&&(!t("operation_status")||!t("business_results")||!e.resultEvents.includes(a))&&o("capabilities",`${r} requires original lookup and its non-financial result`)}),K={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":u.strictObject({}),"requirement.check":$e,"operation.prepare":ze,"benefit.claim":Ue,"operation.read":qe,"purchase.terminate":j},wn={"bridge.ping":u.strictObject({challenge:u.uuid()}),"bridge.describe":ke,"requirement.check":Qe,"operation.prepare":Ke,"benefit.claim":Ve,"operation.read":He,"purchase.terminate":j.extend({outcome:u.enum(["requested","already_paid"])})},Gn=u.enum(["bridge.ping","bridge.describe","requirement.check","operation.prepare","benefit.claim","operation.read","purchase.terminate"]);function $(e,n){return u.strictObject({bridgeVersion:u.literal(_t),requestId:u.uuid(),scope:Ce,command:u.literal(e),data:n})}var kt=u.discriminatedUnion("command",[$("bridge.ping",K["bridge.ping"]),$("bridge.describe",K["bridge.describe"]),$("requirement.check",K["requirement.check"]),$("operation.prepare",K["operation.prepare"]),$("benefit.claim",K["benefit.claim"]),$("operation.read",K["operation.read"]),$("purchase.terminate",K["purchase.terminate"])]),Be=u.strictObject({code:u.string().regex(/^MERCHANT_BRIDGE_[A-Z_]+$/),message:u.string().min(1).max(500),retryable:u.boolean(),recovery:u.string().min(1).max(80),effect:u.enum(["none","unknown"])}).refine(e=>e.effect!=="unknown"||!e.retryable&&e.recovery==="recover_operation","Unknown effects require original-operation recovery");function Bt(e){let n={bridgeVersion:u.literal(4),requestId:u.uuid(),scope:Ce,command:u.literal(e)};return u.union([u.strictObject({...n,data:wn[e]}),u.strictObject({...n,error:Be})])}var Pt="X-Indiana-Bridge-Signature",Q="X-Indiana-Bridge-Key-Id";function vn(e){return new TextEncoder().encode(e)}function Dt(e){return Uint8Array.from(atob(e.replaceAll("-","+").replaceAll("_","/")),n=>n.charCodeAt(0))}function Ft(e,n,t,o){return vn(`indiana-merchant-bridge:${o}
2
2
  ${n}
3
3
  POST
4
4
  ${W}
package/dist/visual.js CHANGED
@@ -1 +1 @@
1
- import{a as pe,c as fe}from"./chunk-OJM6ORHE.js";import{b as le}from"./chunk-J6KIN4RH.js";import{a as Ve,b as ce,c as de,d as ue}from"./chunk-SLUA7ABW.js";import{a as J,b as F,c as ge,e as me}from"./chunk-DKEQCWIR.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import{b as o}from"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import{c as te,e as ie,g as M}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var K="indiana-visual-diagnostics-v1",Ae=o.strictObject({environmentId:o.string().uuid(),release:o.string().regex(/^[a-f0-9]{64}$/).nullable(),generation:o.string().regex(/^[a-f0-9]{64}$/).nullable(),publishedGeneration:o.string().regex(/^[a-f0-9]{64}$/).nullable(),checkedAt:o.string().datetime(),origin:o.string().url(),pathname:o.string().max(2048),urlMatches:o.boolean(),stopped:o.boolean(),rows:o.array(o.strictObject({changeId:o.string().regex(/^[a-f0-9]{64}$/),experimentKey:o.string().max(256),variationKey:o.string().max(256),inExperiment:o.boolean(),fingerprint:o.string().regex(/^[a-f0-9]{64}$/),status:o.enum(["inactive","waiting","partial","applied","mismatch","no_changes","unavailable","error"]),total:o.number().int().min(0).max(600),applied:o.number().int().min(0).max(600)})).max(100)});function ye(e){let l=n=>Array.isArray(n)?"["+n.map(l).join(",")+"]":n&&typeof n=="object"?"{"+Object.entries(n).filter(([,c])=>c!==void 0).sort(([c],[y])=>c.localeCompare(y)).map(([c,y])=>JSON.stringify(c)+":"+l(y)).join(",")+"}":JSON.stringify(n);return l({css:e.css,js:e.js,domMutations:e.domMutations,...e.renderGuard?{renderGuard:e.renderGuard}:{}})}function he(e){let l=new URL(e.baseUrl),n=l.origin==="https://api.longplayai.com"||l.origin==="https://api.dev.longplayai.com"?l.hostname.slice(4):void 0,c=e.origins??(n?[`https://console.${n}`]:[]),y=new Set(c.filter(t=>{try{let i=new URL(t);return i.origin===t&&(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))}catch{return!1}})),v=!1,I=!1,k=0,T=async t=>{if(v||I||!t.source||!y.has(t.origin)||!t.data||typeof t.data!="object")return;let i=t.data;if(!(i.channel!==K||i.type!=="inspect"||i.environmentId!==e.environmentId||typeof i.nonce!="string"||!/^[a-f0-9-]{36}$/i.test(i.nonce)||typeof i.changeId!="string"||!/^[a-f0-9]{64}$/.test(i.changeId)||typeof i.url!="string"||i.url.length>2048||Date.now()-k<250)){try{if(new URL(i.url).origin!==location.origin)return}catch{return}I=!0,k=Date.now();try{let x=await e.inspect(i.changeId,i.url);!v&&x.rows.some(S=>S.changeId===i.changeId)&&t.source.postMessage({channel:K,type:"result",nonce:i.nonce,snapshot:x},t.origin)}finally{I=!1}}},u=t=>{T(t).catch(()=>{})};return window.addEventListener("message",u),()=>{v=!0,window.removeEventListener("message",u)}}var R=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=(e,l)=>typeof e=="string"&&e.length<=l,Ee=e=>typeof e=="string"&&(["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e));function ke(e){if(!R(e)||!E(e.css??"",1e5)||!E(e.js??"",1e5)||!Array.isArray(e.domMutations??[])||Array.isArray(e.domMutations)&&e.domMutations.length>200)throw new Error("Invalid visual variation");let l=e.domMutations??[];for(let n of l)if(!R(n)||!E(n.selector,2048)||!n.selector||!Ee(n.attribute)||!["set","append","remove"].includes(String(n.action))||n.value!==void 0&&!E(n.value,5e4)||n.parentSelector!==void 0&&!E(n.parentSelector,2048)||n.insertBeforeSelector!==void 0&&!E(n.insertBeforeSelector,2048))throw new Error("Invalid visual mutation");return{css:e.css??"",js:e.js??"",domMutations:l,...e.renderGuard===void 0?{}:{renderGuard:le(e.renderGuard)}}}function q(e){if(!R(e)||typeof e.environmentId!="string"||typeof e.trackExposures!="boolean"||!/^[-a-f0-9]{36}$/i.test(e.environmentId)||typeof e.generation!="string"||!/^[a-f0-9]{64}$/.test(e.generation)||!Array.isArray(e.experiments)||e.experiments.length>100||!R(e.savedGroups))throw new Error("Invalid visual experiment payload");let l=e.experiments.map(n=>{if(!R(n)||!["key","changeId"].every(c=>typeof n[c]=="string"&&n[c])||!/^[a-f0-9]{64}$/.test(String(n.changeId))||["namespace","status","groups","url"].some(c=>Object.hasOwn(n,c))||n.hashVersion!==void 0&&n.hashVersion!==2||!Array.isArray(n.variations)||n.variations.length<2||n.variations.length>20||n.urlPatterns!==void 0&&!Array.isArray(n.urlPatterns))throw new Error("Invalid visual experiment");return{...n,variations:n.variations.map(ke)}});return{...e,experiments:l}}var ve=6e4;function qe(e){let l=se(e.baseUrl);if(e.appManifestRelease!==void 0&&!/^[a-f0-9]{64}$/.test(e.appManifestRelease))throw new Error("Invalid IAM manifest digest");if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("Invalid App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),c=F(n),y=F(n),v=`${l}/api/v1/visual-experiments/${e.environmentId}`,I=e.appManifestRelease?`${v}?iam=${e.appManifestRelease}`:v,k=re(e.deviceIdCookie??"indiana_did"),T=ae(),u=null,t=!1,i=!1,x="",S={...e.attributes??{}},G,B,D=0,H=-1/0,$,m=new Map,O=new Map,C=new Set,z=ge({endpoint:`${v}/events`,fetch:n,log:e.log,label:"Visual exposure"}),P=z.flush,W,b;function j(){clearTimeout(W),b?.remove(),b=void 0}function Y(s,d){let f=M(s,d);C.has(f)||e.trackExposures===!1||u?.trackExposures===!1||t||(C.add(f),z.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:k,...T?{sessionId:T}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:s.key,variationKey:d.key}))}function we(s){if(!u||t)return;let d=new Set,f={onExperimentViewed:(r,p)=>{d.add(M(r,p))},url:location.href,attributes:{...me(k,location),...S,indianaAppManifestRelease:e.appManifestRelease??null},savedGroups:te(u.savedGroups),log:e.log},h=new Set;for(let r of u.experiments){if(de(`${e.environmentId}:${r.key}`))continue;let p=r;try{let a=ie(p,f);if(O.set(r.changeId,a),!a.inExperiment)continue;h.add(r.changeId);let w=JSON.stringify([a.key,a.value]),U=m.get(r.changeId);if(U?.signature===w){d.has(M(p,a))&&s.push(()=>{U.applied()&&Y(p,a)});continue}m.get(r.changeId)?.revert(),m.delete(r.changeId);let A=fe(a.value,{requireUniqueTargets:!!e.appManifestRelease&&Array.isArray(r.condition?.$and)&&r.condition.$and.some(g=>g!==null&&typeof g=="object"&&!Array.isArray(g)&&g.indianaAppManifestRelease===e.appManifestRelease),boundVariations:r.variations,allowJs:e.disableJsInjection===!1,nonce:e.nonce,onApplied:()=>{d.has(M(p,a))&&Y(p,a)},onError:g=>e.log?.("Visual experiment stopped",{experiment:r.key,changeId:r.changeId,variation:a.key,error:String(g)}),onTargetStatus:e.log?g=>e.log?.("Visual target status changed",{experiment:r.key,changeId:r.changeId,variation:a.key,...g}):void 0});m.set(r.changeId,{signature:w,revert:A.revert,applied:()=>A.applied,inspect:()=>A.inspect()})}catch(a){e.log?.("Skipping visual experiment",{experiment:r.key,error:String(a)})}}for(let[r,p]of m)h.has(r)||(p.revert(),m.delete(r));j()}let V=()=>{let s=[];pe(()=>we(s));for(let d of s)d()};async function _(){let s=++D,d;try{d=await c.read(I,J)}catch(h){if(t||s!==D)return!1;throw h}let f=q(d);if(f.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Visual payload scope changed");return t||s!==D?!1:(u=f,H=performance.now(),!0)}async function Q(){!await _()||t||(N(),V())}function L(){clearTimeout($),$=setTimeout(()=>{if(document.visibilityState==="hidden")return L();Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()})},ve)}let X=()=>{t||document.visibilityState==="hidden"||performance.now()-H<ve||(clearTimeout($),Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()}))},Ie=()=>{x!==location.href&&(x=location.href,V())},Z=()=>{P(!0)},N=()=>{G||t||(G=oe(Ie),addEventListener("pagehide",Z),x=location.href)};async function ee(s,d){let f=location.href,h=u,r=[],p=null;if(!t)try{let a=q(await y.read(I,J));a.environmentId===e.environmentId&&(p=a.generation)}catch{}for(let a of h?.experiments??[]){if(s&&a.changeId!==s)continue;let w=O.get(a.changeId);if(!w)continue;let U=new TextEncoder().encode(ye(w.value)),A=[...new Uint8Array(await crypto.subtle.digest("SHA-256",U))].map(be=>be.toString(16).padStart(2,"0")).join(""),g=m.get(a.changeId)?.inspect()??{status:"inactive",total:0,applied:0};r.push({changeId:a.changeId,experimentKey:a.key,variationKey:w.key,inExperiment:w.inExperiment,fingerprint:A,...g})}return{environmentId:e.environmentId,release:e.appManifestRelease??null,generation:h?.generation??null,publishedGeneration:p,checkedAt:new Date().toISOString(),origin:location.origin,pathname:location.pathname,urlMatches:location.href===f&&(!d||d===f)&&h===u,stopped:t,rows:r}}let ne,xe=ue(()=>{i&&!t&&V()});return{async start(){if(!(i||t)){i=!0,e.appManifestRelease&&(B=ce(e.appManifestRelease)),e.antiFlicker&&(b=document.createElement("style"),e.nonce&&(b.nonce=e.nonce),b.textContent="body { visibility: hidden !important }",document.head.append(b),W=setTimeout(j,Math.min(3e3,Math.max(0,e.antiFlickerTimeout??1e3))));try{if(!await _()||t)return;N(),V()}finally{j(),t||(L(),document.addEventListener("visibilitychange",X),ne=he({environmentId:e.environmentId,baseUrl:l,origins:e.diagnosticsOrigins,inspect:ee}))}}},async refresh(){t||await _()&&(i&&N(),V())},setAttributes(s){S={...s},V()},flush:()=>P(),getDiagnostics:ee,getResults(){return new Map(O)},get generation(){return u?.generation??null},destroy(){t=!0,clearTimeout($),document.removeEventListener("visibilitychange",X),xe(),ne?.(),D++,c.destroy(),y.destroy(),G?.(),B?.destroy(),removeEventListener("pagehide",Z),j();for(let s of m.values())s.revert();m.clear(),P(!0),u=null,O.clear(),C.clear(),S={}}}}export{qe as createVisualExperiments,Ve as loadAppManifestRelease};
1
+ import{a as pe,c as fe}from"./chunk-OJM6ORHE.js";import{b as le}from"./chunk-J6KIN4RH.js";import{a as Ve,b as ce,c as de,d as ue}from"./chunk-SLUA7ABW.js";import{a as J,b as F,c as ge,e as me}from"./chunk-L33UXXE4.js";import{a as re,b as ae,c as se,d as oe}from"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-DIFM44US.js";import"./chunk-5MRSFLQA.js";import{b as o}from"./chunk-7RUOZL6C.js";import"./chunk-DSPLGTQI.js";import{c as te,e as ie,g as M}from"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var K="indiana-visual-diagnostics-v1",Ae=o.strictObject({environmentId:o.string().uuid(),release:o.string().regex(/^[a-f0-9]{64}$/).nullable(),generation:o.string().regex(/^[a-f0-9]{64}$/).nullable(),publishedGeneration:o.string().regex(/^[a-f0-9]{64}$/).nullable(),checkedAt:o.string().datetime(),origin:o.string().url(),pathname:o.string().max(2048),urlMatches:o.boolean(),stopped:o.boolean(),rows:o.array(o.strictObject({changeId:o.string().regex(/^[a-f0-9]{64}$/),experimentKey:o.string().max(256),variationKey:o.string().max(256),inExperiment:o.boolean(),fingerprint:o.string().regex(/^[a-f0-9]{64}$/),status:o.enum(["inactive","waiting","partial","applied","mismatch","no_changes","unavailable","error"]),total:o.number().int().min(0).max(600),applied:o.number().int().min(0).max(600)})).max(100)});function ye(e){let l=n=>Array.isArray(n)?"["+n.map(l).join(",")+"]":n&&typeof n=="object"?"{"+Object.entries(n).filter(([,c])=>c!==void 0).sort(([c],[y])=>c.localeCompare(y)).map(([c,y])=>JSON.stringify(c)+":"+l(y)).join(",")+"}":JSON.stringify(n);return l({css:e.css,js:e.js,domMutations:e.domMutations,...e.renderGuard?{renderGuard:e.renderGuard}:{}})}function he(e){let l=new URL(e.baseUrl),n=l.origin==="https://api.longplayai.com"||l.origin==="https://api.dev.longplayai.com"?l.hostname.slice(4):void 0,c=e.origins??(n?[`https://console.${n}`]:[]),y=new Set(c.filter(t=>{try{let i=new URL(t);return i.origin===t&&(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))}catch{return!1}})),v=!1,I=!1,k=0,T=async t=>{if(v||I||!t.source||!y.has(t.origin)||!t.data||typeof t.data!="object")return;let i=t.data;if(!(i.channel!==K||i.type!=="inspect"||i.environmentId!==e.environmentId||typeof i.nonce!="string"||!/^[a-f0-9-]{36}$/i.test(i.nonce)||typeof i.changeId!="string"||!/^[a-f0-9]{64}$/.test(i.changeId)||typeof i.url!="string"||i.url.length>2048||Date.now()-k<250)){try{if(new URL(i.url).origin!==location.origin)return}catch{return}I=!0,k=Date.now();try{let x=await e.inspect(i.changeId,i.url);!v&&x.rows.some(S=>S.changeId===i.changeId)&&t.source.postMessage({channel:K,type:"result",nonce:i.nonce,snapshot:x},t.origin)}finally{I=!1}}},u=t=>{T(t).catch(()=>{})};return window.addEventListener("message",u),()=>{v=!0,window.removeEventListener("message",u)}}var R=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=(e,l)=>typeof e=="string"&&e.length<=l,Ee=e=>typeof e=="string"&&(["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(e)||/^(aria|data)-[a-z0-9_-]+$/.test(e));function ke(e){if(!R(e)||!E(e.css??"",1e5)||!E(e.js??"",1e5)||!Array.isArray(e.domMutations??[])||Array.isArray(e.domMutations)&&e.domMutations.length>200)throw new Error("Invalid visual variation");let l=e.domMutations??[];for(let n of l)if(!R(n)||!E(n.selector,2048)||!n.selector||!Ee(n.attribute)||!["set","append","remove"].includes(String(n.action))||n.value!==void 0&&!E(n.value,5e4)||n.parentSelector!==void 0&&!E(n.parentSelector,2048)||n.insertBeforeSelector!==void 0&&!E(n.insertBeforeSelector,2048))throw new Error("Invalid visual mutation");return{css:e.css??"",js:e.js??"",domMutations:l,...e.renderGuard===void 0?{}:{renderGuard:le(e.renderGuard)}}}function q(e){if(!R(e)||typeof e.environmentId!="string"||typeof e.trackExposures!="boolean"||!/^[-a-f0-9]{36}$/i.test(e.environmentId)||typeof e.generation!="string"||!/^[a-f0-9]{64}$/.test(e.generation)||!Array.isArray(e.experiments)||e.experiments.length>100||!R(e.savedGroups))throw new Error("Invalid visual experiment payload");let l=e.experiments.map(n=>{if(!R(n)||!["key","changeId"].every(c=>typeof n[c]=="string"&&n[c])||!/^[a-f0-9]{64}$/.test(String(n.changeId))||["namespace","status","groups","url"].some(c=>Object.hasOwn(n,c))||n.hashVersion!==void 0&&n.hashVersion!==2||!Array.isArray(n.variations)||n.variations.length<2||n.variations.length>20||n.urlPatterns!==void 0&&!Array.isArray(n.urlPatterns))throw new Error("Invalid visual experiment");return{...n,variations:n.variations.map(ke)}});return{...e,experiments:l}}var ve=6e4;function qe(e){let l=se(e.baseUrl);if(e.appManifestRelease!==void 0&&!/^[a-f0-9]{64}$/.test(e.appManifestRelease))throw new Error("Invalid IAM manifest digest");if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("Invalid App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),c=F(n),y=F(n),v=`${l}/api/v1/visual-experiments/${e.environmentId}`,I=e.appManifestRelease?`${v}?iam=${e.appManifestRelease}`:v,k=re(e.deviceIdCookie??"indiana_did"),T=ae(),u=null,t=!1,i=!1,x="",S={...e.attributes??{}},G,B,D=0,H=-1/0,$,m=new Map,O=new Map,C=new Set,z=ge({endpoint:`${v}/events`,fetch:n,log:e.log,label:"Visual exposure"}),P=z.flush,W,b;function j(){clearTimeout(W),b?.remove(),b=void 0}function Y(s,d){let f=M(s,d);C.has(f)||e.trackExposures===!1||u?.trackExposures===!1||t||(C.add(f),z.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:k,...T?{sessionId:T}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:s.key,variationKey:d.key}))}function we(s){if(!u||t)return;let d=new Set,f={onExperimentViewed:(r,p)=>{d.add(M(r,p))},url:location.href,attributes:{...me(k,location),...S,indianaAppManifestRelease:e.appManifestRelease??null},savedGroups:te(u.savedGroups),log:e.log},h=new Set;for(let r of u.experiments){if(de(`${e.environmentId}:${r.key}`))continue;let p=r;try{let a=ie(p,f);if(O.set(r.changeId,a),!a.inExperiment)continue;h.add(r.changeId);let w=JSON.stringify([a.key,a.value]),U=m.get(r.changeId);if(U?.signature===w){d.has(M(p,a))&&s.push(()=>{U.applied()&&Y(p,a)});continue}m.get(r.changeId)?.revert(),m.delete(r.changeId);let A=fe(a.value,{requireUniqueTargets:!!e.appManifestRelease&&Array.isArray(r.condition?.$and)&&r.condition.$and.some(g=>g!==null&&typeof g=="object"&&!Array.isArray(g)&&g.indianaAppManifestRelease===e.appManifestRelease),boundVariations:r.variations,allowJs:e.disableJsInjection===!1,nonce:e.nonce,onApplied:()=>{d.has(M(p,a))&&Y(p,a)},onError:g=>e.log?.("Visual experiment stopped",{experiment:r.key,changeId:r.changeId,variation:a.key,error:String(g)}),onTargetStatus:e.log?g=>e.log?.("Visual target status changed",{experiment:r.key,changeId:r.changeId,variation:a.key,...g}):void 0});m.set(r.changeId,{signature:w,revert:A.revert,applied:()=>A.applied,inspect:()=>A.inspect()})}catch(a){e.log?.("Skipping visual experiment",{experiment:r.key,error:String(a)})}}for(let[r,p]of m)h.has(r)||(p.revert(),m.delete(r));j()}let V=()=>{let s=[];pe(()=>we(s));for(let d of s)d()};async function _(){let s=++D,d;try{d=await c.read(I,J)}catch(h){if(t||s!==D)return!1;throw h}let f=q(d);if(f.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Visual payload scope changed");return t||s!==D?!1:(u=f,H=performance.now(),!0)}async function Q(){!await _()||t||(N(),V())}function L(){clearTimeout($),$=setTimeout(()=>{if(document.visibilityState==="hidden")return L();Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()})},ve)}let X=()=>{t||document.visibilityState==="hidden"||performance.now()-H<ve||(clearTimeout($),Q().catch(s=>e.log?.("Visual payload refresh failed",{error:String(s)})).finally(()=>{t||L()}))},Ie=()=>{x!==location.href&&(x=location.href,V())},Z=()=>{P(!0)},N=()=>{G||t||(G=oe(Ie),addEventListener("pagehide",Z),x=location.href)};async function ee(s,d){let f=location.href,h=u,r=[],p=null;if(!t)try{let a=q(await y.read(I,J));a.environmentId===e.environmentId&&(p=a.generation)}catch{}for(let a of h?.experiments??[]){if(s&&a.changeId!==s)continue;let w=O.get(a.changeId);if(!w)continue;let U=new TextEncoder().encode(ye(w.value)),A=[...new Uint8Array(await crypto.subtle.digest("SHA-256",U))].map(be=>be.toString(16).padStart(2,"0")).join(""),g=m.get(a.changeId)?.inspect()??{status:"inactive",total:0,applied:0};r.push({changeId:a.changeId,experimentKey:a.key,variationKey:w.key,inExperiment:w.inExperiment,fingerprint:A,...g})}return{environmentId:e.environmentId,release:e.appManifestRelease??null,generation:h?.generation??null,publishedGeneration:p,checkedAt:new Date().toISOString(),origin:location.origin,pathname:location.pathname,urlMatches:location.href===f&&(!d||d===f)&&h===u,stopped:t,rows:r}}let ne,xe=ue(()=>{i&&!t&&V()});return{async start(){if(!(i||t)){i=!0,e.appManifestRelease&&(B=ce(e.appManifestRelease)),e.antiFlicker&&(b=document.createElement("style"),e.nonce&&(b.nonce=e.nonce),b.textContent="body { visibility: hidden !important }",document.head.append(b),W=setTimeout(j,Math.min(3e3,Math.max(0,e.antiFlickerTimeout??1e3))));try{if(!await _()||t)return;N(),V()}finally{j(),t||(L(),document.addEventListener("visibilitychange",X),ne=he({environmentId:e.environmentId,baseUrl:l,origins:e.diagnosticsOrigins,inspect:ee}))}}},async refresh(){t||await _()&&(i&&N(),V())},setAttributes(s){S={...s},V()},flush:()=>P(),getDiagnostics:ee,getResults(){return new Map(O)},get generation(){return u?.generation??null},destroy(){t=!0,clearTimeout($),document.removeEventListener("visibilitychange",X),xe(),ne?.(),D++,c.destroy(),y.destroy(),G?.(),B?.destroy(),removeEventListener("pagehide",Z),j();for(let s of m.values())s.revert();m.clear(),P(!0),u=null,O.clear(),C.clear(),S={}}}}export{qe as createVisualExperiments,Ve as loadAppManifestRelease};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkerlandai/longplay-sdk",
3
- "version": "0.10.73",
3
+ "version": "0.10.75",
4
4
  "description": "Framework-independent Longplay SDK for customer identity, entitlements, credits, offers and growth surfaces.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -61,12 +61,6 @@
61
61
  "import": "./dist/visual.js"
62
62
  }
63
63
  },
64
- "scripts": {
65
- "build": "tsup",
66
- "prepack": "pnpm run build",
67
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
68
- "lint": "node ../../scripts/ci/lint.mjs --workspace packages/sdk"
69
- },
70
64
  "dependencies": {
71
65
  "@ai-sdk/provider": "4.0.26",
72
66
  "@types/json-schema": "7.0.15",
@@ -76,13 +70,13 @@
76
70
  "zod": "4.6.6"
77
71
  },
78
72
  "devDependencies": {
79
- "@indiana/contracts": "workspace:*",
80
73
  "@openrouter/sdk": "^1.4.25",
81
74
  "@types/css-tree": "^3.2.0",
82
75
  "ai": "7.0.136",
83
76
  "tsup": "^8.5.1",
84
77
  "typescript": "^5.9.3",
85
- "whatwg-url-minimum": "0.2.0"
78
+ "whatwg-url-minimum": "0.2.0",
79
+ "@indiana/contracts": "0.1.0"
86
80
  },
87
81
  "peerDependencies": {
88
82
  "@openrouter/sdk": "^1.4.25"
@@ -91,5 +85,10 @@
91
85
  "@openrouter/sdk": {
92
86
  "optional": true
93
87
  }
88
+ },
89
+ "scripts": {
90
+ "build": "tsup",
91
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
92
+ "lint": "node ../../scripts/ci/lint.mjs --workspace packages/sdk"
94
93
  }
95
- }
94
+ }
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-PLXNTIX4.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-35JZDDF3.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as validateEntitlementCheck,b as validateResourceCheck};
@@ -1 +0,0 @@
1
- import{a as we,b as ye}from"./chunk-SOUVNTG4.js";import{d as Fe,e as $}from"./chunk-DCPRELJA.js";import{a as De}from"./chunk-HLK7L2RV.js";import{a as A}from"./chunk-DSPLGTQI.js";var je=5*6e4,Je=15e3,He=new WeakMap;function $e(c){return He.get(c)}var R=c=>Array.isArray(c)?c.map(R):c&&typeof c=="object"?Object.fromEntries(Object.keys(c).sort().map(n=>[n,R(c[n])])):c,M=(c,n)=>JSON.stringify(R(c))===JSON.stringify(R(n)),z=c=>JSON.stringify(R([c.funnelId,c.locale??null,c.parameters??{}])),Ue=["onObservationChange","onPurchase","onCheckoutUrl","resumeCheckout","allowNewPurchase","checkoutNavigation","terminateCheckout","beforeCheckoutReplacement","purchaseConfirmation","confirmOnHostedCheckout","resolveOfferId","prepareSubscriptionChange","resolveSubscriptionChange","onOpenUrl","onEvent","onAction","onComplete","onError"];function Ge(c,n,S){let F=e=>structuredClone({funnelId:e.funnelId,locale:e.locale,parameters:e.parameters}),m,q="",k=n.start instanceof Promise?void 0:F(n.start),Q=e=>e?.parameters?.commerce,L=Promise.resolve(n.start).then(e=>e?F(e):void 0),Y=n.maxAgeMs??je,me=new AbortController,w=AbortSignal.any([me.signal,n.client.identitySignal,...n.signal?[n.signal]:[]]),Z=()=>d("released","aborted"),t="preparing",ge,T,ee=()=>{},j=0,b=null,P=null,v=null,y=null,g,H,ne,he=new Map,h=null,J=new Set,E=new Map,re,Pe=new Promise(e=>re=e),U,be=new Promise(e=>U=e),ae,Oe=new Promise(e=>ae=e);function G(e,r){t!==e&&(t=e,ge=r,A(n.onState,e))}function Ne(){w.removeEventListener("abort",Z),W(),P?.destroy(),P=null,b?.remove(),b=null,v=null}function d(e,r){["adopted","unavailable","released","closed"].includes(t)||(G(e,r),Ne(),re(!1),U(!1),ae(null))}function O(e){t!=="shown"&&d("unavailable",e)}let p,te=!1,V=n.client.paywallCopies,oe,ve=new Promise(e=>oe=e),le=!1;function Ie(e){ve.then(r=>{r&&V&&V.write(r,e).catch(()=>{})})}function Se(e){ve.then(async r=>{if(!r||!V)return;let a=await V.read(r);te||a&&"presented"in a||await V.write(r,e)}).catch(()=>{})}let ie=e=>`error:${e?.code??e?.name??"unknown"}`,se=c.ownerDocument.defaultView,N=!S,Ce=null,_=!1,xe=e=>e.storageArea===se?.localStorage&&(e.key===null||e.key.startsWith("indiana.funnel.purchases.")),Ae=e=>{xe(e)&&K()},Me=S?()=>{}:n.client.subscribe(()=>K());function W(){N&&(N=!1,se?.removeEventListener("storage",Ae),Me(),ee())}let ce=()=>N&&(t==="ready"||t==="preparing");function de(e){(t==="ready"||t==="preparing")&&d("unavailable",e)}function K(){if(t==="ready"&&Date.now()-j>=Y)return W();_=!0,Ce??=(async()=>{for(;_&&m&&ce();){_=!1;try{await n.client.retained()==="pending"&&de("purchase_pending")}catch(e){w.aborted?d("released","aborted"):de(ie(e))}}})().finally(()=>{Ce=null,_&&m&&ce()&&K()})}S||se?.addEventListener("storage",Ae),w.addEventListener("abort",Z,{once:!0});let Re=S?Promise.resolve("none"):n.client.findPurchase();Re.catch(()=>{});let B;function X(e){let r=B?.paywallVersionId??n.paywallVersionId??p?.resolution.id??y?.id,a=JSON.stringify(R([r??null,e])),l=he.get(a);return l||(l=n.client.readPaywall({paywallVersionId:r,...r?{}:{paywallId:B?.paywallId??n.paywallId},...e}),he.set(a,l)),l}function D(e,r){let a=Object.values(e.capabilities.plans),l=Object.values(e.document.buttons).some(i=>i.type==="checkout");return l&&a.length===0?!1:r.intent==="subscription_change"&&l?a.some(i=>i.available):a.every(i=>i.available)}function ue(e,r){if(y&&!$(e,y))return d("unavailable","paywall_changed"),!1;y=e,ne=r;for(let a of E.keys())A(a,structuredClone(e));return!0}function ke(e,r){if(!(!y||!["preparing","ready","shown"].includes(t))){if(!$(e,y))return O("paywall_changed");if(!D(e,r.commerce))return O("plan_unavailable");ue(e,r)}}async function x(){let e=await Oe;if(!e)throw new De("PURCHASE_PENDING","The purchase did not start; open it again");return e}let qe={get view(){return h?h.view:y},get signal(){return h?.signal??n.client.identitySignal},get quote(){return h?.quote??null},get operation(){return h?.operation??null},webViewUrl:"bundled",get canReselect(){return h?.canReselect},get recovery(){return h?.recovery},get pendingCancellation(){return h?.pendingCancellation},subscribe(e){return E.set(e,h?.subscribe?.(e)??(()=>{})),()=>{E.get(e)?.(),E.delete(e)}},refresh:async()=>h?h.refresh():structuredClone(y),preview:async e=>(await x()).preview(e),confirm:async()=>(await x()).confirm(),cancel:async()=>(await x()).cancel(),read:async()=>(await x()).read(),destroy(){h?.destroy()}},u={options:{},handoff:{}},Ee={loading:"host",focusAtReveal:!0,settleMotionAtReveal:!0,signal:n.client.identitySignal,start:async()=>qe,canInteract:()=>u.options.canInteract?u.options.canInteract():!["unavailable","released","closed"].includes(t),async beforeAction(){let e=t!=="adopted",r=y?.capabilities,a=await x();if(e&&!M(a.view?.capabilities,r))throw new Fe;await u.options.beforeAction?.()}};for(let e of Ue)Object.defineProperty(Ee,e,{enumerable:!0,get:()=>u.options[e]});function fe(){t!=="preparing"||!v||!P||!p&&(!m||!M(ne?.commerce,Q(m))||ne?.locale!==m.locale)||(G("ready"),re(!0))}let Ve={present(e){if(u.handoff.present)return u.handoff.present(e);t==="preparing"&&(v=e,j=Date.now(),fe())},async dismiss(){if(u.handoff.dismiss)return u.handoff.dismiss();d("closed");for(let e of[...J])A(e)},async closeAction(e){if(u.handoff.closeAction)return u.handoff.closeAction(e);u.options.onAction?await u.options.onAction(e):await Ve.dismiss()},quoteError(e){u.handoff.quoteError?u.handoff.quoteError(e):A(u.options.onError,e)}};async function Le(){if(n.paywallVersionId||n.paywallId)return{paywallVersionId:n.paywallVersionId,paywallId:n.paywallId};let e=n.configuration;if(!e)return d("unavailable","paywall_missing"),null;let r=await Promise.resolve(n.start).catch(()=>null);if(!r||t!=="preparing")return null;let a=()=>we(e,{funnelId:r.funnelId,customerId:n.client.customerId,parameters:r.parameters??{}});if(T=await a(),t!=="preparing")return null;let l=T;if(l.type!=="paywall")return d("unavailable",ye(l)??"route"),null;let i=!1;return ee=e.subscribe(()=>{i||!ce()||(i=!0,a().then(s=>{!(s.type==="unavailable"&&!["funnel_stopped","route_unavailable"].includes(s.reason))&&(s.type!=="paywall"||s.paywallVersionId!==l.paywallVersionId)&&de("route_changed")}).finally(()=>i=!1))}),N||ee(),{paywallVersionId:l.paywallVersionId}}(async()=>{try{let[{showPaywall:e},r]=await Promise.all([import("./paywall-KGICSTDM.js"),Le()]),a=n.commerce??Q(k),l=n.locale??k?.locale,i=r&&a&&l?JSON.stringify(R([r.paywallVersionId??null,r.paywallId??null,{commerce:a,locale:l}])):null;if(oe(i),w.throwIfAborted(),t!=="preparing"||!r)return;if(!a)return d("unavailable","commerce_missing");if(!l)return d("unavailable","locale_missing");B=r;let s={commerce:a,locale:l},f=i?await V?.read(i).catch(()=>null):null;if(le=!!f&&"presented"in f&&(!k||f.funnelId===k.funnelId),w.throwIfAborted(),t!=="preparing"||le)return;f&&!("presented"in f)&&(!k||f.funnelId===k.funnelId)&&D(f.resolution,f.context.commerce)&&(p=f),U(!!p);let o;if(p){let pe=p.context;s=pe,o=structuredClone(p.resolution),X(pe).then(Te=>ke(Te,pe),()=>{})}else o=await X(s);if(w.throwIfAborted(),t!=="preparing"||(!D(o,s.commerce)&&n.start instanceof Promise&&!g&&await L,!p&&g&&!M(s,g)&&(s=g,o=await X(s)),w.throwIfAborted(),t!=="preparing"))return;if(!D(o,s.commerce))return d("unavailable","plan_unavailable");if(!ue(o,s))return;b=c.ownerDocument.createElement("div"),c.append(b);let C=setTimeout(()=>t==="preparing"&&d("unavailable","timeout"),Je);Pe.then(()=>clearTimeout(C));let I=await e(b,Ee,Ve);if(!I.host||w.aborted||t!=="preparing"){I.host?.destroy(),d(w.aborted?"released":"unavailable","error");return}P=I.host,fe()}catch(e){d(w.aborted?"released":"unavailable",ie(e))}finally{oe(null),U(!1)}})(),L.then(async e=>{let r=s=>{Se(null),O(s)};if(!e)return r("gated");let a=e,l=Q(a),i=n.commerce??l;if(!M(l&&{...l,intent:void 0},i&&{...i,intent:void 0})||n.locale!==void 0&&a.locale!==n.locale)return r("start_mismatch");if(!l)return r("commerce_missing");g={commerce:l,locale:a.locale},H=a,p&&["preparing","ready","shown"].includes(t)&&(m=a,q=z(a));try{let s=await Re,f=s==="pending"?"purchase_pending":s==="found"?"original_purchase":s==="blocked"?"purchase_blocked":void 0;if(f)return r(f);if(!["preparing","ready","shown"].includes(t))return;if(n.configuration&&(n.paywallId||n.paywallVersionId)){let o=await we(n.configuration,{funnelId:a.funnelId,customerId:n.client.customerId,parameters:a.parameters??{}});w.throwIfAborted();let C=o.type==="unknown"||o.type==="unavailable"&&o.reason!=="funnel_stopped";if(o.type==="paywall"?p?o.paywallId!==p.resolution.paywallId:n.paywallVersionId?o.paywallVersionId!==n.paywallVersionId:o.paywallId!==n.paywallId:!C)return r(ye(o)??"route_changed")}if(N&&(_=!1,await n.client.retained()==="pending"))return r("purchase_pending");if(await be,le){m=a,q=z(a);return}if(B||n.paywallId||n.paywallVersionId||y){let o=await X(g);if(w.throwIfAborted(),Se(D(o,g.commerce)?{savedAt:Date.now(),funnelId:a.funnelId,context:g,resolution:o}:null),p)ke(o,g);else{if(t!=="preparing")return;if(y){if(!D(o,g.commerce))return d("unavailable","plan_unavailable");if(!ue(o,g))return}}}}catch(s){return w.aborted?d("released","aborted"):O(ie(s))}["preparing","ready","shown"].includes(t)&&(m=a,q=z(a),fe(),_&&K())},()=>O("gated"));let _e={get state(){return t},get reason(){return ge},ready:Pe,local:be,get start(){return m},get prediction(){return T?structuredClone(T):void 0},matches:e=>m?z(e)===q:!!p&&e.funnelId===p.funnelId&&e.locale===p.context.locale,open(){if(t==="preparing")return"pending";if(t!=="ready"||!v)return!1;if(Date.now()-j>=Y)return d("unavailable","expired"),!1;let e=v;return v=null,W(),G("shown"),e(),"shown"},destroy(){me.abort()}};return He.set(_e,{onClose(e){return t==="closed"?(A(e),()=>{}):(J.add(e),()=>{J.delete(e)})},claim(){W()},remember(e){te=!0;let r=structuredClone(e);L.then(()=>{!H||!g||Ie({savedAt:Date.now(),funnelId:H.funnelId,context:g,resolution:r})},()=>{})},withhold(){te=!0,L.then(()=>{H&&Ie({savedAt:Date.now(),funnelId:H.funnelId,presented:"nothing"})},()=>{})},async adopt(e,r){let a=e.paywall?.resolution,l=e.paywall&&!e.paywall.quote&&!e.paywall.operation&&!e.paywall.purchaseRequestId&&!(e.paywall.selectionGeneration??0);if(t!=="shown"||!P||!y||!a||!l||e.source.id!==m?.funnelId||e.locale!==m?.locale||!M(e.parameters??{},m?.parameters??{})||!["running","waiting"].includes(e.status)||!$(a,y))return null;let i;try{i=await r.start()}catch{return null}if(t!=="shown"||!P)return i.destroy(),null;h=i,u.options=r.options,u.handoff=r.handoff;for(let[o]of E)E.set(o,i.subscribe?.(o)??(()=>{})),i.view&&A(o,structuredClone(i.view));w.removeEventListener("abort",Z),G("adopted"),ae(i),J.clear();let s=P,f=b;return P=null,b=null,v=null,new Proxy(s,{get(o,C){return C==="destroy"?()=>{o.destroy(),f?.remove()}:C==="retainPurchaseDialog"?()=>{let I=o.retainPurchaseDialog();if(I)return{dialog:I.dialog,release(){I.release(),f?.remove()}}}:Reflect.get(o,C,o)}})},retainPurchaseDialog(){if(t!=="shown")return;let e=P?.retainPurchaseDialog();if(!e)return;let r=b;return P=null,b=null,d("released"),{dialog:e.dialog,release(){e.release(),r?.remove()}}},get modal(){return y?.document.presentation.type!=="inline"},get revealable(){return t==="ready"&&!!v&&Date.now()-j<Y},release(){d("released")}}),_e}function ze(c,n){let S=n.run.parameters??{},F=S?.commerce;return Ge(c,{client:n.client,start:{funnelId:n.run.source.id,locale:n.run.locale,parameters:S},paywallVersionId:n.paywallVersionId,...F&&{commerce:F},locale:n.run.locale,signal:n.signal},{run:!0})}export{je as a,$e as b,Ge as c,ze as d};
@@ -1 +0,0 @@
1
- import{o as n,r as t}from"./chunk-4ZIA22MI.js";function u(o,e,a){return n(o,e,a,t)}export{u as a};
@@ -1 +0,0 @@
1
- import{b as oe}from"./chunk-QLUP7E5M.js";import{b as X,d as se}from"./chunk-VWVLWUBX.js";import{b as ce}from"./chunk-7XQKSA4R.js";import{a as ie}from"./chunk-WX55MS2F.js";import"./chunk-OHPNHCQS.js";import{a as K}from"./chunk-UG5RBIWP.js";import"./chunk-SOUVNTG4.js";import"./chunk-O273JQ7U.js";import{b as le}from"./chunk-724YT3J5.js";import"./chunk-45PGU2HW.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import{k as H,l as Q}from"./chunk-VVZLNTWC.js";import"./chunk-MCFHMWLX.js";import"./chunk-ZZ4X4DMO.js";import"./chunk-4ZIA22MI.js";import"./chunk-CN2INQIX.js";import"./chunk-KWOB5LYC.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-H4RDA4MD.js";import"./chunk-2XTBFJN4.js";import"./chunk-SZPHTRYE.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-AVXJB4O6.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import{a as g}from"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-3VUPVXAV.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import{a as f}from"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";var D=new WeakMap,W=new WeakMap,Y=new WeakSet;function ge(R,e){let y=e.hostPaywallTarget?void 0:e.prepared,Z=()=>{e.prepared&&!Y.has(e.prepared)&&X(e.prepared)?.release()},$=D.get(e.client);if($)return Z(),$;let ee=n=>({...n,requestId:n.requestId??crypto.randomUUID()}),N=e.allowNewPurchase!==!1&&e.start instanceof Promise?e.start:void 0,m=e.allowNewPurchase===!1||!e.start||e.start instanceof Promise?void 0:ee(e.start);m&&y?.state==="ready"&&y.matches(m)&&y.open();let h=y&&(m&&(y.state==="preparing"||["shown","closed"].includes(y.state)&&y.matches(m))||N&&["preparing","ready"].includes(y.state))?y:void 0;h?Y.add(h):Z();let p=h&&X(h);p?.claim();let T=Promise.resolve().then(async()=>{let n=!1,c,b=!1,V,C=0,S,I,U=!1,E=()=>{},te=()=>{},_,z=!1,j=!1,O,re=!1,a=e.signal?AbortSignal.any([e.signal,e.client.identitySignal]):e.client.identitySignal,v=()=>{D.get(e.client)===T&&D.delete(e.client),a.removeEventListener("abort",F),E(),te(),h&&Y.delete(h),p?.release()};function ne(){if(O)return O;let t=new Promise(o=>O=o);return W.set(e.client,t),t.then(()=>{W.get(e.client)===t&&W.delete(e.client)}),D.get(e.client)===T&&D.delete(e.client),O}let l=Q(R,e,"funnel",()=>k(),K);function F(){k()}function k(t=!1){if(!n){if(n=!0,l.finish("dismissed"),c){c.destroy();return}if(t&&_){let o=ne();re=!0,_.then(async s=>{s.mode==="run"&&s.status!=="blocked"&&e.client.controller&&e.client.attempt?.requestId===m?.requestId&&await e.client.close()}).catch(()=>{}).finally(()=>{o(),f(e.onDismiss,null)}),v();return}v(),f(e.onDismiss,null)}}let q={destroy:()=>k(),refresh:()=>S??(b?J():c?.refresh())??Promise.resolve(),get recovery(){return c?.recovery??{type:"recover",operationId:null,requestId:null}},prepareFallback:()=>c?.prepareFallback()??Promise.resolve({type:"recover",operationId:null,requestId:null}),review:(...t)=>c?.review(...t)??Promise.resolve(),exitReview:(...t)=>c?.exitReview(...t)??Promise.resolve(),get unappliedDrafts(){return c?.unappliedDrafts??new Map}};a.addEventListener("abort",F,{once:!0}),p&&(te=p.onClose(()=>{z?n||ne():k(!0)}));try{a.throwIfAborted();let t=e.client.controller?.view?.paywall?.resolution,o=t&&"document"in t?t.document:e.loadingDocument;l.start(!0,m?.locale??e.client.attempt?.locale??o?.screen.strings.defaultLocale,o??null);let s=N?l.wait(N.then(r=>r?ee(r):null,()=>null),H):Promise.resolve(m??null);s.catch(()=>{}),h?.state==="shown"?(j=!0,l.present(()=>{})):h&&["preparing","ready"].includes(h.state)&&Promise.all([h.ready,s.catch(()=>null)]).then(([r,i])=>{if(r){if(n||!l.active||!i||!h.matches(i)||!p?.revealable)return p?.release();l.present(()=>{h.open()==="shown"?j=!0:p.release()})}});let d=W.get(e.client);if(d&&await l.wait(d),n)return null;if(a.throwIfAborted(),N){let r=await s;if(n)return null;if(a.throwIfAborted(),!r)return l.finish("skipped"),v(),null;m=r}_=m?e.client.start(m):e.client.refresh({reuseRecentRead:!0});let u=await l.wait(_,H);return n?null:(a.throwIfAborted(),await ae(u,l))}catch(t){if(re||O?.(),n)return null;throw l.finish("error",t),v(),f(e.onError,t),t}function B(t=!1){C++;let o=c;c=void 0,E(),E=()=>{};let s=t?o?.retainPurchaseDialog?.():void 0;return o?.destroy(),a.addEventListener("abort",F,{once:!0}),s}function x(t){b=!0;let o=e.client.attempt?.locale??m?.locale,s=o?.startsWith("zh"),d=t?s?"正在查询原订单…":"Checking your purchase…":s?"暂时无法确认原订单,请重试。":"Could not check your original purchase. Try again.",u=t?void 0:()=>{J()};c?.setPurchaseRecovery?.(d,u)||(c&&B(),l.active||(l=Q(R,e,"funnel",()=>k(),K),l.start(!0,o,e.loadingDocument??null)),l.setPurchaseRecovery(d,u))}function J(){if(S)return S;if(n||a.aborted)return Promise.resolve();V??=c?.recoveryPaywall,a.addEventListener("abort",F,{once:!0}),x(!0);let t=Promise.resolve().then(async()=>{try{let s=await l.wait(e.client.refresh(),H);!n&&!a.aborted&&await ae(s,l)}catch(s){!n&&!a.aborted&&(f(e.onError,s),x(!1))}});S=t;let o=()=>{S===t&&(S=void 0)};return t.then(o,o),t}async function ae(t,o){let s=e.client.controller;if(t.mode==="run"&&t.status!=="blocked"&&s)return b&&c&&B(),b=!1,V=void 0,ue(s,o?.active?o:void 0);if(t.mode==="operation"&&t.purchases.length){x(!0);let d=await l.wait(e.client.recoverPurchasePaywall(V).then(u=>((n||a.aborted)&&u?.destroy(),u)),H).catch(u=>(!n&&!a.aborted&&f(e.onError,u),null));if(n||a.aborted)return null;if(d){if(n||a.aborted)return d.destroy(),null;let u=B(!0)??p?.retainPurchaseDialog?.()??l.retainPurchaseDialog();p?.release();let r=m,i=ce({client:e.client,session:d,start:e.allowNewPurchase===!1||!r?void 0:async()=>{let{requestId:P,...G}=r;return G},signal:a}),w=()=>{!n&&!a.aborted&&!U&&I&&e.client.recovery.status==="complete"&&(U=!0,f(e.onComplete,structuredClone(I)))},A=await ie(R,{signal:a,loading:"host",start:async()=>i.session,checkoutNavigation:"after_confirmation",allowNewPurchase:!1,resumeCheckout:P=>e.client.continueCheckout(L,P),...i.prepare&&{prepareUpgradeReplacement:i.prepare,terminateCheckout:P=>e.client.terminateCheckout(P),beforeCheckoutReplacement:e.beforeCheckoutReplacement,purchaseConfirmation:e.purchaseConfirmation,confirmOnHostedCheckout:e.confirmOnHostedCheckout,claimCoupon:e.claimCoupon,prepareSubscriptionChange:e.prepareSubscriptionChange,resolveSubscriptionChange:e.resolveSubscriptionChange,onPurchase:e.onPurchase,onCheckoutUrl:L,async resolveOfferId(P){let G=e.client.attempt;if(!G)throw new g("PURCHASE_PENDING","Read the new Start before selecting an offer");return e.resolveOfferId?.(P,G)},onComplete(){I=structuredClone(e.client.controller?.view)??I,E(),E=e.client.subscribe(w),w()}},onError:e.onError,onDismiss:()=>{n||k()}},{retainedDialog:u,present(P){l.active?l.present(P):P(!!u)},async dismiss(){k()}});if(!A.host||n||a.aborted)return A.host?.destroy(),u?.release(),v(),null;let M=A.host;return b=!1,c={destroy(){M.destroy(),v(),f(e.onDismiss,null)},refresh:async()=>{await M.refresh()},get recovery(){return M.recovery},prepareFallback:()=>M.prepareFallback(),review:async()=>{},exitReview:async()=>{},unappliedDrafts:new Map},q}}return t.purchases.length||b?(x(!1),q):(l.finish("skipped"),v(),(j||z)&&(n=!0,f(e.onDismiss,null)),null)}function L(t){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");return e.onCheckoutUrl?e.onCheckoutUrl(t):R.ownerDocument.defaultView?.location.assign(t)}async function ue(t,o){a.removeEventListener("abort",F),z=!0;function s(){!n&&!a.aborted&&!b&&!U&&I&&e.client.recovery.status==="complete"&&(U=!0,f(e.onComplete,structuredClone(I)))}E(),E=e.client.subscribe(s);let d=++C,u=await oe(R,{...e,prepared:h,client:t,signal:a,prepareNextPaywall:({run:r,paywallVersionId:i})=>se(R,{client:e.client,run:r,paywallVersionId:i,signal:a}),checkoutNavigation:"after_confirmation",resumeCheckout:r=>e.client.continueCheckout(L,r),terminateCheckout:e.allowNewPurchase===!1?void 0:r=>e.client.terminateCheckout(r),async onCheckoutUrl(r){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let i=e.client.recovery;if((!i.actions.includes("continue_checkout")||!i.purchases.some(w=>w.type==="checkout"&&w.checkoutUrl===r))&&(i=await e.client.refresh(),a.throwIfAborted(),n))throw new DOMException("Presentation dismissed","AbortError");if(le(i)!==r)throw new g("PURCHASE_PENDING","Checkout differs from the original recovery proof");return L(r)},async resolveOfferId(r){if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");let i=e.client.attempt;if(!i)throw new g("PURCHASE_PENDING","Read the original Start before selecting an offer");let w=await e.resolveOfferId?.(r,i);if(a.throwIfAborted(),n)throw new DOMException("Presentation dismissed","AbortError");if(e.client.attempt?.requestId!==i.requestId)throw new g("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting an offer");return w},async resolveSubscriptionChange(r,...i){a.throwIfAborted();let w=e.client.attempt;if(n||!w)throw new g("PURCHASE_PENDING","Read the original Start before selecting a membership");let A=e.resolveSubscriptionChange?await e.resolveSubscriptionChange(r,...i):await i[0]?.();if(a.throwIfAborted(),n||e.client.attempt?.requestId!==w.requestId)throw new g("PURCHASE_STORAGE_CONFLICT","The original purchase changed while selecting a membership");return A},onPresentationState(r){d===C&&f(e.onPresentationState,r)},onComplete(r){d===C&&(I=r,s())},onError(r){d===C&&(f(e.onError,r),r instanceof g&&(r.status===401||r.status===409&&r.reason==="STATE_CHANGED"&&r.recovery==="recover_operation")&&!a.aborted&&J().catch(i=>f(e.onError,i)))},onDismiss(r){d===C&&(n=!0,v(),O?.(),f(e.onDismiss,r))}},o);return d!==C||n||a.aborted?(u.destroy(),n||a.aborted?null:q):(c=u,q)}});return D.set(e.client,T),T}export{ge as showFunnelPurchase};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-7XQKSA4R.js";import"./chunk-WX55MS2F.js";import"./chunk-OHPNHCQS.js";import"./chunk-UG5RBIWP.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-VVZLNTWC.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as mountFunnelRecoveryPaywall,b as replaceableOriginalSession};
@@ -1 +0,0 @@
1
- import{a,b,c,d}from"./chunk-VWVLWUBX.js";import"./chunk-SOUVNTG4.js";import"./chunk-O273JQ7U.js";import"./chunk-DCPRELJA.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-AVXJB4O6.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-4DMVOAXB.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase,d as prerenderRunPaywall};
@@ -1 +0,0 @@
1
- import{a,b,c}from"./chunk-SOUVNTG4.js";import"./chunk-O273JQ7U.js";import"./chunk-AVXJB4O6.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-WG2DKREQ.js";import"./chunk-35JZDDF3.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as predictFunnelStart,c as predictedPaywallLoadingDocument,b as predictionRefusal};
@@ -1 +0,0 @@
1
- import{a as e,b as o,c as n}from"./chunk-O273JQ7U.js";import"./chunk-AVXJB4O6.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-WG2DKREQ.js";import"./chunk-35JZDDF3.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{e as FUNNEL_ROUTE_LIMITS,o as funnelRouteSchema,n as projectFunnelRoute};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-QLUP7E5M.js";import"./chunk-VWVLWUBX.js";import"./chunk-OHPNHCQS.js";import"./chunk-UG5RBIWP.js";import"./chunk-SOUVNTG4.js";import"./chunk-O273JQ7U.js";import"./chunk-45PGU2HW.js";import"./chunk-AEQUKR4O.js";import"./chunk-W32FI2A2.js";import"./chunk-VVZLNTWC.js";import"./chunk-CN2INQIX.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-AVXJB4O6.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-SLUA7ABW.js";import"./chunk-MB2U2GWJ.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
@@ -1 +0,0 @@
1
- import{P as r,Q as m,j as e}from"./chunk-V53RJR3S.js";import"./chunk-4DMVOAXB.js";import"./chunk-7KQWJBFQ.js";import"./chunk-GNRFL6KF.js";import"./chunk-35JZDDF3.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{m as merchantBridgeCommerceSchema,r as merchantBridgeOperationSchema,e as merchantOperationLookupSchema};
@@ -1 +0,0 @@
1
- import{e as o}from"./chunk-JFQBHUUN.js";import"./chunk-T3JVQBQT.js";import"./chunk-XOX4O4A7.js";import"./chunk-2XTBFJN4.js";import"./chunk-SZPHTRYE.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-E3DRXDDQ.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-GNRFL6KF.js";import"./chunk-35JZDDF3.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-WX55MS2F.js";import"./chunk-UG5RBIWP.js";import"./chunk-W32FI2A2.js";import"./chunk-VVZLNTWC.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-VILB5M4X.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as showPaywall};
@@ -1 +0,0 @@
1
- import{b as a}from"./chunk-H4RDA4MD.js";import"./chunk-2XTBFJN4.js";import"./chunk-SZPHTRYE.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-3VUPVXAV.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-MSRPJSCY.js";import"./chunk-JFQBHUUN.js";import"./chunk-T3JVQBQT.js";import"./chunk-KWOB5LYC.js";import"./chunk-TY4PJ2AG.js";import"./chunk-DCPRELJA.js";import"./chunk-XOX4O4A7.js";import"./chunk-PLXNTIX4.js";import"./chunk-H4RDA4MD.js";import"./chunk-2XTBFJN4.js";import"./chunk-SZPHTRYE.js";import"./chunk-Y4MFO2FU.js";import"./chunk-SSVSXSYE.js";import"./chunk-KLPRVDHS.js";import"./chunk-V53RJR3S.js";import"./chunk-EK5U2JOM.js";import"./chunk-VILB5M4X.js";import"./chunk-E3DRXDDQ.js";import"./chunk-LM6TMEMB.js";import"./chunk-4DMVOAXB.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-3VUPVXAV.js";import"./chunk-SUAUY6IF.js";import"./chunk-5MRSFLQA.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-NE64O6U6.js";import"./chunk-VVZLNTWC.js";import"./chunk-HQWZWHHM.js";import"./chunk-NPDRXDI7.js";import"./chunk-XJTEGBPR.js";import"./chunk-7KQWJBFQ.js";import"./chunk-WG2DKREQ.js";import"./chunk-HLK7L2RV.js";import"./chunk-GNRFL6KF.js";import"./chunk-35JZDDF3.js";import"./chunk-DSPLGTQI.js";import"./chunk-VPT5MFDG.js";import"./chunk-CILM5XMH.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
File without changes