@tinkerlandai/longplay-sdk 0.10.44 → 0.10.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/check-response-5ZLFYMPK.js +1 -0
- package/dist/{chunk-CWD36SJO.js → chunk-4LIM2ZQR.js} +1 -1
- package/dist/chunk-6RNLPMMJ.js +1 -0
- package/dist/{chunk-LZ3OJYBY.js → chunk-7MTQQIGR.js} +1 -1
- package/dist/{chunk-MPD3UIY4.js → chunk-A37ZU2AP.js} +1 -1
- package/dist/{chunk-WSGTKHYR.js → chunk-AAILPAL5.js} +1 -1
- package/dist/{chunk-4MBJTEA6.js → chunk-AKBF7TGD.js} +1 -1
- package/dist/{chunk-LU7AMQCJ.js → chunk-ANTKNFC6.js} +1 -1
- package/dist/{chunk-MKLZPUKJ.js → chunk-ASCVMPXG.js} +1 -1
- package/dist/{chunk-AV2WZSII.js → chunk-CI7UPAWD.js} +1 -1
- package/dist/{chunk-B4AELNLE.js → chunk-CRCAYVV5.js} +1 -1
- package/dist/{chunk-JK2IZQQK.js → chunk-D3WC3T4U.js} +1 -1
- package/dist/{chunk-5JRBCW6V.js → chunk-DTOYPMAW.js} +1 -1
- package/dist/{chunk-EEQRGIPH.js → chunk-EIVFBGI5.js} +1 -1
- package/dist/{chunk-AQONMY2H.js → chunk-EQKTKITL.js} +1 -1
- package/dist/{chunk-7MYS52FL.js → chunk-GFSAWDV2.js} +1 -1
- package/dist/{chunk-MWICFZUF.js → chunk-GJLCTQJN.js} +1 -1
- package/dist/chunk-HIUSHWDK.js +1 -0
- package/dist/{chunk-CSLTAXC7.js → chunk-HMPIUYZ2.js} +1 -1
- package/dist/{chunk-5TJISOWN.js → chunk-JDUB4T4P.js} +1 -1
- package/dist/{chunk-ASL7TJFU.js → chunk-JZ73DRHT.js} +1 -1
- package/dist/{chunk-3SXPCVIP.js → chunk-KAMYLHAT.js} +1 -1
- package/dist/{chunk-MEDW4N3F.js → chunk-L42A5KVA.js} +1 -1
- package/dist/{chunk-DCZWNTG2.js → chunk-L7OMFH4O.js} +1 -1
- package/dist/{chunk-HLCDAU5A.js → chunk-MBWUIYCH.js} +1 -1
- package/dist/{chunk-TL67SYPH.js → chunk-MFAEHTOH.js} +1 -1
- package/dist/{chunk-2HU3HWGB.js → chunk-MMJBC6PW.js} +1 -1
- package/dist/chunk-N3C57R2I.js +1 -0
- package/dist/chunk-N3TAZ7HB.js +1 -0
- package/dist/{chunk-TK2DKYFK.js → chunk-PE5Y524X.js} +1 -1
- package/dist/{chunk-IT5DIE6G.js → chunk-POOXIM6Q.js} +1 -1
- package/dist/{chunk-NVF54BDR.js → chunk-PPOPJTHA.js} +1 -1
- package/dist/{chunk-RJY5CUTB.js → chunk-R2OJIXYE.js} +1 -1
- package/dist/{chunk-4DRJAICV.js → chunk-SIJY35EE.js} +1 -1
- package/dist/{chunk-FTGRTYBL.js → chunk-SWULFBRF.js} +1 -1
- package/dist/chunk-TWQB35B7.js +318 -0
- package/dist/{chunk-PBZSOTKZ.js → chunk-UBUFXGS7.js} +1 -1
- package/dist/{chunk-UJMP7AMY.js → chunk-UHT5DGAJ.js} +1 -1
- package/dist/{chunk-LSVTH3TS.js → chunk-UIKMEVXM.js} +1 -1
- package/dist/{chunk-DGZCD3AY.js → chunk-W55G3VGB.js} +1 -1
- package/dist/{chunk-KP4QI4RX.js → chunk-WQN2D5FZ.js} +1 -1
- package/dist/{chunk-CALDEF4M.js → chunk-X2ON6QRA.js} +1 -1
- package/dist/{chunk-6XRXHFM6.js → chunk-XB24ATBA.js} +1 -1
- package/dist/{chunk-V65FSNYO.js → chunk-XQN7MLP5.js} +1 -1
- package/dist/{chunk-C4NG6RVA.js → chunk-XWD4N2QI.js} +1 -1
- package/dist/{chunk-6GEAXL7F.js → chunk-YHC5WAVP.js} +1 -1
- package/dist/{chunk-2TTDF4ZM.js → chunk-YPN2ZL2V.js} +1 -1
- package/dist/{chunk-VDMM6LNJ.js → chunk-ZNTV6TU7.js} +1 -1
- package/dist/{chunk-RDUKCMST.js → chunk-ZQAAZ7Q4.js} +1 -1
- package/dist/{content-2E2QSSJ5.js → content-4Y57QHWP.js} +1 -1
- package/dist/funnel-host-purchase-UWTK3C7Q.js +1 -0
- package/dist/funnel-paywall-prerender-MQWJONN5.js +1 -0
- package/dist/funnel-route-prediction-O7XGFYHS.js +1 -0
- package/dist/funnel-route-source-MYKZJIXG.js +1 -0
- package/dist/funnel-runtime-host-66OPNY4C.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-Z5PJ2P6H.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-OSBKHIVO.js +1 -0
- package/dist/page.js +1 -1
- package/dist/{paywall-4STK4AB4.js → paywall-QMYTDELU.js} +1 -1
- package/dist/paywall-content-LLRPWEZD.js +1 -0
- package/dist/paywall-session-P6NIFMKG.js +1 -0
- package/dist/popup.d.ts +3 -3
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-B2OeFzRN.d.ts → presentation-loading-mEA1iohf.d.ts} +2 -2
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-AQXCFML3.js +1 -0
- package/dist/server.js +1 -1
- package/dist/{visual-dom-IN6DRNX3.js → visual-dom-KUABNJV6.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/check-response-OIBVUP72.js +0 -1
- package/dist/chunk-6L652ZLP.js +0 -1
- package/dist/chunk-A4O2UDJP.js +0 -1
- package/dist/chunk-AVPJK4NU.js +0 -1
- package/dist/chunk-P6TNBX2S.js +0 -1
- package/dist/chunk-W7DI47LO.js +0 -10
- package/dist/funnel-host-purchase-P57U3SLX.js +0 -1
- package/dist/funnel-paywall-prerender-NB6DIIPJ.js +0 -1
- package/dist/funnel-route-prediction-XGCMCIKA.js +0 -1
- package/dist/funnel-route-source-O76QSUYU.js +0 -1
- package/dist/funnel-runtime-host-LVYYWHZ5.js +0 -1
- package/dist/merchant-bridge-contracts-FB63H7NE.js +0 -1
- package/dist/operation-contracts-YSFIINLK.js +0 -1
- package/dist/paywall-content-ITCPYRUZ.js +0 -1
- package/dist/paywall-session-W4JSVFCR.js +0 -1
- package/dist/screen-renderer-QFI7D6QJ.js +0 -1
- /package/dist/{chunk-GPJF3T43.js → chunk-6RGARS6I.js} +0 -0
- /package/dist/{chunk-WPFTSHP2.js → chunk-FRK6322O.js} +0 -0
- /package/dist/{chunk-RA7GZ67U.js → chunk-KV5MZ4NI.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ye,b as we}from"./chunk-
|
|
1
|
+
import{a as ye,b as we}from"./chunk-HMPIUYZ2.js";import{d as pe,e as $}from"./chunk-EQKTKITL.js";import{a as fe}from"./chunk-MFAEHTOH.js";import{a as P}from"./chunk-DSPLGTQI.js";var Ce=5*6e4,Ae=15e3,ge=new WeakMap;function Oe(i){return ge.get(i)}var C=i=>Array.isArray(i)?i.map(C):i&&typeof i=="object"?Object.fromEntries(Object.keys(i).sort().map(n=>[n,C(i[n])])):i,R=(i,n)=>JSON.stringify(C(i))===JSON.stringify(C(n)),me=i=>JSON.stringify(C([i.funnelId,i.locale??null,i.parameters??{}])),Ee=["onObservationChange","onPurchase","onCheckoutUrl","resumeCheckout","allowNewPurchase","checkoutNavigation","terminateCheckout","confirmOnHostedCheckout","resolveOfferId","resolveSubscriptionChange","onOpenUrl","onEvent","onAction","onComplete","onError"];function Fe(i,n){let z=e=>structuredClone({funnelId:e.funnelId,locale:e.locale,parameters:e.parameters}),y,Q="",Y=n.start instanceof Promise?void 0:z(n.start),D=e=>e?.parameters?.commerce,Z=Promise.resolve(n.start).then(e=>e?z(e):void 0),M=n.maxAgeMs??Ce,ee=new AbortController,p=AbortSignal.any([ee.signal,n.client.identitySignal,...n.signal?[n.signal]:[]]),q=()=>o("released","aborted"),t="preparing",ne,_,x=()=>{},V=0,h=null,m=null,g=null,u=null,b,L,ae=new Map,f=null,O=new Set,S=new Map,j,te=new Promise(e=>j=e),T,he=new Promise(e=>T=e);function F(e,a){t!==e&&(t=e,ne=a,P(n.onState,e))}function be(){p.removeEventListener("abort",q),H(),m?.destroy(),m=null,h?.remove(),h=null,g=null}function o(e,a){["adopted","unavailable","released","closed"].includes(t)||(F(e,a),be(),j(!1),T(null))}let J=e=>`error:${e?.code??e?.name??"unknown"}`,U=i.ownerDocument.defaultView,A=!0,re=null,I=!1,ve=e=>e.storageArea===U?.localStorage&&(e.key===null||e.key.startsWith("indiana.funnel.purchases.")),oe=e=>{ve(e)&&N()},Pe=n.client.subscribe(()=>N());function H(){A&&(A=!1,U?.removeEventListener("storage",oe),Pe(),x())}let G=()=>A&&(t==="ready"||t==="preparing");function W(e){(t==="ready"||t==="preparing")&&o("unavailable",e)}function N(){if(t==="ready"&&Date.now()-V>=M)return H();I=!0,re??=(async()=>{for(;I&&y&&G();){I=!1;try{await n.client.retained()==="pending"&&W("purchase_pending")}catch(e){p.aborted?o("released","aborted"):W(J(e))}}})().finally(()=>{re=null,I&&y&&G()&&N()})}U?.addEventListener("storage",oe),p.addEventListener("abort",q,{once:!0});let le=n.client.findPurchase();le.catch(()=>{});let E;function K(e){let a=JSON.stringify(C(e)),r=ae.get(a);return r||(r=n.client.readPaywall({paywallVersionId:E?.paywallVersionId??n.paywallVersionId??u?.id,...E?.paywallVersionId||n.paywallVersionId||u?{}:{paywallId:E?.paywallId??n.paywallId},...e}),ae.set(a,r)),r}function B(e){let a=Object.values(e.capabilities.plans);return!(Object.values(e.document.buttons).some(c=>c.type==="checkout")&&a.length===0)&&!a.some(c=>!c.available)}function ie(e,a){if(u&&!$(e,u))return o("unavailable","paywall_changed"),!1;u=e,L=a;for(let r of S.keys())P(r,structuredClone(e));return!0}async function k(){let e=await he;if(!e)throw new fe("PURCHASE_PENDING","The purchase did not start; open it again");return e}let Se={get view(){return f?f.view:u},get signal(){return f?.signal??n.client.identitySignal},get quote(){return f?.quote??null},get operation(){return f?.operation??null},webViewUrl:"bundled",get canReselect(){return f?.canReselect},get recovery(){return f?.recovery},get pendingCancellation(){return f?.pendingCancellation},subscribe(e){return S.set(e,f?.subscribe?.(e)??(()=>{})),()=>{S.get(e)?.(),S.delete(e)}},refresh:async()=>f?f.refresh():structuredClone(u),preview:async e=>(await k()).preview(e),confirm:async()=>(await k()).confirm(),cancel:async()=>(await k()).cancel(),read:async()=>(await k()).read(),destroy(){f?.destroy()}},s={options:{},handoff:{}},se={loading:"host",focusAtReveal:!0,signal:n.client.identitySignal,start:async()=>Se,canInteract:()=>s.options.canInteract?s.options.canInteract():!["unavailable","released","closed"].includes(t),async beforeAction(){let e=t!=="adopted",a=u?.capabilities,r=await k();if(e&&!R(r.view?.capabilities,a))throw new pe;await s.options.beforeAction?.()}};for(let e of Ee)Object.defineProperty(se,e,{enumerable:!0,get:()=>s.options[e]});function X(){t!=="preparing"||!g||!m||!y||!R(L?.commerce,D(y))||L?.locale!==y.locale||(F("ready"),j(!0))}let ce={present(e){if(s.handoff.present)return s.handoff.present(e);t==="preparing"&&(g=e,V=Date.now(),X())},async dismiss(){if(s.handoff.dismiss)return s.handoff.dismiss();o("closed");for(let e of[...O])P(e)},async closeAction(e){if(s.handoff.closeAction)return s.handoff.closeAction(e);s.options.onAction?await s.options.onAction(e):await ce.dismiss()},quoteError(e){s.handoff.quoteError?s.handoff.quoteError(e):P(s.options.onError,e)}};async function Ie(){if(n.paywallVersionId||n.paywallId)return{paywallVersionId:n.paywallVersionId,paywallId:n.paywallId};let e=n.configuration;if(!e)return o("unavailable","paywall_missing"),null;let a=await Promise.resolve(n.start).catch(()=>null);if(!a||t!=="preparing")return null;let r=()=>ye(e,{funnelId:a.funnelId,customerId:n.client.customerId,parameters:a.parameters??{}});if(_=await r(),t!=="preparing")return null;let c=_;if(c.type!=="paywall")return o("unavailable",we(c)??"route"),null;let l=!1;return x=e.subscribe(()=>{l||!G()||(l=!0,r().then(d=>{!(d.type==="unavailable"&&!["funnel_stopped","route_unavailable"].includes(d.reason))&&(d.type!=="paywall"||d.paywallVersionId!==c.paywallVersionId)&&W("route_changed")}).finally(()=>l=!1))}),A||x(),{paywallVersionId:c.paywallVersionId}}(async()=>{try{let[{showPaywall:e},a]=await Promise.all([import("./paywall-QMYTDELU.js"),Ie()]);if(p.throwIfAborted(),t!=="preparing"||!a)return;let r=n.commerce??D(Y),c=n.locale??Y?.locale;if(!r)return o("unavailable","commerce_missing");if(!c)return o("unavailable","locale_missing");E=a;let l={commerce:r,locale:c},d=await K(l);if(p.throwIfAborted(),t!=="preparing"||(!B(d)&&n.start instanceof Promise&&!b&&await Z,b&&!R(l,b)&&(l=b,d=await K(l)),p.throwIfAborted(),t!=="preparing"))return;if(!B(d))return o("unavailable","plan_unavailable");if(!ie(d,l))return;h=i.ownerDocument.createElement("div"),i.append(h);let v=setTimeout(()=>t==="preparing"&&o("unavailable","timeout"),Ae);te.then(()=>clearTimeout(v));let w=await e(h,se,ce);if(!w.host||p.aborted||t!=="preparing"){w.host?.destroy(),o(p.aborted?"released":"unavailable","error");return}m=w.host,X()}catch(e){o(p.aborted?"released":"unavailable",J(e))}})(),Z.then(async e=>{if(!e)return o("unavailable","gated");let a=e,r=D(a),c=n.commerce??r;if(!R(r&&{...r,intent:void 0},c&&{...c,intent:void 0})||n.locale!==void 0&&a.locale!==n.locale)return o("unavailable","start_mismatch");if(!r)return o("unavailable","commerce_missing");b={commerce:r,locale:a.locale};try{let l=await le,d=l==="pending"?"purchase_pending":l==="found"?"original_purchase":l==="blocked"?"purchase_blocked":void 0;if(d)return o("unavailable",d);if(t!=="preparing")return;if(A&&(I=!1,await n.client.retained()==="pending"))return o("unavailable","purchase_pending");if(E||n.paywallId||n.paywallVersionId||u){let v=await K(b);if(p.throwIfAborted(),t!=="preparing")return;if(u){if(!B(v))return o("unavailable","plan_unavailable");if(!ie(v,b))return}}}catch(l){return o(p.aborted?"released":"unavailable",J(l))}t==="preparing"&&(y=a,Q=me(a),X(),I&&N())},()=>o("unavailable","gated"));let de={get state(){return t},get reason(){return ne},ready:te,get start(){return y},get prediction(){return _?structuredClone(_):void 0},matches:e=>!!y&&me(e)===Q,open(){if(t==="preparing")return"pending";if(t!=="ready"||!g)return!1;if(Date.now()-V>=M)return o("unavailable","expired"),!1;let e=g;return g=null,H(),F("shown"),e(),"shown"},destroy(){ee.abort()}};return ge.set(de,{onClose(e){return t==="closed"?(P(e),()=>{}):(O.add(e),()=>{O.delete(e)})},claim(){H()},async adopt(e,a){let r=e.paywall?.resolution,c=e.paywall&&!e.paywall.quote&&!e.paywall.operation&&!e.paywall.purchaseRequestId&&!(e.paywall.selectionGeneration??0);if(t!=="shown"||!m||!u||!r||!c||e.source.id!==y?.funnelId||e.locale!==y?.locale||!R(e.parameters??{},y?.parameters??{})||!["running","waiting"].includes(e.status)||!$(r,u))return null;let l;try{l=await a.start()}catch{return null}if(t!=="shown"||!m)return l.destroy(),null;f=l,s.options=a.options,s.handoff=a.handoff;for(let[w]of S)S.set(w,l.subscribe?.(w)??(()=>{})),l.view&&P(w,structuredClone(l.view));p.removeEventListener("abort",q),F("adopted"),T(l),O.clear();let d=m,v=h;return m=null,h=null,g=null,new Proxy(d,{get(w,ue){return ue==="destroy"?()=>{w.destroy(),v?.remove()}:Reflect.get(w,ue,w)}})},get modal(){return u?.document.presentation.type!=="inline"},get revealable(){return t==="ready"&&!!g&&Date.now()-V<M},release(){o("released")}}),de}export{Ce as a,Oe as b,Fe as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-MFAEHTOH.js";var p=new WeakMap;function P(i,n){p.set(i,n)}function v(i){let n,l=!1,d=new AbortController,u=e=>(i.client.pendingCommands??(i.client.pendingCommand?[i.client.pendingCommand]:[])).some(r=>r.requestId===e.command.requestId),m=()=>i.document.defaultView?.navigator.onLine!==!1,C=e=>new Promise((r,t)=>{let o=()=>{clearTimeout(c),d.signal.removeEventListener("abort",a),r()},a=()=>{clearTimeout(c),d.signal.removeEventListener("abort",a),t(new s("IDENTITY_CHANGED","Closing presentation was released"))},c=setTimeout(o,e);d.signal.addEventListener("abort",a,{once:!0}),d.signal.aborted&&a()});async function b(e,r){try{let t;for(let o=0;o<3;o++){if(l)throw new s("IDENTITY_CHANGED","Closing presentation was released");if(o&&(!m()||(await C(o===1?500:2e3),!m())))break;try{let a=p.get(i.client),c=r&&o===0?await(a?a(e.command,()=>{l||n!==e||(e.retained=!0,i.conceal())}):i.client.submit(e.command)):await i.client.retry();if(l)return c;if(!e.retained||!u(e))return n===e&&(n=void 0),await i.receive(c),c;t=new s("COMMAND_PENDING","Closing is still being confirmed. Retry the original request.")}catch(a){if(t=a,!e.retained||!u(e))throw a}}throw t??new s("COMMAND_PENDING","Closing is still being confirmed. Retry the original request.")}catch(t){throw!u(e)&&n===e&&(n=void 0),!l&&e.retained&&i.failed(t),t}}function f(e,r){if(e.flight)return e.flight;let t=b(e,r);e.flight=t;let o=()=>{e.flight===t&&(e.flight=void 0)};return t.then(o,o),t}function g(){if(l)return Promise.reject(new s("IDENTITY_CHANGED","Closing presentation was released"));let e=n;return!e||!u(e)?Promise.reject(new s("INVALID_REQUEST","No closing command is pending")):(!e.flight&&e.retained&&i.conceal(),f(e,!1))}let w=()=>{!l&&n?.retained&&!n.flight&&u(n)&&g().catch(()=>{})};return i.document.defaultView?.addEventListener("online",w),{get pending(){return n?.retained===!0},observe(){n&&!n.flight&&!u(n)&&(n=void 0)},submit(e){if(e.operation==="submit"&&e.input.type!=="screen")return Promise.reject(new s("INVALID_REQUEST","Presentation closure cannot execute a purchase"));if(l)return Promise.reject(new s("IDENTITY_CHANGED","Closing presentation was released"));if(n&&u(n)){let t=n.command;return t.operation===e.operation&&t.nodeId===e.nodeId&&t.visit===e.visit&&(t.operation==="close"||t.operation==="submit"&&e.operation==="submit"&&JSON.stringify(t.input)===JSON.stringify(e.input))?f(n,!n.retained):Promise.reject(new s("COMMAND_PENDING","Recover the original closing command"))}let r={command:e,retained:!1};return n=r,f(r,!0)},retry:g,destroy(){l=!0,d.abort(),i.document.defaultView?.removeEventListener("online",w)}}}export{P as a,v as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-MFAEHTOH.js";import{a as d}from"./chunk-6RGARS6I.js";function I(n,r,i){if(!["subscriptions/operations/read","subscriptions/updates/read","subscriptions/refunds/read"].includes(n))return;let e=r,s=i,o=s.operation;if(o.operationId!==e.operationId||[o.authority,o.merchantExecution].some(t=>t&&(t.operationId!==e.operationId||e.customerId!==void 0&&t.customerId!==e.customerId))||o.authority&&(o.authority.scope.projectId!==s.scope.projectId||o.authority.scope.environment!==s.scope.environment))throw new p("INVALID_RESPONSE","Original commerce operation changed")}function g(n){try{return structuredClone(n)}catch{return n}}async function E(n,r){let i=n.captureIdentity?.(),{apiOperations:e}=await import("./operation-contracts-OSBKHIVO.js");return i?.(),e[r]}function m(n,r,i,e){try{return n.parse(r)}catch(s){throw e&&s instanceof d?new p(i,e):s}}async function P(n,r,i,e={},s){let o=typeof e=="function"?{}:e,t=m(r.request,i,"INVALID_REQUEST",o.request);try{let a=await n(r.path,t,r.method,s),u=typeof e=="function"?e:e.parseResponse,c=u?u(r.response,a):m(r.response,a,"INVALID_RESPONSE",o.response);return I(r.path,t,c),c}catch(a){throw a instanceof p&&t!==null&&typeof t=="object"&&"requestId"in t&&typeof t.requestId=="string"&&(a.commandRequestId??=t.requestId),a}}export{g as a,E as b,P as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as o,c as i}from"./chunk-
|
|
1
|
+
import{a,b as o,c as i}from"./chunk-PPOPJTHA.js";import{a as p}from"./chunk-MFAEHTOH.js";function c(e){if(e!==null&&typeof e=="object"&&"customerId"in e)throw new p("INVALID_REQUEST","Customer requests use the verified session identity")}function I(e){return{async previewUpdate(t){t=a(t),c(t);let r=await o(e,"previewUpdate");return i(e,r,t)},async update(t){t=a(t),c(t);let r=await o(e,"update");return i(e,r,t)},async readSubscriptionUpdate(t){t=a(t),c(t);let r=await o(e,"readSubscriptionUpdate");return i(e,r,t)},async restoreNativePurchase(t){t=a(t),c(t);let r=await o(e,"restoreNativePurchase");return i(e,r,t)},async previewAttach(t){t=a(t),c(t);let r=await o(e,"previewAttach");return i(e,r,t)},async attach(t){t=a(t),c(t);let r=await o(e,"attach");return i(e,r,t)},async readSubscriptionOperation(t){t=a(t),c(t);let r=await o(e,"readSubscriptionOperation");return i(e,r,t)}}}export{c as a,I as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as $,b as N,c as J,d as q}from"./chunk-
|
|
1
|
+
import{a as $,b as N,c as J,d as q}from"./chunk-AAILPAL5.js";import{a as P}from"./chunk-3VUPVXAV.js";import{a as D}from"./chunk-YPN2ZL2V.js";import{a as _}from"./chunk-DSPLGTQI.js";import{b as C,c as O,e as j}from"./chunk-XWD4N2QI.js";async function B(e,t,o,n={}){let r=n.message??"Invalid SDK JSON response",s=e.headers.get("content-length");if(!e.ok||!/^application\/json(?:;|$)/i.test(e.headers.get("content-type")??"")||s!==null&&(!/^\d+$/.test(s)||Number(s)>t)||!e.body)throw e.body?.cancel().catch(()=>{}),Error(r);let u;try{u=await P(e,t,{signal:o,error:()=>Error(r)})}catch(p){throw o.aborted?Error(r):p}return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(u))}async function G(e,t){if(!e?.body)return;let o=new AbortController,n=()=>o.abort(t?.reason);t?.addEventListener("abort",n,{once:!0}),t?.aborted&&n();let r=setTimeout(()=>o.abort(Error("Exposure response timeout")),2e3);try{return await P(e,16384,{signal:o.signal,error:()=>Error("Exposure response budget")})}finally{clearTimeout(r),t?.removeEventListener("abort",n)}}var be=2*1024*1024,V=256*1024;async function Y(e,t,o,n){let r=()=>{},s=new Promise((u,p)=>{r=()=>p(n.reason),n.addEventListener("abort",r,{once:!0}),n.aborted&&r()});try{let u=e(t,{...o,signal:n});return u.then(p=>{n.aborted&&p.body?.cancel().catch(()=>{})},()=>{}),await Promise.race([u,s])}finally{n.removeEventListener("abort",r)}}async function M(e,t,o,n=!1){if(new TextEncoder().encode(o).byteLength>65536)throw Error("Exposure request budget");let r=new URL(t);r.searchParams.set("sdkVersion",D.version);let s=new AbortController,u=setTimeout(()=>s.abort(Error("Exposure request timeout")),5e3);try{let p=await Y(e,r.href,{method:"POST",headers:{"Content-Type":"text/plain"},body:o,credentials:"omit",keepalive:n,redirect:"error"},s.signal),a=await G(p,s.signal),c;try{c=a&&JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(a))}catch{}return{response:p,receipt:c}}finally{clearTimeout(u)}}function H(e){let t,o=!1;return{async read(n,r){if(o)throw Error("Experiment client stopped");t?.abort(Error("Experiment request superseded"));let s=new AbortController;t=s;let{signal:u}=s,p=setTimeout(()=>s.abort(Error("Experiment request timeout")),5e3);try{let a=await Y(e,n,{cache:"no-cache",credentials:"omit",redirect:"error"},u),c=await B(a,r,u);return u.throwIfAborted(),c}finally{clearTimeout(p),t===s&&(t=void 0)}},destroy(){o=!0,t?.abort(Error("Experiment client stopped")),t=void 0}}}var Q=20,ie=65536,se=5e3,ae=5,K=e=>new TextEncoder().encode(JSON.stringify(e)).length;function ce(e,t){let o=e,n=r=>Number.isSafeInteger(r)&&r>=0;return!!o&&typeof o=="object"&&n(o.inserted)&&n(o.duplicates)&&n(o.skipped)&&Array.isArray(o.rejected)&&o.inserted+o.duplicates+o.skipped+o.rejected.length===t&&o.rejected.every(r=>!!r&&typeof r=="object"&&n(r.index)&&r.index<t&&typeof r.reason=="string")&&new Set(o.rejected.map(r=>r.index)).size===o.rejected.length}function F(e){let t=[],o,n,r=(a,c)=>{try{e.log?.(`${e.label} ${a}`,c)}catch{}};function s(a){o===void 0&&!n&&t.length&&(o=setTimeout(()=>{p()},a))}async function u(a,c){let g,f;try{({response:g,receipt:f}=await M(e.fetch,e.endpoint,JSON.stringify({events:a}),c))}catch(h){return r("not sent",{error:h}),!1}return g.status===408||g.status===429||g.status>=500?(r("not sent",{status:g.status}),!1):g.ok?ce(f,a.length)?(f.rejected.length&&r("rejected",{rejected:f.rejected}),!0):(r("not acknowledged",{status:g.status}),!1):(r("rejected",{status:g.status,events:a.length}),!0)}function p(a=!0){if(n)return n;clearTimeout(o),o=void 0;let c=[],g=K({events:[]});for(;t.length&&c.length<Q;){let m=K(t[0].event)+(c.length?1:0);if(c.length&&g+m>ie)break;c.push(t.shift()),g+=m}if(!c.length)return Promise.resolve();let f=1e3,h=u(c.map(m=>m.event),a).then(m=>{if(m)return;f=se;let y=c.filter(b=>++b.attempts<ae);y.length<c.length&&r("dropped after retries",{events:c.length-y.length}),t.unshift(...y)}).finally(()=>{n===h&&(n=void 0),s(f)});return n=h,h}return{push(a){t.push({event:structuredClone(a),attempts:0}),t.length>=Q?p():s(1e3)},flush:p}}/*!
|
|
2
2
|
Portions ported from GrowthBook sdk-js @ ed29827 (GrowthBook.ts auto experiments, util.ts mergeQueryStrings,
|
|
3
3
|
plugins/auto-attributes.ts). Copyright (c) GrowthBook, Inc. MIT License.
|
|
4
4
|
*/function ue(e,t){let o,n;try{o=new URL(e),n=new URL(t)}catch{return t}return o.searchParams.forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),n.toString()}function de(e,t){let o=navigator.userAgent,n=new URLSearchParams(t.search),r={};for(let s of["source","medium","campaign","term","content"]){let u=n.get(`utm_${s}`);u!==null&&(r[`utm${s[0].toUpperCase()}${s.slice(1)}`]=u)}return{id:e,deviceId:e,url:t.href,path:t.pathname,host:t.host,query:t.search,pageTitle:typeof document>"u"?"":document.title,browser:/Edg/.test(o)?"edge":/Chrome/.test(o)?"chrome":/Firefox/.test(o)?"firefox":/Safari/.test(o)?"safari":"unknown",deviceType:/Mobi/.test(o)?"mobile":"desktop",...r}}function le(e){let t=e;if(!(!!t&&typeof t=="object"&&typeof t.environmentId=="string"&&typeof t.trackExposures=="boolean"&&/^[a-f0-9]{64}$/.test(t.generation??"")&&Array.isArray(t.experiments)&&t.experiments.length<=100&&t.experiments.every(n=>!!n&&!["namespace","status","url","groups"].some(r=>Object.hasOwn(n,r))&&(n.hashVersion===void 0||n.hashVersion===2)&&typeof n.key=="string"&&Array.isArray(n.variations)&&n.variations.length>=2&&n.variations.every(r=>!!r&&typeof r.urlRedirect=="string")&&(n.urlPatterns===void 0||Array.isArray(n.urlPatterns)))&&!!t.savedGroups&&typeof t.savedGroups=="object"&&!Array.isArray(t.savedGroups)))throw new Error("Invalid page experiment payload");return t}function Te(e){if(e.configuration&&e.configuration.scope.environmentId!==e.environmentId)throw new Error("Page configuration belongs to another App environment");let t=J(e.baseUrl);if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("environmentId must be the App environment ID");let o=e.fetch??globalThis.fetch.bind(globalThis),n=H(async(i,d)=>{let l=await o(i,d);if(!l.ok)throw l.body?.cancel().catch(()=>{}),new Error(`Page experiments unavailable (${l.status})`);return l}),r=e.log?(i,d)=>_(e.log,i,d):void 0,s=`${t}/api/v1/page-experiments/${e.environmentId}`,u=$(e.deviceIdCookie??"indiana_did"),p=N(),a=null,c={...e.attributes??{}},g="",f=!1,h=!1,m=0,y=0,b=new Map,S=F({endpoint:`${s}/events`,fetch:o,log:r,label:"Exposure"}),k=S.flush,E={trackedExperiments:new Set,log:r,onExperimentViewed:(i,d)=>{e.trackExposures===!1||a?.trackExposures===!1||S.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:u,...p?{sessionId:p}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:i.key,variationKey:d.key})}},z=()=>{E.url=location.href,E.attributes={...de(u,location),...c}};function W(i){if(!e.disableCrossOriginUrlRedirects)return!1;try{let d=new URL(location.href);return i.variations.some(l=>{if(!l.urlRedirect)return!1;let v=new URL(l.urlRedirect);return v.protocol!==d.protocol||v.host!==d.host})}catch{return!0}}function X(i,d){let l=e.configuration?.snapshot?.generation,v=y,te=location.href;g=i;let re=e.navigate??(w=>location.replace(w)),ne=e.navigateDelay??(e.navigate?0:100),oe=e.maxNavigateDelay??1e3;Promise.all([Promise.race([d,new Promise(w=>setTimeout(w,oe))]),new Promise(w=>setTimeout(w,ne))]).then(()=>{!f&&v===y&&location.href===te&&(!e.configuration||e.configuration.fresh&&e.configuration.snapshot?.generation===l)&&re(i)})}function x(){if(!(!a||f||e.configuration&&!e.configuration.fresh)){z();for(let i of a.experiments){if(W(i)){r?.("Auto experiment blocked",{id:i.key});continue}let d;try{d=j(i,E)}catch(l){r?.("Skipping page experiment",{id:i.key,error:String(l)});continue}if(b.set(i.key,d),!!d.inExperiment){if(d.value.urlRedirect){let l=i.persistQueryString?ue(location.href,d.value.urlRedirect):d.value.urlRedirect;C(l,i.urlPatterns??[])?r?.("Skipping redirect because original URL matches redirect URL",{id:i.key}):l!==g&&X(l,k())}break}}}}let R="",Z=()=>{location.href!==R&&(y++,R=location.href,g="",x())},T,L;function ee(){T??=q(Z),addEventListener("pagehide",I)}let I=()=>{k()};async function A(){if(f)return!1;let i=++m,d;try{d=e.configuration?await e.configuration.pageExperiments():await n.read(s,V)}catch(v){if(f||i!==m)return!1;throw v}if(f||i!==m)return!1;let l=le(d);if(l.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Page experiment payload scope changed");return a?.trackExposures===!1&&l.trackExposures&&E.trackedExperiments?.clear(),a=l,E.savedGroups=O(l.savedGroups),!0}function U(){f||(L??=e.configuration?.subscribe(()=>{!f&&e.configuration?.fresh&&A().then(i=>{i&&x()}).catch(i=>r?.("Page configuration unavailable",{error:String(i)}))}),ee(),R=location.href)}return{async start(){h||f||(h=!0,await A()&&(U(),x()))},async refresh(){await A()&&(y++,h&&U(),g="",x())},setAttributes(i){y++,g="",c={...i},x()},getResults(){return new Map(b)},get generation(){return a?.generation??null},destroy(){f||(f=!0,m++,n.destroy(),L?.(),T?.(),removeEventListener("pagehide",I),a=null,b.clear(),k())}}}export{be as a,H as b,F as c,ue as d,de as e,le as f,Te as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o}from"./chunk-
|
|
1
|
+
import{b as o}from"./chunk-6RGARS6I.js";var s=["input","output","cache_read","cache_write","reasoning","input_audio","output_audio"],n=o.string().regex(/.+\/.+/),e=o.number().min(-100),t=o.string().regex(/^(0|[1-9]\d{0,5})(\.\d{1,12})?$/),p=o.strictObject({input:t,output:t,cache_read:t.optional(),cache_write:t.optional(),reasoning:t.optional(),input_audio:t.optional(),output_audio:t.optional()}),i=(r,a)=>o.record(r,a).refine(c=>Object.keys(c).length<=100,"At most 100 AI overrides"),d=o.strictObject({defaultMarkup:e,providerMarkups:i(o.string().min(1),e),modelMarkups:i(n,e),customModels:i(n,p.partial())});export{s as a,n as b,e as c,p as d,d as e};
|