@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.
- package/dist/app-event.d.ts +274 -274
- package/dist/app-event.d.ts.map +1 -1
- package/dist/app-event.js +16 -16
- package/dist/client-meta.d.ts +13 -13
- package/dist/client-meta.d.ts.map +1 -1
- package/dist/client-meta.js +6 -6
- package/dist/flow-assignments.d.ts +183 -183
- package/dist/flow-assignments.d.ts.map +1 -1
- package/dist/flow-assignments.js +16 -16
- package/dist/host/sdk-types.d.ts +8 -4
- package/dist/host/sdk-types.d.ts.map +1 -1
- package/dist/identity-type.d.ts +2 -2
- package/dist/identity-type.d.ts.map +1 -1
- package/dist/identity-type.js +13 -15
- package/dist/index.d.ts +86 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/public-grant-scope.d.ts +12 -0
- package/dist/public-grant-scope.d.ts.map +1 -0
- package/dist/public-grant-scope.js +13 -0
- package/dist/runtime-endpoints.d.ts +4 -4
- package/dist/runtime-endpoints.d.ts.map +1 -1
- package/dist/runtime-endpoints.js +4 -6
- package/dist/scopes.d.ts +4 -4
- package/dist/scopes.d.ts.map +1 -1
- package/dist/scopes.js +1 -1
- package/dist/trpc-envelope.d.ts +4 -4
- package/dist/trpc-envelope.d.ts.map +1 -1
- package/dist/trpc-envelope.js +1 -1
- package/dist/version-resolution.d.ts +5 -5
- package/dist/version-resolution.d.ts.map +1 -1
- package/dist/version-resolution.js +2 -2
- package/dist/widget-commands.d.ts +112 -108
- package/dist/widget-commands.d.ts.map +1 -1
- package/dist/widget-commands.js +30 -56
- package/dist/widget-config.d.ts +315 -96
- package/dist/widget-config.d.ts.map +1 -1
- package/dist/widget-config.js +65 -35
- 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.
|
|
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.
|
|
16
|
-
kind: z.
|
|
17
|
-
}, z.core.$strict>, z.
|
|
18
|
-
kind: z.
|
|
19
|
-
host: z.
|
|
20
|
-
sharing: z.
|
|
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.
|
|
26
|
-
kind: z.
|
|
27
|
-
flowId: z.
|
|
28
|
-
flowHandleId: z.
|
|
29
|
-
container: z.
|
|
30
|
-
containerRequirement: z.
|
|
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.
|
|
35
|
-
}, z.core.$strict>, z.
|
|
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.
|
|
49
|
-
kind: z.
|
|
50
|
-
flowId: z.
|
|
51
|
-
flowHandleId: z.
|
|
52
|
-
}, z.core.$strict>, z.
|
|
53
|
-
kind: z.
|
|
54
|
-
flowId: z.
|
|
55
|
-
flowHandleId: z.
|
|
56
|
-
hideCloseButton: z.
|
|
57
|
-
}, z.core.$strict>, z.
|
|
58
|
-
kind: z.
|
|
59
|
-
flowHandleId: z.
|
|
60
|
-
container: z.
|
|
61
|
-
}, z.core.$strict>, z.
|
|
62
|
-
kind: z.
|
|
63
|
-
policy: z.
|
|
64
|
-
kind: z.
|
|
65
|
-
}, z.core.$strict>, z.
|
|
66
|
-
kind: z.
|
|
67
|
-
host: z.
|
|
68
|
-
sharing: z.
|
|
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.
|
|
74
|
-
kind: z.
|
|
75
|
-
opts: z.
|
|
76
|
-
colorScheme: z.
|
|
77
|
-
autoDetectColorScheme: z.
|
|
78
|
-
}, z.core.$strict>, z.
|
|
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.
|
|
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.
|
|
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.
|
|
97
|
-
jwt: z.
|
|
98
|
-
token: z.
|
|
99
|
-
}, z.core.$strip>, z.
|
|
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.
|
|
103
|
-
kind: z.
|
|
104
|
-
opts: z.
|
|
105
|
-
apiKey: z.
|
|
106
|
-
colorScheme: z.
|
|
107
|
-
autoDetectColorScheme: z.
|
|
108
|
-
}, z.core.$strict>, z.
|
|
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.
|
|
114
|
-
enableDebug: z.
|
|
115
|
-
defaultConsent: z.
|
|
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.
|
|
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.
|
|
129
|
-
loader: z.
|
|
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.
|
|
138
|
-
clientVersion: z.
|
|
139
|
-
integrator: z.
|
|
140
|
-
name: z.
|
|
141
|
-
version: z.
|
|
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.
|
|
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.
|
|
151
|
-
framework: z.
|
|
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.
|
|
161
|
+
runtime: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
158
162
|
browser: "browser";
|
|
159
163
|
edge: "edge";
|
|
160
164
|
}>>;
|
|
161
165
|
}, z.core.$strip>>;
|
|
162
|
-
notes: z.
|
|
166
|
+
notes: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
163
167
|
}, z.core.$strip>>;
|
|
164
|
-
capabilities: z.
|
|
165
|
-
flags: z.
|
|
166
|
-
key: z.
|
|
167
|
-
target: z.
|
|
168
|
-
value: z.
|
|
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.
|
|
218
|
-
origin: z.
|
|
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.
|
|
225
|
-
name: z.
|
|
226
|
-
project: z.
|
|
227
|
-
environment: z.
|
|
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.
|
|
230
|
-
reason: z.
|
|
231
|
-
evaluatedAt: z.
|
|
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.
|
|
234
|
-
key: z.
|
|
235
|
-
source: z.
|
|
236
|
-
provider: z.
|
|
237
|
-
name: z.
|
|
238
|
-
project: z.
|
|
239
|
-
environment: z.
|
|
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.
|
|
243
|
-
apiUrl: z.
|
|
244
|
-
coreUrl: z.
|
|
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.
|
|
248
|
-
kind: z.
|
|
249
|
-
flowHandleId: z.
|
|
250
|
-
}, z.core.$strict>, z.
|
|
251
|
-
kind: z.
|
|
252
|
-
}, z.core.$strict>], "kind">, z.
|
|
253
|
-
kind: z.
|
|
254
|
-
traits: z.
|
|
255
|
-
}, z.core.$strict>, z.
|
|
256
|
-
kind: z.
|
|
257
|
-
userId: z.
|
|
258
|
-
traits: z.
|
|
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,
|
|
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"}
|
package/dist/widget-commands.js
CHANGED
|
@@ -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().
|
|
4
|
-
const flowIdSchema = z.string().trim().
|
|
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
|
-
|
|
44
|
-
z
|
|
45
|
-
.object({
|
|
41
|
+
}),
|
|
42
|
+
z.strictObject({
|
|
46
43
|
kind: z.literal("identify"),
|
|
47
|
-
userId: z.string().trim().
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
98
|
-
z
|
|
99
|
-
.object({
|
|
83
|
+
}),
|
|
84
|
+
z.strictObject({
|
|
100
85
|
kind: z.literal("setContainer"),
|
|
101
86
|
flowHandleId: flowHandleIdSchema,
|
|
102
87
|
container: htmlElementOrNullSchema,
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
z
|
|
106
|
-
.object({
|
|
88
|
+
}),
|
|
89
|
+
z.strictObject({
|
|
107
90
|
kind: z.literal("setDefaultContainerPolicy"),
|
|
108
91
|
policy: containerPolicySchema,
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
z
|
|
112
|
-
.object({
|
|
92
|
+
}),
|
|
93
|
+
z.strictObject({
|
|
113
94
|
kind: z.literal("configure"),
|
|
114
95
|
opts: configureOptionsSchema,
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
z
|
|
118
|
-
.object({
|
|
96
|
+
}),
|
|
97
|
+
z.strictObject({
|
|
119
98
|
kind: z.literal("init"),
|
|
120
99
|
opts: initOptionsSchema,
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
z
|
|
124
|
-
.object({
|
|
100
|
+
}),
|
|
101
|
+
z.strictObject({
|
|
125
102
|
kind: z.literal("close"),
|
|
126
103
|
flowHandleId: z.optional(flowHandleIdSchema),
|
|
127
|
-
})
|
|
128
|
-
|
|
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
|
]);
|