@tinkerlandai/indiana-sdk 0.3.1 → 0.5.0

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 (39) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +18 -13
  3. package/README.zh-CN.md +7 -4
  4. package/THIRD_PARTY_NOTICES.md +27 -0
  5. package/dist/ai-usage-BzydP8eN.d.ts +11085 -0
  6. package/dist/chunk-3OSMEG44.js +17 -0
  7. package/dist/chunk-GA6X57BO.js +1 -0
  8. package/dist/chunk-GTBD4BJ4.js +11 -0
  9. package/dist/chunk-QUW4UOKZ.js +4 -0
  10. package/dist/chunk-RMFH5TWV.js +1 -0
  11. package/dist/chunk-YNUVRZRQ.js +1 -0
  12. package/dist/chunk-ZT523F45.js +1 -0
  13. package/dist/funnel-runtime-host-RZRB2CY6.js +1 -0
  14. package/dist/{funnel-runtime-start-CQhy2kx1.d.ts → funnel-runtime-start-JHA9ES24.d.ts} +68 -29
  15. package/dist/index.d.ts +109 -53
  16. package/dist/index.js +1 -1
  17. package/dist/native-shell.js +1 -1
  18. package/dist/openrouter.d.ts +3 -2
  19. package/dist/openrouter.js +1 -1
  20. package/dist/page.d.ts +13 -12
  21. package/dist/page.js +1 -4
  22. package/dist/{paywall-Y3FIG43H.js → paywall-MYBEOVTQ.js} +1 -1
  23. package/dist/popup.d.ts +254 -1
  24. package/dist/popup.js +8 -7
  25. package/dist/{screen-Keau_Qa2.d.ts → screen-16d-xADb.d.ts} +354 -463
  26. package/dist/server.d.ts +4 -3
  27. package/dist/server.js +1 -1
  28. package/dist/src-E2GXK6WA.js +1 -0
  29. package/dist/visual-editor-agent-FDCV3BXP.js +1 -0
  30. package/dist/visual.d.ts +38 -0
  31. package/dist/visual.js +1 -0
  32. package/package.json +8 -2
  33. package/dist/ai-usage-D_mBF5Gp.d.ts +0 -9942
  34. package/dist/chunk-CRJJ4EA2.js +0 -1
  35. package/dist/chunk-D37O6FAW.js +0 -11
  36. package/dist/chunk-G5ZGWOLJ.js +0 -1
  37. package/dist/chunk-MJG7X7LM.js +0 -17
  38. package/dist/funnel-runtime-host-X7AGEGHN.js +0 -1
  39. package/dist/src-RZJKF6LQ.js +0 -1
@@ -1,9 +1,10 @@
1
1
  import { OpenRouter } from '@openrouter/sdk';
2
2
  import { ChatUsage } from '@openrouter/sdk/models';
3
- import { c as createAiPricing, F as FoundationApi, a as AiUsageContext, b as AiTokenUsage, d as AiTokenQuote } from './ai-usage-D_mBF5Gp.js';
3
+ import { c as createAiPricing, F as FoundationApi, a as AiUsageContext, b as AiTokenUsage, d as AiTokenQuote } from './ai-usage-BzydP8eN.js';
4
4
  import '@ai-sdk/provider';
5
- import './screen-Keau_Qa2.js';
5
+ import './screen-16d-xADb.js';
6
6
  import 'zod';
7
+ import 'zod/v4';
7
8
 
