@getuserfeedback/protocol 0.5.12 → 0.6.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 (40) 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/errors.d.ts +73 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +43 -0
  10. package/dist/flow-assignments.d.ts +262 -183
  11. package/dist/flow-assignments.d.ts.map +1 -1
  12. package/dist/flow-assignments.js +17 -16
  13. package/dist/identity-type.d.ts +2 -2
  14. package/dist/identity-type.d.ts.map +1 -1
  15. package/dist/identity-type.js +13 -15
  16. package/dist/index.d.ts +87 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +7 -1
  19. package/dist/public-grant-scope.d.ts +3 -3
  20. package/dist/public-grant-scope.d.ts.map +1 -1
  21. package/dist/public-grant-scope.js +1 -1
  22. package/dist/runtime-endpoints.d.ts +4 -4
  23. package/dist/runtime-endpoints.d.ts.map +1 -1
  24. package/dist/runtime-endpoints.js +4 -6
  25. package/dist/scopes.d.ts +2 -2
  26. package/dist/scopes.d.ts.map +1 -1
  27. package/dist/scopes.js +1 -1
  28. package/dist/trpc-envelope.d.ts +4 -4
  29. package/dist/trpc-envelope.d.ts.map +1 -1
  30. package/dist/trpc-envelope.js +1 -1
  31. package/dist/version-resolution.d.ts +5 -5
  32. package/dist/version-resolution.d.ts.map +1 -1
  33. package/dist/version-resolution.js +2 -2
  34. package/dist/widget-commands.d.ts +108 -108
  35. package/dist/widget-commands.d.ts.map +1 -1
  36. package/dist/widget-commands.js +30 -56
  37. package/dist/widget-config.d.ts +161 -245
  38. package/dist/widget-config.d.ts.map +1 -1
  39. package/dist/widget-config.js +22 -36
  40. 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,47 +45,47 @@ 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";
@@ -95,31 +95,31 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
95
95
  "functionality.storage": "functionality.storage";
96
96
  "security.storage": "security.storage";
97
97
  }>>]>>;
98
- auth: z.ZodOptional<z.ZodObject<{
99
- jwt: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
100
- token: z.ZodString;
101
- }, 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]>>;
102
102
  }, z.core.$strip>>;
103
103
  }, z.core.$strict>;
104
- }, z.core.$strict>, z.ZodObject<{
105
- kind: z.ZodLiteral<"init">;
106
- opts: z.ZodObject<{
107
- apiKey: z.ZodString;
108
- colorScheme: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
109
- autoDetectColorScheme: z.ZodArray<z.ZodString>;
110
- }, 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<{
111
111
  light: "light";
112
112
  dark: "dark";
113
113
  system: "system";
114
114
  }>]>>;
115
- disableTelemetry: z.ZodOptional<z.ZodBoolean>;
116
- enableDebug: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>;
117
- 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<{
118
118
  pending: "pending";
119
119
  granted: "granted";
120
120
  denied: "denied";
121
121
  revoked: "revoked";
122
- }>, z.ZodArray<z.ZodEnum<{
122
+ }>, z.ZodMiniArray<z.ZodMiniEnum<{
123
123
  "analytics.storage": "analytics.storage";
124
124
  "analytics.measurement": "analytics.measurement";
125
125
  "personalization.storage": "personalization.storage";
@@ -129,8 +129,8 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
129
129
  "functionality.storage": "functionality.storage";
130
130
  "security.storage": "security.storage";
131
131
  }>>]>>;
