@getuserfeedback/protocol 0.5.11 → 0.6.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/dist/app-event.d.ts +274 -274
  2. package/dist/app-event.d.ts.map +1 -1
  3. package/dist/app-event.js +16 -16
  4. package/dist/client-meta.d.ts +13 -13
  5. package/dist/client-meta.d.ts.map +1 -1
  6. package/dist/client-meta.js +6 -6
  7. package/dist/flow-assignments.d.ts +183 -183
  8. package/dist/flow-assignments.d.ts.map +1 -1
  9. package/dist/flow-assignments.js +16 -16
  10. package/dist/host/sdk-types.d.ts +8 -4
  11. package/dist/host/sdk-types.d.ts.map +1 -1
  12. package/dist/identity-type.d.ts +2 -2
  13. package/dist/identity-type.d.ts.map +1 -1
  14. package/dist/identity-type.js +13 -15
  15. package/dist/index.d.ts +86 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +7 -1
  18. package/dist/public-grant-scope.d.ts +12 -0
  19. package/dist/public-grant-scope.d.ts.map +1 -0
  20. package/dist/public-grant-scope.js +13 -0
  21. package/dist/runtime-endpoints.d.ts +4 -4
  22. package/dist/runtime-endpoints.d.ts.map +1 -1
  23. package/dist/runtime-endpoints.js +4 -6
  24. package/dist/scopes.d.ts +4 -4
  25. package/dist/scopes.d.ts.map +1 -1
  26. package/dist/scopes.js +1 -1
  27. package/dist/trpc-envelope.d.ts +4 -4
  28. package/dist/trpc-envelope.d.ts.map +1 -1
  29. package/dist/trpc-envelope.js +1 -1
  30. package/dist/version-resolution.d.ts +5 -5
  31. package/dist/version-resolution.d.ts.map +1 -1
  32. package/dist/version-resolution.js +2 -2
  33. package/dist/widget-commands.d.ts +112 -108
  34. package/dist/widget-commands.d.ts.map +1 -1
  35. package/dist/widget-commands.js +30 -56
  36. package/dist/widget-config.d.ts +315 -96
  37. package/dist/widget-config.d.ts.map +1 -1
  38. package/dist/widget-config.js +65 -35
  39. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import * as z from "zod";
1
+ import * as z from "zod/mini";
2
2
  import { type ConfigureOptions, type InitOptions } from "./widget-config.js";