8
9
  type OpenRouterUsageRecord = {
9
10
  context: AiUsageContext;
@@ -1 +1 @@
1
- import{a as i}from"./chunk-CRJJ4EA2.js";import"./chunk-D37O6FAW.js";import"./chunk-MJG7X7LM.js";import{z as R}from"zod";var c=R.number().int().min(0).max(1e9);function k(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function h(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):k(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await h({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:A}=await w.read();if(A){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,h as trackOpenRouterUsage};
1
+ import"./chunk-RMFH5TWV.js";import{a as i}from"./chunk-YNUVRZRQ.js";import"./chunk-GTBD4BJ4.js";import"./chunk-3OSMEG44.js";import{z as k}from"zod";var c=k.number().int().min(0).max(1e9);function R(e,o){let a=c.parse(e.promptTokens),p=c.parse(e.completionTokens),s=c.parse(e.promptTokensDetails?.cachedTokens??0),t=c.parse(e.promptTokensDetails?.cacheWriteTokens??0),r=c.parse(e.promptTokensDetails?.audioTokens??0),l=c.parse(e.completionTokensDetails?.audioTokens??0),n=c.parse(e.completionTokensDetails?.reasoningTokens??0);if(c.parse(e.totalTokens)!==a+p||s+t+r>a||n+l>p||(e.promptTokensDetails?.videoTokens??0)>0)throw new i("AI_USAGE_UNAVAILABLE","Token pools must conserve usage; video needs an explicit token mapper");return{input:a-s-t-r,output:p-l-(o==="separate"?n:0),cache_read:s,cache_write:t,input_audio:r,output_audio:l,reasoning:o==="separate"?n:0}}function I(e){if(!Number.isFinite(e)||e<0)throw new i("AI_USAGE_UNAVAILABLE","Provider cost must be a nonnegative USD amount");let o=String(e),a=o.includes("e")?e.toFixed(18).replace(/0+$/,"").replace(/\.$/,""):o;if(!/^(0|[1-9]\d{0,11})(\.\d{1,18})?$/.test(a)||Number(a)!==e)throw new i("AI_USAGE_UNAVAILABLE","Provider cost exceeds the supported precision");return a}async function h(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning)||!e.modelId||!e.generationId)throw new i("INVALID_REQUEST","Actual model, generation ID and reasoning pricing are required");let o={context:e.context,generationId:e.generationId,modelId:`openrouter/${e.modelId}`,usage:e.usage,tokens:null,quote:null,receipt:null,phase:"captured"};await e.persist(o);let a=e.mapTokens?e.mapTokens(e.usage):R(e.usage,e.reasoning),p=e.usage.cost==null?void 0:I(e.usage.cost),s=e.quote??await e.pricing.quoteTokens({modelId:o.modelId,tokens:a});if(s.pricing.modelId!==o.modelId||Object.keys(a).some(l=>a[l]!==s.tokens[l]))throw new i("INVALID_REQUEST","Saved quote must match the provider model and token pools");await e.persist({...o,tokens:a,quote:s,phase:"quoted"});let t=await e.pricing.trackTokens(e.client,{...e.context,quote:s,providerCostUsd:p,generationId:e.generationId});if(!t.receipt.accepted)throw new i("AI_BALANCE_REJECTED","OpenRouter usage was saved but the balance request was rejected");let r={...o,tokens:a,quote:s,receipt:t,phase:"settled"};return await e.persist(r),r}function T(e){if(typeof window<"u")throw new i("SERVER_ONLY","OpenRouter accounting requires your backend");if(!["output","separate"].includes(e.reasoning))throw new i("INVALID_REQUEST","Reasoning pricing is required");let o=e.openRouter.chat;async function a(t){if(!t.usage||!t.modelId||!t.generationId)throw new i("AI_USAGE_UNAVAILABLE","OpenRouter did not return final usage and the actual model");await h({...e,context:t.context,generationId:t.generationId,modelId:t.modelId.slice(11),usage:t.usage})}let p=async(t,r)=>{let n={context:await e.context(),generationId:null,modelId:null,usage:null,tokens:null,quote:null,receipt:null,phase:"incomplete"},d;try{d=await o.send(t,r)}catch(g){throw await e.persist(n),g}if(!(d instanceof ReadableStream)){if(n={...n,generationId:d.id,modelId:d.model?`openrouter/${d.model}`:null,usage:d.usage??null},!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter omitted final accounting");return await a(n),d}let w=d.getReader(),m=!1;return new ReadableStream({async pull(g){try{let{value:u,done:A}=await w.read();if(A){if(m=!0,!n.usage||!n.modelId)throw await e.persist(n),new i("AI_USAGE_UNAVAILABLE","OpenRouter stream ended without final accounting");await a(n),g.close();return}if(u.error)throw new i("AI_PROVIDER_ERROR",u.error.message);u.usage&&(n={...n,generationId:u.id,modelId:u.model?`openrouter/${u.model}`:null,usage:u.usage}),g.enqueue(u)}catch(u){m||(m=!0,await e.persist(n)),await w.cancel(u),g.error(u)}},async cancel(g){m||(m=!0,await e.persist(n)),await w.cancel(g)}})},s=new Proxy(o,{get(t,r){return r==="send"?p:Reflect.get(t,r,t)}});return new Proxy(e.openRouter,{get(t,r){return r==="chat"?s:Reflect.get(t,r,t)}})}export{T as createOpenRouterUsageClient,h as trackOpenRouterUsage};
package/dist/page.d.ts CHANGED
@@ -4,14 +4,16 @@ import { z } from 'zod';
4
4
  /** GET /api/v1/page-experiments/{environmentId}: page experiments and the saved groups they reference only. */
5
5
  declare const pageExperimentPayloadSchema: z.ZodObject<{
6
6
  environmentId: z.ZodUUID;
7
+ trackExposures: z.ZodBoolean;
7
8
  generation: z.ZodString;
8
9
  experiments: z.ZodArray<z.ZodObject<{
10
+ name: z.ZodOptional<z.ZodString>;
11
+ coverage: z.ZodOptional<z.ZodNumber>;
12
+ key: z.ZodString;
9
13
  condition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
10
14
  seed: z.ZodOptional<z.ZodString>;
11
15
  hashVersion: z.ZodOptional<z.ZodLiteral<2>>;
12
16
  ranges: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
13
- key: z.ZodString;
14
- name: z.ZodOptional<z.ZodString>;
15
17
  force: z.ZodOptional<z.ZodNumber>;
16
18
  urlPatterns: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
19
  include: z.ZodBoolean;
@@ -30,22 +32,21 @@ declare const pageExperimentPayloadSchema: z.ZodObject<{
30
32
  hashVersion: z.ZodLiteral<2>;
31
33
  ranges: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
32
34
  }, z.core.$strict>>>;
33
- coverage: z.ZodOptional<z.ZodNumber>;
34
- meta: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
- key: z.ZodOptional<z.ZodString>;
36
- name: z.ZodOptional<z.ZodString>;
37
- passthrough: z.ZodOptional<z.ZodBoolean>;
38
- }, z.core.$strict>>>;
39
- fallbackAttribute: z.ZodOptional<z.ZodString>;
40
- disableStickyBucketing: z.ZodOptional<z.ZodBoolean>;
41
- bucketVersion: z.ZodOptional<z.ZodNumber>;
42
- minBucketVersion: z.ZodOptional<z.ZodNumber>;
43
35
  parentConditions: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
36
  id: z.ZodString;
45
37
  condition: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
46
38
  gate: z.ZodOptional<z.ZodBoolean>;
47
39
  }, z.core.$strict>>>;
48
40
  weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
41
+ fallbackAttribute: z.ZodOptional<z.ZodString>;
42
+ disableStickyBucketing: z.ZodOptional<z.ZodBoolean>;
43
+ bucketVersion: z.ZodOptional<z.ZodNumber>;
44
+ minBucketVersion: z.ZodOptional<z.ZodNumber>;
45
+ meta: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ key: z.ZodOptional<z.ZodString>;
47
+ name: z.ZodOptional<z.ZodString>;
48
+ passthrough: z.ZodOptional<z.ZodBoolean>;
49
+ }, z.core.$strict>>>;
49
50
  changeId: z.ZodString;
50
51
  variations: z.ZodArray<z.ZodObject<{
51
52
  urlRedirect: z.ZodString;
package/dist/page.js CHANGED
@@ -1,4 +1 @@
1
- import{c as U,d as S,f as I}from"./chunk-MJG7X7LM.js";/*!
2
- Portions ported from GrowthBook sdk-js @ ed29827 (GrowthBook.ts auto experiments, util.ts mergeQueryStrings,
3
- plugins/auto-attributes.ts). Copyright (c) GrowthBook, Inc. MIT License.
4
- */function D(t,e){let a,n;try{a=new URL(t),n=new URL(e)}catch{return e}return a.searchParams.forEach((o,c)=>{n.searchParams.has(c)||n.searchParams.set(c,o)}),n.toString()}function G(t){let e=`${t}=`;for(let a of document.cookie.split(";")){let n=a.trim();if(n.startsWith(e))return decodeURIComponent(n.slice(e.length))}return""}function V(t){let e=G(t);return/^[A-Za-z0-9_-]{8,128}$/.test(e)||(e=crypto.randomUUID(),document.cookie=`${t}=${encodeURIComponent(e)}; path=/; max-age=${400*24*3600}; SameSite=Lax`),e}function _(){try{let t=sessionStorage.getItem("indiana_sid");return t||(t=crypto.randomUUID(),sessionStorage.setItem("indiana_sid",t)),t}catch{return}}function j(t,e){let a=navigator.userAgent,n=new URLSearchParams(e.search),o={};for(let c of["source","medium","campaign","term","content"]){let u=n.get(`utm_${c}`);u!==null&&(o[`utm${c[0].toUpperCase()}${c.slice(1)}`]=u)}return{id:t,deviceId:t,url:e.href,path:e.pathname,host:e.host,query:e.search,pageTitle:typeof document>"u"?"":document.title,browser:/Edg/.test(a)?"edge":/Chrome/.test(a)?"chrome":/Firefox/.test(a)?"firefox":/Safari/.test(a)?"safari":"unknown",deviceType:/Mobi/.test(a)?"mobile":"desktop",...o}}function J(t){let e=new URL(t),a=["localhost","127.0.0.1","[::1]"].includes(e.hostname);if(e.protocol!=="https:"&&!(e.protocol==="http:"&&a)||e.username||e.password||e.search||e.hash)throw new Error("baseUrl must be an https origin without credentials");return e.origin}function N(t){let e=t;if(!(!!e&&typeof e=="object"&&typeof e.environmentId=="string"&&/^[a-f0-9]{64}$/.test(e.generation??"")&&Array.isArray(e.experiments)&&e.experiments.length<=100&&e.experiments.every(n=>!!n&&!["namespace","status","url","groups"].some(o=>Object.hasOwn(n,o))&&(n.hashVersion===void 0||n.hashVersion===2)&&typeof n.key=="string"&&Array.isArray(n.variations)&&n.variations.length>=2&&n.variations.every(o=>!!o&&typeof o.urlRedirect=="string")&&(n.urlPatterns===void 0||Array.isArray(n.urlPatterns)))&&!!e.savedGroups&&typeof e.savedGroups=="object"&&!Array.isArray(e.savedGroups)))throw new Error("Invalid page experiment payload");return e}function M(t){let e=J(t.baseUrl);if(!/^[0-9a-f-]{36}$/i.test(t.environmentId))throw new Error("environmentId must be the App environment ID");let a=t.fetch??globalThis.fetch.bind(globalThis),n=`${e}/api/v1/page-experiments/${t.environmentId}`,o=V(t.deviceIdCookie??"indiana_did"),c=_(),u=null,R={...t.attributes??{}},d="",x=!1,w=new Map,P=[],p;function L(r){return r.length?a(`${n}/events`,{method:"POST",body:JSON.stringify({events:r}),headers:{"Content-Type":"text/plain"},keepalive:!0,credentials:"omit"}).then(()=>{}).catch(i=>t.log?.("Exposure not sent",{error:i})):Promise.resolve()}function m(){return clearTimeout(p),p=void 0,L(P.splice(0,20))}let g={trackedExperiments:new Set,log:t.log,onExperimentViewed:(r,i)=>{t.trackExposures!==!1&&(P.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:o,...c?{sessionId:c}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:r.key,variationKey:i.key}),p||(p=setTimeout(()=>{m()},1e3)))}},T=()=>{g.url=location.href,g.attributes={...j(o,location),...R}};function A(r){if(!t.disableCrossOriginUrlRedirects)return!1;try{let i=new URL(location.href);return r.variations.some(s=>{if(!s.urlRedirect)return!1;let v=new URL(s.urlRedirect);return v.protocol!==i.protocol||v.host!==i.host})}catch{return!0}}function C(r,i){d=r;let s=t.navigate??(l=>location.replace(l)),v=t.navigateDelay??(t.navigate?0:100),O=t.maxNavigateDelay??1e3;Promise.all([Promise.race([i,new Promise(l=>setTimeout(l,O))]),new Promise(l=>setTimeout(l,v))]).then(()=>{x||s(r)})}function h(){if(!(!u||x)){T();for(let r of u.experiments){if(A(r)){t.log?.("Auto experiment blocked",{id:r.key});continue}let i;try{i=I(r,g)}catch(s){t.log?.("Skipping page experiment",{id:r.key,error:String(s)});continue}if(w.set(r.key,i),!!i.inExperiment){if(i.value.urlRedirect){let s=r.persistQueryString?D(location.href,i.value.urlRedirect):i.value.urlRedirect;U(s,r.urlPatterns??[])?t.log?.("Skipping redirect because original URL matches redirect URL",{id:r.key}):s!==d&&C(s,m())}break}}}}let E="",f=()=>{location.href!==E&&(E=location.href,d="",h())},y={push:history.pushState,replace:history.replaceState};function $(){history.pushState=function(...r){y.push.apply(this,r),f()},history.replaceState=function(...r){y.replace.apply(this,r),f()},addEventListener("popstate",f),addEventListener("pagehide",b)}let b=()=>{m()};async function k(){let r=await a(n,{cache:"no-cache",credentials:"omit"});if(!r.ok)throw new Error(`Page experiments unavailable (${r.status})`);let i=N(await r.json());if(i.environmentId.toLowerCase()!==t.environmentId.toLowerCase())throw new Error("Page experiment payload scope changed");u=i,g.savedGroups=S(i.savedGroups)}return{async start(){await k(),$(),E=location.href,h()},async refresh(){await k(),d="",h()},setAttributes(r){R={...r},h()},getResults(){return new Map(w)},get generation(){return u?.generation??null},destroy(){x=!0,history.pushState=y.push,history.replaceState=y.replace,removeEventListener("popstate",f),removeEventListener("pagehide",b),m()}}}export{M as createPageExperiments,D as mergeQueryStrings,j as pageAttributes,N as readPayload};
1
+ import{g as a,h as b,i as c,j as d}from"./chunk-QUW4UOKZ.js";import"./chunk-3OSMEG44.js";export{d as createPageExperiments,a as mergeQueryStrings,b as pageAttributes,c as readPayload};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-6X42DWOM.js";import{a as m}from"./chunk-CRJJ4EA2.js";import{Ie as U,Vl as B,hf as V,y as M}from"./chunk-D37O6FAW.js";import"./chunk-MJG7X7LM.js";async function F(y,t,d){if(t.status!=="complete")throw new m("INVALID_RESPONSE","A verified completed purchase is required");if(await d.onComplete?.(t),!y||!d.check)return;let i=U.parse(await d.check());if(i.internal_feature_id!==y.internal_feature_id||i.quantity!==y.quantity)throw new m("INVALID_RESPONSE","The access requirement changed");i.allowed&&await d.onAccessGranted?.(i)}async function re(y,t){let d=t.check?U.parse(await t.check()):null;if(d?.allowed)return await t.onAccessGranted?.(d),{check:d,host:null};let i=await t.start(),p=i.view;if(!p)throw new m("INVALID_RESPONSE","Paywall presentation is missing");let{mountScreenPreview:j}=await import("./popup.js"),n=y.ownerDocument,R=new AbortController,v=n.createElement("section"),$=n.createElement("div"),I=n.createElement("div"),P=n.createElement("p"),E=n.createElement("button"),D=n.createElement("button"),f=n.createElement("dialog"),L=n.activeElement,w=p.document.screen.strings.defaultLocale.startsWith("zh");v.dataset.indianaPaywall="",v.setAttribute("aria-label",p.document.name),v.style.cssText="width:100%;box-sizing:border-box;background:#fff;color:#172033;font:14px/1.5 system-ui,sans-serif",I.style.cssText="display:flex;gap:12px;padding:12px 20px;align-items:center;flex-wrap:wrap",P.setAttribute("role","status"),D.textContent=w?"\u5173\u95ED":"Close",E.textContent=w?"\u91CD\u8BD5":"Retry",E.hidden=!0,I.append(P,E,D),v.append($,I);let N=p.document.presentation,g,u=!1,_=!1,l=null,T=!1,a=null,x=null,S=e=>{P.textContent=e instanceof Error?e.message:w?"\u8BF7\u6C42\u5931\u8D25":"Request failed",H(t.onError,e),E.hidden=a===null};async function b(e){if(!(_||u)){_=!0,E.hidden=!0,P.textContent="";try{await e()}catch(o){u||S(o)}finally{_=!1}}}async function W(e){await F(d,e,t)}async function O(e){if(u)return;if(P.textContent=e.status,e.status==="complete"){a=null,await W(e);return}if(e.status!=="pending"){a=null,l=null;return}let o=Date.now()+6e5,c=2e3;for(;!u&&Date.now()<o;){if(await new Promise(h=>{let A=()=>{clearTimeout(C),h()},C=setTimeout(()=>{R.signal.removeEventListener("abort",A),h()},c);R.signal.addEventListener("abort",A,{once:!0})}),u)return;let r=await i.read();if(r.status!=="pending"){await O(r);return}c=Math.min(c*1.5,3e4)}a=async()=>O(await i.read()),E.hidden=!1}async function z(){x?.remove(),x=null,a=z;let e=await i.confirm();if(e.status==="pending"){if(e.checkoutUrl)t.onCheckoutUrl?await t.onCheckoutUrl(e.checkoutUrl):n.defaultView?.location.assign(e.checkoutUrl);else if(e.execution||e.nativePurchase){if(!t.onPurchase)throw new m("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await t.onPurchase({operation:e,signal:R.signal})}}a=async()=>O(await i.read()),await O(e)}function J(e){x?.remove();let o=n.createElement("div"),c=n.createElement("button"),r=n.createElement("button"),h=n.createElement("p");h.textContent=e.lines.map(s=>s.productName).join(", ")+" \xB7 "+M(e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),e.currency),c.textContent=w?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",r.textContent=w?"\u53D6\u6D88":"Cancel",c.onclick=()=>{b(z)};let A=async()=>{await i.cancel(),!u&&(l=null,a=null,o.remove(),x=null)};r.onclick=()=>{a=A,b(A)};let C=n.createElement("div");for(let s of e.lines){let q=n.createElement("p");if(q.textContent=`${s.productName} \xB7 ${M(s.catalogAmountMinor,e.currency)}${B(s.interval,w?"zh-CN":"en",s.intervalCount??1)}`,C.append(q),s.trial){let G=n.createElement("p");G.textContent=w?`\u8BD5\u7528 ${s.trial.days} \u5929\uFF1B${s.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${s.trial.days}; ${s.trial.cardRequired?"a payment method is required":"no payment method is required"}`,C.append(G)}}if(!e.charge){let s=n.createElement("p");s.textContent=w?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",C.append(s)}o.append(h,C,c,r),I.prepend(o),x=o,a=null}async function Q(){if(!l)return;if(a=Q,!T){let o=i.view,c=o?.document.buttons[l.actionId],r=o&&c?.type==="checkout"?V(c.product,l.selection,o.capabilities):null;if(!r)throw new m("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let h=await t.resolveOfferId?.({actionId:l.actionId,productVersionId:r});if(u)return;h!==void 0&&(l.offerId=h),T=!0}let e=await i.preview(l);u||J(e)}function k(e="destroy"){u||(u=!0,R.abort(),g?.destroy(),i.destroy(),f.open&&f.close(),f.remove(),v.remove(),L instanceof HTMLElement&&L.isConnected&&L.focus(),e==="dismiss"&&H(t.onDismiss))}D.onclick=()=>k("dismiss"),f.addEventListener("cancel",e=>{e.preventDefault(),k("dismiss")}),E.onclick=()=>{a&&b(a)};try{if(N.type==="inline")y.append(v);else{let e={sm:420,md:640,lg:900};f.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in N?e[N.size]+"px":"100vw"}`,f.setAttribute("aria-label",p.document.name),f.append(v),y.append(f),f.showModal()}g=j($,{mode:"live",rendererUrl:i.webViewUrl,title:p.document.name,onAction(e,o={}){let c=i.view,r=c?.document.buttons[e];if(r){if(r.type==="close"){b(async()=>{await t.onAction?.(e),k(t.onAction?"action":"dismiss")});return}if(r.type==="action"){a=async()=>{if(r.action.type==="event"){if(!t.onEvent)throw new m("EVENT_HANDLER_REQUIRED","Provide the event handler");await t.onEvent(r.action.event)}else t.onOpenUrl?await t.onOpenUrl(r.action.url):n.defaultView?.location.assign(r.action.url);await t.onAction?.(e),a=null},b(a);return}if(!c||!V(r.product,o,c.capabilities)){S(new m("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(l&&l.actionId!==e){S(new m("COMMAND_PENDING","Finish the current purchase"));return}l||(l={requestId:crypto.randomUUID(),actionId:e,selection:o},T=!1),b(Q)}},onEscape:()=>k("dismiss"),onError:e=>S(new Error(e))}),g.update(p.document.screen,p.document.screen.strings.defaultLocale,{capabilities:p.capabilities,serverInput:{bindings:[],answers:{}}}),await g.ready}catch(e){throw k(),e}return{check:d,host:{destroy:k,refresh:async()=>{let e=await i.refresh();return u||g?.updateCapabilities(e.capabilities),e}}}}export{re as showPaywall};
1
+ import{a as H}from"./chunk-6X42DWOM.js";import{a as m}from"./chunk-YNUVRZRQ.js";import{Te as V,gm as B,se as U,y as M}from"./chunk-GTBD4BJ4.js";import"./chunk-3OSMEG44.js";async function F(y,t,d){if(t.status!=="complete")throw new m("INVALID_RESPONSE","A verified completed purchase is required");if(await d.onComplete?.(t),!y||!d.check)return;let i=U.parse(await d.check());if(i.internal_feature_id!==y.internal_feature_id||i.quantity!==y.quantity)throw new m("INVALID_RESPONSE","The access requirement changed");i.allowed&&await d.onAccessGranted?.(i)}async function re(y,t){let d=t.check?U.parse(await t.check()):null;if(d?.allowed)return await t.onAccessGranted?.(d),{check:d,host:null};let i=await t.start(),p=i.view;if(!p)throw new m("INVALID_RESPONSE","Paywall presentation is missing");let{mountScreenPreview:j}=await import("./popup.js"),n=y.ownerDocument,R=new AbortController,v=n.createElement("section"),$=n.createElement("div"),I=n.createElement("div"),P=n.createElement("p"),E=n.createElement("button"),D=n.createElement("button"),f=n.createElement("dialog"),L=n.activeElement,w=p.document.screen.strings.defaultLocale.startsWith("zh");v.dataset.indianaPaywall="",v.setAttribute("aria-label",p.document.name),v.style.cssText="width:100%;box-sizing:border-box;background:#fff;color:#172033;font:14px/1.5 system-ui,sans-serif",I.style.cssText="display:flex;gap:12px;padding:12px 20px;align-items:center;flex-wrap:wrap",P.setAttribute("role","status"),D.textContent=w?"\u5173\u95ED":"Close",E.textContent=w?"\u91CD\u8BD5":"Retry",E.hidden=!0,I.append(P,E,D),v.append($,I);let N=p.document.presentation,g,u=!1,_=!1,l=null,T=!1,a=null,x=null,S=e=>{P.textContent=e instanceof Error?e.message:w?"\u8BF7\u6C42\u5931\u8D25":"Request failed",H(t.onError,e),E.hidden=a===null};async function b(e){if(!(_||u)){_=!0,E.hidden=!0,P.textContent="";try{await e()}catch(o){u||S(o)}finally{_=!1}}}async function W(e){await F(d,e,t)}async function O(e){if(u)return;if(P.textContent=e.status,e.status==="complete"){a=null,await W(e);return}if(e.status!=="pending"){a=null,l=null;return}let o=Date.now()+6e5,c=2e3;for(;!u&&Date.now()<o;){if(await new Promise(h=>{let A=()=>{clearTimeout(C),h()},C=setTimeout(()=>{R.signal.removeEventListener("abort",A),h()},c);R.signal.addEventListener("abort",A,{once:!0})}),u)return;let r=await i.read();if(r.status!=="pending"){await O(r);return}c=Math.min(c*1.5,3e4)}a=async()=>O(await i.read()),E.hidden=!1}async function z(){x?.remove(),x=null,a=z;let e=await i.confirm();if(e.status==="pending"){if(e.checkoutUrl)t.onCheckoutUrl?await t.onCheckoutUrl(e.checkoutUrl):n.defaultView?.location.assign(e.checkoutUrl);else if(e.execution||e.nativePurchase){if(!t.onPurchase)throw new m("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await t.onPurchase({operation:e,signal:R.signal})}}a=async()=>O(await i.read()),await O(e)}function J(e){x?.remove();let o=n.createElement("div"),c=n.createElement("button"),r=n.createElement("button"),h=n.createElement("p");h.textContent=e.lines.map(s=>s.productName).join(", ")+" \xB7 "+M(e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),e.currency),c.textContent=w?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",r.textContent=w?"\u53D6\u6D88":"Cancel",c.onclick=()=>{b(z)};let A=async()=>{await i.cancel(),!u&&(l=null,a=null,o.remove(),x=null)};r.onclick=()=>{a=A,b(A)};let C=n.createElement("div");for(let s of e.lines){let q=n.createElement("p");if(q.textContent=`${s.productName} \xB7 ${M(s.catalogAmountMinor,e.currency)}${B(s.interval,w?"zh-CN":"en",s.intervalCount??1)}`,C.append(q),s.trial){let G=n.createElement("p");G.textContent=w?`\u8BD5\u7528 ${s.trial.days} \u5929\uFF1B${s.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${s.trial.days}; ${s.trial.cardRequired?"a payment method is required":"no payment method is required"}`,C.append(G)}}if(!e.charge){let s=n.createElement("p");s.textContent=w?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",C.append(s)}o.append(h,C,c,r),I.prepend(o),x=o,a=null}async function Q(){if(!l)return;if(a=Q,!T){let o=i.view,c=o?.document.buttons[l.actionId],r=o&&c?.type==="checkout"?V(c.product,l.selection,o.capabilities):null;if(!r)throw new m("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let h=await t.resolveOfferId?.({actionId:l.actionId,productVersionId:r});if(u)return;h!==void 0&&(l.offerId=h),T=!0}let e=await i.preview(l);u||J(e)}function k(e="destroy"){u||(u=!0,R.abort(),g?.destroy(),i.destroy(),f.open&&f.close(),f.remove(),v.remove(),L instanceof HTMLElement&&L.isConnected&&L.focus(),e==="dismiss"&&H(t.onDismiss))}D.onclick=()=>k("dismiss"),f.addEventListener("cancel",e=>{e.preventDefault(),k("dismiss")}),E.onclick=()=>{a&&b(a)};try{if(N.type==="inline")y.append(v);else{let e={sm:420,md:640,lg:900};f.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in N?e[N.size]+"px":"100vw"}`,f.setAttribute("aria-label",p.document.name),f.append(v),y.append(f),f.showModal()}g=j($,{mode:"live",rendererUrl:i.webViewUrl,title:p.document.name,onAction(e,o={}){let c=i.view,r=c?.document.buttons[e];if(r){if(r.type==="close"){b(async()=>{await t.onAction?.(e),k(t.onAction?"action":"dismiss")});return}if(r.type==="action"){a=async()=>{if(r.action.type==="event"){if(!t.onEvent)throw new m("EVENT_HANDLER_REQUIRED","Provide the event handler");await t.onEvent(r.action.event)}else t.onOpenUrl?await t.onOpenUrl(r.action.url):n.defaultView?.location.assign(r.action.url);await t.onAction?.(e),a=null},b(a);return}if(!c||!V(r.product,o,c.capabilities)){S(new m("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(l&&l.actionId!==e){S(new m("COMMAND_PENDING","Finish the current purchase"));return}l||(l={requestId:crypto.randomUUID(),actionId:e,selection:o},T=!1),b(Q)}},onEscape:()=>k("dismiss"),onError:e=>S(new Error(e))}),g.update(p.document.screen,p.document.screen.strings.defaultLocale,{capabilities:p.capabilities,serverInput:{bindings:[],answers:{}}}),await g.ready}catch(e){throw k(),e}return{check:d,host:{destroy:k,refresh:async()=>{let e=await i.refresh();return u||g?.updateCapabilities(e.capabilities),e}}}}export{re as showPaywall};
package/dist/popup.d.ts CHANGED
@@ -1,8 +1,261 @@
1
- import { a as ScreenAction, b as ScreenNode, c as ScreenDocument, d as SurfaceData } from './screen-Keau_Qa2.js';
1
+ import { a as ScreenAction, b as ScreenNode, c as ScreenDocument } from './screen-16d-xADb.js';
2
2
  import { O as Offer, b as OfferUnavailableReason, c as CustomerPageData, a as CustomerDataIntent } from './customer-page-aZb5Twue.js';
3
3
  import { z } from 'zod';
4
4
  import { WindowLike } from 'dompurify';
5
5
 
6
+ declare const surfaceDataSchema: z.ZodObject<{
7
+ paywall: z.ZodOptional<z.ZodObject<{
8
+ internal_feature_id: z.ZodString;
9
+ name: z.ZodString;
10
+ kind: z.ZodEnum<{
11
+ access: "access";
12
+ metered: "metered";
13
+ credit: "credit";
14
+ }>;
15
+ quantity: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
16
+ allowed: z.ZodBoolean;
17
+ reason: z.ZodNullable<z.ZodEnum<{
18
+ unavailable: "unavailable";
19
+ insufficient_balance: "insufficient_balance";
20
+ limit_exceeded: "limit_exceeded";
21
+ awaiting_topup: "awaiting_topup";
22
+ authorization_required: "authorization_required";
23
+ payment_blocked: "payment_blocked";
24
+ cash_budget_exceeded: "cash_budget_exceeded";
25
+ not_entitled: "not_entitled";
26
+ capacity_exceeded: "capacity_exceeded";
27
+ authentication_required: "authentication_required";
28
+ }>>;
29
+ preview: z.ZodNullable<z.ZodObject<{
30
+ scenario: z.ZodEnum<{
31
+ feature_flag: "feature_flag";
32
+ usage_limit: "usage_limit";
33
+ }>;
34
+ candidates: z.ZodArray<z.ZodObject<{
35
+ productId: z.ZodString;
36
+ productVersionId: z.ZodString;
37
+ name: z.ZodString;
38
+ action: z.ZodEnum<{
39
+ purchase: "purchase";
40
+ upgrade: "upgrade";
41
+ addon: "addon";
42
+ topup: "topup";
43
+ }>;
44
+ membershipId: z.ZodNullable<z.ZodString>;
45
+ currency: z.ZodEnum<{
46
+ USD: "USD";
47
+ EUR: "EUR";
48
+ CNY: "CNY";
49
+ GBP: "GBP";
50
+ JPY: "JPY";
51
+ CAD: "CAD";
52
+ AUD: "AUD";
53
+ NZD: "NZD";
54
+ CHF: "CHF";
55
+ HKD: "HKD";
56
+ SGD: "SGD";
57
+ KRW: "KRW";
58
+ INR: "INR";
59
+ BRL: "BRL";
60
+ MXN: "MXN";
61
+ TWD: "TWD";
62
+ THB: "THB";
63
+ IDR: "IDR";
64
+ MYR: "MYR";
65
+ PHP: "PHP";
66
+ VND: "VND";
67
+ ZAR: "ZAR";
68
+ AED: "AED";
69
+ SAR: "SAR";
70
+ SEK: "SEK";
71
+ NOK: "NOK";
72
+ DKK: "DKK";
73
+ PLN: "PLN";
74
+ CZK: "CZK";
75
+ HUF: "HUF";
76
+ ILS: "ILS";
77
+ TRY: "TRY";
78
+ RON: "RON";
79
+ }>;
80
+ amountMinor: z.ZodString;
81
+ interval: z.ZodEnum<{
82
+ week: "week";
83
+ month: "month";
84
+ year: "year";
85
+ free: "free";
86
+ one_time: "one_time";
87
+ }>;
88
+ intervalCount: z.ZodNumber;
89
+ }, z.core.$strict>>;
90
+ }, z.core.$strict>>;
91
+ }, z.core.$strict>>;
92
+ nodes: z.ZodRecord<z.ZodString, z.ZodObject<{
93
+ base: z.ZodObject<{
94
+ text: z.ZodOptional<z.ZodString>;
95
+ label: z.ZodOptional<z.ZodString>;
96
+ alt: z.ZodOptional<z.ZodString>;
97
+ html: z.ZodOptional<z.ZodString>;
98
+ price: z.ZodOptional<z.ZodObject<{
99
+ current: z.ZodString;
100
+ original: z.ZodNullable<z.ZodString>;
101
+ period: z.ZodString;
102
+ }, z.core.$strip>>;
103
+ code: z.ZodOptional<z.ZodString>;
104
+ countdownAt: z.ZodOptional<z.ZodISODateTime>;
105
+ planId: z.ZodOptional<z.ZodString>;
106
+ planVersionId: z.ZodOptional<z.ZodString>;
107
+ currency: z.ZodOptional<z.ZodEnum<{
108
+ USD: "USD";
109
+ EUR: "EUR";
110
+ CNY: "CNY";
111
+ GBP: "GBP";
112
+ JPY: "JPY";
113
+ CAD: "CAD";
114
+ AUD: "AUD";
115
+ NZD: "NZD";
116
+ CHF: "CHF";
117
+ HKD: "HKD";
118
+ SGD: "SGD";
119
+ KRW: "KRW";
120
+ INR: "INR";
121
+ BRL: "BRL";
122
+ MXN: "MXN";
123
+ TWD: "TWD";
124
+ THB: "THB";
125
+ IDR: "IDR";
126
+ MYR: "MYR";
127
+ PHP: "PHP";
128
+ VND: "VND";
129
+ ZAR: "ZAR";
130
+ AED: "AED";
131
+ SAR: "SAR";
132
+ SEK: "SEK";
133
+ NOK: "NOK";
134
+ DKK: "DKK";
135
+ PLN: "PLN";
136
+ CZK: "CZK";
137
+ HUF: "HUF";
138
+ ILS: "ILS";
139
+ TRY: "TRY";
140
+ RON: "RON";
141
+ }>>;
142
+ couponId: z.ZodOptional<z.ZodUUID>;
143
+ offerId: z.ZodOptional<z.ZodUUID>;
144
+ unavailable: z.ZodOptional<z.ZodBoolean>;
145
+ unavailableReason: z.ZodOptional<z.ZodString>;
146
+ missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
147
+ }, z.core.$strict>;
148
+ picker: z.ZodOptional<z.ZodString>;
149
+ byPlan: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
150
+ text: z.ZodOptional<z.ZodString>;
151
+ label: z.ZodOptional<z.ZodString>;
152
+ alt: z.ZodOptional<z.ZodString>;
153
+ html: z.ZodOptional<z.ZodString>;
154
+ price: z.ZodOptional<z.ZodObject<{
155
+ current: z.ZodString;
156
+ original: z.ZodNullable<z.ZodString>;
157
+ period: z.ZodString;
158
+ }, z.core.$strip>>;
159
+ code: z.ZodOptional<z.ZodString>;
160
+ countdownAt: z.ZodOptional<z.ZodISODateTime>;
161
+ planId: z.ZodOptional<z.ZodString>;
162
+ planVersionId: z.ZodOptional<z.ZodString>;
163
+ currency: z.ZodOptional<z.ZodEnum<{
164
+ USD: "USD";
165
+ EUR: "EUR";
166
+ CNY: "CNY";
167
+ GBP: "GBP";
168
+ JPY: "JPY";
169
+ CAD: "CAD";
170
+ AUD: "AUD";
171
+ NZD: "NZD";
172
+ CHF: "CHF";
173
+ HKD: "HKD";
174
+ SGD: "SGD";
175
+ KRW: "KRW";
176
+ INR: "INR";
177
+ BRL: "BRL";
178
+ MXN: "MXN";
179
+ TWD: "TWD";
180
+ THB: "THB";
181
+ IDR: "IDR";
182
+ MYR: "MYR";
183
+ PHP: "PHP";
184
+ VND: "VND";
185
+ ZAR: "ZAR";
186
+ AED: "AED";
187
+ SAR: "SAR";
188
+ SEK: "SEK";
189
+ NOK: "NOK";
190
+ DKK: "DKK";
191
+ PLN: "PLN";
192
+ CZK: "CZK";
193
+ HUF: "HUF";
194
+ ILS: "ILS";
195
+ TRY: "TRY";
196
+ RON: "RON";
197
+ }>>;
198
+ couponId: z.ZodOptional<z.ZodUUID>;
199
+ offerId: z.ZodOptional<z.ZodUUID>;
200
+ unavailable: z.ZodOptional<z.ZodBoolean>;
201
+ unavailableReason: z.ZodOptional<z.ZodString>;
202
+ missing: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
+ }, z.core.$strict>>>;
204
+ }, z.core.$strict>>;
205
+ plans: z.ZodRecord<z.ZodString, z.ZodObject<{
206
+ id: z.ZodString;
207
+ versionId: z.ZodString;
208
+ available: z.ZodBoolean;
209
+ name: z.ZodString;
210
+ price: z.ZodString;
211
+ period: z.ZodString;
212
+ currency: z.ZodOptional<z.ZodEnum<{
213
+ USD: "USD";
214
+ EUR: "EUR";
215
+ CNY: "CNY";
216
+ GBP: "GBP";
217
+ JPY: "JPY";
218
+ CAD: "CAD";
219
+ AUD: "AUD";
220
+ NZD: "NZD";
221
+ CHF: "CHF";
222
+ HKD: "HKD";
223
+ SGD: "SGD";
224
+ KRW: "KRW";
225
+ INR: "INR";
226
+ BRL: "BRL";
227
+ MXN: "MXN";
228
+ TWD: "TWD";
229
+ THB: "THB";
230
+ IDR: "IDR";
231
+ MYR: "MYR";
232
+ PHP: "PHP";
233
+ VND: "VND";
234
+ ZAR: "ZAR";
235
+ AED: "AED";
236
+ SAR: "SAR";
237
+ SEK: "SEK";
238
+ NOK: "NOK";
239
+ DKK: "DKK";
240
+ PLN: "PLN";
241
+ CZK: "CZK";
242
+ HUF: "HUF";
243
+ ILS: "ILS";
244
+ TRY: "TRY";
245
+ RON: "RON";
246
+ }>>;
247
+ }, z.core.$strict>>;
248
+ pickers: z.ZodRecord<z.ZodString, z.ZodObject<{
249
+ options: z.ZodArray<z.ZodString>;
250
+ selected: z.ZodNullable<z.ZodString>;
251
+ }, z.core.$strict>>;
252
+ diagnostics: z.ZodArray<z.ZodObject<{
253
+ nodeId: z.ZodString;
254
+ message: z.ZodString;
255
+ }, z.core.$strict>>;
256
+ }, z.core.$strict>;
257
+ type SurfaceData = z.infer<typeof surfaceDataSchema>;
258
+
6
259
  type PopupEvent = {
7
260
  type: "shown";
8
261
  } | {