@getuserfeedback/protocol 2.2.0 → 3.0.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.
@@ -148,7 +148,7 @@ export declare const appEventBaseSchema: z.ZodMiniObject<{
148
148
  messageId: z.ZodMiniOptional<z.ZodMiniString<string>>;
149
149
  timestamp: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
150
150
  }, z.core.$strip>;
151
- export declare const reservedSystemAppEventNames: readonly ["Response Submitted", "Flow Viewed", "Flow Dismissed", "Identified"];
151
+ export declare const reservedSystemAppEventNames: readonly ["Response Submitted", "Flow Completed", "Flow Viewed", "Flow Dismissed", "Identified"];
152
152
  export declare const appEventSystemBaseSchema: z.ZodMiniObject<{
153
153
  traits: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
154
154
  identities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"app-event.d.ts","sourceRoot":"","sources":["../src/app-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AAEH,KAAK,iBAAiB,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,iBAAiB,EAAE,GACnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAC1B,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,iBAAiB,EAAE,GACnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAgCxC,eAAO,MAAM,0BAA0B;;;;iBAIrC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;i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mB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/dist/app-event.js CHANGED
@@ -80,6 +80,7 @@ const appEventSurveyReferenceSchema = z.object({
80
80
  });
81
81
  export const reservedSystemAppEventNames = [
82
82
  "Response Submitted",
83
+ "Flow Completed",
83
84
  "Flow Viewed",
84
85
  "Flow Dismissed",
85
86
  "Identified",
@@ -0,0 +1,53 @@
1
+ import * as z from "zod/mini";
2
+ export declare const coreCommandKindSchema: z.ZodMiniEnum<{
3
+ error: "error";
4
+ open: "open";
5
+ prefetch: "prefetch";
6
+ prerender: "prerender";
7
+ hostContextUpdated: "hostContextUpdated";
8
+ hostSignal: "hostSignal";
9
+ setTargetingPlan: "setTargetingPlan";
10
+ telemetry: "telemetry";
11
+ identify: "identify";
12
+ track: "track";
13
+ configure: "configure";
14
+ init: "init";
15
+ close: "close";
16
+ reset: "reset";
17
+ }>;
18
+ export declare const publicCommandKindSchema: z.ZodMiniEnum<{
19
+ open: "open";
20
+ prefetch: "prefetch";
21
+ prerender: "prerender";
22
+ identify: "identify";
23
+ track: "track";
24
+ configure: "configure";
25
+ init: "init";
26
+ close: "close";
27
+ reset: "reset";
28
+ updateHostContext: "updateHostContext";
29
+ emitHostSignal: "emitHostSignal";
30
+ setContainer: "setContainer";
31
+ setDefaultContainerPolicy: "setDefaultContainerPolicy";
32
+ }>;
33
+ export declare const allCommandKindSchema: z.ZodMiniEnum<{
34
+ error: "error";
35
+ open: "open";
36
+ prefetch: "prefetch";
37
+ prerender: "prerender";
38
+ hostContextUpdated: "hostContextUpdated";
39
+ hostSignal: "hostSignal";
40
+ setTargetingPlan: "setTargetingPlan";
41
+ telemetry: "telemetry";
42
+ identify: "identify";
43
+ track: "track";
44
+ configure: "configure";
45
+ init: "init";
46
+ close: "close";
47
+ reset: "reset";
48
+ updateHostContext: "updateHostContext";
49
+ emitHostSignal: "emitHostSignal";
50
+ setContainer: "setContainer";
51
+ setDefaultContainerPolicy: "setDefaultContainerPolicy";
52
+ }>;
53
+ //# sourceMappingURL=command-kinds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-kinds.d.ts","sourceRoot":"","sources":["../src/command-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAmC9B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAA2B,CAAC;AAC9D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;EAA6B,CAAC;AAKlE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;EAA0B,CAAC"}
@@ -0,0 +1,37 @@
1
+ import * as z from "zod/mini";
2
+ const coreCommandKinds = [
3
+ "open",
4
+ "prefetch",
5
+ "prerender",
6
+ "hostContextUpdated",
7
+ "hostSignal",
8
+ "setTargetingPlan",
9
+ "telemetry",
10
+ "identify",
11
+ "track",
12
+ "configure",
13
+ "init",
14
+ "close",
15
+ "reset",
16
+ "error",
17
+ ];
18
+ const publicCommandKinds = [
19
+ "open",
20
+ "prefetch",
21
+ "prerender",
22
+ "identify",
23
+ "updateHostContext",
24
+ "emitHostSignal",
25
+ "setContainer",
26
+ "setDefaultContainerPolicy",
27
+ "configure",
28
+ "init",
29
+ "close",
30
+ "reset",
31
+ "track",
32
+ ];
33
+ export const coreCommandKindSchema = z.enum(coreCommandKinds);
34
+ export const publicCommandKindSchema = z.enum(publicCommandKinds);
35
+ /** All command kinds that may appear in settlement events (core receives loader + SDK commands). */
36
+ const allCommandKinds = [...coreCommandKinds, ...publicCommandKinds];
37
+ export const allCommandKindSchema = z.enum(allCommandKinds);
@@ -13,9 +13,6 @@ export declare const flowAssignmentStatusSchema: z.ZodMiniEnum<{
13
13
  completed: "completed";
14
14
  expired: "expired";
15
15
  superseded: "superseded";
16
- withdrawn_pending: "withdrawn_pending";
17
- withdrawn_presented: "withdrawn_presented";
18
- withdrawn_final: "withdrawn_final";
19
16
  }>;
20
17
  export declare const flowAssignmentTargetingContextSchema: z.ZodMiniObject<{
21
18
  flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
@@ -205,9 +202,6 @@ export declare const flowAssignmentRecordSchema: z.ZodMiniObject<{
205
202
  completed: "completed";
206
203
  expired: "expired";
207
204
  superseded: "superseded";
208
- withdrawn_pending: "withdrawn_pending";
209
- withdrawn_presented: "withdrawn_presented";
210
- withdrawn_final: "withdrawn_final";
211
205
  }>;
212
206
  assignedAt: z.ZodMiniString<string>;
213
207
  expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -233,9 +227,6 @@ export declare const listPendingFlowAssignmentsResponseSchema: z.ZodMiniObject<{
233
227
  completed: "completed";
234
228
  expired: "expired";
235
229
  superseded: "superseded";
236
- withdrawn_pending: "withdrawn_pending";
237
- withdrawn_presented: "withdrawn_presented";
238
- withdrawn_final: "withdrawn_final";
239
230
  }>;
240
231
  assignedAt: z.ZodMiniString<string>;
241
232
  expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -355,9 +346,6 @@ export declare const claimPendingFlowAssignmentsResponseSchema: z.ZodMiniObject<
355
346
  completed: "completed";
356
347
  expired: "expired";
357
348
  superseded: "superseded";
358
- withdrawn_pending: "withdrawn_pending";
359
- withdrawn_presented: "withdrawn_presented";
360
- withdrawn_final: "withdrawn_final";
361
349
  }>;
362
350
  assignedAt: z.ZodMiniString<string>;
363
351
  expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -488,9 +476,6 @@ export declare const updateFlowAssignmentLifecycleResponseSchema: z.ZodMiniObjec
488
476
  completed: "completed";
489
477
  expired: "expired";
490
478
  superseded: "superseded";
491
- withdrawn_pending: "withdrawn_pending";
492
- withdrawn_presented: "withdrawn_presented";
493
- withdrawn_final: "withdrawn_final";
494
479
  }>;
495
480
  assignedAt: z.ZodMiniString<string>;
496
481
  expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -514,9 +499,6 @@ export declare const nullableUpdateFlowAssignmentLifecycleResponseSchema: z.ZodM
514
499
  completed: "completed";
515
500
  expired: "expired";
516
501
  superseded: "superseded";
517
- withdrawn_pending: "withdrawn_pending";
518
- withdrawn_presented: "withdrawn_presented";
519
- withdrawn_final: "withdrawn_final";
520
502
  }>;
521
503
  assignedAt: z.ZodMiniString<string>;
522
504
  expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"flow-assignments.d.ts","sourceRoot":"","sources":["../src/flow-assignments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAO9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,yCAAyC,GACpD,yBAAyB,MAAM,EAAE,CAAC;AACnC,MAAM,MAAM,+BAA+B,GACxC,iBAAiB,GACjB,yCAAyC,CAAC;AAc7C,eAAO,MAAM,4BAA4B;;;iBAMvC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;EAUrC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU/C,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI/C,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBrC,CAAC;AAEH,eAAO,MAAM,wCAAwC;;;;;;;;;;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,OAAO,wCAAwC,CAC/C,CAAC;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAC1D,OAAO,0CAA0C,CACjD,CAAC;AACF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,OAAO,2CAA2C,CAClD,CAAC"}
@@ -17,9 +17,6 @@ export const flowAssignmentStatusSchema = z.enum([
17
17
  "completed",
18
18
  "expired",
19
19
  "superseded",
20
- "withdrawn_pending",
21
- "withdrawn_presented",
22
- "withdrawn_final",
23
20
  ]);
24
21
  export const flowAssignmentTargetingContextSchema = z.object({
25
22
  flags: z.optional(z.array(appEventFlagSchema)),
@@ -165,9 +165,6 @@ export declare const flowDisplaySyncResponseSchema: z.ZodMiniObject<{
165
165
  completed: "completed";
166
166
  expired: "expired";
167
167
  superseded: "superseded";
168
- withdrawn_pending: "withdrawn_pending";
169
- withdrawn_presented: "withdrawn_presented";
170
- withdrawn_final: "withdrawn_final";
171
168
  }>;
172
169
  assignedAt: z.ZodMiniString<string>;
173
170
  expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"flow-display.d.ts","sourceRoot":"","sources":["../src/flow-display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAQ9B,eAAO,MAAM,+BAA+B;;;;;iBAU1C,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;2BAOtC,CAAC;AAQH,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;iBAcnD,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;iBAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASvC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;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AC;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CACxD,OAAO,wCAAwC,CAC/C,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAC/C,OAAO,+BAA+B,CACtC,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAC3C,OAAO,2BAA2B,CAClC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAC5C,OAAO,4BAA4B,CACnC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,6BAA6B,CACpC,CAAC"}
@@ -107,4 +107,20 @@ export declare function getFlowHandleFromSettlementDetail(detail: {
107
107
  kind: string;
108
108
  result?: unknown;
109
109
  }): FlowHandleFromSettlement | null;
110
+ /** Normalized allocation from a handle-returning settlement: handle + instanceId for state. */
111
+ export type FlowHandleAllocationFromSettlement = {
112
+ flowHandleId: string;
113
+ flowRunId: string | null;
114
+ instanceId: string | null;
115
+ };
116
+ /**
117
+ * Parse a command settlement into a single allocation object when the command
118
+ * returned a flow handle (open/prerender/prefetch). Returns null otherwise.
119
+ */
120
+ export declare function getFlowHandleAllocationFromSettlement(detail: {
121
+ ok: boolean;
122
+ kind: string;
123
+ result?: unknown;
124
+ instanceId?: string | null;
125
+ }): FlowHandleAllocationFromSettlement | null;
110
126
  //# sourceMappingURL=host-event-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"host-event-contract.d.ts","sourceRoot":"","sources":["../../src/host/host-event-contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6FAA6F;AAC7F,MAAM,WAAW,SAAS;IACzB,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,CAAC,EAAE,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AAgB,iCAAiC,CAAC,MAAM,EAAE;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,wBAAwB,GAAG,IAAI,CAgBlC"}
1
+ {"version":3,"file":"host-event-contract.d.ts","sourceRoot":"","sources":["../../src/host/host-event-contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6FAA6F;AAC7F,MAAM,WAAW,SAAS;IACzB,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,8BAA+B,SAAQ,SAAS;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,+BAA+B,EAAE,SAAS;IACtD,OAAO;IACP,QAAQ;IACR,cAAc;IACd,oBAAoB;IACpB,gBAAgB;IAChB,sBAAsB;IACtB,UAAU;CASV,CAAC;AAEF,MAAM,MAAM,2BAA2B,GACtC,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,0BAA0B,EAAE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAGlE,CAAC;A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AAE/B,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,OAAO,GACb,MAAM,IAAI,oBAAoB,CAkBhC;AAED,+FAA+F;AAC/F,MAAM,MAAM,wBAAwB,GAAG;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAElE;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,0BAA0B,GAAG,IAAI,CAEpC;AAcD;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,wBAAwB,GAAG,IAAI,CAgBlC;AAED,+FAA+F;AAC/F,MAAM,MAAM,kCAAkC,GAAG;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAKF;;;GAGG;AACH,wBAAgB,qCAAqC,CAAC,MAAM,EAAE;IAC7D,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,kCAAkC,GAAG,IAAI,CAU5C"}
@@ -124,3 +124,19 @@ export function getFlowHandleFromSettlementDetail(detail) {
124
124
  ...(isNonEmptyString(flowRunId) && { flowRunId }),
125
125
  };
126
126
  }
127
+ const nonEmptyOrNull = (value) => typeof value === "string" && value.length > 0 ? value : null;
128
+ /**
129
+ * Parse a command settlement into a single allocation object when the command
130
+ * returned a flow handle (open/prerender/prefetch). Returns null otherwise.
131
+ */
132
+ export function getFlowHandleAllocationFromSettlement(detail) {
133
+ const handle = getFlowHandleFromSettlementDetail(detail);
134
+ if (!handle) {
135
+ return null;
136
+ }
137
+ return {
138
+ flowHandleId: handle.flowHandleId,
139
+ flowRunId: handle.flowRunId ?? null,
140
+ instanceId: nonEmptyOrNull(detail.instanceId ?? null),
141
+ };
142
+ }
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Zod schemas that validate the host event detail contract.
3
+ * Paired with host-event-contract.ts, which defines the types and lightweight guards.
4
+ */
5
+ import * as z from "zod/mini";
6
+ /**
7
+ * Canonical shape when a command (open, prerender, prefetch) settles and core
8
+ * has allocated a flow handle. flowRunId is present for open/prerender, absent for prefetch.
9
+ */
10
+ export declare const flowHandleSettlementResultSchema: z.ZodMiniObject<{
11
+ flowHandleId: z.ZodMiniString<string>;
12
+ flowRunId: z.ZodMiniOptional<z.ZodMiniString<string>>;
13
+ }, z.core.$strict>;
14
+ export type FlowHandleSettlementResult = z.output<typeof flowHandleSettlementResultSchema>;
15
+ export declare const commandSettledDetailSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
16
+ ok: z.ZodMiniLiteral<true>;
17
+ result: z.ZodMiniOptional<z.ZodMiniUnknown>;
18
+ requestId: z.ZodMiniString<string>;
19
+ instanceId: z.ZodMiniNullable<z.ZodMiniString<string>>;
20
+ kind: z.ZodMiniEnum<{
21
+ error: "error";
22
+ open: "open";
23
+ prefetch: "prefetch";
24
+ prerender: "prerender";
25
+ hostContextUpdated: "hostContextUpdated";
26
+ hostSignal: "hostSignal";
27
+ setTargetingPlan: "setTargetingPlan";
28
+ telemetry: "telemetry";
29
+ identify: "identify";
30
+ track: "track";
31
+ configure: "configure";
32
+ init: "init";
33
+ close: "close";
34
+ reset: "reset";
35
+ updateHostContext: "updateHostContext";
36
+ emitHostSignal: "emitHostSignal";
37
+ setContainer: "setContainer";
38
+ setDefaultContainerPolicy: "setDefaultContainerPolicy";
39
+ }>;
40
+ }, z.core.$strict>, z.ZodMiniObject<{
41
+ ok: z.ZodMiniLiteral<false>;
42
+ error: z.ZodMiniObject<{
43
+ message: z.ZodMiniString<string>;
44
+ code: z.ZodMiniOptional<z.ZodMiniString<string>>;
45
+ }, z.core.$strict>;
46
+ requestId: z.ZodMiniString<string>;
47
+ instanceId: z.ZodMiniNullable<z.ZodMiniString<string>>;
48
+ kind: z.ZodMiniEnum<{
49
+ error: "error";
50
+ open: "open";
51
+ prefetch: "prefetch";
52
+ prerender: "prerender";
53
+ hostContextUpdated: "hostContextUpdated";
54
+ hostSignal: "hostSignal";
55
+ setTargetingPlan: "setTargetingPlan";
56
+ telemetry: "telemetry";
57
+ identify: "identify";
58
+ track: "track";
59
+ configure: "configure";
60
+ init: "init";
61
+ close: "close";
62
+ reset: "reset";
63
+ updateHostContext: "updateHostContext";
64
+ emitHostSignal: "emitHostSignal";
65
+ setContainer: "setContainer";
66
+ setDefaultContainerPolicy: "setDefaultContainerPolicy";
67
+ }>;
68
+ }, z.core.$strict>], "ok">;
69
+ export type { CommandSettledDetail } from "./host-event-contract.js";
70
+ export declare const flowStateChangedDetailSchema: z.ZodMiniObject<{
71
+ flowHandleId: z.ZodMiniString<string>;
72
+ instanceId: z.ZodMiniString<string>;
73
+ isOpen: z.ZodMiniBoolean<boolean>;
74
+ isLoading: z.ZodMiniBoolean<boolean>;
75
+ width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
76
+ height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
77
+ }, z.core.$strict>;
78
+ export type { FlowStateChangedDetail } from "./host-event-contract.js";
79
+ export declare const instanceFlowStateChangedDetailSchema: z.ZodMiniObject<{
80
+ flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
81
+ instanceId: z.ZodMiniString<string>;
82
+ isOpen: z.ZodMiniBoolean<boolean>;
83
+ isLoading: z.ZodMiniBoolean<boolean>;
84
+ width: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
85
+ height: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
86
+ }, z.core.$strict>;
87
+ export type { InstanceFlowStateChangedDetail } from "./host-event-contract.js";
88
+ export declare const openRequestedDetailSchema: z.ZodMiniObject<{
89
+ instanceId: z.ZodMiniString<string>;
90
+ source: z.ZodMiniEnum<{
91
+ command: "command";
92
+ targeting: "targeting";
93
+ }>;
94
+ flowId: z.ZodMiniString<string>;
95
+ flowHandleId: z.ZodMiniOptional<z.ZodMiniString<string>>;
96
+ hideCloseButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
97
+ }, z.core.$strict>;
98
+ export type { OpenRequestedDetail } from "./host-event-contract.js";
99
+ export declare const handleInvalidatedDetailSchema: z.ZodMiniObject<{
100
+ instanceId: z.ZodMiniString<string>;
101
+ handleKind: z.ZodMiniString<string>;
102
+ handleId: z.ZodMiniString<string>;
103
+ reasonCode: z.ZodMiniEnum<{
104
+ INTERNAL: "INTERNAL";
105
+ RESET: "RESET";
106
+ CLOSED: "CLOSED";
107
+ STALE_HANDLE: "STALE_HANDLE";
108
+ OWNERSHIP_CONFLICT: "OWNERSHIP_CONFLICT";
109
+ OWNER_DISPOSED: "OWNER_DISPOSED";
110
+ UPSTREAM_INVALIDATED: "UPSTREAM_INVALIDATED";
111
+ }>;
112
+ reasonMessage: z.ZodMiniOptional<z.ZodMiniString<string>>;
113
+ relatedRequestId: z.ZodMiniOptional<z.ZodMiniString<string>>;
114
+ source: z.ZodMiniEnum<{
115
+ loader: "loader";
116
+ core: "core";
117
+ }>;
118
+ at: z.ZodMiniNumber<number>;
119
+ }, z.core.$strict>;
120
+ export type { HandleInvalidatedDetail } from "./host-event-contract.js";
121
+ /**
122
+ * Parse unknown result into FlowHandleSettlementResult. Returns null if invalid.
123
+ */
124
+ export declare function parseFlowHandleSettlementResult(result: unknown): FlowHandleSettlementResult | null;
125
+ /**
126
+ * Extract flow handle from a successful command settlement when the command
127
+ * is one that can return a handle (open, prerender, prefetch). Returns null
128
+ * if detail is not ok, kind is not one of those, or result does not match
129
+ * flowHandleSettlementResultSchema.
130
+ */
131
+ export declare function getFlowHandleFromSettlementDetail(detail: {
132
+ ok: boolean;
133
+ kind: string;
134
+ result?: unknown;
135
+ }): FlowHandleSettlementResult | null;
136
+ export type { FlowHandleAllocationFromSettlement } from "./host-event-contract.js";
137
+ export { getFlowHandleAllocationFromSettlement } from "./host-event-contract.js";
138
+ //# sourceMappingURL=host-event-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-event-schemas.d.ts","sourceRoot":"","sources":["../../src/host/host-event-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAoB9B;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;kBAG3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAChD,OAAO,gCAAgC,CACvC,CAAC;AAcF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAGrC,CAAC;AAEH,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAUrE,eAAO,MAAM,4BAA4B;;;;;;;kBAGvC,CAAC;AAEH,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,eAAO,MAAM,oCAAoC;;;;;;;kBAG/C,CAAC;AAEH,YAAY,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE/E,eAAO,MAAM,yBAAyB;;;;;;;;;kBAMpC,CAAC;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;kBASxC,CAAC;AAEH,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE;;GAEG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,OAAO,GACb,0BAA0B,GAAG,IAAI,CAGnC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,0BAA0B,GAAG,IAAI,CAUpC;AAED,YAAY,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Zod schemas that validate the host event detail contract.
3
+ * Paired with host-event-contract.ts, which defines the types and lightweight guards.
4
+ */
5
+ import * as z from "zod/mini";
6
+ import { allCommandKindSchema } from "../command-kinds.js";
7
+ import { HANDLE_INVALIDATED_REASON_CODES, HANDLE_INVALIDATED_SOURCES, } from "./host-event-contract.js";
8
+ const nonEmptyStringSchema = z.string().check(z.trim(), z.minLength(1));
9
+ const commandErrorSchema = z.strictObject({
10
+ message: nonEmptyStringSchema,
11
+ code: z.optional(nonEmptyStringSchema),
12
+ });
13
+ const commandSettledDetailBase = {
14
+ requestId: nonEmptyStringSchema,
15
+ instanceId: z.nullable(nonEmptyStringSchema),
16
+ kind: allCommandKindSchema,
17
+ };
18
+ /**
19
+ * Canonical shape when a command (open, prerender, prefetch) settles and core
20
+ * has allocated a flow handle. flowRunId is present for open/prerender, absent for prefetch.
21
+ */
22
+ export const flowHandleSettlementResultSchema = z.strictObject({
23
+ flowHandleId: nonEmptyStringSchema,
24
+ flowRunId: z.optional(nonEmptyStringSchema),
25
+ });
26
+ const commandSettledSuccessDetailSchema = z.strictObject({
27
+ ...commandSettledDetailBase,
28
+ ok: z.literal(true),
29
+ result: z.optional(z.unknown()),
30
+ });
31
+ const commandSettledFailureDetailSchema = z.strictObject({
32
+ ...commandSettledDetailBase,
33
+ ok: z.literal(false),
34
+ error: commandErrorSchema,
35
+ });
36
+ export const commandSettledDetailSchema = z.discriminatedUnion("ok", [
37
+ commandSettledSuccessDetailSchema,
38
+ commandSettledFailureDetailSchema,
39
+ ]);
40
+ const flowStateChangedBase = {
41
+ instanceId: nonEmptyStringSchema,
42
+ isOpen: z.boolean(),
43
+ isLoading: z.boolean(),
44
+ width: z.optional(z.number()),
45
+ height: z.optional(z.number()),
46
+ };
47
+ export const flowStateChangedDetailSchema = z.strictObject({
48
+ ...flowStateChangedBase,
49
+ flowHandleId: nonEmptyStringSchema,
50
+ });
51
+ export const instanceFlowStateChangedDetailSchema = z.strictObject({
52
+ ...flowStateChangedBase,
53
+ flowHandleId: z.optional(nonEmptyStringSchema),
54
+ });
55
+ export const openRequestedDetailSchema = z.strictObject({
56
+ instanceId: nonEmptyStringSchema,
57
+ source: z.enum(["command", "targeting"]),
58
+ flowId: nonEmptyStringSchema,
59
+ flowHandleId: z.optional(nonEmptyStringSchema),
60
+ hideCloseButton: z.optional(z.boolean()),
61
+ });
62
+ export const handleInvalidatedDetailSchema = z.strictObject({
63
+ instanceId: nonEmptyStringSchema,
64
+ handleKind: nonEmptyStringSchema,
65
+ handleId: nonEmptyStringSchema,
66
+ reasonCode: z.enum(HANDLE_INVALIDATED_REASON_CODES),
67
+ reasonMessage: z.optional(nonEmptyStringSchema),
68
+ relatedRequestId: z.optional(nonEmptyStringSchema),
69
+ source: z.enum(HANDLE_INVALIDATED_SOURCES),
70
+ at: z.number(),
71
+ });
72
+ /**
73
+ * Parse unknown result into FlowHandleSettlementResult. Returns null if invalid.
74
+ */
75
+ export function parseFlowHandleSettlementResult(result) {
76
+ const parsed = flowHandleSettlementResultSchema.safeParse(result);
77
+ return parsed.success ? parsed.data : null;
78
+ }
79
+ /**
80
+ * Extract flow handle from a successful command settlement when the command
81
+ * is one that can return a handle (open, prerender, prefetch). Returns null
82
+ * if detail is not ok, kind is not one of those, or result does not match
83
+ * flowHandleSettlementResultSchema.
84
+ */
85
+ export function getFlowHandleFromSettlementDetail(detail) {
86
+ if (!detail.ok ||
87
+ (detail.kind !== "open" &&
88
+ detail.kind !== "prerender" &&
89
+ detail.kind !== "prefetch")) {
90
+ return null;
91
+ }
92
+ return parseFlowHandleSettlementResult(detail.result);
93
+ }
94
+ export { getFlowHandleAllocationFromSettlement } from "./host-event-contract.js";
@@ -2,18 +2,18 @@ import * as z from "zod/mini";
2
2
  import { type ConfigureOptions, type InitOptions } from "./widget-config.js";
3
3
  export declare const publicWidgetCommandKindSchema: z.ZodMiniEnum<{
4
4
  open: "open";
5
- prerender: "prerender";
6
5
  prefetch: "prefetch";
6
+ prerender: "prerender";
7
7
  identify: "identify";
8
- updateHostContext: "updateHostContext";
9
- emitHostSignal: "emitHostSignal";
10
- setContainer: "setContainer";
11
- setDefaultContainerPolicy: "setDefaultContainerPolicy";
8
+ track: "track";
12
9
  configure: "configure";
13
10
  init: "init";
14
11
  close: "close";
15
12
  reset: "reset";
16
- track: "track";
13
+ updateHostContext: "updateHostContext";
14
+ emitHostSignal: "emitHostSignal";
15
+ setContainer: "setContainer";
16
+ setDefaultContainerPolicy: "setDefaultContainerPolicy";
17
17
  }>;
18
18
  export declare const containerPolicySchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
19
19
  kind: z.ZodMiniLiteral<"floating">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/protocol",
3
- "version": "2.2.0",
3
+ "version": "3.0.2",
4
4
  "description": "getuserfeedback widget protocol — host surface and (later) wire protocol",
5
5
  "keywords": [
6
6
  "getuserfeedback",
@@ -46,6 +46,12 @@
46
46
  "import": "./dist/host/host-event-contract.js",
47
47
  "default": "./dist/host/host-event-contract.js"
48
48
  },
49
+ "./host/host-event-schemas": {
50
+ "types": "./dist/host/host-event-schemas.d.ts",
51
+ "bun": "./src/host/host-event-schemas.ts",
52
+ "import": "./dist/host/host-event-schemas.js",
53
+ "default": "./dist/host/host-event-schemas.js"
54
+ },
49
55
  "./host/constants": {
50
56
  "types": "./dist/host/constants.d.ts",
51
57
  "bun": "./src/host/constants.ts",
@@ -140,7 +146,6 @@
140
146
  "zod": "^4.2.1"
141
147
  },
142
148
  "devDependencies": {
143
- "rimraf": "^6.0.0",
144
149
  "typescript": "^5.8.3"
145
150
  }
146
151
  }
