@tinkerlandai/indiana-sdk 0.9.2 → 0.10.1

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 (64) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +50 -5
  3. package/README.zh-CN.md +30 -5
  4. package/dist/{ai-usage-DMNKvCiq.d.ts → ai-usage-Cn7dhvFw.d.ts} +5 -5
  5. package/dist/{api--Zf0gxfj.d.ts → api-DC44FaTV.d.ts} +6346 -749
  6. package/dist/chunk-2Y4G5364.js +6 -0
  7. package/dist/chunk-6ZZUNGNE.js +1 -0
  8. package/dist/chunk-ABNSU3ZG.js +4 -0
  9. package/dist/chunk-ACF2FBUB.js +1 -0
  10. package/dist/{chunk-65TBYVCS.js → chunk-AHXYGGAA.js} +1 -1
  11. package/dist/chunk-BOCKPUCM.js +2 -0
  12. package/dist/chunk-CCPNMQHZ.js +1 -0
  13. package/dist/chunk-CLXORAOK.js +1 -0
  14. package/dist/chunk-EDQCH2QS.js +1 -0
  15. package/dist/chunk-IWWKVNEX.js +1 -0
  16. package/dist/chunk-QUWPPZHH.js +1 -0
  17. package/dist/chunk-SBPTOOYB.js +1 -0
  18. package/dist/chunk-WYZI3TNB.js +1 -0
  19. package/dist/chunk-X6BCUINI.js +173 -0
  20. package/dist/chunk-Y46ALAKP.js +1 -0
  21. package/dist/{configuration-sync-E98CqVwh.d.ts → configuration-sync-CXe9Zcng.d.ts} +74 -21
  22. package/dist/content-ZRWZ26PF.js +1 -0
  23. package/dist/coupon-fA1QujHt.d.ts +184 -0
  24. package/dist/{customer-page-9B97Qdt_.d.ts → customer-page-km5f1PJZ.d.ts} +86 -182
  25. package/dist/{funnel-local-client-BjPwXlQb.d.ts → funnel-local-client-BQsdOjQ7.d.ts} +19985 -2451
  26. package/dist/funnel-node-evaluation-P5B4fPfJ.d.ts +2054 -0
  27. package/dist/funnel-resource-client-Zof1WLgA.d.ts +14525 -0
  28. package/dist/funnel-runtime-host-N7TX3LWI.js +1 -0
  29. package/dist/index.d.ts +13905 -13996
  30. package/dist/index.js +1 -1
  31. package/dist/native-shell.js +1 -1
  32. package/dist/openrouter.d.ts +3 -3
  33. package/dist/openrouter.js +1 -1
  34. package/dist/page.d.ts +4 -4
  35. package/dist/page.js +1 -1
  36. package/dist/paywall-DR65VN2G.js +1 -0
  37. package/dist/popup.d.ts +7 -5
  38. package/dist/popup.js +1 -1
  39. package/dist/react-native.d.ts +36432 -174
  40. package/dist/react-native.js +1 -1
  41. package/dist/{screen-BITZ11jn.d.ts → screen-D81zCpfi.d.ts} +159 -6
  42. package/dist/{screen-renderer-A6VYE2QL.js → screen-renderer-ZSAR7LPS.js} +1 -1
  43. package/dist/server.d.ts +2924 -500
  44. package/dist/server.js +1 -1
  45. package/dist/visual-dom-OFB7BFFB.js +1 -0
  46. package/dist/visual.d.ts +2 -2
  47. package/dist/visual.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/chunk-5O667MKA.js +0 -1
  50. package/dist/chunk-67A7I6MB.js +0 -1
  51. package/dist/chunk-CCQHYQ4P.js +0 -1
  52. package/dist/chunk-CPLLMISZ.js +0 -1
  53. package/dist/chunk-G23YNWWI.js +0 -1
  54. package/dist/chunk-L7LKE3MG.js +0 -173
  55. package/dist/chunk-NH2PTTNK.js +0 -2
  56. package/dist/chunk-PK5HYUHD.js +0 -1
  57. package/dist/chunk-SEW4YVR7.js +0 -1
  58. package/dist/chunk-UYSOTMY3.js +0 -1
  59. package/dist/chunk-WSVH6IQA.js +0 -1
  60. package/dist/chunk-YZSQDZXW.js +0 -4
  61. package/dist/content-3LOJVYQO.js +0 -1
  62. package/dist/errors-0TSUIbUi.d.ts +0 -115
  63. package/dist/funnel-runtime-host-NYHKQT6T.js +0 -1
  64. package/dist/paywall-ISCYOGPZ.js +0 -1
@@ -0,0 +1 @@
1
+ import{d as t}from"./chunk-WYZI3TNB.js";import{Ga as n}from"./chunk-2Y4G5364.js";function r(e,o,a){return n(e,o,a,t)}export{r as a};
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { S as StackNode } from './screen-BITZ11jn.js';
2
+ import { S as StackNode } from './screen-D81zCpfi.js';
3
3
 
