@getuserfeedback/protocol 0.10.0 → 0.10.2
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/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mobile-bridge.d.ts +439 -0
- package/dist/mobile-bridge.d.ts.map +1 -0
- package/dist/mobile-bridge.js +74 -0
- package/dist/scopes.d.ts +2 -2
- package/dist/widget-commands.d.ts +22 -4
- package/dist/widget-commands.d.ts.map +1 -1
- package/dist/widget-commands.js +21 -0
- package/dist/widget-config.d.ts +10 -10
- package/package.json +7 -1
- package/src/index.ts +9 -0
- package/src/mobile-bridge.ts +95 -0
- package/src/protocol-root.test.ts +133 -0
- package/src/widget-commands.ts +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export type { ErrorEvent, ProtocolErrorCode } from "./errors.js";
|
|
|
5
5
|
export { ErrorCategory, ErrorCategorySchema, ErrorEventSchema, ProtocolError, } from "./errors.js";
|
|
6
6
|
export { type ClaimPendingFlowAssignmentsRequest, type ClaimPendingFlowAssignmentsResponse, claimPendingFlowAssignmentsRequestSchema, claimPendingFlowAssignmentsResponseSchema, type FlowAssignmentExternalIdIdentityTypeValue, type FlowAssignmentIdentityTypeValue, type FlowAssignmentRecipientRequest, type FlowAssignmentRecord, type FlowAssignmentStatus, type FlowAssignmentTargetingContext, flowAssignmentRecipientRequestSchema, flowAssignmentRecordSchema, flowAssignmentStatusSchema, flowAssignmentTargetingContextSchema, type ListPendingFlowAssignmentsResponse, listPendingFlowAssignmentsResponseSchema, nullableUpdateFlowAssignmentLifecycleResponseSchema, type ReleaseFlowAssignmentClaimRequest, type ReleaseFlowAssignmentClaimResponse, releaseFlowAssignmentClaimRequestSchema, releaseFlowAssignmentClaimResponseSchema, type UpdateFlowAssignmentLifecycleRequest, type UpdateFlowAssignmentLifecycleResponse, updateFlowAssignmentLifecycleRequestSchema, updateFlowAssignmentLifecycleResponseSchema, } from "./flow-assignments.js";
|
|
7
7
|
export { buildIdentityTypeGuidanceMessage, getIdentityTypeSuggestion, IDENTITY_TYPE_VALUES, type IdentityTypeValue, isIdentityTypeValue, type StandardIdentityTypeValue, } from "./identity-type.js";
|
|
8
|
+
export { type MobileBridgeNativeMessage, type MobileBridgeWebMessage, mobileBridgeNativeMessageSchema, mobileBridgeWebMessageSchema, parseMobileBridgeNativeMessage, parseMobileBridgeWebMessage, } from "./mobile-bridge.js";
|
|
8
9
|
export { isPublicGrantScope, type PublicGrantScope, publicGrantScopeIdSchema, } from "./public-grant-scope.js";
|
|
9
10
|
export { type RuntimeEndpoints, resolveApiBaseUrl, resolveCoreUrl, resolveTrpcBaseUrl, runtimeEndpointsSchema, } from "./runtime-endpoints.js";
|
|
10
|
-
export { getScopeMeta, isScope, listScopes, SCOPE_IDS, type Scope, scopeIdSchema, } from "./scopes.js";
|
|
11
|
+
export { getScopeMeta, isScope, listScopes, SCOPE_IDS, type Scope, type ScopeMeta, scopeIdSchema, } from "./scopes.js";
|
|
11
12
|
export { type TrpcSuccessResponse, trpcSuccessResponseSchema, } from "./trpc-envelope.js";
|
|
12
13
|
export { type FlowVersionResolution, flowVersionResolutionSchema, type ThemeVersionResolution, themeVersionResolutionSchema, } from "./version-resolution.js";
|
|
13
14
|
export { type PublicCommandPayload, parseConfigureOptions, parseInitOptions, parsePublicCommand, publicCommandPayloadSchema, publicWidgetCommandKindSchema, } from "./widget-commands.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { DEFAULT_AUTO_DETECT_COLOR_SCHEME_ATTRS } from "./defaults.js";
|
|
|
4
4
|
export { ErrorCategory, ErrorCategorySchema, ErrorEventSchema, ProtocolError, } from "./errors.js";
|
|
5
5
|
export { claimPendingFlowAssignmentsRequestSchema, claimPendingFlowAssignmentsResponseSchema, flowAssignmentRecipientRequestSchema, flowAssignmentRecordSchema, flowAssignmentStatusSchema, flowAssignmentTargetingContextSchema, listPendingFlowAssignmentsResponseSchema, nullableUpdateFlowAssignmentLifecycleResponseSchema, releaseFlowAssignmentClaimRequestSchema, releaseFlowAssignmentClaimResponseSchema, updateFlowAssignmentLifecycleRequestSchema, updateFlowAssignmentLifecycleResponseSchema, } from "./flow-assignments.js";
|
|
6
6
|
export { buildIdentityTypeGuidanceMessage, getIdentityTypeSuggestion, IDENTITY_TYPE_VALUES, isIdentityTypeValue, } from "./identity-type.js";
|
|
7
|
+
export { mobileBridgeNativeMessageSchema, mobileBridgeWebMessageSchema, parseMobileBridgeNativeMessage, parseMobileBridgeWebMessage, } from "./mobile-bridge.js";
|
|
7
8
|
export { isPublicGrantScope, publicGrantScopeIdSchema, } from "./public-grant-scope.js";
|
|
8
9
|
export { resolveApiBaseUrl, resolveCoreUrl, resolveTrpcBaseUrl, runtimeEndpointsSchema, } from "./runtime-endpoints.js";
|
|
9
10
|
export { getScopeMeta, isScope, listScopes, SCOPE_IDS, scopeIdSchema, } from "./scopes.js";
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
export declare const mobileBridgeNativeMessageSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
3
|
+
kind: z.ZodMiniLiteral<"command">;
|
|
4
|
+
id: z.ZodMiniString<string>;
|
|
5
|
+
command: z.ZodMiniUnion<readonly [z.ZodMiniDiscriminatedUnion<[z.ZodMiniPipe<z.ZodMiniObject<{
|
|
6
|
+
kind: z.ZodMiniLiteral<"open">;
|
|
7
|
+
flowId: z.ZodMiniString<string>;
|
|
8
|
+
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
9
|
+
container: z.ZodMiniOptional<z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>>;
|
|
10
|
+
containerRequirement: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
11
|
+
any: "any";
|
|
12
|
+
hostOnly: "hostOnly";
|
|
13
|
+
}>>;
|
|
14
|
+
hideCloseButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
15
|
+
}, z.core.$strict>, z.ZodMiniTransform<{
|
|
16
|
+
kind: "open";
|
|
17
|
+
flowId: string;
|
|
18
|
+
flowHandleId?: string | undefined;
|
|
19
|
+
container?: HTMLElement | null | undefined;
|
|
20
|
+
hideCloseButton?: boolean | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
kind: "open";
|
|
23
|
+
flowId: string;
|
|
24
|
+
flowHandleId?: string | undefined;
|
|
25
|
+
container?: HTMLElement | null | undefined;
|
|
26
|
+
containerRequirement?: "any" | "hostOnly" | undefined;
|
|
27
|
+
hideCloseButton?: boolean | undefined;
|
|
28
|
+
}>>, z.ZodMiniObject<{
|
|
29
|
+
kind: z.ZodMiniLiteral<"prefetch">;
|
|
30
|
+
flowId: z.ZodMiniString<string>;
|
|
31
|
+
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
32
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
33
|
+
kind: z.ZodMiniLiteral<"prerender">;
|
|
34
|
+
flowId: z.ZodMiniString<string>;
|
|
35
|
+
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
36
|
+
hideCloseButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
37
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
38
|
+
kind: z.ZodMiniLiteral<"updateHostContext">;
|
|
39
|
+
context: z.ZodMiniObject<{
|
|
40
|
+
url: z.ZodMiniString<string>;
|
|
41
|
+
env: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
42
|
+
storage: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
43
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
44
|
+
path: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
45
|
+
referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
46
|
+
search: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
50
|
+
kind: z.ZodMiniLiteral<"emitHostSignal">;
|
|
51
|
+
name: z.ZodMiniString<string>;
|
|
52
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
53
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
54
|
+
kind: z.ZodMiniLiteral<"setContainer">;
|
|
55
|
+
flowHandleId: z.ZodMiniString<string>;
|
|
56
|
+
container: z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>;
|
|
57
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
58
|
+
kind: z.ZodMiniLiteral<"setDefaultContainerPolicy">;
|
|
59
|
+
policy: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
60
|
+
kind: z.ZodMiniLiteral<"floating">;
|
|
61
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
62
|
+
kind: z.ZodMiniLiteral<"hostContainer">;
|
|
63
|
+
host: z.ZodMiniCustom<HTMLElement | null, HTMLElement | null>;
|
|
64
|
+
sharing: z.ZodMiniEnum<{
|
|
65
|
+
shared: "shared";
|
|
66
|
+
perFlowRun: "perFlowRun";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strict>], "kind">;
|
|
69
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
70
|
+
kind: z.ZodMiniLiteral<"configure">;
|
|
71
|
+
opts: z.ZodMiniObject<{
|
|
72
|
+
colorScheme: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
73
|
+
autoDetectColorScheme: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
74
|
+
}, z.core.$strict>, z.ZodMiniEnum<{
|
|
75
|
+
system: "system";
|
|
76
|
+
light: "light";
|
|
77
|
+
dark: "dark";
|
|
78
|
+
}>]>>;
|
|
79
|
+
consent: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
|
|
80
|
+
pending: "pending";
|
|
81
|
+
granted: "granted";
|
|
82
|
+
denied: "denied";
|
|
83
|
+
revoked: "revoked";
|
|
84
|
+
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
85
|
+
"functionality.storage": "functionality.storage";
|
|
86
|
+
"security.storage": "security.storage";
|
|
87
|
+
"analytics.storage": "analytics.storage";
|
|
88
|
+
"analytics.measurement": "analytics.measurement";
|
|
89
|
+
"personalization.storage": "personalization.storage";
|
|
90
|
+
"ads.storage": "ads.storage";
|
|
91
|
+
"ads.user_data": "ads.user_data";
|
|
92
|
+
"ads.personalization": "ads.personalization";
|
|
93
|
+
}>>]>>;
|
|
94
|
+
auth: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
95
|
+
jwt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
96
|
+
token: z.ZodMiniString<string>;
|
|
97
|
+
}, z.core.$strip>, z.ZodMiniNull]>>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
101
|
+
kind: z.ZodMiniLiteral<"init">;
|
|
102
|
+
opts: z.ZodMiniObject<{
|
|
103
|
+
apiKey: z.ZodMiniString<string>;
|
|
104
|
+
colorScheme: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
105
|
+
autoDetectColorScheme: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
106
|
+
}, z.core.$strict>, z.ZodMiniEnum<{
|
|
107
|
+
system: "system";
|
|
108
|
+
light: "light";
|
|
109
|
+
dark: "dark";
|
|
110
|
+
}>]>>;
|
|
111
|
+
disableTelemetry: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
112
|
+
enableDebug: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
113
|
+
defaultConsent: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
|
|
114
|
+
pending: "pending";
|
|
115
|
+
granted: "granted";
|
|
116
|
+
denied: "denied";
|
|
117
|
+
revoked: "revoked";
|
|
118
|
+
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
119
|
+
"functionality.storage": "functionality.storage";
|
|
120
|
+
"security.storage": "security.storage";
|
|
121
|
+
"analytics.storage": "analytics.storage";
|
|
122
|
+
"analytics.measurement": "analytics.measurement";
|
|
123
|
+
"personalization.storage": "personalization.storage";
|
|
124
|
+
"ads.storage": "ads.storage";
|
|
125
|
+
"ads.user_data": "ads.user_data";
|
|
126
|
+
"ads.personalization": "ads.personalization";
|
|
127
|
+
}>>]>>;
|
|
128
|
+
clientMeta: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
129
|
+
loader: z.ZodMiniEnum<{
|
|
130
|
+
custom: "custom";
|
|
131
|
+
sdk: "sdk";
|
|
132
|
+
gtm: "gtm";
|
|
133
|
+
segment: "segment";
|
|
134
|
+
rudderstack: "rudderstack";
|
|
135
|
+
tealium: "tealium";
|
|
136
|
+
}>;
|
|
137
|
+
clientName: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
138
|
+
clientVersion: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
139
|
+
integrator: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
140
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
141
|
+
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
transport: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
144
|
+
loader: "loader";
|
|
145
|
+
"script-tag": "script-tag";
|
|
146
|
+
esm: "esm";
|
|
147
|
+
"tag-manager": "tag-manager";
|
|
148
|
+
snippet: "snippet";
|
|
149
|
+
}>>;
|
|
150
|
+
runtime: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
151
|
+
framework: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
152
|
+
next: "next";
|
|
153
|
+
vite: "vite";
|
|
154
|
+
webpack: "webpack";
|
|
155
|
+
plain: "plain";
|
|
156
|
+
}>>;
|
|
157
|
+
runtime: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
158
|
+
browser: "browser";
|
|
159
|
+
edge: "edge";
|
|
160
|
+
}>>;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
notes: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
capabilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
165
|
+
flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
166
|
+
key: z.ZodMiniString<string>;
|
|
167
|
+
target: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
168
|
+
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
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
170
|
+
} | null)[] | {
|
|
171
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
172
|
+
} | null)[] | {
|
|
173
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
174
|
+
} | null)[] | {
|
|
175
|
+
[key: string]: 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;
|
|
176
|
+
} | null)[] | {
|
|
177
|
+
[key: string]: 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;
|
|
178
|
+
} | null)[] | {
|
|
179
|
+
[key: string]: 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;
|
|
180
|
+
} | null)[] | {
|
|
181
|
+
[key: string]: 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;
|
|
182
|
+
} | null)[] | {
|
|
183
|
+
[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 | /*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;
|
|
184
|
+
} | null)[] | {
|
|
185
|
+
[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 | /*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;
|
|
186
|
+
} | null)[] | {
|
|
187
|
+
[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 | /*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;
|
|
188
|
+
} | null)[] | {
|
|
189
|
+
[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 | /*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;
|
|
190
|
+
} | null)[] | {
|
|
191
|
+
[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;
|
|
192
|
+
} | null, unknown, z.core.$ZodTypeInternals<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 | {
|
|
193
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
194
|
+
} | null)[] | {
|
|
195
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
196
|
+
} | null)[] | {
|
|
197
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
198
|
+
} | null)[] | {
|
|
199
|
+
[key: string]: 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;
|
|
200
|
+
} | null)[] | {
|
|
201
|
+
[key: string]: 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;
|
|
202
|
+
} | null)[] | {
|
|
203
|
+
[key: string]: 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;
|
|
204
|
+
} | null)[] | {
|
|
205
|
+
[key: string]: 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;
|
|
206
|
+
} | null)[] | {
|
|
207
|
+
[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 | /*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;
|
|
208
|
+
} | null)[] | {
|
|
209
|
+
[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 | /*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;
|
|
210
|
+
} | null)[] | {
|
|
211
|
+
[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 | /*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;
|
|
212
|
+
} | null)[] | {
|
|
213
|
+
[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 | /*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;
|
|
214
|
+
} | null)[] | {
|
|
215
|
+
[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
|
+
} | null, unknown>>;
|
|
217
|
+
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
218
|
+
origin: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
219
|
+
runtime_config: "runtime_config";
|
|
220
|
+
trigger_context: "trigger_context";
|
|
221
|
+
provider_sync: "provider_sync";
|
|
222
|
+
api: "api";
|
|
223
|
+
}>>;
|
|
224
|
+
provider: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
225
|
+
name: z.ZodMiniString<string>;
|
|
226
|
+
project: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
227
|
+
environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
status: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
230
|
+
reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
231
|
+
evaluatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
232
|
+
}, z.core.$strip>>>;
|
|
233
|
+
hostCapabilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
234
|
+
key: z.ZodMiniString<string>;
|
|
235
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
236
|
+
provider: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
237
|
+
name: z.ZodMiniString<string>;
|
|
238
|
+
project: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
239
|
+
environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
}, z.core.$strip>>>;
|
|
242
|
+
runtimeEndpoints: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
243
|
+
apiUrl: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
244
|
+
coreUrl: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
245
|
+
}, z.core.$strict>>;
|
|
246
|
+
}, z.core.$strict>;
|
|
247
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
248
|
+
kind: z.ZodMiniLiteral<"close">;
|
|
249
|
+
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
250
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
251
|
+
kind: z.ZodMiniLiteral<"reset">;
|
|
252
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
253
|
+
traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
|
|
254
|
+
identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
255
|
+
type: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>;
|
|
256
|
+
value: z.ZodMiniString<string>;
|
|
257
|
+
}, z.core.$strip>>>;
|
|
258
|
+
context: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
259
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
260
|
+
path: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
261
|
+
referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
262
|
+
search: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
locale: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
265
|
+
userAgent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
266
|
+
externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
267
|
+
id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
|
|
268
|
+
type: z.ZodMiniString<string>;
|
|
269
|
+
collection: z.ZodMiniLiteral<"users">;
|
|
270
|
+
encoding: z.ZodMiniLiteral<"none">;
|
|
271
|
+
}, z.core.$strip>>>;
|
|
272
|
+
flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
273
|
+
key: z.ZodMiniString<string>;
|
|
274
|
+
target: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
275
|
+
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 | {
|
|
276
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
277
|
+
} | null)[] | {
|
|
278
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
279
|
+
} | null)[] | {
|
|
280
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
281
|
+
} | null)[] | {
|
|
282
|
+
[key: string]: 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;
|
|
283
|
+
} | null)[] | {
|
|
284
|
+
[key: string]: 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;
|
|
285
|
+
} | null)[] | {
|
|
286
|
+
[key: string]: 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;
|
|
287
|
+
} | null)[] | {
|
|
288
|
+
[key: string]: 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;
|
|
289
|
+
} | null)[] | {
|
|
290
|
+
[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 | /*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;
|
|
291
|
+
} | null)[] | {
|
|
292
|
+
[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 | /*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;
|
|
293
|
+
} | null)[] | {
|
|
294
|
+
[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 | /*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;
|
|
295
|
+
} | null)[] | {
|
|
296
|
+
[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 | /*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;
|
|
297
|
+
} | null)[] | {
|
|
298
|
+
[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;
|
|
299
|
+
} | null, unknown, z.core.$ZodTypeInternals<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 | {
|
|
300
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
301
|
+
} | null)[] | {
|
|
302
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
303
|
+
} | null)[] | {
|
|
304
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
305
|
+
} | null)[] | {
|
|
306
|
+
[key: string]: 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;
|
|
307
|
+
} | null)[] | {
|
|
308
|
+
[key: string]: 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;
|
|
309
|
+
} | null)[] | {
|
|
310
|
+
[key: string]: 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;
|
|
311
|
+
} | null)[] | {
|
|
312
|
+
[key: string]: 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;
|
|
313
|
+
} | null)[] | {
|
|
314
|
+
[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 | /*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;
|
|
315
|
+
} | null)[] | {
|
|
316
|
+
[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 | /*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;
|
|
317
|
+
} | null)[] | {
|
|
318
|
+
[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 | /*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;
|
|
319
|
+
} | null)[] | {
|
|
320
|
+
[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 | /*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;
|
|
321
|
+
} | null)[] | {
|
|
322
|
+
[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;
|
|
323
|
+
} | null, unknown>>;
|
|
324
|
+
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
325
|
+
origin: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
326
|
+
runtime_config: "runtime_config";
|
|
327
|
+
trigger_context: "trigger_context";
|
|
328
|
+
provider_sync: "provider_sync";
|
|
329
|
+
api: "api";
|
|
330
|
+
}>>;
|
|
331
|
+
provider: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
332
|
+
name: z.ZodMiniString<string>;
|
|
333
|
+
project: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
334
|
+
environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
335
|
+
}, z.core.$strip>>;
|
|
336
|
+
status: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
337
|
+
reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
338
|
+
evaluatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
339
|
+
}, z.core.$strip>>>;
|
|
340
|
+
capabilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
341
|
+
key: z.ZodMiniString<string>;
|
|
342
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
343
|
+
provider: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
344
|
+
name: z.ZodMiniString<string>;
|
|
345
|
+
project: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
346
|
+
environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
347
|
+
}, z.core.$strip>>;
|
|
348
|
+
}, z.core.$strip>>>;
|
|
349
|
+
}, z.core.$strip>>;
|
|
350
|
+
messageId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
351
|
+
timestamp: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
352
|
+
origin: z.ZodMiniLiteral<"customer">;
|
|
353
|
+
event: z.ZodMiniString<string>;
|
|
354
|
+
properties: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniType<import("./app-event.js").AppEventJsonValue, unknown, z.core.$ZodTypeInternals<import("./app-event.js").AppEventJsonValue, unknown>>>>;
|
|
355
|
+
kind: z.ZodMiniLiteral<"track">;
|
|
356
|
+
}, z.core.$strip>], "kind">, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
357
|
+
kind: z.ZodMiniLiteral<"identify">;
|
|
358
|
+
traits: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
|
|
359
|
+
options: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
360
|
+
externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
361
|
+
id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
|
|
362
|
+
type: z.ZodMiniString<string>;
|
|
363
|
+
collection: z.ZodMiniLiteral<"users">;
|
|
364
|
+
encoding: z.ZodMiniLiteral<"none">;
|
|
365
|
+
}, z.core.$strip>>>;
|
|
366
|
+
}, z.core.$strict>>;
|
|
367
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
368
|
+
kind: z.ZodMiniLiteral<"identify">;
|
|
369
|
+
userId: z.ZodMiniString<string>;
|
|
370
|
+
traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
|
|
371
|
+
options: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
372
|
+
externalIds: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
373
|
+
id: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<string, string>>;
|
|
374
|
+
type: z.ZodMiniString<string>;
|
|
375
|
+
collection: z.ZodMiniLiteral<"users">;
|
|
376
|
+
encoding: z.ZodMiniLiteral<"none">;
|
|
377
|
+
}, z.core.$strip>>>;
|
|
378
|
+
}, z.core.$strict>>;
|
|
379
|
+
}, z.core.$strict>]>]>;
|
|
380
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
381
|
+
kind: z.ZodMiniLiteral<"setOpenSuppressed">;
|
|
382
|
+
id: z.ZodMiniString<string>;
|
|
383
|
+
suppressed: z.ZodMiniBoolean<boolean>;
|
|
384
|
+
reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
385
|
+
}, z.core.$strict>], "kind">;
|
|
386
|
+
export declare const mobileBridgeWebMessageSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
387
|
+
kind: z.ZodMiniLiteral<"ready">;
|
|
388
|
+
instanceId: z.ZodMiniString<string>;
|
|
389
|
+
}, z.core.$strict>, z.ZodMiniPipe<z.ZodMiniObject<{
|
|
390
|
+
ok: z.ZodMiniBoolean<boolean>;
|
|
391
|
+
error: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
392
|
+
message: z.ZodMiniString<string>;
|
|
393
|
+
code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
394
|
+
}, z.core.$strict>>;
|
|
395
|
+
kind: z.ZodMiniLiteral<"commandSettled">;
|
|
396
|
+
id: z.ZodMiniString<string>;
|
|
397
|
+
requestId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
398
|
+
}, z.core.$strict>, z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
399
|
+
ok: z.ZodMiniLiteral<true>;
|
|
400
|
+
kind: z.ZodMiniLiteral<"commandSettled">;
|
|
401
|
+
id: z.ZodMiniString<string>;
|
|
402
|
+
requestId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
403
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
404
|
+
ok: z.ZodMiniLiteral<false>;
|
|
405
|
+
error: z.ZodMiniObject<{
|
|
406
|
+
message: z.ZodMiniString<string>;
|
|
407
|
+
code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
408
|
+
}, z.core.$strict>;
|
|
409
|
+
kind: z.ZodMiniLiteral<"commandSettled">;
|
|
410
|
+
id: z.ZodMiniString<string>;
|
|
411
|
+
requestId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
412
|
+
}, z.core.$strict>], "ok">>, z.ZodMiniObject<{
|
|
413
|
+
kind: z.ZodMiniLiteral<"flowStateChanged">;
|
|
414
|
+
isOpen: z.ZodMiniBoolean<boolean>;
|
|
415
|
+
isLoading: z.ZodMiniBoolean<boolean>;
|
|
416
|
+
width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
417
|
+
height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
418
|
+
flowId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
419
|
+
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
420
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
421
|
+
kind: z.ZodMiniLiteral<"openRequested">;
|
|
422
|
+
source: z.ZodMiniEnum<{
|
|
423
|
+
command: "command";
|
|
424
|
+
targeting: "targeting";
|
|
425
|
+
}>;
|
|
426
|
+
flowId: z.ZodMiniString<string>;
|
|
427
|
+
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
428
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
429
|
+
kind: z.ZodMiniLiteral<"error">;
|
|
430
|
+
error: z.ZodMiniObject<{
|
|
431
|
+
message: z.ZodMiniString<string>;
|
|
432
|
+
code: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
433
|
+
}, z.core.$strict>;
|
|
434
|
+
}, z.core.$strict>], "kind">;
|
|
435
|
+
export type MobileBridgeNativeMessage = z.output<typeof mobileBridgeNativeMessageSchema>;
|
|
436
|
+
export type MobileBridgeWebMessage = z.output<typeof mobileBridgeWebMessageSchema>;
|
|
437
|
+
export declare function parseMobileBridgeNativeMessage(input: unknown): MobileBridgeNativeMessage;
|
|
438
|
+
export declare function parseMobileBridgeWebMessage(input: unknown): MobileBridgeWebMessage;
|
|
439
|
+
//# sourceMappingURL=mobile-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-bridge.d.ts","sourceRoot":"","sources":["../src/mobile-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAoC9B,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAY1C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAyBvC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAC/C,OAAO,+BAA+B,CACtC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAC5C,OAAO,4BAA4B,CACnC,CAAC;AAEF,wBAAgB,8BAA8B,CAC7C,KAAK,EAAE,OAAO,GACZ,yBAAyB,CAE3B;AAED,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,OAAO,GACZ,sBAAsB,CAExB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
import { publicCommandPayloadSchema } from "./widget-commands.js";
|
|
3
|
+
const bridgeMessageIdSchema = z.string().check(z.trim(), z.minLength(1));
|
|
4
|
+
const bridgeErrorSchema = z.strictObject({
|
|
5
|
+
message: z.string().check(z.trim(), z.minLength(1)),
|
|
6
|
+
code: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
7
|
+
});
|
|
8
|
+
const commandSettledBase = {
|
|
9
|
+
kind: z.literal("commandSettled"),
|
|
10
|
+
id: bridgeMessageIdSchema,
|
|
11
|
+
requestId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
12
|
+
};
|
|
13
|
+
const commandSettledSuccessSchema = z.strictObject({
|
|
14
|
+
...commandSettledBase,
|
|
15
|
+
ok: z.literal(true),
|
|
16
|
+
});
|
|
17
|
+
const commandSettledFailureSchema = z.strictObject({
|
|
18
|
+
...commandSettledBase,
|
|
19
|
+
ok: z.literal(false),
|
|
20
|
+
error: bridgeErrorSchema,
|
|
21
|
+
});
|
|
22
|
+
const commandSettledSchema = z.pipe(z.strictObject({
|
|
23
|
+
...commandSettledBase,
|
|
24
|
+
ok: z.boolean(),
|
|
25
|
+
error: z.optional(bridgeErrorSchema),
|
|
26
|
+
}), z.discriminatedUnion("ok", [
|
|
27
|
+
commandSettledSuccessSchema,
|
|
28
|
+
commandSettledFailureSchema,
|
|
29
|
+
]));
|
|
30
|
+
export const mobileBridgeNativeMessageSchema = z.discriminatedUnion("kind", [
|
|
31
|
+
z.strictObject({
|
|
32
|
+
kind: z.literal("command"),
|
|
33
|
+
id: bridgeMessageIdSchema,
|
|
34
|
+
command: publicCommandPayloadSchema,
|
|
35
|
+
}),
|
|
36
|
+
z.strictObject({
|
|
37
|
+
kind: z.literal("setOpenSuppressed"),
|
|
38
|
+
id: bridgeMessageIdSchema,
|
|
39
|
+
suppressed: z.boolean(),
|
|
40
|
+
reason: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
41
|
+
}),
|
|
42
|
+
]);
|
|
43
|
+
export const mobileBridgeWebMessageSchema = z.discriminatedUnion("kind", [
|
|
44
|
+
z.strictObject({
|
|
45
|
+
kind: z.literal("ready"),
|
|
46
|
+
instanceId: z.string().check(z.trim(), z.minLength(1)),
|
|
47
|
+
}),
|
|
48
|
+
commandSettledSchema,
|
|
49
|
+
z.strictObject({
|
|
50
|
+
kind: z.literal("flowStateChanged"),
|
|
51
|
+
isOpen: z.boolean(),
|
|
52
|
+
isLoading: z.boolean(),
|
|
53
|
+
width: z.optional(z.number()),
|
|
54
|
+
height: z.optional(z.number()),
|
|
55
|
+
flowId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
56
|
+
flowHandleId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
57
|
+
}),
|
|
58
|
+
z.strictObject({
|
|
59
|
+
kind: z.literal("openRequested"),
|
|
60
|
+
source: z.enum(["command", "targeting"]),
|
|
61
|
+
flowId: z.string().check(z.trim(), z.minLength(1)),
|
|
62
|
+
flowHandleId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
63
|
+
}),
|
|
64
|
+
z.strictObject({
|
|
65
|
+
kind: z.literal("error"),
|
|
66
|
+
error: bridgeErrorSchema,
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
export function parseMobileBridgeNativeMessage(input) {
|
|
70
|
+
return mobileBridgeNativeMessageSchema.parse(input);
|
|
71
|
+
}
|
|
72
|
+
export function parseMobileBridgeWebMessage(input) {
|
|
73
|
+
return mobileBridgeWebMessageSchema.parse(input);
|
|
74
|
+
}
|
package/dist/scopes.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export declare const SCOPE_IDS: readonly [
|
|
|
10
10
|
"ads.personalization"
|
|
11
11
|
];
|
|
12
12
|
export declare const scopeIdSchema: z.ZodMiniEnum<{
|
|
13
|
+
"functionality.storage": "functionality.storage";
|
|
14
|
+
"security.storage": "security.storage";
|
|
13
15
|
"analytics.storage": "analytics.storage";
|
|
14
16
|
"analytics.measurement": "analytics.measurement";
|
|
15
17
|
"personalization.storage": "personalization.storage";
|
|
16
18
|
"ads.storage": "ads.storage";
|
|
17
19
|
"ads.user_data": "ads.user_data";
|
|
18
20
|
"ads.personalization": "ads.personalization";
|
|
19
|
-
"functionality.storage": "functionality.storage";
|
|
20
|
-
"security.storage": "security.storage";
|
|
21
21
|
}>;
|
|
22
22
|
export type Scope = (typeof SCOPE_IDS)[number];
|
|
23
23
|
export declare function isScope(value: unknown): value is Scope;
|
|
@@ -5,6 +5,8 @@ export declare const publicWidgetCommandKindSchema: z.ZodMiniEnum<{
|
|
|
5
5
|
prefetch: "prefetch";
|
|
6
6
|
prerender: "prerender";
|
|
7
7
|
identify: "identify";
|
|
8
|
+
updateHostContext: "updateHostContext";
|
|
9
|
+
emitHostSignal: "emitHostSignal";
|
|
8
10
|
setContainer: "setContainer";
|
|
9
11
|
setDefaultContainerPolicy: "setDefaultContainerPolicy";
|
|
10
12
|
configure: "configure";
|
|
@@ -55,6 +57,22 @@ export declare const publicCommandPayloadSchema: z.ZodMiniUnion<readonly [z.ZodM
|
|
|
55
57
|
flowId: z.ZodMiniString<string>;
|
|
56
58
|
flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
57
59
|
hideCloseButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
60
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
61
|
+
kind: z.ZodMiniLiteral<"updateHostContext">;
|
|
62
|
+
context: z.ZodMiniObject<{
|
|
63
|
+
url: z.ZodMiniString<string>;
|
|
64
|
+
env: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
65
|
+
storage: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
66
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
67
|
+
path: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
68
|
+
referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
69
|
+
search: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
70
|
+
}, z.core.$strict>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
73
|
+
kind: z.ZodMiniLiteral<"emitHostSignal">;
|
|
74
|
+
name: z.ZodMiniString<string>;
|
|
75
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
58
76
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
59
77
|
kind: z.ZodMiniLiteral<"setContainer">;
|
|
60
78
|
flowHandleId: z.ZodMiniString<string>;
|
|
@@ -87,14 +105,14 @@ export declare const publicCommandPayloadSchema: z.ZodMiniUnion<readonly [z.ZodM
|
|
|
87
105
|
denied: "denied";
|
|
88
106
|
revoked: "revoked";
|
|
89
107
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
108
|
+
"functionality.storage": "functionality.storage";
|
|
109
|
+
"security.storage": "security.storage";
|
|
90
110
|
"analytics.storage": "analytics.storage";
|
|
91
111
|
"analytics.measurement": "analytics.measurement";
|
|
92
112
|
"personalization.storage": "personalization.storage";
|
|
93
113
|
"ads.storage": "ads.storage";
|
|
94
114
|
"ads.user_data": "ads.user_data";
|
|
95
115
|
"ads.personalization": "ads.personalization";
|
|
96
|
-
"functionality.storage": "functionality.storage";
|
|
97
|
-
"security.storage": "security.storage";
|
|
98
116
|
}>>]>>;
|
|
99
117
|
auth: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
100
118
|
jwt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
@@ -121,14 +139,14 @@ export declare const publicCommandPayloadSchema: z.ZodMiniUnion<readonly [z.ZodM
|
|
|
121
139
|
denied: "denied";
|
|
122
140
|
revoked: "revoked";
|
|
123
141
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
142
|
+
"functionality.storage": "functionality.storage";
|
|
143
|
+
"security.storage": "security.storage";
|
|
124
144
|
"analytics.storage": "analytics.storage";
|
|
125
145
|
"analytics.measurement": "analytics.measurement";
|
|
126
146
|
"personalization.storage": "personalization.storage";
|
|
127
147
|
"ads.storage": "ads.storage";
|
|
128
148
|
"ads.user_data": "ads.user_data";
|
|
129
149
|
"ads.personalization": "ads.personalization";
|
|
130
|
-
"functionality.storage": "functionality.storage";
|
|
131
|
-
"security.storage": "security.storage";
|
|
132
150
|
}>>]>>;
|
|
133
151
|
clientMeta: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
134
152
|
loader: z.ZodMiniEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-commands.d.ts","sourceRoot":"","sources":["../src/widget-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,WAAW,EAEhB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"widget-commands.d.ts","sourceRoot":"","sources":["../src/widget-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,WAAW,EAEhB,MAAM,oBAAoB,CAAC;AAsB5B,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;EAAmC,CAAC;AA6D9E,eAAO,MAAM,qBAAqB;;;;;;;;;4BAShC,CAAC;AAeH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAoDrC,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
|
@@ -9,6 +9,8 @@ const publicWidgetCommandKinds = [
|
|
|
9
9
|
"prefetch",
|
|
10
10
|
"prerender",
|
|
11
11
|
"identify",
|
|
12
|
+
"updateHostContext",
|
|
13
|
+
"emitHostSignal",
|
|
12
14
|
"setContainer",
|
|
13
15
|
"setDefaultContainerPolicy",
|
|
14
16
|
"configure",
|
|
@@ -52,6 +54,16 @@ const identifyPayloadSchema = z.union([
|
|
|
52
54
|
options: z.optional(identifyOptionsSchema),
|
|
53
55
|
}),
|
|
54
56
|
]);
|
|
57
|
+
const hostContextSchema = z.strictObject({
|
|
58
|
+
url: z.string().check(z.url()),
|
|
59
|
+
env: z.optional(z.record(z.string(), z.string())),
|
|
60
|
+
storage: z.optional(z.record(z.string(), z.string())),
|
|
61
|
+
page: z.optional(z.strictObject({
|
|
62
|
+
path: z.optional(z.string()),
|
|
63
|
+
referrer: z.optional(z.string()),
|
|
64
|
+
search: z.optional(z.string()),
|
|
65
|
+
})),
|
|
66
|
+
});
|
|
55
67
|
// 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.
|
|
56
68
|
// [from=legacy-open-container-requirement] [to=strict-public-open-only] [scope=slice] [priority=low] [impact=medium] [risk=low]
|
|
57
69
|
const legacyOpenContainerRequirementSchema = z.enum(["any", "hostOnly"]);
|
|
@@ -88,6 +100,15 @@ export const publicCommandPayloadSchema = z.union([
|
|
|
88
100
|
flowHandleId: z.optional(flowHandleIdSchema),
|
|
89
101
|
hideCloseButton: z.optional(z.boolean()),
|
|
90
102
|
}),
|
|
103
|
+
z.strictObject({
|
|
104
|
+
kind: z.literal("updateHostContext"),
|
|
105
|
+
context: hostContextSchema,
|
|
106
|
+
}),
|
|
107
|
+
z.strictObject({
|
|
108
|
+
kind: z.literal("emitHostSignal"),
|
|
109
|
+
name: z.string().check(z.trim(), z.minLength(1)),
|
|
110
|
+
data: z.optional(z.unknown()),
|
|
111
|
+
}),
|
|
91
112
|
z.strictObject({
|
|
92
113
|
kind: z.literal("setContainer"),
|
|
93
114
|
flowHandleId: flowHandleIdSchema,
|
package/dist/widget-config.d.ts
CHANGED
|
@@ -17,14 +17,14 @@ export declare const consentConfigInputSchema: z.ZodMiniUnion<readonly [z.ZodMin
|
|
|
17
17
|
denied: "denied";
|
|
18
18
|
revoked: "revoked";
|
|
19
19
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
20
|
+
"functionality.storage": "functionality.storage";
|
|
21
|
+
"security.storage": "security.storage";
|
|
20
22
|
"analytics.storage": "analytics.storage";
|
|
21
23
|
"analytics.measurement": "analytics.measurement";
|
|
22
24
|
"personalization.storage": "personalization.storage";
|
|
23
25
|
"ads.storage": "ads.storage";
|
|
24
26
|
"ads.user_data": "ads.user_data";
|
|
25
27
|
"ads.personalization": "ads.personalization";
|
|
26
|
-
"functionality.storage": "functionality.storage";
|
|
27
|
-
"security.storage": "security.storage";
|
|
28
28
|
}>>]>;
|
|
29
29
|
export type ConsentConfigInput = z.output<typeof consentConfigInputSchema>;
|
|
30
30
|
export declare const debugInputSchema: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>;
|
|
@@ -144,14 +144,14 @@ export declare const configureOptionsSchema: z.ZodMiniObject<{
|
|
|
144
144
|
denied: "denied";
|
|
145
145
|
revoked: "revoked";
|
|
146
146
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
147
|
+
"functionality.storage": "functionality.storage";
|
|
148
|
+
"security.storage": "security.storage";
|
|
147
149
|
"analytics.storage": "analytics.storage";
|
|
148
150
|
"analytics.measurement": "analytics.measurement";
|
|
149
151
|
"personalization.storage": "personalization.storage";
|
|
150
152
|
"ads.storage": "ads.storage";
|
|
151
153
|
"ads.user_data": "ads.user_data";
|
|
152
154
|
"ads.personalization": "ads.personalization";
|
|
153
|
-
"functionality.storage": "functionality.storage";
|
|
154
|
-
"security.storage": "security.storage";
|
|
155
155
|
}>>]>>;
|
|
156
156
|
auth: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
157
157
|
jwt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
@@ -177,14 +177,14 @@ export declare const initOptionsSchema: z.ZodMiniObject<{
|
|
|
177
177
|
denied: "denied";
|
|
178
178
|
revoked: "revoked";
|
|
179
179
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
180
|
+
"functionality.storage": "functionality.storage";
|
|
181
|
+
"security.storage": "security.storage";
|
|
180
182
|
"analytics.storage": "analytics.storage";
|
|
181
183
|
"analytics.measurement": "analytics.measurement";
|
|
182
184
|
"personalization.storage": "personalization.storage";
|
|
183
185
|
"ads.storage": "ads.storage";
|
|
184
186
|
"ads.user_data": "ads.user_data";
|
|
185
187
|
"ads.personalization": "ads.personalization";
|
|
186
|
-
"functionality.storage": "functionality.storage";
|
|
187
|
-
"security.storage": "security.storage";
|
|
188
188
|
}>>]>>;
|
|
189
189
|
clientMeta: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
190
190
|
loader: z.ZodMiniEnum<{
|
|
@@ -326,14 +326,14 @@ export declare const instanceUpdateableConfigSchema: z.ZodMiniObject<{
|
|
|
326
326
|
denied: "denied";
|
|
327
327
|
revoked: "revoked";
|
|
328
328
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
329
|
+
"functionality.storage": "functionality.storage";
|
|
330
|
+
"security.storage": "security.storage";
|
|
329
331
|
"analytics.storage": "analytics.storage";
|
|
330
332
|
"analytics.measurement": "analytics.measurement";
|
|
331
333
|
"personalization.storage": "personalization.storage";
|
|
332
334
|
"ads.storage": "ads.storage";
|
|
333
335
|
"ads.user_data": "ads.user_data";
|
|
334
336
|
"ads.personalization": "ads.personalization";
|
|
335
|
-
"functionality.storage": "functionality.storage";
|
|
336
|
-
"security.storage": "security.storage";
|
|
337
337
|
}>>]>>;
|
|
338
338
|
auth: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
339
339
|
jwt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
@@ -378,14 +378,14 @@ export declare const coreInstanceConfigSchema: z.ZodMiniObject<{
|
|
|
378
378
|
denied: "denied";
|
|
379
379
|
revoked: "revoked";
|
|
380
380
|
}>, z.ZodMiniArray<z.ZodMiniEnum<{
|
|
381
|
+
"functionality.storage": "functionality.storage";
|
|
382
|
+
"security.storage": "security.storage";
|
|
381
383
|
"analytics.storage": "analytics.storage";
|
|
382
384
|
"analytics.measurement": "analytics.measurement";
|
|
383
385
|
"personalization.storage": "personalization.storage";
|
|
384
386
|
"ads.storage": "ads.storage";
|
|
385
387
|
"ads.user_data": "ads.user_data";
|
|
386
388
|
"ads.personalization": "ads.personalization";
|
|
387
|
-
"functionality.storage": "functionality.storage";
|
|
388
|
-
"security.storage": "security.storage";
|
|
389
389
|
}>>]>>;
|
|
390
390
|
auth: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
391
391
|
jwt: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getuserfeedback/protocol",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "getuserfeedback widget protocol — host surface and (later) wire protocol",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"getuserfeedback",
|
|
@@ -88,6 +88,12 @@
|
|
|
88
88
|
"import": "./dist/host/lazy-handle-client.js",
|
|
89
89
|
"default": "./dist/host/lazy-handle-client.js"
|
|
90
90
|
},
|
|
91
|
+
"./mobile-bridge": {
|
|
92
|
+
"types": "./dist/mobile-bridge.d.ts",
|
|
93
|
+
"bun": "./src/mobile-bridge.ts",
|
|
94
|
+
"import": "./dist/mobile-bridge.js",
|
|
95
|
+
"default": "./dist/mobile-bridge.js"
|
|
96
|
+
},
|
|
91
97
|
"./version-resolution": {
|
|
92
98
|
"types": "./dist/version-resolution.d.ts",
|
|
93
99
|
"bun": "./src/version-resolution.ts",
|
package/src/index.ts
CHANGED
|
@@ -69,6 +69,14 @@ export {
|
|
|
69
69
|
isIdentityTypeValue,
|
|
70
70
|
type StandardIdentityTypeValue,
|
|
71
71
|
} from "./identity-type.js";
|
|
72
|
+
export {
|
|
73
|
+
type MobileBridgeNativeMessage,
|
|
74
|
+
type MobileBridgeWebMessage,
|
|
75
|
+
mobileBridgeNativeMessageSchema,
|
|
76
|
+
mobileBridgeWebMessageSchema,
|
|
77
|
+
parseMobileBridgeNativeMessage,
|
|
78
|
+
parseMobileBridgeWebMessage,
|
|
79
|
+
} from "./mobile-bridge.js";
|
|
72
80
|
export {
|
|
73
81
|
isPublicGrantScope,
|
|
74
82
|
type PublicGrantScope,
|
|
@@ -87,6 +95,7 @@ export {
|
|
|
87
95
|
listScopes,
|
|
88
96
|
SCOPE_IDS,
|
|
89
97
|
type Scope,
|
|
98
|
+
type ScopeMeta,
|
|
90
99
|
scopeIdSchema,
|
|
91
100
|
} from "./scopes.js";
|
|
92
101
|
export {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
import { publicCommandPayloadSchema } from "./widget-commands.js";
|
|
3
|
+
|
|
4
|
+
const bridgeMessageIdSchema = z.string().check(z.trim(), z.minLength(1));
|
|
5
|
+
const bridgeErrorSchema = z.strictObject({
|
|
6
|
+
message: z.string().check(z.trim(), z.minLength(1)),
|
|
7
|
+
code: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
8
|
+
});
|
|
9
|
+
const commandSettledBase = {
|
|
10
|
+
kind: z.literal("commandSettled"),
|
|
11
|
+
id: bridgeMessageIdSchema,
|
|
12
|
+
requestId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
const commandSettledSuccessSchema = z.strictObject({
|
|
16
|
+
...commandSettledBase,
|
|
17
|
+
ok: z.literal(true),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const commandSettledFailureSchema = z.strictObject({
|
|
21
|
+
...commandSettledBase,
|
|
22
|
+
ok: z.literal(false),
|
|
23
|
+
error: bridgeErrorSchema,
|
|
24
|
+
});
|
|
25
|
+
const commandSettledSchema = z.pipe(
|
|
26
|
+
z.strictObject({
|
|
27
|
+
...commandSettledBase,
|
|
28
|
+
ok: z.boolean(),
|
|
29
|
+
error: z.optional(bridgeErrorSchema),
|
|
30
|
+
}),
|
|
31
|
+
z.discriminatedUnion("ok", [
|
|
32
|
+
commandSettledSuccessSchema,
|
|
33
|
+
commandSettledFailureSchema,
|
|
34
|
+
]),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const mobileBridgeNativeMessageSchema = z.discriminatedUnion("kind", [
|
|
38
|
+
z.strictObject({
|
|
39
|
+
kind: z.literal("command"),
|
|
40
|
+
id: bridgeMessageIdSchema,
|
|
41
|
+
command: publicCommandPayloadSchema,
|
|
42
|
+
}),
|
|
43
|
+
z.strictObject({
|
|
44
|
+
kind: z.literal("setOpenSuppressed"),
|
|
45
|
+
id: bridgeMessageIdSchema,
|
|
46
|
+
suppressed: z.boolean(),
|
|
47
|
+
reason: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
48
|
+
}),
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
export const mobileBridgeWebMessageSchema = z.discriminatedUnion("kind", [
|
|
52
|
+
z.strictObject({
|
|
53
|
+
kind: z.literal("ready"),
|
|
54
|
+
instanceId: z.string().check(z.trim(), z.minLength(1)),
|
|
55
|
+
}),
|
|
56
|
+
commandSettledSchema,
|
|
57
|
+
z.strictObject({
|
|
58
|
+
kind: z.literal("flowStateChanged"),
|
|
59
|
+
isOpen: z.boolean(),
|
|
60
|
+
isLoading: z.boolean(),
|
|
61
|
+
width: z.optional(z.number()),
|
|
62
|
+
height: z.optional(z.number()),
|
|
63
|
+
flowId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
64
|
+
flowHandleId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
65
|
+
}),
|
|
66
|
+
z.strictObject({
|
|
67
|
+
kind: z.literal("openRequested"),
|
|
68
|
+
source: z.enum(["command", "targeting"]),
|
|
69
|
+
flowId: z.string().check(z.trim(), z.minLength(1)),
|
|
70
|
+
flowHandleId: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
71
|
+
}),
|
|
72
|
+
z.strictObject({
|
|
73
|
+
kind: z.literal("error"),
|
|
74
|
+
error: bridgeErrorSchema,
|
|
75
|
+
}),
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
export type MobileBridgeNativeMessage = z.output<
|
|
79
|
+
typeof mobileBridgeNativeMessageSchema
|
|
80
|
+
>;
|
|
81
|
+
export type MobileBridgeWebMessage = z.output<
|
|
82
|
+
typeof mobileBridgeWebMessageSchema
|
|
83
|
+
>;
|
|
84
|
+
|
|
85
|
+
export function parseMobileBridgeNativeMessage(
|
|
86
|
+
input: unknown,
|
|
87
|
+
): MobileBridgeNativeMessage {
|
|
88
|
+
return mobileBridgeNativeMessageSchema.parse(input);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function parseMobileBridgeWebMessage(
|
|
92
|
+
input: unknown,
|
|
93
|
+
): MobileBridgeWebMessage {
|
|
94
|
+
return mobileBridgeWebMessageSchema.parse(input);
|
|
95
|
+
}
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
listScopes,
|
|
18
18
|
parseConfigureOptions,
|
|
19
19
|
parseInitOptions,
|
|
20
|
+
parseMobileBridgeNativeMessage,
|
|
21
|
+
parseMobileBridgeWebMessage,
|
|
20
22
|
parsePublicCommand,
|
|
21
23
|
publicGrantScopeIdSchema,
|
|
22
24
|
publicWidgetCommandKindSchema,
|
|
@@ -161,6 +163,40 @@ describe("@getuserfeedback/protocol root contract", () => {
|
|
|
161
163
|
});
|
|
162
164
|
});
|
|
163
165
|
|
|
166
|
+
it("parses public mobile host context and signal commands from the root contract", () => {
|
|
167
|
+
expect(
|
|
168
|
+
parsePublicCommand({
|
|
169
|
+
kind: "updateHostContext",
|
|
170
|
+
context: {
|
|
171
|
+
url: "app://screen/checkout",
|
|
172
|
+
page: { path: "/checkout" },
|
|
173
|
+
env: { locale: "en-US" },
|
|
174
|
+
storage: { cartId: "cart_123" },
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
177
|
+
).toEqual({
|
|
178
|
+
kind: "updateHostContext",
|
|
179
|
+
context: {
|
|
180
|
+
url: "app://screen/checkout",
|
|
181
|
+
page: { path: "/checkout" },
|
|
182
|
+
env: { locale: "en-US" },
|
|
183
|
+
storage: { cartId: "cart_123" },
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
expect(
|
|
188
|
+
parsePublicCommand({
|
|
189
|
+
kind: "emitHostSignal",
|
|
190
|
+
name: "screenFocused",
|
|
191
|
+
data: { path: "/checkout" },
|
|
192
|
+
}),
|
|
193
|
+
).toEqual({
|
|
194
|
+
kind: "emitHostSignal",
|
|
195
|
+
name: "screenFocused",
|
|
196
|
+
data: { path: "/checkout" },
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
164
200
|
it("parses theme resolution payloads with optional runtime artifacts", () => {
|
|
165
201
|
expect(
|
|
166
202
|
themeVersionResolutionSchema.parse({
|
|
@@ -304,6 +340,103 @@ describe("@getuserfeedback/protocol root contract", () => {
|
|
|
304
340
|
).toThrow();
|
|
305
341
|
});
|
|
306
342
|
|
|
343
|
+
it("parses mobile bridge native and web messages from the root contract", () => {
|
|
344
|
+
expect(
|
|
345
|
+
parseMobileBridgeNativeMessage({
|
|
346
|
+
kind: "command",
|
|
347
|
+
id: "native_message_1",
|
|
348
|
+
command: {
|
|
349
|
+
kind: "updateHostContext",
|
|
350
|
+
context: { url: "app://screen/checkout" },
|
|
351
|
+
},
|
|
352
|
+
}),
|
|
353
|
+
).toEqual({
|
|
354
|
+
kind: "command",
|
|
355
|
+
id: "native_message_1",
|
|
356
|
+
command: {
|
|
357
|
+
kind: "updateHostContext",
|
|
358
|
+
context: { url: "app://screen/checkout" },
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
expect(
|
|
363
|
+
parseMobileBridgeWebMessage({
|
|
364
|
+
kind: "flowStateChanged",
|
|
365
|
+
isOpen: true,
|
|
366
|
+
isLoading: false,
|
|
367
|
+
width: 320,
|
|
368
|
+
height: 480,
|
|
369
|
+
flowId: "sur_123",
|
|
370
|
+
flowHandleId: "handle_123",
|
|
371
|
+
}),
|
|
372
|
+
).toEqual({
|
|
373
|
+
kind: "flowStateChanged",
|
|
374
|
+
isOpen: true,
|
|
375
|
+
isLoading: false,
|
|
376
|
+
width: 320,
|
|
377
|
+
height: 480,
|
|
378
|
+
flowId: "sur_123",
|
|
379
|
+
flowHandleId: "handle_123",
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
expect(
|
|
383
|
+
parseMobileBridgeWebMessage({
|
|
384
|
+
kind: "commandSettled",
|
|
385
|
+
id: "native_message_1",
|
|
386
|
+
requestId: "request_123",
|
|
387
|
+
ok: true,
|
|
388
|
+
}),
|
|
389
|
+
).toEqual({
|
|
390
|
+
kind: "commandSettled",
|
|
391
|
+
id: "native_message_1",
|
|
392
|
+
requestId: "request_123",
|
|
393
|
+
ok: true,
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
expect(
|
|
397
|
+
parseMobileBridgeWebMessage({
|
|
398
|
+
kind: "commandSettled",
|
|
399
|
+
id: "native_message_2",
|
|
400
|
+
requestId: "request_456",
|
|
401
|
+
ok: false,
|
|
402
|
+
error: {
|
|
403
|
+
message: "Command failed",
|
|
404
|
+
code: "COMMAND_FAILED",
|
|
405
|
+
},
|
|
406
|
+
}),
|
|
407
|
+
).toEqual({
|
|
408
|
+
kind: "commandSettled",
|
|
409
|
+
id: "native_message_2",
|
|
410
|
+
requestId: "request_456",
|
|
411
|
+
ok: false,
|
|
412
|
+
error: {
|
|
413
|
+
message: "Command failed",
|
|
414
|
+
code: "COMMAND_FAILED",
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
it("rejects mobile bridge command settlements with mismatched success state", () => {
|
|
420
|
+
expect(() =>
|
|
421
|
+
parseMobileBridgeWebMessage({
|
|
422
|
+
kind: "commandSettled",
|
|
423
|
+
id: "native_message_1",
|
|
424
|
+
ok: false,
|
|
425
|
+
}),
|
|
426
|
+
).toThrow();
|
|
427
|
+
|
|
428
|
+
expect(() =>
|
|
429
|
+
parseMobileBridgeWebMessage({
|
|
430
|
+
kind: "commandSettled",
|
|
431
|
+
id: "native_message_2",
|
|
432
|
+
ok: true,
|
|
433
|
+
error: {
|
|
434
|
+
message: "Should not be present",
|
|
435
|
+
},
|
|
436
|
+
}),
|
|
437
|
+
).toThrow();
|
|
438
|
+
});
|
|
439
|
+
|
|
307
440
|
it("parses public API flow and theme version resolution payloads", () => {
|
|
308
441
|
expect(
|
|
309
442
|
flowVersionResolutionSchema.parse({ flowVersionId: "fv_abc" }),
|
package/src/widget-commands.ts
CHANGED
|
@@ -19,6 +19,8 @@ const publicWidgetCommandKinds = [
|
|
|
19
19
|
"prefetch",
|
|
20
20
|
"prerender",
|
|
21
21
|
"identify",
|
|
22
|
+
"updateHostContext",
|
|
23
|
+
"emitHostSignal",
|
|
22
24
|
"setContainer",
|
|
23
25
|
"setDefaultContainerPolicy",
|
|
24
26
|
"configure",
|
|
@@ -72,6 +74,19 @@ const identifyPayloadSchema = z.union([
|
|
|
72
74
|
}),
|
|
73
75
|
]);
|
|
74
76
|
|
|
77
|
+
const hostContextSchema = z.strictObject({
|
|
78
|
+
url: z.string().check(z.url()),
|
|
79
|
+
env: z.optional(z.record(z.string(), z.string())),
|
|
80
|
+
storage: z.optional(z.record(z.string(), z.string())),
|
|
81
|
+
page: z.optional(
|
|
82
|
+
z.strictObject({
|
|
83
|
+
path: z.optional(z.string()),
|
|
84
|
+
referrer: z.optional(z.string()),
|
|
85
|
+
search: z.optional(z.string()),
|
|
86
|
+
}),
|
|
87
|
+
),
|
|
88
|
+
});
|
|
89
|
+
|
|
75
90
|
// 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.
|
|
76
91
|
// [from=legacy-open-container-requirement] [to=strict-public-open-only] [scope=slice] [priority=low] [impact=medium] [risk=low]
|
|
77
92
|
const legacyOpenContainerRequirementSchema = z.enum(["any", "hostOnly"]);
|
|
@@ -114,6 +129,15 @@ export const publicCommandPayloadSchema = z.union([
|
|
|
114
129
|
flowHandleId: z.optional(flowHandleIdSchema),
|
|
115
130
|
hideCloseButton: z.optional(z.boolean()),
|
|
116
131
|
}),
|
|
132
|
+
z.strictObject({
|
|
133
|
+
kind: z.literal("updateHostContext"),
|
|
134
|
+
context: hostContextSchema,
|
|
135
|
+
}),
|
|
136
|
+
z.strictObject({
|
|
137
|
+
kind: z.literal("emitHostSignal"),
|
|
138
|
+
name: z.string().check(z.trim(), z.minLength(1)),
|
|
139
|
+
data: z.optional(z.unknown()),
|
|
140
|
+
}),
|
|
117
141
|
z.strictObject({
|
|
118
142
|
kind: z.literal("setContainer"),
|
|
119
143
|
flowHandleId: flowHandleIdSchema,
|