3
- export declare const publicWidgetCommandKindSchema: z.ZodEnum<{
3
+ export declare const publicWidgetCommandKindSchema: z.ZodMiniEnum<{
4
4
  open: "open";
5
5
  prefetch: "prefetch";
6
6
  prerender: "prerender";
@@ -12,27 +12,27 @@ export declare const publicWidgetCommandKindSchema: z.ZodEnum<{
12
12
  close: "close";
13
13
  reset: "reset";
14
14
  }>;
15
- export declare const containerPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
- kind: z.ZodLiteral<"floating">;
17
- }, z.core.$strict>, z.ZodObject<{
18
- kind: z.ZodLiteral<"hostContainer">;
19
- host: z.ZodCustom<HTMLElement | null, HTMLElement | null>;
20
- sharing: z.ZodEnum<{
15
+ export declare const containerPolicySchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
16
+ kind: z.ZodMiniLiteral<"floating">;
17
+ }, z.core.$strict>, z.ZodMiniObject<{
18
+ kind: z.ZodMiniLiteral<"hostContainer">;
19
+ host: z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>;
20
+ sharing: z.ZodMiniEnum<{
21
21
  shared: "shared";
22
22
  perFlowRun: "perFlowRun";
23
23
  }>;
24
24
  }, z.core.$strict>], "kind">;
25
- export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodPipe<z.ZodObject<{
26
- kind: z.ZodLiteral<"open">;
27
- flowId: z.ZodString;
28
- flowHandleId: z.ZodOptional<z.ZodString>;
29
- container: z.ZodOptional<z.ZodCustom<HTMLElement | null, HTMLElement | null>>;
30
- containerRequirement: z.ZodOptional<z.ZodEnum<{
25
+ export declare const publicCommandPayloadSchema: z.ZodMiniUnion<readonly [z.ZodMiniDiscriminatedUnion<[z.ZodMiniPipe<z.ZodMiniObject<{
26
+ kind: z.ZodMiniLiteral<"open">;
27
+ flowId: z.ZodMiniString<string>;
28
+ flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
29
+ container: z.ZodMiniOptional<z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>>;
30
+ containerRequirement: z.ZodMiniOptional<z.ZodMiniEnum<{
31
31
  any: "any";
32
32
  hostOnly: "hostOnly";
33
33
  }>>;
34
- hideCloseButton: z.ZodOptional<z.ZodBoolean>;
35
- }, z.core.$strict>, z.ZodTransform<{
34
+ hideCloseButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
35
+ }, z.core.$strict>, z.ZodMiniTransform<{
36
36
  kind: "open";
37
37
  flowId: string;
38
38
  flowHandleId?: string | undefined;
@@ -45,88 +45,92 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
45
45
  container?: HTMLElement | null | undefined;
46
46
  containerRequirement?: "any" | "hostOnly" | undefined;
47
47
  hideCloseButton?: boolean | undefined;
48
- }>>, z.ZodObject<{
49
- kind: z.ZodLiteral<"prefetch">;
50
- flowId: z.ZodString;
51
- flowHandleId: z.ZodOptional<z.ZodString>;
52
- }, z.core.$strict>, z.ZodObject<{
53
- kind: z.ZodLiteral<"prerender">;
54
- flowId: z.ZodString;
55
- flowHandleId: z.ZodOptional<z.ZodString>;
56
- hideCloseButton: z.ZodOptional<z.ZodBoolean>;
57
- }, z.core.$strict>, z.ZodObject<{
58
- kind: z.ZodLiteral<"setContainer">;
59
- flowHandleId: z.ZodString;
60
- container: z.ZodCustom<HTMLElement | null, HTMLElement | null>;
61
- }, z.core.$strict>, z.ZodObject<{
62
- kind: z.ZodLiteral<"setDefaultContainerPolicy">;
63
- policy: z.ZodDiscriminatedUnion<[z.ZodObject<{
64
- kind: z.ZodLiteral<"floating">;
65
- }, z.core.$strict>, z.ZodObject<{
66
- kind: z.ZodLiteral<"hostContainer">;
67
- host: z.ZodCustom<HTMLElement | null, HTMLElement | null>;
68
- sharing: z.ZodEnum<{
48
+ }>>, z.ZodMiniObject<{
49
+ kind: z.ZodMiniLiteral<"prefetch">;
50
+ flowId: z.ZodMiniString<string>;
51
+ flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
52
+ }, z.core.$strict>, z.ZodMiniObject<{
53
+ kind: z.ZodMiniLiteral<"prerender">;
54
+ flowId: z.ZodMiniString<string>;
55
+ flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
56
+ hideCloseButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
57
+ }, z.core.$strict>, z.ZodMiniObject<{
58
+ kind: z.ZodMiniLiteral<"setContainer">;
59
+ flowHandleId: z.ZodMiniString<string>;
60
+ container: z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>;
61
+ }, z.core.$strict>, z.ZodMiniObject<{
62
+ kind: z.ZodMiniLiteral<"setDefaultContainerPolicy">;
63
+ policy: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
64
+ kind: z.ZodMiniLiteral<"floating">;
65
+ }, z.core.$strict>, z.ZodMiniObject<{
66
+ kind: z.ZodMiniLiteral<"hostContainer">;
67
+ host: z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>;
68
+ sharing: z.ZodMiniEnum<{
69
69
  shared: "shared";
70
70
  perFlowRun: "perFlowRun";
71
71
  }>;
72
72
  }, z.core.$strict>], "kind">;
73
- }, z.core.$strict>, z.ZodObject<{
74
- kind: z.ZodLiteral<"configure">;
75
- opts: z.ZodObject<{
76
- colorScheme: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
77
- autoDetectColorScheme: z.ZodArray<z.ZodString>;
78
- }, z.core.$strict>, z.ZodEnum<{
73
+ }, z.core.$strict>, z.ZodMiniObject<{
74
+ kind: z.ZodMiniLiteral<"configure">;
75
+ opts: z.ZodMiniObject<{
76
+ colorScheme: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
77
+ autoDetectColorScheme: z.ZodMiniArray<z.ZodMiniString<string>>;
78
+ }, z.core.$strict>, z.ZodMiniEnum<{
79
79
  light: "light";
80
80
  dark: "dark";
81
81
  system: "system";
82
82
  }>]>>;
83
- consent: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
83
+ consent: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
84
84
  pending: "pending";
85
85
  granted: "granted";
86
86
  denied: "denied";
87
87
  revoked: "revoked";
88
- }>, z.ZodArray<z.ZodEnum<{
88
+ }>, z.ZodMiniArray<z.ZodMiniEnum<{
89
89
  "analytics.storage": "analytics.storage";
90
90
  "analytics.measurement": "analytics.measurement";
91
91
  "personalization.storage": "personalization.storage";
92
92
  "ads.storage": "ads.storage";
93
93
  "ads.user_data": "ads.user_data";
94
94
  "ads.personalization": "ads.personalization";
95
+ "functionality.storage": "functionality.storage";
96
+ "security.storage": "security.storage";
95
97
  }>>]>>;
96
- auth: z.ZodOptional<z.ZodObject<{
97
- jwt: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
98
- token: z.ZodString;
99
- }, z.core.$strip>, z.ZodNull]>>;
98
+ auth: z.ZodMiniOptional<z.ZodMiniObject<{
99
+ jwt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
100
+ token: z.ZodMiniString<string>;
101
+ }, z.core.$strip>, z.ZodMiniNull]>>;
100
102
  }, z.core.$strip>>;
101
103
  }, z.core.$strict>;
102
- }, z.core.$strict>, z.ZodObject<{
103
- kind: z.ZodLiteral<"init">;
104
- opts: z.ZodObject<{
105
- apiKey: z.ZodString;
106
- colorScheme: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
107
- autoDetectColorScheme: z.ZodArray<z.ZodString>;
108
- }, z.core.$strict>, z.ZodEnum<{
104
+ }, z.core.$strict>, z.ZodMiniObject<{
105
+ kind: z.ZodMiniLiteral<"init">;
106
+ opts: z.ZodMiniObject<{
107
+ apiKey: z.ZodMiniString<string>;
108
+ colorScheme: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
109
+ autoDetectColorScheme: z.ZodMiniArray<z.ZodMiniString<string>>;
110
+ }, z.core.$strict>, z.ZodMiniEnum<{
109
111
  light: "light";
110
112
  dark: "dark";
111
113
  system: "system";
112
114
  }>]>>;
113
- disableTelemetry: z.ZodOptional<z.ZodBoolean>;
114
- enableDebug: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>;
115
- defaultConsent: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
115
+ disableTelemetry: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
116
+ enableDebug: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
117
+ defaultConsent: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
116
118
  pending: "pending";
117
119
  granted: "granted";
118
120
  denied: "denied";
119
121
  revoked: "revoked";
120
- }>, z.ZodArray<z.ZodEnum<{
122
+ }>, z.ZodMiniArray<z.ZodMiniEnum<{
121
123
  "analytics.storage": "analytics.storage";
122
124
  "analytics.measurement": "analytics.measurement";
123
125
  "personalization.storage": "personalization.storage";
124
126
  "ads.storage": "ads.storage";
125
127
  "ads.user_data": "ads.user_data";
126
128
  "ads.personalization": "ads.personalization";
129
+ "functionality.storage": "functionality.storage";
130
+ "security.storage": "security.storage";
127
131
  }>>]>>;
