@tinkerlandai/indiana-sdk 0.9.2 → 0.9.5
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 +10 -0
- package/README.md +60 -4
- package/README.zh-CN.md +26 -3
- package/dist/{ai-usage-DMNKvCiq.d.ts → ai-usage-CUTIHAU0.d.ts} +5 -5
- package/dist/{api--Zf0gxfj.d.ts → api-BXu6TAoB.d.ts} +274 -127
- package/dist/{chunk-65TBYVCS.js → chunk-4C3HUZ3B.js} +1 -1
- package/dist/chunk-5ZWSFE2C.js +1 -0
- package/dist/chunk-6ZZUNGNE.js +1 -0
- package/dist/chunk-AOGPGUWE.js +1 -0
- package/dist/chunk-BOCKPUCM.js +2 -0
- package/dist/chunk-CLXORAOK.js +1 -0
- package/dist/chunk-HEGNIATD.js +1 -0
- package/dist/{chunk-WSVH6IQA.js → chunk-LMO3FXRT.js} +1 -1
- package/dist/chunk-M7JWCLYX.js +173 -0
- package/dist/chunk-MKV726FV.js +1 -0
- package/dist/chunk-QYECMZJJ.js +1 -0
- package/dist/chunk-UBMPFTGE.js +1 -0
- package/dist/chunk-UWFYBRM2.js +6 -0
- package/dist/chunk-XRXI3DMZ.js +1 -0
- package/dist/chunk-XSOEA4A5.js +4 -0
- package/dist/{configuration-sync-E98CqVwh.d.ts → configuration-sync-DuJl4SbM.d.ts} +64 -11
- package/dist/content-PQJYLAGQ.js +1 -0
- package/dist/coupon-fA1QujHt.d.ts +184 -0
- package/dist/{customer-page-9B97Qdt_.d.ts → customer-page-km5f1PJZ.d.ts} +86 -182
- package/dist/{funnel-local-client-BjPwXlQb.d.ts → funnel-local-client-BhHdi5_V.d.ts} +2843 -1187
- package/dist/funnel-node-evaluation-DuPmqIo1.d.ts +998 -0
- package/dist/funnel-resource-client-BoIhL_my.d.ts +9674 -0
- package/dist/funnel-runtime-host-3YUGXD3Y.js +1 -0
- package/dist/index.d.ts +1292 -9349
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +3 -3
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +3 -3
- package/dist/page.js +1 -1
- package/dist/paywall-CSAGKPCP.js +1 -0
- package/dist/popup.d.ts +7 -5
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +23680 -173
- package/dist/react-native.js +1 -1
- package/dist/{screen-BITZ11jn.d.ts → screen-CvfI_L41.d.ts} +157 -4
- package/dist/{screen-renderer-A6VYE2QL.js → screen-renderer-VAMWY7ID.js} +1 -1
- package/dist/server.d.ts +355 -95
- package/dist/server.js +1 -1
- package/dist/visual-dom-OFB7BFFB.js +1 -0
- package/dist/visual.d.ts +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5O667MKA.js +0 -1
- package/dist/chunk-67A7I6MB.js +0 -1
- package/dist/chunk-CCQHYQ4P.js +0 -1
- package/dist/chunk-CPLLMISZ.js +0 -1
- package/dist/chunk-G23YNWWI.js +0 -1
- package/dist/chunk-L7LKE3MG.js +0 -173
- package/dist/chunk-NH2PTTNK.js +0 -2
- package/dist/chunk-PK5HYUHD.js +0 -1
- package/dist/chunk-SEW4YVR7.js +0 -1
- package/dist/chunk-UYSOTMY3.js +0 -1
- package/dist/chunk-YZSQDZXW.js +0 -4
- package/dist/content-3LOJVYQO.js +0 -1
- package/dist/errors-0TSUIbUi.d.ts +0 -115
- package/dist/funnel-runtime-host-NYHKQT6T.js +0 -1
- package/dist/paywall-ISCYOGPZ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-UBMPFTGE.js";import{Ca as n}from"./chunk-UWFYBRM2.js";function r(e,o,a){return n(e,o,a,t)}export{r as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as j,b as N,c as $,d as Y}from"./chunk-4C3HUZ3B.js";import{a as D}from"./chunk-DSPLGTQI.js";import{a as O}from"./chunk-LMO3FXRT.js";import{b as U,e as _,g as C}from"./chunk-3PZ4Y6UD.js";var te=e=>new TextEncoder().encode(JSON.stringify({events:e})).length;function re(e,t){let n=e,r=o=>Number.isInteger(o)&&o>=0;return!!n&&typeof n=="object"&&r(n.inserted)&&r(n.duplicates)&&r(n.skipped)&&Array.isArray(n.rejected)&&n.inserted+n.duplicates+n.skipped+n.rejected.length===t}function V(e){let t=[],n,r=(a,i)=>e.log?.(`${e.label} ${a}`,i);function o(a){n===void 0&&t.length&&(n=setTimeout(()=>{u()},a))}async function s(a){let i;try{i=await e.fetch(e.endpoint,{method:"POST",body:JSON.stringify({events:a}),headers:{"Content-Type":"text/plain"},keepalive:!0,credentials:"omit"})}catch(p){return r("not sent",{error:p}),!1}if(i.status===408||i.status===429||i.status>=500)return r("not sent",{status:i.status}),!1;if(!i.ok)return r("rejected",{status:i.status,events:a.length}),!0;let f;try{f=await i.json()}catch{f=void 0}return re(f,a.length)?(f.rejected.length&&r("rejected",{rejected:f.rejected}),!0):(r("not acknowledged",{status:i.status}),!1)}function u(){clearTimeout(n),n=void 0;let a=[];for(;t.length&&a.length<20&&(!a.length||te([...a,t[0]].map(i=>i.event))<=65536);)a.push(t.shift());return a.length?s(a.map(i=>i.event)).then(i=>{if(i)return o(1e3);let f=a.filter(p=>++p.attempts<5);f.length<a.length&&r("dropped after retries",{events:a.length-f.length}),t.unshift(...f),o(5e3)}):Promise.resolve()}return{push(a){t.push({event:a,attempts:0}),t.length>=20?u():o(1e3)},flush:u}}async function q(e,t,n,r={}){let o=r.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(o);let u=e.body.getReader(),a=[],i=0,f=!1,p=()=>{},g=new Promise((v,h)=>{p=()=>h(Error(o)),n.addEventListener("abort",p,{once:!0}),n.aborted&&p()});try{for(;;){let m=await Promise.race([u.read(),g]);if(m.done){f=!0;break}if(i+=m.value.byteLength,i>t)throw Error(o);a.push(m.value)}let v=new Uint8Array(i),h=0;for(let m of a)v.set(m,h),h+=m.length;return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(v))}finally{n.removeEventListener("abort",p),f||u.cancel().catch(()=>{}),u.releaseLock()}}async function B(e,t){let n=e?.body;if(!n)return;let r=n.getReader(),o=0,s=!1,u,a=new Promise((p,g)=>{u=setTimeout(()=>g(Error("Exposure response timeout")),2e3)}),i=()=>{},f=new Promise((p,g)=>{i=()=>g(t?.reason),t?.addEventListener("abort",i,{once:!0}),t?.aborted&&i()});try{for(;;){let p=await Promise.race([r.read(),a,f]);if(p.done){s=!0;return}if(o+=p.value.byteLength,o>16384)throw Error("Exposure response budget")}}finally{clearTimeout(u),t?.removeEventListener("abort",i),s||r.cancel().catch(()=>{}),r.releaseLock()}}var fe=2*1024*1024,J=256*1024;async function G(e,t,n,r){let o=()=>{},s=new Promise((u,a)=>{o=()=>a(r.reason),r.addEventListener("abort",o,{once:!0}),r.aborted&&o()});try{let u=e(t,{...n,signal:r});return u.then(a=>{r.aborted&&a.body?.cancel().catch(()=>{})},()=>{}),await Promise.race([u,s])}finally{r.removeEventListener("abort",o)}}async function pe(e,t,n,r=!1){if(new TextEncoder().encode(n).byteLength>65536)throw Error("Exposure request budget");let o=new URL(t);o.searchParams.set("sdkVersion",O.version);let s=new AbortController,u=setTimeout(()=>s.abort(Error("Exposure request timeout")),5e3);try{let a=await G(e,o.href,{method:"POST",headers:{"Content-Type":"text/plain"},body:n,credentials:"omit",keepalive:r,redirect:"error"},s.signal);await B(a,s.signal)}finally{clearTimeout(u)}}function M(e){let t,n=!1;return{async read(r,o){if(n)throw Error("Experiment client stopped");t?.abort(Error("Experiment request superseded"));let s=new AbortController;t=s;let{signal:u}=s,a=setTimeout(()=>s.abort(Error("Experiment request timeout")),5e3);try{let i=await G(e,r,{cache:"no-cache",credentials:"omit",redirect:"error"},u),f=await q(i,o,u);return u.throwIfAborted(),f}finally{clearTimeout(a),t===s&&(t=void 0)}},destroy(){n=!0,t?.abort(Error("Experiment client stopped")),t=void 0}}}/*!
|
|
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 ne(e,t){let n,r;try{n=new URL(e),r=new URL(t)}catch{return t}return n.searchParams.forEach((o,s)=>{r.searchParams.has(s)||r.searchParams.set(s,o)}),r.toString()}function oe(e,t){let n=navigator.userAgent,r=new URLSearchParams(t.search),o={};for(let s of["source","medium","campaign","term","content"]){let u=r.get(`utm_${s}`);u!==null&&(o[`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(n)?"edge":/Chrome/.test(n)?"chrome":/Firefox/.test(n)?"firefox":/Safari/.test(n)?"safari":"unknown",deviceType:/Mobi/.test(n)?"mobile":"desktop",...o}}function ie(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(r=>!!r&&!["namespace","status","url","groups"].some(o=>Object.hasOwn(r,o))&&(r.hashVersion===void 0||r.hashVersion===2)&&typeof r.key=="string"&&Array.isArray(r.variations)&&r.variations.length>=2&&r.variations.every(o=>!!o&&typeof o.urlRedirect=="string")&&(r.urlPatterns===void 0||Array.isArray(r.urlPatterns)))&&!!t.savedGroups&&typeof t.savedGroups=="object"&&!Array.isArray(t.savedGroups)))throw new Error("Invalid page experiment payload");return t}function be(e){if(e.configuration&&e.configuration.scope.environmentId!==e.environmentId)throw new Error("Page configuration belongs to another App environment");let t=$(e.baseUrl);if(!/^[0-9a-f-]{36}$/i.test(e.environmentId))throw new Error("environmentId must be the App environment ID");let n=e.fetch??globalThis.fetch.bind(globalThis),r=M(async(c,d)=>{let l=await n(c,d);if(!l.ok)throw l.body?.cancel().catch(()=>{}),new Error(`Page experiments unavailable (${l.status})`);return l}),o=e.log?(c,d)=>D(e.log,c,d):void 0,s=`${t}/api/v1/page-experiments/${e.environmentId}`,u=j(e.deviceIdCookie??"indiana_did"),a=N(),i=null,f={...e.attributes??{}},p="",g=!1,v=!1,h=0,m=0,w=new Map,T=V({endpoint:`${s}/events`,fetch:n,log:o,label:"Exposure"}),P=T.flush,E={trackedExperiments:new Set,log:o,onExperimentViewed:(c,d)=>{e.trackExposures===!1||i?.trackExposures===!1||T.push({eventUuid:crypto.randomUUID(),timestamp:new Date().toISOString(),deviceId:u,...a?{sessionId:a}:{},url:location.href,pageTitle:document.title.slice(0,512),experimentKey:c.key,variationKey:d.key})}},H=()=>{E.url=location.href,E.attributes={...oe(u,location),...f}};function Q(c){if(!e.disableCrossOriginUrlRedirects)return!1;try{let d=new URL(location.href);return c.variations.some(l=>{if(!l.urlRedirect)return!1;let y=new URL(l.urlRedirect);return y.protocol!==d.protocol||y.host!==d.host})}catch{return!0}}function K(c,d){let l=e.configuration?.snapshot?.generation,y=m,z=location.href;p=c;let W=e.navigate??(x=>location.replace(x)),Z=e.navigateDelay??(e.navigate?0:100),ee=e.maxNavigateDelay??1e3;Promise.all([Promise.race([d,new Promise(x=>setTimeout(x,ee))]),new Promise(x=>setTimeout(x,Z))]).then(()=>{!g&&y===m&&location.href===z&&(!e.configuration||e.configuration.fresh&&e.configuration.snapshot?.generation===l)&&W(c)})}function b(){if(!(!i||g||e.configuration&&!e.configuration.fresh)){H();for(let c of i.experiments){if(Q(c)){o?.("Auto experiment blocked",{id:c.key});continue}let d;try{d=C(c,E)}catch(l){o?.("Skipping page experiment",{id:c.key,error:String(l)});continue}if(w.set(c.key,d),!!d.inExperiment){if(d.value.urlRedirect){let l=c.persistQueryString?ne(location.href,d.value.urlRedirect):d.value.urlRedirect;U(l,c.urlPatterns??[])?o?.("Skipping redirect because original URL matches redirect URL",{id:c.key}):l!==p&&K(l,P())}break}}}}let R="",F=()=>{location.href!==R&&(m++,R=location.href,p="",b())},A,S;function X(){A??=Y(F),addEventListener("pagehide",L)}let L=()=>{P()};async function k(){if(g)return!1;let c=++h,d;try{d=e.configuration?await e.configuration.pageExperiments():await r.read(s,J)}catch(y){if(g||c!==h)return!1;throw y}if(g||c!==h)return!1;let l=ie(d);if(l.environmentId.toLowerCase()!==e.environmentId.toLowerCase())throw new Error("Page experiment payload scope changed");return i?.trackExposures===!1&&l.trackExposures&&E.trackedExperiments?.clear(),i=l,E.savedGroups=_(l.savedGroups),!0}function I(){g||(S??=e.configuration?.subscribe(()=>{!g&&e.configuration?.fresh&&k().then(c=>{c&&b()}).catch(c=>o?.("Page configuration unavailable",{error:String(c)}))}),X(),R=location.href)}return{async start(){v||g||(v=!0,await k()&&(I(),b()))},async refresh(){await k()&&(m++,v&&I(),p="",b())},setAttributes(c){m++,p="",f={...c},b()},getResults(){return new Map(w)},get generation(){return i?.generation??null},destroy(){g||(g=!0,h++,r.destroy(),S?.(),A?.(),removeEventListener("pagehide",L),i=null,w.clear(),P())}}}export{fe as a,pe as b,M as c,ne as d,oe as e,ie as f,be as g};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { S as StackNode } from './screen-
|
|
2
|
+
import { S as StackNode } from './screen-CvfI_L41.js';
|
|
3
3
|
|
|
4
4
|
declare const configurationScopeSchema: z.ZodObject<{
|
|
5
5
|
projectId: z.ZodString;
|
|
@@ -170,6 +170,10 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
170
170
|
features(): Promise<{
|
|
171
171
|
evaluatedAt: string;
|
|
172
172
|
expiresAt: string;
|
|
173
|
+
scope: {
|
|
174
|
+
projectId: string;
|
|
175
|
+
environment: "sandbox" | "live";
|
|
176
|
+
};
|
|
173
177
|
features: Record<string, {
|
|
174
178
|
defaultValue?: z.core.util.JSONType | undefined;
|
|
175
179
|
rules?: {
|
|
@@ -266,10 +270,6 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
266
270
|
phase?: string | undefined;
|
|
267
271
|
}[] | undefined;
|
|
268
272
|
}>;
|
|
269
|
-
scope: {
|
|
270
|
-
projectId: string;
|
|
271
|
-
environment: "sandbox" | "live";
|
|
272
|
-
};
|
|
273
273
|
generation: string;
|
|
274
274
|
savedGroups: Record<string, {
|
|
275
275
|
type: "hashed";
|
|
@@ -401,6 +401,27 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
401
401
|
next: string;
|
|
402
402
|
id: string;
|
|
403
403
|
name: string;
|
|
404
|
+
triggers?: {
|
|
405
|
+
id: string;
|
|
406
|
+
name: string;
|
|
407
|
+
client: string;
|
|
408
|
+
source: {
|
|
409
|
+
versionId: string;
|
|
410
|
+
manifestDigest: string;
|
|
411
|
+
sourceGraphDigest: string;
|
|
412
|
+
pageKey: string;
|
|
413
|
+
stateKey: string;
|
|
414
|
+
documentKey: string;
|
|
415
|
+
documentHash: string;
|
|
416
|
+
elementKey?: string | undefined;
|
|
417
|
+
nodeId?: string | undefined;
|
|
418
|
+
contentHash?: string | undefined;
|
|
419
|
+
renderKey?: string | undefined;
|
|
420
|
+
};
|
|
421
|
+
event: "screen_enter" | "button_click";
|
|
422
|
+
cooldownSeconds: number;
|
|
423
|
+
behavior: "observe";
|
|
424
|
+
}[] | undefined;
|
|
404
425
|
position?: {
|
|
405
426
|
x: number;
|
|
406
427
|
y: number;
|
|
@@ -812,6 +833,14 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
812
833
|
nodeId: string;
|
|
813
834
|
message: string;
|
|
814
835
|
}[];
|
|
836
|
+
quantities?: Record<string, {
|
|
837
|
+
minimum: number;
|
|
838
|
+
maximum: number;
|
|
839
|
+
step: number;
|
|
840
|
+
value: number;
|
|
841
|
+
label: string;
|
|
842
|
+
available: boolean;
|
|
843
|
+
}> | undefined;
|
|
815
844
|
}>;
|
|
816
845
|
} | undefined;
|
|
817
846
|
} | {
|
|
@@ -886,6 +915,10 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
886
915
|
growth: {
|
|
887
916
|
evaluatedAt: string;
|
|
888
917
|
expiresAt: string;
|
|
918
|
+
scope: {
|
|
919
|
+
projectId: string;
|
|
920
|
+
environment: "sandbox" | "live";
|
|
921
|
+
};
|
|
889
922
|
features: Record<string, {
|
|
890
923
|
defaultValue?: z.core.util.JSONType | undefined;
|
|
891
924
|
rules?: {
|
|
@@ -982,10 +1015,6 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
982
1015
|
phase?: string | undefined;
|
|
983
1016
|
}[] | undefined;
|
|
984
1017
|
}>;
|
|
985
|
-
scope: {
|
|
986
|
-
projectId: string;
|
|
987
|
-
environment: "sandbox" | "live";
|
|
988
|
-
};
|
|
989
1018
|
generation: string;
|
|
990
1019
|
savedGroups: Record<string, {
|
|
991
1020
|
type: "hashed";
|
|
@@ -1265,6 +1294,30 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1265
1294
|
}[];
|
|
1266
1295
|
} | undefined;
|
|
1267
1296
|
};
|
|
1297
|
+
prepaid?: {
|
|
1298
|
+
internalFeatureId: string;
|
|
1299
|
+
name: string;
|
|
1300
|
+
includedAmount: string;
|
|
1301
|
+
reset: "week" | "month" | "year" | "hour" | "day" | "lifetime";
|
|
1302
|
+
resetCount: number;
|
|
1303
|
+
terms: {
|
|
1304
|
+
units: string;
|
|
1305
|
+
prices: {
|
|
1306
|
+
currency: "USD" | "EUR" | "CNY" | "GBP" | "JPY" | "CAD" | "AUD" | "NZD" | "CHF" | "HKD" | "SGD" | "KRW" | "INR" | "BRL" | "MXN" | "TWD" | "THB" | "IDR" | "MYR" | "PHP" | "VND" | "ZAR" | "AED" | "SAR" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "ILS" | "TRY" | "RON";
|
|
1307
|
+
amountMinor: number;
|
|
1308
|
+
pricing?: {
|
|
1309
|
+
kind: "graduated" | "volume";
|
|
1310
|
+
tiers: {
|
|
1311
|
+
upTo: number | null;
|
|
1312
|
+
unitAmountMinor: number;
|
|
1313
|
+
flatAmountMinor?: number | undefined;
|
|
1314
|
+
}[];
|
|
1315
|
+
} | undefined;
|
|
1316
|
+
}[];
|
|
1317
|
+
minimumQuantity: number;
|
|
1318
|
+
maximumQuantity: number;
|
|
1319
|
+
};
|
|
1320
|
+
}[] | undefined;
|
|
1268
1321
|
}>;
|
|
1269
1322
|
buttons: Record<string, {
|
|
1270
1323
|
type: "checkout";
|
|
@@ -1577,7 +1630,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1577
1630
|
entry: string;
|
|
1578
1631
|
nodes: {
|
|
1579
1632
|
id: string;
|
|
1580
|
-
type: "output" | "action" | "
|
|
1633
|
+
type: "output" | "action" | "split" | "feature" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
|
|
1581
1634
|
outputs: Record<string, string>;
|
|
1582
1635
|
writes: Record<string, string>;
|
|
1583
1636
|
resources: {
|
|
@@ -1642,4 +1695,4 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
1642
1695
|
};
|
|
1643
1696
|
type ConfigurationSync = ReturnType<typeof createConfigurationSync>;
|
|
1644
1697
|
|
|
1645
|
-
export { type
|
|
1698
|
+
export { type ConfigurationStorage as C, type ConfigurationSync as a, type ConfigurationSyncOptions as b, createConfigurationSync as c };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as _,j as F}from"./chunk-M7JWCLYX.js";import{b as q}from"./chunk-SSLZKIIU.js";import{H as U}from"./chunk-UWFYBRM2.js";import{W as P,aa as M,ha as z,ia as N,oa as d}from"./chunk-HEGNIATD.js";import{a as v}from"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-LMO3FXRT.js";import{a as O}from"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";import{z as p}from"zod";var V=new WeakMap;function Q(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:O}[r.type];return r.nullable?t.nullable():t}async function ne(r,t){return W(r,t,!1)}async function re(r,t){return W(r,t,!0)}async function W(r,t,w){t.signal?.throwIfAborted();let T=U.parse(t.content),o=T.document;if(V.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),O).parse(t.inputs??{});if(Object.keys(f).length>40)throw new d("INVALID_REQUEST","Too many content inputs");for(let[e,s]of Object.entries(f))z.parse({[e]:s});if(Object.keys(f).some(e=>!Object.hasOwn(o.contract.inputs,e)))throw new d("INVALID_REQUEST","Undeclared content input");for(let[e,s]of Object.entries(o.contract.inputs))if(Object.hasOwn(f,e))Q(s).parse(f[e]);else if(s.required)throw new d("INVALID_REQUEST",`Missing content input ${e}`);for(let e of Object.keys(o.contract.outputs))if(typeof t.actions[e]!="function")throw new d("INVALID_REQUEST",`Missing host handler for ${e}`);let $=N.parse(t.bindings??[]),a=r.ownerDocument,L,k=o.kind==="popup",n=k?a.createElement("dialog"):null,i=a.createElement("div");if(i.dataset.indianaContent=o.kind,i.setAttribute("aria-label",o.name),i.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",o.name);let e=o.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${P[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",n.append(i),r.append(n)}else r.append(i);let c=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||a.defaultView?.innerWidth||800}px`);let B=w?_(n??i):()=>{},H,x,A=new Promise((e,s)=>{H=e,x=s});A.catch(()=>{});let l=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let b;function m(){c||(c=!0,t.signal?.removeEventListener("abort",m),x(new Error("Content preparation cancelled")),b?.destroy(),n?.close(),n?.remove(),i.remove(),V.delete(r),n&&L?.())}let S=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=a.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),e.style.cssText="position:absolute;right:8px;top:8px;width:30px;height:30px;z-index:1",e.addEventListener("click",S),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),S()});async function D(){if(c||!g||C||!l)return;let e=l;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),l=null}catch(s){v(t.onError,s)}finally{C=!1,c||i.removeAttribute("aria-busy")}}function R(){if(c)throw new d("CONFLICT","Content host has been destroyed");g||(L=q(a),B(),w&&!n&&(i.style.width="100%"),n?.showModal(),g=!0)}try{w||R(),b=F(i,{mode:"live",title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||a.defaultView?.innerHeight||800:void 0,onRendered:H,onError:u=>{let I=new Error(u);x(I),v(t.onError,I)},onEscape:k?S:void 0,onAction:(u,I,J)=>{if(c||!g||C||l)return;let h=o.screen.actions.find(y=>y.id===u),j=o.contract.outputs[u];if(!(h?.type!=="event"||!j))try{let y=Q(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);l={requestId:crypto.randomUUID(),contentVersionId:T.id,actionId:u,event:h.event,value:y,selection:I??{},answers:J??{},requestedClose:h.close},D()}catch(y){v(t.onError,y)}}});let e={destroy:m,show:R,get pendingAction(){return l?structuredClone(l):null},retryAction:D,updateCapabilities:u=>b?.updateCapabilities(u)};V.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=M(E,[t.locale,...a.defaultView?.navigator.languages??[]]);if(b.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:$,answers:{},values:f}}),await Promise.race([b.ready,A]),w&&await A,c)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ne as mountContent,re as prepareContent};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const couponInputSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
description: z.ZodString;
|
|
6
|
+
discount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
+
type: z.ZodLiteral<"percent">;
|
|
8
|
+
percentOff: z.ZodNumber;
|
|
9
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"amount">;
|
|
11
|
+
amountOffCents: z.ZodNumber;
|
|
12
|
+
currency: z.ZodEnum<{
|
|
13
|
+
USD: "USD";
|
|
14
|
+
EUR: "EUR";
|
|
15
|
+
CNY: "CNY";
|
|
16
|
+
GBP: "GBP";
|
|
17
|
+
JPY: "JPY";
|
|
18
|
+
CAD: "CAD";
|
|
19
|
+
AUD: "AUD";
|
|
20
|
+
NZD: "NZD";
|
|
21
|
+
CHF: "CHF";
|
|
22
|
+
HKD: "HKD";
|
|
23
|
+
SGD: "SGD";
|
|
24
|
+
KRW: "KRW";
|
|
25
|
+
INR: "INR";
|
|
26
|
+
BRL: "BRL";
|
|
27
|
+
MXN: "MXN";
|
|
28
|
+
TWD: "TWD";
|
|
29
|
+
THB: "THB";
|
|
30
|
+
IDR: "IDR";
|
|
31
|
+
MYR: "MYR";
|
|
32
|
+
PHP: "PHP";
|
|
33
|
+
VND: "VND";
|
|
34
|
+
ZAR: "ZAR";
|
|
35
|
+
AED: "AED";
|
|
36
|
+
SAR: "SAR";
|
|
37
|
+
SEK: "SEK";
|
|
38
|
+
NOK: "NOK";
|
|
39
|
+
DKK: "DKK";
|
|
40
|
+
PLN: "PLN";
|
|
41
|
+
CZK: "CZK";
|
|
42
|
+
HUF: "HUF";
|
|
43
|
+
ILS: "ILS";
|
|
44
|
+
TRY: "TRY";
|
|
45
|
+
RON: "RON";
|
|
46
|
+
}>;
|
|
47
|
+
}, z.core.$strict>], "type">;
|
|
48
|
+
duration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"once">;
|
|
50
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"repeating">;
|
|
52
|
+
months: z.ZodNumber;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"forever">;
|
|
55
|
+
}, z.core.$strict>], "type">;
|
|
56
|
+
appliesTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"all">;
|
|
58
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"plans">;
|
|
60
|
+
planIds: z.ZodArray<z.ZodUUID>;
|
|
61
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"merchandise">;
|
|
63
|
+
scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"all">;
|
|
65
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"selected">;
|
|
67
|
+
merchandiseIds: z.ZodArray<z.ZodUUID>;
|
|
68
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"condition">;
|
|
70
|
+
condition: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
71
|
+
}, z.core.$strict>], "type">;
|
|
72
|
+
}, z.core.$strict>], "type">;
|
|
73
|
+
eligibility: z.ZodObject<{
|
|
74
|
+
firstPurchaseOnly: z.ZodBoolean;
|
|
75
|
+
condition: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
selfClaimEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
78
|
+
startsAt: z.ZodNullable<z.ZodISODateTime>;
|
|
79
|
+
endsAt: z.ZodNullable<z.ZodISODateTime>;
|
|
80
|
+
totalLimit: z.ZodNullable<z.ZodNumber>;
|
|
81
|
+
perCustomerLimit: z.ZodNumber;
|
|
82
|
+
grantWindowHours: z.ZodNumber;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
type CouponInput = z.infer<typeof couponInputSchema>;
|
|
85
|
+
/**
|
|
86
|
+
* 客户领到的优惠(SDK 返回)。id 用作 previewAttach 的 offerId;报价冻结优惠与逐套餐分配,attach 仅接受 operationId。
|
|
87
|
+
* 支付金额由原生渠道验证后入账。appliesTo.planIds 对应商品根 ID。
|
|
88
|
+
*/
|
|
89
|
+
declare const offerSchema: z.ZodObject<{
|
|
90
|
+
id: z.ZodUUID;
|
|
91
|
+
couponId: z.ZodUUID;
|
|
92
|
+
status: z.ZodEnum<{
|
|
93
|
+
expired: "expired";
|
|
94
|
+
issued: "issued";
|
|
95
|
+
reserved: "reserved";
|
|
96
|
+
redeemed: "redeemed";
|
|
97
|
+
revoked: "revoked";
|
|
98
|
+
}>;
|
|
99
|
+
issuedAt: z.ZodISODateTime;
|
|
100
|
+
expiresAt: z.ZodISODateTime;
|
|
101
|
+
coupon: z.ZodObject<{
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
discount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"percent">;
|
|
105
|
+
percentOff: z.ZodNumber;
|
|
106
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"amount">;
|
|
108
|
+
amountOffCents: z.ZodNumber;
|
|
109
|
+
currency: z.ZodEnum<{
|
|
110
|
+
USD: "USD";
|
|
111
|
+
EUR: "EUR";
|
|
112
|
+
CNY: "CNY";
|
|
113
|
+
GBP: "GBP";
|
|
114
|
+
JPY: "JPY";
|
|
115
|
+
CAD: "CAD";
|
|
116
|
+
AUD: "AUD";
|
|
117
|
+
NZD: "NZD";
|
|
118
|
+
CHF: "CHF";
|
|
119
|
+
HKD: "HKD";
|
|
120
|
+
SGD: "SGD";
|
|
121
|
+
KRW: "KRW";
|
|
122
|
+
INR: "INR";
|
|
123
|
+
BRL: "BRL";
|
|
124
|
+
MXN: "MXN";
|
|
125
|
+
TWD: "TWD";
|
|
126
|
+
THB: "THB";
|
|
127
|
+
IDR: "IDR";
|
|
128
|
+
MYR: "MYR";
|
|
129
|
+
PHP: "PHP";
|
|
130
|
+
VND: "VND";
|
|
131
|
+
ZAR: "ZAR";
|
|
132
|
+
AED: "AED";
|
|
133
|
+
SAR: "SAR";
|
|
134
|
+
SEK: "SEK";
|
|
135
|
+
NOK: "NOK";
|
|
136
|
+
DKK: "DKK";
|
|
137
|
+
PLN: "PLN";
|
|
138
|
+
CZK: "CZK";
|
|
139
|
+
HUF: "HUF";
|
|
140
|
+
ILS: "ILS";
|
|
141
|
+
TRY: "TRY";
|
|
142
|
+
RON: "RON";
|
|
143
|
+
}>;
|
|
144
|
+
}, z.core.$strict>], "type">;
|
|
145
|
+
duration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
146
|
+
type: z.ZodLiteral<"once">;
|
|
147
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"repeating">;
|
|
149
|
+
months: z.ZodNumber;
|
|
150
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
151
|
+
type: z.ZodLiteral<"forever">;
|
|
152
|
+
}, z.core.$strict>], "type">;
|
|
153
|
+
appliesTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
154
|
+
type: z.ZodLiteral<"all">;
|
|
155
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"plans">;
|
|
157
|
+
planIds: z.ZodArray<z.ZodUUID>;
|
|
158
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<"merchandise">;
|
|
160
|
+
scope: z.ZodObject<{
|
|
161
|
+
type: z.ZodEnum<{
|
|
162
|
+
selected: "selected";
|
|
163
|
+
all: "all";
|
|
164
|
+
condition: "condition";
|
|
165
|
+
}>;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
}, z.core.$strict>], "type">;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
}, z.core.$strict>;
|
|
170
|
+
type Offer = z.infer<typeof offerSchema>;
|
|
171
|
+
/** 领取失败的原因:未生效 / 不在有效期 / 不符合标签 / 不是首购 / 已达每人上限 / 已领完。 */
|
|
172
|
+
declare const offerUnavailableReasonSchema: z.ZodEnum<{
|
|
173
|
+
unavailable: "unavailable";
|
|
174
|
+
inactive: "inactive";
|
|
175
|
+
claim_disabled: "claim_disabled";
|
|
176
|
+
outside_window: "outside_window";
|
|
177
|
+
not_targeted: "not_targeted";
|
|
178
|
+
not_first_purchase: "not_first_purchase";
|
|
179
|
+
limit_reached: "limit_reached";
|
|
180
|
+
sold_out: "sold_out";
|
|
181
|
+
}>;
|
|
182
|
+
type OfferUnavailableReason = z.infer<typeof offerUnavailableReasonSchema>;
|
|
183
|
+
|
|
184
|
+
export type { CouponInput as C, Offer as O, OfferUnavailableReason as a };
|
|
@@ -241,11 +241,96 @@ declare const surfaceDataSchema: z.ZodObject<{
|
|
|
241
241
|
TRY: "TRY";
|
|
242
242
|
RON: "RON";
|
|
243
243
|
}>>;
|
|
244
|
+
amountMinor: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
interval: z.ZodOptional<z.ZodEnum<{
|
|
246
|
+
free: "free";
|
|
247
|
+
week: "week";
|
|
248
|
+
month: "month";
|
|
249
|
+
year: "year";
|
|
250
|
+
one_time: "one_time";
|
|
251
|
+
}>>;
|
|
252
|
+
intervalCount: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
prepaid: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
254
|
+
internalFeatureId: z.ZodUUID;
|
|
255
|
+
name: z.ZodString;
|
|
256
|
+
includedAmount: z.ZodString;
|
|
257
|
+
reset: z.ZodEnum<{
|
|
258
|
+
week: "week";
|
|
259
|
+
month: "month";
|
|
260
|
+
year: "year";
|
|
261
|
+
hour: "hour";
|
|
262
|
+
day: "day";
|
|
263
|
+
lifetime: "lifetime";
|
|
264
|
+
}>;
|
|
265
|
+
resetCount: z.ZodNumber;
|
|
266
|
+
terms: z.ZodObject<{
|
|
267
|
+
units: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
268
|
+
prices: z.ZodArray<z.ZodObject<{
|
|
269
|
+
currency: z.ZodEnum<{
|
|
270
|
+
USD: "USD";
|
|
271
|
+
EUR: "EUR";
|
|
272
|
+
CNY: "CNY";
|
|
273
|
+
GBP: "GBP";
|
|
274
|
+
JPY: "JPY";
|
|
275
|
+
CAD: "CAD";
|
|
276
|
+
AUD: "AUD";
|
|
277
|
+
NZD: "NZD";
|
|
278
|
+
CHF: "CHF";
|
|
279
|
+
HKD: "HKD";
|
|
280
|
+
SGD: "SGD";
|
|
281
|
+
KRW: "KRW";
|
|
282
|
+
INR: "INR";
|
|
283
|
+
BRL: "BRL";
|
|
284
|
+
MXN: "MXN";
|
|
285
|
+
TWD: "TWD";
|
|
286
|
+
THB: "THB";
|
|
287
|
+
IDR: "IDR";
|
|
288
|
+
MYR: "MYR";
|
|
289
|
+
PHP: "PHP";
|
|
290
|
+
VND: "VND";
|
|
291
|
+
ZAR: "ZAR";
|
|
292
|
+
AED: "AED";
|
|
293
|
+
SAR: "SAR";
|
|
294
|
+
SEK: "SEK";
|
|
295
|
+
NOK: "NOK";
|
|
296
|
+
DKK: "DKK";
|
|
297
|
+
PLN: "PLN";
|
|
298
|
+
CZK: "CZK";
|
|
299
|
+
HUF: "HUF";
|
|
300
|
+
ILS: "ILS";
|
|
301
|
+
TRY: "TRY";
|
|
302
|
+
RON: "RON";
|
|
303
|
+
}>;
|
|
304
|
+
amountMinor: z.ZodNumber;
|
|
305
|
+
pricing: z.ZodOptional<z.ZodObject<{
|
|
306
|
+
kind: z.ZodEnum<{
|
|
307
|
+
graduated: "graduated";
|
|
308
|
+
volume: "volume";
|
|
309
|
+
}>;
|
|
310
|
+
tiers: z.ZodArray<z.ZodObject<{
|
|
311
|
+
upTo: z.ZodNullable<z.ZodNumber>;
|
|
312
|
+
unitAmountMinor: z.ZodNumber;
|
|
313
|
+
flatAmountMinor: z.ZodOptional<z.ZodNumber>;
|
|
314
|
+
}, z.core.$strict>>;
|
|
315
|
+
}, z.core.$strict>>;
|
|
316
|
+
}, z.core.$strict>>;
|
|
317
|
+
minimumQuantity: z.ZodNumber;
|
|
318
|
+
maximumQuantity: z.ZodNumber;
|
|
319
|
+
}, z.core.$strict>;
|
|
320
|
+
}, z.core.$strict>>>;
|
|
244
321
|
}, z.core.$strict>>;
|
|
245
322
|
pickers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
246
323
|
options: z.ZodArray<z.ZodString>;
|
|
247
324
|
selected: z.ZodNullable<z.ZodString>;
|
|
248
325
|
}, z.core.$strict>>;
|
|
326
|
+
quantities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
327
|
+
minimum: z.ZodNumber;
|
|
328
|
+
maximum: z.ZodNumber;
|
|
329
|
+
step: z.ZodNumber;
|
|
330
|
+
value: z.ZodNumber;
|
|
331
|
+
label: z.ZodString;
|
|
332
|
+
available: z.ZodBoolean;
|
|
333
|
+
}, z.core.$strict>>>;
|
|
249
334
|
diagnostics: z.ZodArray<z.ZodObject<{
|
|
250
335
|
nodeId: z.ZodString;
|
|
251
336
|
message: z.ZodString;
|
|
@@ -253,187 +338,6 @@ declare const surfaceDataSchema: z.ZodObject<{
|
|
|
253
338
|
}, z.core.$strict>;
|
|
254
339
|
type SurfaceData = z.infer<typeof surfaceDataSchema>;
|
|
255
340
|
|
|
256
|
-
declare const couponInputSchema: z.ZodObject<{
|
|
257
|
-
name: z.ZodString;
|
|
258
|
-
description: z.ZodString;
|
|
259
|
-
discount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
260
|
-
type: z.ZodLiteral<"percent">;
|
|
261
|
-
percentOff: z.ZodNumber;
|
|
262
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
263
|
-
type: z.ZodLiteral<"amount">;
|
|
264
|
-
amountOffCents: z.ZodNumber;
|
|
265
|
-
currency: z.ZodEnum<{
|
|
266
|
-
USD: "USD";
|
|
267
|
-
EUR: "EUR";
|
|
268
|
-
CNY: "CNY";
|
|
269
|
-
GBP: "GBP";
|
|
270
|
-
JPY: "JPY";
|
|
271
|
-
CAD: "CAD";
|
|
272
|
-
AUD: "AUD";
|
|
273
|
-
NZD: "NZD";
|
|
274
|
-
CHF: "CHF";
|
|
275
|
-
HKD: "HKD";
|
|
276
|
-
SGD: "SGD";
|
|
277
|
-
KRW: "KRW";
|
|
278
|
-
INR: "INR";
|
|
279
|
-
BRL: "BRL";
|
|
280
|
-
MXN: "MXN";
|
|
281
|
-
TWD: "TWD";
|
|
282
|
-
THB: "THB";
|
|
283
|
-
IDR: "IDR";
|
|
284
|
-
MYR: "MYR";
|
|
285
|
-
PHP: "PHP";
|
|
286
|
-
VND: "VND";
|
|
287
|
-
ZAR: "ZAR";
|
|
288
|
-
AED: "AED";
|
|
289
|
-
SAR: "SAR";
|
|
290
|
-
SEK: "SEK";
|
|
291
|
-
NOK: "NOK";
|
|
292
|
-
DKK: "DKK";
|
|
293
|
-
PLN: "PLN";
|
|
294
|
-
CZK: "CZK";
|
|
295
|
-
HUF: "HUF";
|
|
296
|
-
ILS: "ILS";
|
|
297
|
-
TRY: "TRY";
|
|
298
|
-
RON: "RON";
|
|
299
|
-
}>;
|
|
300
|
-
}, z.core.$strict>], "type">;
|
|
301
|
-
duration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
302
|
-
type: z.ZodLiteral<"once">;
|
|
303
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
304
|
-
type: z.ZodLiteral<"repeating">;
|
|
305
|
-
months: z.ZodNumber;
|
|
306
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
307
|
-
type: z.ZodLiteral<"forever">;
|
|
308
|
-
}, z.core.$strict>], "type">;
|
|
309
|
-
appliesTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
310
|
-
type: z.ZodLiteral<"all">;
|
|
311
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
312
|
-
type: z.ZodLiteral<"plans">;
|
|
313
|
-
planIds: z.ZodArray<z.ZodUUID>;
|
|
314
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
315
|
-
type: z.ZodLiteral<"merchandise">;
|
|
316
|
-
scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
317
|
-
type: z.ZodLiteral<"all">;
|
|
318
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
319
|
-
type: z.ZodLiteral<"selected">;
|
|
320
|
-
merchandiseIds: z.ZodArray<z.ZodUUID>;
|
|
321
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
322
|
-
type: z.ZodLiteral<"condition">;
|
|
323
|
-
condition: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
324
|
-
}, z.core.$strict>], "type">;
|
|
325
|
-
}, z.core.$strict>], "type">;
|
|
326
|
-
eligibility: z.ZodObject<{
|
|
327
|
-
firstPurchaseOnly: z.ZodBoolean;
|
|
328
|
-
condition: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
329
|
-
}, z.core.$strict>;
|
|
330
|
-
selfClaimEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
331
|
-
startsAt: z.ZodNullable<z.ZodISODateTime>;
|
|
332
|
-
endsAt: z.ZodNullable<z.ZodISODateTime>;
|
|
333
|
-
totalLimit: z.ZodNullable<z.ZodNumber>;
|
|
334
|
-
perCustomerLimit: z.ZodNumber;
|
|
335
|
-
grantWindowHours: z.ZodNumber;
|
|
336
|
-
}, z.core.$strict>;
|
|
337
|
-
type CouponInput = z.infer<typeof couponInputSchema>;
|
|
338
|
-
/**
|
|
339
|
-
* 客户领到的优惠(SDK 返回)。id 用作 previewAttach 的 offerId;报价冻结优惠与逐套餐分配,attach 仅接受 operationId。
|
|
340
|
-
* 支付金额由原生渠道验证后入账。appliesTo.planIds 对应商品根 ID。
|
|
341
|
-
*/
|
|
342
|
-
declare const offerSchema: z.ZodObject<{
|
|
343
|
-
id: z.ZodUUID;
|
|
344
|
-
couponId: z.ZodUUID;
|
|
345
|
-
status: z.ZodEnum<{
|
|
346
|
-
expired: "expired";
|
|
347
|
-
issued: "issued";
|
|
348
|
-
reserved: "reserved";
|
|
349
|
-
redeemed: "redeemed";
|
|
350
|
-
revoked: "revoked";
|
|
351
|
-
}>;
|
|
352
|
-
issuedAt: z.ZodISODateTime;
|
|
353
|
-
expiresAt: z.ZodISODateTime;
|
|
354
|
-
coupon: z.ZodObject<{
|
|
355
|
-
name: z.ZodString;
|
|
356
|
-
discount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
357
|
-
type: z.ZodLiteral<"percent">;
|
|
358
|
-
percentOff: z.ZodNumber;
|
|
359
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
360
|
-
type: z.ZodLiteral<"amount">;
|
|
361
|
-
amountOffCents: z.ZodNumber;
|
|
362
|
-
currency: z.ZodEnum<{
|
|
363
|
-
USD: "USD";
|
|
364
|
-
EUR: "EUR";
|
|
365
|
-
CNY: "CNY";
|
|
366
|
-
GBP: "GBP";
|
|
367
|
-
JPY: "JPY";
|
|
368
|
-
CAD: "CAD";
|
|
369
|
-
AUD: "AUD";
|
|
370
|
-
NZD: "NZD";
|
|
371
|
-
CHF: "CHF";
|
|
372
|
-
HKD: "HKD";
|
|
373
|
-
SGD: "SGD";
|
|
374
|
-
KRW: "KRW";
|
|
375
|
-
INR: "INR";
|
|
376
|
-
BRL: "BRL";
|
|
377
|
-
MXN: "MXN";
|
|
378
|
-
TWD: "TWD";
|
|
379
|
-
THB: "THB";
|
|
380
|
-
IDR: "IDR";
|
|
381
|
-
MYR: "MYR";
|
|
382
|
-
PHP: "PHP";
|
|
383
|
-
VND: "VND";
|
|
384
|
-
ZAR: "ZAR";
|
|
385
|
-
AED: "AED";
|
|
386
|
-
SAR: "SAR";
|
|
387
|
-
SEK: "SEK";
|
|
388
|
-
NOK: "NOK";
|
|
389
|
-
DKK: "DKK";
|
|
390
|
-
PLN: "PLN";
|
|
391
|
-
CZK: "CZK";
|
|
392
|
-
HUF: "HUF";
|
|
393
|
-
ILS: "ILS";
|
|
394
|
-
TRY: "TRY";
|
|
395
|
-
RON: "RON";
|
|
396
|
-
}>;
|
|
397
|
-
}, z.core.$strict>], "type">;
|
|
398
|
-
duration: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
399
|
-
type: z.ZodLiteral<"once">;
|
|
400
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
401
|
-
type: z.ZodLiteral<"repeating">;
|
|
402
|
-
months: z.ZodNumber;
|
|
403
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
404
|
-
type: z.ZodLiteral<"forever">;
|
|
405
|
-
}, z.core.$strict>], "type">;
|
|
406
|
-
appliesTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
407
|
-
type: z.ZodLiteral<"all">;
|
|
408
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
409
|
-
type: z.ZodLiteral<"plans">;
|
|
410
|
-
planIds: z.ZodArray<z.ZodUUID>;
|
|
411
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
412
|
-
type: z.ZodLiteral<"merchandise">;
|
|
413
|
-
scope: z.ZodObject<{
|
|
414
|
-
type: z.ZodEnum<{
|
|
415
|
-
selected: "selected";
|
|
416
|
-
all: "all";
|
|
417
|
-
condition: "condition";
|
|
418
|
-
}>;
|
|
419
|
-
}, z.core.$strict>;
|
|
420
|
-
}, z.core.$strict>], "type">;
|
|
421
|
-
}, z.core.$strict>;
|
|
422
|
-
}, z.core.$strict>;
|
|
423
|
-
type Offer = z.infer<typeof offerSchema>;
|
|
424
|
-
/** 领取失败的原因:未生效 / 不在有效期 / 不符合标签 / 不是首购 / 已达每人上限 / 已领完。 */
|
|
425
|
-
declare const offerUnavailableReasonSchema: z.ZodEnum<{
|
|
426
|
-
unavailable: "unavailable";
|
|
427
|
-
inactive: "inactive";
|
|
428
|
-
claim_disabled: "claim_disabled";
|
|
429
|
-
outside_window: "outside_window";
|
|
430
|
-
not_targeted: "not_targeted";
|
|
431
|
-
not_first_purchase: "not_first_purchase";
|
|
432
|
-
limit_reached: "limit_reached";
|
|
433
|
-
sold_out: "sold_out";
|
|
434
|
-
}>;
|
|
435
|
-
type OfferUnavailableReason = z.infer<typeof offerUnavailableReasonSchema>;
|
|
436
|
-
|
|
437
341
|
declare const screenAnswersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
438
342
|
declare const screenParametersSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
439
343
|
type ScreenParameters = z.infer<typeof screenParametersSchema>;
|
|
@@ -573,4 +477,4 @@ declare const customerDataIntentSchema: z.ZodObject<{
|
|
|
573
477
|
}, z.core.$strict>;
|
|
574
478
|
type CustomerDataIntent = z.infer<typeof customerDataIntentSchema>;
|
|
575
479
|
|
|
576
|
-
export { type
|
|
480
|
+
export { type CustomerDataIntent as C, type ScreenAnswers as S, type SurfaceData as a, type CustomerPageData as b, type ScreenParameters as c, type ScreenRendererInput as d, screenInputBindingsSchema as s };
|