4
4
  declare const configurationScopeSchema: z.ZodObject<{
5
5
  projectId: z.ZodString;
@@ -46,8 +46,8 @@ declare const sdkConfigurationManifestSchema: z.ZodObject<{
46
46
  funnels: z.ZodRecord<z.ZodUUID, z.ZodObject<{
47
47
  state: z.ZodEnum<{
48
48
  active: "active";
49
- archived: "archived";
50
49
  paused: "paused";
50
+ archived: "archived";
51
51
  }>;
52
52
  controlRevision: z.ZodNumber;
53
53
  evaluationMode: z.ZodEnum<{
@@ -139,7 +139,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
139
139
  generation?: string | undefined;
140
140
  }>;
141
141
  funnels: Record<string, {
142
- state: "active" | "archived" | "paused";
142
+ state: "active" | "paused" | "archived";
143
143
  controlRevision: number;
144
144
  evaluationMode: "local" | "remote";
145
145
  evaluationRevision: number;
@@ -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";
@@ -342,6 +342,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
342
342
  urlRedirect: string;
343
343
  }[];
344
344
  name?: string | undefined;
345
+ phase?: string | undefined;
345
346
  filters?: {
346
347
  seed: string;
347
348
  hashVersion: 2;
@@ -376,7 +377,6 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
376
377
  name?: string | undefined;
377
378
  passthrough?: boolean | undefined;
378
379
  }[] | undefined;
379
- phase?: string | undefined;
380
380
  }[];
381
381
  savedGroups: Record<string, {
382
382
  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;
@@ -732,7 +753,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
732
753
  primary: string;
733
754
  background: string;
734
755
  text: string;
735
- radius: "none" | "sm" | "md" | "lg" | "full";
756
+ radius: "none" | "full" | "sm" | "md" | "lg";
736
757
  font: "system" | "serif" | "rounded" | "mono";
737
758
  };
738
759
  pages: {
@@ -743,7 +764,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
743
764
  primary: string;
744
765
  background: string;
745
766
  text: string;
746
- radius: "none" | "sm" | "md" | "lg" | "full";
767
+ radius: "none" | "full" | "sm" | "md" | "lg";
747
768
  font: "system" | "serif" | "rounded" | "mono";
748
769
  } | undefined;
749
770
  editorPosition?: {
@@ -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";
@@ -1049,7 +1078,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
1049
1078
  } | undefined;
1050
1079
  versionId: string;
1051
1080
  control: {
1052
- state: "active" | "archived" | "paused";
1081
+ state: "active" | "paused" | "archived";
1053
1082
  controlRevision: number;
1054
1083
  evaluationMode: "local" | "remote";
1055
1084
  evaluationRevision: number;
@@ -1092,7 +1121,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
1092
1121
  generation?: string | undefined;
1093
1122
  }>;
1094
1123
  funnels: Record<string, {
1095
- state: "active" | "archived" | "paused";
1124
+ state: "active" | "paused" | "archived";
1096
1125
  controlRevision: number;
1097
1126
  evaluationMode: "local" | "remote";
1098
1127
  evaluationRevision: number;
@@ -1157,7 +1186,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
1157
1186
  primary: string;
1158
1187
  background: string;
1159
1188
  text: string;
1160
- radius: "none" | "sm" | "md" | "lg" | "full";
1189
+ radius: "none" | "full" | "sm" | "md" | "lg";
1161
1190
  font: "system" | "serif" | "rounded" | "mono";
1162
1191
  };
1163
1192
  pages: {
@@ -1168,7 +1197,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
1168
1197
  primary: string;
1169
1198
  background: string;
1170
1199
  text: string;
1171
- radius: "none" | "sm" | "md" | "lg" | "full";
1200
+ radius: "none" | "full" | "sm" | "md" | "lg";
1172
1201
  font: "system" | "serif" | "rounded" | "mono";
1173
1202
  } | undefined;
1174
1203
  editorPosition?: {
@@ -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";
@@ -1373,7 +1426,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
1373
1426
  generation?: string | undefined;
1374
1427
  }>;
1375
1428
  funnels: Record<string, {
1376
- state: "active" | "archived" | "paused";
1429
+ state: "active" | "paused" | "archived";
1377
1430
  controlRevision: number;
1378
1431
  evaluationMode: "local" | "remote";
1379
1432
  evaluationRevision: number;
@@ -1577,7 +1630,7 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
1577
1630
  entry: string;
1578
1631
  nodes: {
1579
1632
  id: string;
1580
- type: "output" | "action" | "feature" | "split" | "condition" | "entry" | "coupon" | "end" | "screen" | "offering" | "coupons" | "external_page" | "wait";
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 ConfigurationSync as C, type ConfigurationStorage as a, type ConfigurationSyncOptions as b, createConfigurationSync as c };
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-X6BCUINI.js";import{b as q}from"./chunk-SSLZKIIU.js";import{L as U}from"./chunk-2Y4G5364.js";import{Y as P,ca as M,ja as z,ka as N,qa as d}from"./chunk-ACF2FBUB.js";import{a as v}from"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-IWWKVNEX.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 };