package/src/app-event.ts CHANGED
@@ -132,6 +132,7 @@ const appEventSurveyReferenceSchema = z.object({
132
132
 
133
133
  export const reservedSystemAppEventNames = [
134
134
  "Response Submitted",
135
+ "Flow Completed",
135
136
  "Flow Viewed",
136
137
  "Flow Dismissed",
137
138
  "Identified",
@@ -0,0 +1,42 @@
1
+ import * as z from "zod/mini";
2
+
3
+ const coreCommandKinds = [
4
+ "open",
5
+ "prefetch",
6
+ "prerender",
7
+ "hostContextUpdated",
8
+ "hostSignal",
9
+ "setTargetingPlan",
10
+ "telemetry",
11
+ "identify",
12
+ "track",
13
+ "configure",
14
+ "init",
15
+ "close",
16
+ "reset",
17
+ "error",
18
+ ] as const;
19
+
20
+ const publicCommandKinds = [
21
+ "open",
22
+ "prefetch",
23
+ "prerender",
24
+ "identify",
25
+ "updateHostContext",
26
+ "emitHostSignal",
27
+ "setContainer",
28
+ "setDefaultContainerPolicy",
29
+ "configure",
30
+ "init",
31
+ "close",
32
+ "reset",
33
+ "track",
34
+ ] as const;
35
+
36
+ export const coreCommandKindSchema = z.enum(coreCommandKinds);
37
+ export const publicCommandKindSchema = z.enum(publicCommandKinds);
38
+
39
+ /** All command kinds that may appear in settlement events (core receives loader + SDK commands). */
40
+ const allCommandKinds = [...coreCommandKinds, ...publicCommandKinds] as const;
41
+
42
+ export const allCommandKindSchema = z.enum(allCommandKinds);
@@ -40,9 +40,6 @@ export const flowAssignmentStatusSchema = z.enum([
40
40
  "completed",
41
41
  "expired",
42
42
  "superseded",
43
- "withdrawn_pending",
44
- "withdrawn_presented",
45
- "withdrawn_final",
46
43
  ]);
47
44
 
48
45
  export const flowAssignmentTargetingContextSchema = z.object({
@@ -278,3 +278,34 @@ export function getFlowHandleFromSettlementDetail(detail: {
278
278
  ...(isNonEmptyString(flowRunId) && { flowRunId }),
279
279
  };
280
280
  }
281
+
282
+ /** Normalized allocation from a handle-returning settlement: handle + instanceId for state. */
283
+ export type FlowHandleAllocationFromSettlement = {
284
+ flowHandleId: string;
285
+ flowRunId: string | null;
286
+ instanceId: string | null;
287
+ };
288
+
289
+ const nonEmptyOrNull = (value: string | null | undefined): string | null =>
290
+ typeof value === "string" && value.length > 0 ? value : null;
291
+
292
+ /**
293
+ * Parse a command settlement into a single allocation object when the command
294
+ * returned a flow handle (open/prerender/prefetch). Returns null otherwise.
295
+ */
296
+ export function getFlowHandleAllocationFromSettlement(detail: {
297
+ ok: boolean;
298
+ kind: string;
299
+ result?: unknown;
300
+ instanceId?: string | null;
301
+ }): FlowHandleAllocationFromSettlement | null {
302
+ const handle = getFlowHandleFromSettlementDetail(detail);
303
+ if (!handle) {
304
+ return null;
305
+ }
306
+ return {
307
+ flowHandleId: handle.flowHandleId,
308
+ flowRunId: handle.flowRunId ?? null,
309
+ instanceId: nonEmptyOrNull(detail.instanceId ?? null),
310
+ };
311
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Zod schemas that validate the host event detail contract.
3
+ * Paired with host-event-contract.ts, which defines the types and lightweight guards.
4
+ */
5
+ import * as z from "zod/mini";
6
+ import { allCommandKindSchema } from "../command-kinds.js";
7
+ import {
8
+ HANDLE_INVALIDATED_REASON_CODES,
9
+ HANDLE_INVALIDATED_SOURCES,
10
+ } from "./host-event-contract.js";
11
+
12
+ const nonEmptyStringSchema = z.string().check(z.trim(), z.minLength(1));
13
+
14
+ const commandErrorSchema = z.strictObject({
15
+ message: nonEmptyStringSchema,
16
+ code: z.optional(nonEmptyStringSchema),
17
+ });
18
+
19
+ const commandSettledDetailBase = {
20
+ requestId: nonEmptyStringSchema,
21
+ instanceId: z.nullable(nonEmptyStringSchema),
22
+ kind: allCommandKindSchema,
23
+ };
24
+
25
+ /**
26
+ * Canonical shape when a command (open, prerender, prefetch) settles and core
27
+ * has allocated a flow handle. flowRunId is present for open/prerender, absent for prefetch.
28
+ */
29
+ export const flowHandleSettlementResultSchema = z.strictObject({
30
+ flowHandleId: nonEmptyStringSchema,
31
+ flowRunId: z.optional(nonEmptyStringSchema),
32
+ });
33
+
34
+ export type FlowHandleSettlementResult = z.output<
35
+ typeof flowHandleSettlementResultSchema
36
+ >;
37
+
38
+ const commandSettledSuccessDetailSchema = z.strictObject({
39
+ ...commandSettledDetailBase,
40
+ ok: z.literal(true),
41
+ result: z.optional(z.unknown()),
42
+ });
43
+
44
+ const commandSettledFailureDetailSchema = z.strictObject({
45
+ ...commandSettledDetailBase,
46
+ ok: z.literal(false),
47
+ error: commandErrorSchema,
48
+ });
49
+
50
+ export const commandSettledDetailSchema = z.discriminatedUnion("ok", [
51
+ commandSettledSuccessDetailSchema,
52
+ commandSettledFailureDetailSchema,
53
+ ]);
54
+
55
+ export type { CommandSettledDetail } from "./host-event-contract.js";
56
+
57
+ const flowStateChangedBase = {
58
+ instanceId: nonEmptyStringSchema,
59
+ isOpen: z.boolean(),
60
+ isLoading: z.boolean(),
61
+ width: z.optional(z.number()),
62
+ height: z.optional(z.number()),
63
+ } as const;
64
+
65
+ export const flowStateChangedDetailSchema = z.strictObject({
66
+ ...flowStateChangedBase,
67
+ flowHandleId: nonEmptyStringSchema,
68
+ });
69
+
70
+ export type { FlowStateChangedDetail } from "./host-event-contract.js";
71
+
72
+ export const instanceFlowStateChangedDetailSchema = z.strictObject({
73
+ ...flowStateChangedBase,
74
+ flowHandleId: z.optional(nonEmptyStringSchema),
75
+ });
76
+
77
+ export type { InstanceFlowStateChangedDetail } from "./host-event-contract.js";
78
+
79
+ export const openRequestedDetailSchema = z.strictObject({
80
+ instanceId: nonEmptyStringSchema,
81
+ source: z.enum(["command", "targeting"]),
82
+ flowId: nonEmptyStringSchema,
83
+ flowHandleId: z.optional(nonEmptyStringSchema),
84
+ hideCloseButton: z.optional(z.boolean()),
85
+ });
86
+
87
+ export type { OpenRequestedDetail } from "./host-event-contract.js";
88
+
89
+ export const handleInvalidatedDetailSchema = z.strictObject({
90
+ instanceId: nonEmptyStringSchema,
91
+ handleKind: nonEmptyStringSchema,
92
+ handleId: nonEmptyStringSchema,
93
+ reasonCode: z.enum(HANDLE_INVALIDATED_REASON_CODES),
94
+ reasonMessage: z.optional(nonEmptyStringSchema),
95
+ relatedRequestId: z.optional(nonEmptyStringSchema),
96
+ source: z.enum(HANDLE_INVALIDATED_SOURCES),
97
+ at: z.number(),
98
+ });
99
+
100
+ export type { HandleInvalidatedDetail } from "./host-event-contract.js";
101
+
102
+ /**
103
+ * Parse unknown result into FlowHandleSettlementResult. Returns null if invalid.
104
+ */
105
+ export function parseFlowHandleSettlementResult(
106
+ result: unknown,
107
+ ): FlowHandleSettlementResult | null {
108
+ const parsed = flowHandleSettlementResultSchema.safeParse(result);
109
+ return parsed.success ? parsed.data : null;
110
+ }
111
+
112
+ /**
113
+ * Extract flow handle from a successful command settlement when the command
114
+ * is one that can return a handle (open, prerender, prefetch). Returns null
115
+ * if detail is not ok, kind is not one of those, or result does not match
116
+ * flowHandleSettlementResultSchema.
117
+ */
118
+ export function getFlowHandleFromSettlementDetail(detail: {
119
+ ok: boolean;
120
+ kind: string;
121
+ result?: unknown;
122
+ }): FlowHandleSettlementResult | null {
123
+ if (
124
+ !detail.ok ||
125
+ (detail.kind !== "open" &&
126
+ detail.kind !== "prerender" &&
127
+ detail.kind !== "prefetch")
128
+ ) {
129
+ return null;
130
+ }
131
+ return parseFlowHandleSettlementResult(detail.result);
132
+ }
133
+
134
+ export type { FlowHandleAllocationFromSettlement } from "./host-event-contract.js";
135
+ export { getFlowHandleAllocationFromSettlement } from "./host-event-contract.js";