128
- clientMeta: z.ZodOptional<z.ZodObject<{
129
- loader: z.ZodEnum<{
132
+ clientMeta: z.ZodMiniOptional<z.ZodMiniObject<{
133
+ loader: z.ZodMiniEnum<{
130
134
  custom: "custom";
131
135
  sdk: "sdk";
132
136
  gtm: "gtm";
@@ -134,38 +138,38 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
134
138
  rudderstack: "rudderstack";
135
139
  tealium: "tealium";
136
140
  }>;
137
- clientName: z.ZodOptional<z.ZodString>;
138
- clientVersion: z.ZodOptional<z.ZodString>;
139
- integrator: z.ZodOptional<z.ZodObject<{
140
- name: z.ZodOptional<z.ZodString>;
141
- version: z.ZodOptional<z.ZodString>;
141
+ clientName: z.ZodMiniOptional<z.ZodMiniString<string>>;
142
+ clientVersion: z.ZodMiniOptional<z.ZodMiniString<string>>;
143
+ integrator: z.ZodMiniOptional<z.ZodMiniObject<{
144
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
145
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
142
146
  }, z.core.$strip>>;
143
- transport: z.ZodOptional<z.ZodEnum<{
147
+ transport: z.ZodMiniOptional<z.ZodMiniEnum<{
144
148
  loader: "loader";
145
149
  "script-tag": "script-tag";
146
150
  esm: "esm";
147
151
  "tag-manager": "tag-manager";
148
152
  snippet: "snippet";
149
153
  }>>;
150
- runtime: z.ZodOptional<z.ZodObject<{
151
- framework: z.ZodOptional<z.ZodEnum<{
154
+ runtime: z.ZodMiniOptional<z.ZodMiniObject<{
155
+ framework: z.ZodMiniOptional<z.ZodMiniEnum<{
152
156
  next: "next";
153
157
  vite: "vite";
154
158
  webpack: "webpack";
155
159
  plain: "plain";
156
160
  }>>;
157
- runtime: z.ZodOptional<z.ZodEnum<{
161
+ runtime: z.ZodMiniOptional<z.ZodMiniEnum<{
158
162
  browser: "browser";
159
163
  edge: "edge";
160
164
  }>>;
161
165
  }, z.core.$strip>>;
162
- notes: z.ZodOptional<z.ZodString>;
166
+ notes: z.ZodMiniOptional<z.ZodMiniString<string>>;
163
167
  }, z.core.$strip>>;
164
- capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
- flags: z.ZodOptional<z.ZodArray<z.ZodObject<{
166
- key: z.ZodString;
167
- target: z.ZodOptional<z.ZodString>;
168
- value: z.ZodType<string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
168
+ capabilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
169
+ flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
170
+ key: z.ZodMiniString<string>;
171
+ target: z.ZodMiniOptional<z.ZodMiniString<string>>;
172
+ value: z.ZodMiniType<string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
169
173
  [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
170
174
  } | null)[] | {
171
175
  [key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
@@ -214,48 +218,48 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
214
218
  } | null)[] | {
215
219
  [key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
216
220
  } | null, unknown>>;
217
- variant: z.ZodOptional<z.ZodString>;
218
- origin: z.ZodOptional<z.ZodEnum<{
221
+ variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
222
+ origin: z.ZodMiniOptional<z.ZodMiniEnum<{
219
223
  runtime_config: "runtime_config";
220
224
  trigger_context: "trigger_context";
221
225
  provider_sync: "provider_sync";
222
226
  api: "api";
223
227
  }>>;
224
- provider: z.ZodOptional<z.ZodObject<{
225
- name: z.ZodString;
226
- project: z.ZodOptional<z.ZodString>;
227
- environment: z.ZodOptional<z.ZodString>;
228
+ provider: z.ZodMiniOptional<z.ZodMiniObject<{
229
+ name: z.ZodMiniString<string>;
230
+ project: z.ZodMiniOptional<z.ZodMiniString<string>>;
231
+ environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
228
232
  }, z.core.$strip>>;
229
- status: z.ZodOptional<z.ZodString>;
230
- reason: z.ZodOptional<z.ZodString>;
231
- evaluatedAt: z.ZodOptional<z.ZodString>;
233
+ status: z.ZodMiniOptional<z.ZodMiniString<string>>;
234
+ reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
235
+ evaluatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
232
236
  }, z.core.$strip>>>;
233
- hostCapabilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
234
- key: z.ZodString;
235
- source: z.ZodOptional<z.ZodString>;
236
- provider: z.ZodOptional<z.ZodObject<{
237
- name: z.ZodString;
238
- project: z.ZodOptional<z.ZodString>;
239
- environment: z.ZodOptional<z.ZodString>;
237
+ hostCapabilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
238
+ key: z.ZodMiniString<string>;
239
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
240
+ provider: z.ZodMiniOptional<z.ZodMiniObject<{
241
+ name: z.ZodMiniString<string>;
242
+ project: z.ZodMiniOptional<z.ZodMiniString<string>>;
243
+ environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
240
244
  }, z.core.$strip>>;
241
245
  }, z.core.$strip>>>;
242
- runtimeEndpoints: z.ZodOptional<z.ZodObject<{
243
- apiUrl: z.ZodOptional<z.ZodString>;
244
- coreUrl: z.ZodOptional<z.ZodString>;
246
+ runtimeEndpoints: z.ZodMiniOptional<z.ZodMiniObject<{
247
+ apiUrl: z.ZodMiniOptional<z.ZodMiniString<string>>;
248
+ coreUrl: z.ZodMiniOptional<z.ZodMiniString<string>>;
245
249
  }, z.core.$strict>>;
246
250
  }, z.core.$strict>;
247
- }, z.core.$strict>, z.ZodObject<{
248
- kind: z.ZodLiteral<"close">;
249
- flowHandleId: z.ZodOptional<z.ZodString>;
250
- }, z.core.$strict>, z.ZodObject<{
251
- kind: z.ZodLiteral<"reset">;
252
- }, z.core.$strict>], "kind">, z.ZodUnion<readonly [z.ZodObject<{
253
- kind: z.ZodLiteral<"identify">;
254
- traits: z.ZodRecord<z.ZodString, z.ZodUnknown>;
255
- }, z.core.$strict>, z.ZodObject<{
256
- kind: z.ZodLiteral<"identify">;
257
- userId: z.ZodString;
258
- traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
251
+ }, z.core.$strict>, z.ZodMiniObject<{
252
+ kind: z.ZodMiniLiteral<"close">;
253
+ flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
254
+ }, z.core.$strict>, z.ZodMiniObject<{
255
+ kind: z.ZodMiniLiteral<"reset">;
256
+ }, z.core.$strict>], "kind">, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
257
+ kind: z.ZodMiniLiteral<"identify">;
258
+ traits: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
259
+ }, z.core.$strict>, z.ZodMiniObject<{
260
+ kind: z.ZodMiniLiteral<"identify">;
261
+ userId: z.ZodMiniString<string>;
262
+ traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
259
263
  }, z.core.$strict>]>]>;
260
264
  export type PublicCommandPayload = z.output<typeof publicCommandPayloadSchema>;
261
265
  export type ContainerPolicy = z.output<typeof containerPolicySchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"widget-commands.d.ts","sourceRoot":"","sources":["../src/widget-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,WAAW,EAEhB,MAAM,oBAAoB,CAAC;AAmB5B,eAAO,MAAM,6BAA6B;;;;;;;;;;;EAAmC,CAAC;AA6C9E,eAAO,MAAM,qBAAqB;;;;;;;;;4BAahC,CAAC;AAiBH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwDrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAEvE"}
1
+ {"version":3,"file":"widget-commands.d.ts","sourceRoot":"","sources":["../src/widget-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,WAAW,EAEhB,MAAM,oBAAoB,CAAC;AAmB5B,eAAO,MAAM,6BAA6B;;;;;;;;;;;EAAmC,CAAC;AAyC9E,eAAO,MAAM,qBAAqB;;;;;;;;;4BAShC,CAAC;AAeH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwCrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAE5D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAEvE"}
@@ -1,7 +1,7 @@
1
- import * as z from "zod";
1
+ import * as z from "zod/mini";
2
2
  import { configureOptionsSchema, initOptionsSchema, } from "./widget-config.js";
3
- const flowHandleIdSchema = z.string().trim().min(1);
4
- const flowIdSchema = z.string().trim().min(1);
3
+ const flowHandleIdSchema = z.string().check(z.trim(), z.minLength(1));
4
+ const flowIdSchema = z.string().check(z.trim(), z.minLength(1));
5
5
  /** Public command kinds accepted from host / SDK before core dispatch. */
6
6
  const publicWidgetCommandKinds = [
7
7
  "open",
@@ -35,39 +35,30 @@ const htmlElementOrNullSchema = z.custom((value) => value === null || isHTMLElem
35
35
  });
36
36
  const identifyTraitsSchema = z.record(z.string(), z.unknown());
37
37
  const identifyPayloadSchema = z.union([
38
- z
39
- .object({
38
+ z.strictObject({
40
39
  kind: z.literal("identify"),
41
40
  traits: identifyTraitsSchema,
42
- })
43
- .strict(),
44
- z
45
- .object({
41
+ }),
42
+ z.strictObject({
46
43
  kind: z.literal("identify"),
47
- userId: z.string().trim().min(1),
44
+ userId: z.string().check(z.trim(), z.minLength(1)),
48
45
  traits: z.optional(identifyTraitsSchema),
49
- })
50
- .strict(),
46
+ }),
51
47
  ]);
52
48
  // TODO(migration): After telemetry confirms no remaining `open.containerRequirement` in host command queues, remove the optional field and transform so unknown keys fail under `.strict()` again.
53
49
  // [from=legacy-open-container-requirement] [to=strict-public-open-only] [scope=slice] [priority=low] [impact=medium] [risk=low]
54
50
  const legacyOpenContainerRequirementSchema = z.enum(["any", "hostOnly"]);
55
51
  export const containerPolicySchema = z.discriminatedUnion("kind", [
56
- z
57
- .object({
52
+ z.strictObject({
58
53
  kind: z.literal("floating"),
59
- })
60
- .strict(),
61
- z
62
- .object({
54
+ }),
55
+ z.strictObject({
63
56
  kind: z.literal("hostContainer"),
64
57
  host: htmlElementOrNullSchema,
65
58
  sharing: z.enum(["shared", "perFlowRun"]),
66
- })
67
- .strict(),
59
+ }),
68
60
  ]);
69
- const openPublicPayloadSchema = z.pipe(z
70
- .object({
61
+ const openPublicPayloadSchema = z.pipe(z.strictObject({
71
62
  kind: z.literal("open"),
72
63
  flowId: flowIdSchema,
73
64
  flowHandleId: z.optional(flowHandleIdSchema),
@@ -75,62 +66,45 @@ const openPublicPayloadSchema = z.pipe(z
75
66
  /** Accepted for legacy browser SDK payloads; stripped before dispatch. */
76
67
  containerRequirement: z.optional(legacyOpenContainerRequirementSchema),
77
68
  hideCloseButton: z.optional(z.boolean()),
78
- })
79
- .strict(), z.transform(({ containerRequirement: _legacy, ...rest }) => rest));
69
+ }), z.transform(({ containerRequirement: _legacy, ...rest }) => rest));
80
70
  export const publicCommandPayloadSchema = z.union([
81
71
  z.discriminatedUnion("kind", [
82
72
  openPublicPayloadSchema,
83
- z
84
- .object({
73
+ z.strictObject({
85
74
  kind: z.literal("prefetch"),
86
75
  flowId: flowIdSchema,
87
76
  flowHandleId: z.optional(flowHandleIdSchema),
88
- })
89
- .strict(),
90
- z
91
- .object({
77
+ }),
78
+ z.strictObject({
92
79
  kind: z.literal("prerender"),
93
80
  flowId: flowIdSchema,
94
81
  flowHandleId: z.optional(flowHandleIdSchema),
95
82
  hideCloseButton: z.optional(z.boolean()),
96
- })
97
- .strict(),
98
- z
99
- .object({
83
+ }),
84
+ z.strictObject({
100
85
  kind: z.literal("setContainer"),
101
86
  flowHandleId: flowHandleIdSchema,
102
87
  container: htmlElementOrNullSchema,
103
- })
104
- .strict(),
105
- z
106
- .object({
88
+ }),
89
+ z.strictObject({
107
90
  kind: z.literal("setDefaultContainerPolicy"),
108
91
  policy: containerPolicySchema,
109
- })
110
- .strict(),
111
- z
112
- .object({
92
+ }),
93
+ z.strictObject({
113
94
  kind: z.literal("configure"),
114
95
  opts: configureOptionsSchema,
115
- })
116
- .strict(),
117
- z
118
- .object({
96
+ }),
97
+ z.strictObject({
119
98
  kind: z.literal("init"),
120
99
  opts: initOptionsSchema,
121
- })
122
- .strict(),
123
- z
124
- .object({
100
+ }),
101
+ z.strictObject({
125
102
  kind: z.literal("close"),
126
103
  flowHandleId: z.optional(flowHandleIdSchema),
127
- })
128
- .strict(),
129
- z
130
- .object({
104
+ }),
105
+ z.strictObject({
131
106
  kind: z.literal("reset"),
132
- })
133
- .strict(),
107
+ }),
134
108
  ]),
135
109
  identifyPayloadSchema,
136
110
  ]);