132
- clientMeta: z.ZodOptional<z.ZodObject<{
133
- loader: z.ZodEnum<{
132
+ clientMeta: z.ZodMiniOptional<z.ZodMiniObject<{
133
+ loader: z.ZodMiniEnum<{
134
134
  custom: "custom";
135
135
  sdk: "sdk";
136
136
  gtm: "gtm";
@@ -138,38 +138,38 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
138
138
  rudderstack: "rudderstack";
139
139
  tealium: "tealium";
140
140
  }>;
141
- clientName: z.ZodOptional<z.ZodString>;
142
- clientVersion: z.ZodOptional<z.ZodString>;
143
- integrator: z.ZodOptional<z.ZodObject<{
144
- name: z.ZodOptional<z.ZodString>;
145
- 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>>;
146
146
  }, z.core.$strip>>;
147
- transport: z.ZodOptional<z.ZodEnum<{
147
+ transport: z.ZodMiniOptional<z.ZodMiniEnum<{
148
148
  loader: "loader";
149
149
  "script-tag": "script-tag";
150
150
  esm: "esm";
151
151
  "tag-manager": "tag-manager";
152
152
  snippet: "snippet";
153
153
  }>>;
154
- runtime: z.ZodOptional<z.ZodObject<{
155
- framework: z.ZodOptional<z.ZodEnum<{
154
+ runtime: z.ZodMiniOptional<z.ZodMiniObject<{
155
+ framework: z.ZodMiniOptional<z.ZodMiniEnum<{
156
156
  next: "next";
157
157
  vite: "vite";
158
158
  webpack: "webpack";
159
159
  plain: "plain";
160
160
  }>>;
161
- runtime: z.ZodOptional<z.ZodEnum<{
161
+ runtime: z.ZodMiniOptional<z.ZodMiniEnum<{
162
162
  browser: "browser";
163
163
  edge: "edge";
164
164
  }>>;
165
165
  }, z.core.$strip>>;
166
- notes: z.ZodOptional<z.ZodString>;
166
+ notes: z.ZodMiniOptional<z.ZodMiniString<string>>;
167
167
  }, z.core.$strip>>;
168
- capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
- flags: z.ZodOptional<z.ZodArray<z.ZodObject<{
170
- key: z.ZodString;
171
- target: z.ZodOptional<z.ZodString>;
172
- 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 | {
173
173
  [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
174
174
  } | null)[] | {
175
175
  [key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
@@ -218,48 +218,48 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
218
218
  } | null)[] | {
219
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;
220
220
  } | null, unknown>>;
221
- variant: z.ZodOptional<z.ZodString>;
222
- origin: z.ZodOptional<z.ZodEnum<{
221
+ variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
222
+ origin: z.ZodMiniOptional<z.ZodMiniEnum<{
223
223
  runtime_config: "runtime_config";
224
224
  trigger_context: "trigger_context";
225
225
  provider_sync: "provider_sync";
226
226
  api: "api";
227
227
  }>>;
228
- provider: z.ZodOptional<z.ZodObject<{
229
- name: z.ZodString;
230
- project: z.ZodOptional<z.ZodString>;
231
- 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>>;
232
232
  }, z.core.$strip>>;
233
- status: z.ZodOptional<z.ZodString>;
234
- reason: z.ZodOptional<z.ZodString>;
235
- 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>>;
236
236
  }, z.core.$strip>>>;
237
- hostCapabilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
238
- key: z.ZodString;
239
- source: z.ZodOptional<z.ZodString>;
240
- provider: z.ZodOptional<z.ZodObject<{
241
- name: z.ZodString;
242
- project: z.ZodOptional<z.ZodString>;
243
- 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>>;
244
244
  }, z.core.$strip>>;
245
245
  }, z.core.$strip>>>;
246
- runtimeEndpoints: z.ZodOptional<z.ZodObject<{
247
- apiUrl: z.ZodOptional<z.ZodString>;
248
- 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>>;
249
249
  }, z.core.$strict>>;
250
250
  }, z.core.$strict>;
251
- }, z.core.$strict>, z.ZodObject<{
252
- kind: z.ZodLiteral<"close">;
253
- flowHandleId: z.ZodOptional<z.ZodString>;
254
- }, z.core.$strict>, z.ZodObject<{
255
- kind: z.ZodLiteral<"reset">;
256
- }, z.core.$strict>], "kind">, z.ZodUnion<readonly [z.ZodObject<{
257
- kind: z.ZodLiteral<"identify">;
258
- traits: z.ZodRecord<z.ZodString, z.ZodUnknown>;
259
- }, z.core.$strict>, z.ZodObject<{
260
- kind: z.ZodLiteral<"identify">;
261
- userId: z.ZodString;
262
- 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>>;
263
263
  }, z.core.$strict>]>]>;
264
264
  export type PublicCommandPayload = z.output<typeof publicCommandPayloadSchema>;
265
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
  ]);