@getuserfeedback/protocol 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flow-assignments.d.ts +4 -0
- package/dist/flow-assignments.d.ts.map +1 -1
- package/dist/flow-assignments.js +1 -1
- package/dist/flow-display.d.ts +140 -0
- package/dist/flow-display.d.ts.map +1 -0
- package/dist/flow-display.js +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +7 -1
- package/src/flow-assignments.ts +1 -1
- package/src/flow-display.test.ts +56 -0
- package/src/flow-display.ts +41 -0
- package/src/index.ts +8 -0
|
@@ -2,6 +2,10 @@ import * as z from "zod/mini";
|
|
|
2
2
|
import type { IdentityTypeValue } from "./identity-type.js";
|
|
3
3
|
export type FlowAssignmentExternalIdIdentityTypeValue = `externalId.users.none.${string}`;
|
|
4
4
|
export type FlowAssignmentIdentityTypeValue = IdentityTypeValue | FlowAssignmentExternalIdIdentityTypeValue;
|
|
5
|
+
export declare const flowAssignmentIdentitySchema: z.ZodMiniObject<{
|
|
6
|
+
type: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>, z.ZodMiniType<`externalId.users.none.${string}`, `externalId.users.none.${string}`, z.core.$ZodTypeInternals<`externalId.users.none.${string}`, `externalId.users.none.${string}`>>]>;
|
|
7
|
+
value: z.ZodMiniString<string>;
|
|
8
|
+
}, z.core.$strip>;
|
|
5
9
|
export declare const flowAssignmentStatusSchema: z.ZodMiniEnum<{
|
|
6
10
|
pending: "pending";
|
|
7
11
|
held: "held";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-assignments.d.ts","sourceRoot":"","sources":["../src/flow-assignments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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1D,OAAO,0CAA0C,CACjD,CAAC;AACF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAC3D,OAAO,2CAA2C,CAClD,CAAC"}
|
package/dist/flow-assignments.js
CHANGED
|
@@ -3,7 +3,7 @@ import { appEventCapabilitySchema, appEventFlagSchema, appEventIdentityTypeSchem
|
|
|
3
3
|
const flowAssignmentExternalIdIdentityTypeSchema = z.string().check(z.trim(), z.minLength(1), z.regex(/^externalId\.users\.none\.[a-z0-9][a-z0-9_.-]*$/, {
|
|
4
4
|
message: "External ID identity type must use externalId.users.none.<type> with a lowercase Segment external ID type.",
|
|
5
5
|
}));
|
|
6
|
-
const flowAssignmentIdentitySchema = z.object({
|
|
6
|
+
export const flowAssignmentIdentitySchema = z.object({
|
|
7
7
|
type: z.union([
|
|
8
8
|
appEventIdentityTypeSchema,
|
|
9
9
|
flowAssignmentExternalIdIdentityTypeSchema,
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
export declare const runtimeDisplayBroadcastsSchema: z.ZodMiniObject<{
|
|
3
|
+
version: z.ZodMiniString<string>;
|
|
4
|
+
opportunities: z.ZodMiniArray<z.ZodMiniNever>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const flowDisplaySyncRequestSchema: z.ZodMiniObject<{
|
|
7
|
+
identities: z.ZodMiniDefault<z.ZodMiniArray<z.ZodMiniObject<{
|
|
8
|
+
type: z.ZodMiniUnion<readonly [z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"anonymousId" | "userId" | "traits.email" | "traits.phone" | "context.device.id" | "context.device.advertisingId" | "context.device.token", string>>, z.ZodMiniType<`externalId.users.none.${string}`, `externalId.users.none.${string}`, z.core.$ZodTypeInternals<`externalId.users.none.${string}`, `externalId.users.none.${string}`>>]>;
|
|
9
|
+
value: z.ZodMiniString<string>;
|
|
10
|
+
}, z.core.$strip>>>;
|
|
11
|
+
context: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
12
|
+
flags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
13
|
+
key: z.ZodMiniString<string>;
|
|
14
|
+
target: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
15
|
+
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 | {
|
|
16
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
17
|
+
} | null)[] | {
|
|
18
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
19
|
+
} | null)[] | {
|
|
20
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
21
|
+
} | null)[] | {
|
|
22
|
+
[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;
|
|
23
|
+
} | null)[] | {
|
|
24
|
+
[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;
|
|
25
|
+
} | null)[] | {
|
|
26
|
+
[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;
|
|
27
|
+
} | null)[] | {
|
|
28
|
+
[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;
|
|
29
|
+
} | null)[] | {
|
|
30
|
+
[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;
|
|
31
|
+
} | null)[] | {
|
|
32
|
+
[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;
|
|
33
|
+
} | null)[] | {
|
|
34
|
+
[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;
|
|
35
|
+
} | null)[] | {
|
|
36
|
+
[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;
|
|
37
|
+
} | null)[] | {
|
|
38
|
+
[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;
|
|
39
|
+
} | 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 | {
|
|
40
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
41
|
+
} | null)[] | {
|
|
42
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
43
|
+
} | null)[] | {
|
|
44
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | /*elided*/ any | null)[] | /*elided*/ any | null;
|
|
45
|
+
} | null)[] | {
|
|
46
|
+
[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;
|
|
47
|
+
} | null)[] | {
|
|
48
|
+
[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;
|
|
49
|
+
} | null)[] | {
|
|
50
|
+
[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;
|
|
51
|
+
} | null)[] | {
|
|
52
|
+
[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;
|
|
53
|
+
} | null)[] | {
|
|
54
|
+
[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;
|
|
55
|
+
} | null)[] | {
|
|
56
|
+
[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;
|
|
57
|
+
} | null)[] | {
|
|
58
|
+
[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;
|
|
59
|
+
} | null)[] | {
|
|
60
|
+
[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;
|
|
61
|
+
} | null)[] | {
|
|
62
|
+
[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;
|
|
63
|
+
} | null, unknown>>;
|
|
64
|
+
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
65
|
+
origin: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
66
|
+
runtime_config: "runtime_config";
|
|
67
|
+
trigger_context: "trigger_context";
|
|
68
|
+
provider_sync: "provider_sync";
|
|
69
|
+
api: "api";
|
|
70
|
+
}>>;
|
|
71
|
+
provider: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
72
|
+
name: z.ZodMiniString<string>;
|
|
73
|
+
project: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
74
|
+
environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
status: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
77
|
+
reason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
78
|
+
evaluatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
79
|
+
}, z.core.$strip>>>;
|
|
80
|
+
capabilities: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
|
|
81
|
+
key: z.ZodMiniString<string>;
|
|
82
|
+
source: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
83
|
+
provider: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
84
|
+
name: z.ZodMiniString<string>;
|
|
85
|
+
project: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
86
|
+
environment: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
}, z.core.$strip>>>;
|
|
89
|
+
page: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
90
|
+
path: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
91
|
+
referrer: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
92
|
+
search: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
holdOwnerKey: z.ZodMiniString<string>;
|
|
96
|
+
at: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
97
|
+
assignmentLimit: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
98
|
+
knownBroadcastManifestVersion: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export declare const flowDisplaySyncResponseSchema: z.ZodMiniObject<{
|
|
101
|
+
fetchedAt: z.ZodMiniString<string>;
|
|
102
|
+
assignments: z.ZodMiniObject<{
|
|
103
|
+
claimed: z.ZodMiniArray<z.ZodMiniObject<{
|
|
104
|
+
flowAssignmentId: z.ZodMiniString<string>;
|
|
105
|
+
flowId: z.ZodMiniString<string>;
|
|
106
|
+
holdGroupToken: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
107
|
+
presentedFlowVersionId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
108
|
+
latestFlowVersionId: z.ZodMiniString<string>;
|
|
109
|
+
status: z.ZodMiniEnum<{
|
|
110
|
+
pending: "pending";
|
|
111
|
+
held: "held";
|
|
112
|
+
presented: "presented";
|
|
113
|
+
completed: "completed";
|
|
114
|
+
expired: "expired";
|
|
115
|
+
superseded: "superseded";
|
|
116
|
+
withdrawn_pending: "withdrawn_pending";
|
|
117
|
+
withdrawn_presented: "withdrawn_presented";
|
|
118
|
+
withdrawn_final: "withdrawn_final";
|
|
119
|
+
}>;
|
|
120
|
+
assignedAt: z.ZodMiniString<string>;
|
|
121
|
+
expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
122
|
+
heldAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
123
|
+
holdExpiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
124
|
+
presentedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
125
|
+
completedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
126
|
+
expiredAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
127
|
+
supersededAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
128
|
+
withdrawnAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
129
|
+
withdrawnFinalAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
broadcasts: z.ZodMiniObject<{
|
|
133
|
+
version: z.ZodMiniString<string>;
|
|
134
|
+
opportunities: z.ZodMiniArray<z.ZodMiniNever>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export type RuntimeDisplayBroadcasts = z.output<typeof runtimeDisplayBroadcastsSchema>;
|
|
138
|
+
export type FlowDisplaySyncRequest = z.output<typeof flowDisplaySyncRequestSchema>;
|
|
139
|
+
export type FlowDisplaySyncResponse = z.output<typeof flowDisplaySyncResponseSchema>;
|
|
140
|
+
//# sourceMappingURL=flow-display.d.ts.map
|
|
@@ -0,0 +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,8BAA8B;;;iBAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASvC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC9C,OAAO,8BAA8B,CACrC,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
import { flowAssignmentIdentitySchema, flowAssignmentRecordSchema, flowAssignmentTargetingContextSchema, } from "./flow-assignments.js";
|
|
3
|
+
export const runtimeDisplayBroadcastsSchema = z.object({
|
|
4
|
+
version: z.string().check(z.trim(), z.minLength(1)),
|
|
5
|
+
opportunities: z.array(z.never()),
|
|
6
|
+
});
|
|
7
|
+
export const flowDisplaySyncRequestSchema = z.object({
|
|
8
|
+
identities: z._default(z.array(flowAssignmentIdentitySchema), []),
|
|
9
|
+
context: z.optional(flowAssignmentTargetingContextSchema),
|
|
10
|
+
holdOwnerKey: z.string().check(z.trim(), z.minLength(1)),
|
|
11
|
+
at: z.optional(z.number()),
|
|
12
|
+
assignmentLimit: z.optional(z.number()),
|
|
13
|
+
knownBroadcastManifestVersion: z.optional(z.string().check(z.trim(), z.minLength(1))),
|
|
14
|
+
});
|
|
15
|
+
export const flowDisplaySyncResponseSchema = z.object({
|
|
16
|
+
fetchedAt: z.string(),
|
|
17
|
+
assignments: z.object({
|
|
18
|
+
claimed: z.array(flowAssignmentRecordSchema),
|
|
19
|
+
}),
|
|
20
|
+
broadcasts: runtimeDisplayBroadcastsSchema,
|
|
21
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { DEFAULT_AUTO_DETECT_COLOR_SCHEME_ATTRS } from "./defaults.js";
|
|
|
4
4
|
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
|
+
export { type FlowDisplaySyncRequest, type FlowDisplaySyncResponse, flowDisplaySyncRequestSchema, flowDisplaySyncResponseSchema, type RuntimeDisplayBroadcasts, runtimeDisplayBroadcastsSchema, } from "./flow-display.js";
|
|
7
8
|
export { buildIdentityTypeGuidanceMessage, getIdentityTypeSuggestion, IDENTITY_TYPE_VALUES, type IdentityTypeValue, isIdentityTypeValue, type StandardIdentityTypeValue, } from "./identity-type.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";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,GAC3B,MAAM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AC5B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,iCAAiC,EACjC,KAAK,mBAAmB,EACxB,2BAA2B,EAC3B,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,yBAAyB,EACzB,iBAAiB,EACjB,8BAA8B,EAC9B,KAAK,oBAAoB,EACzB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { clientMetaSchema, } from "./client-meta.js";
|
|
|
3
3
|
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
|
+
export { flowDisplaySyncRequestSchema, flowDisplaySyncResponseSchema, runtimeDisplayBroadcastsSchema, } from "./flow-display.js";
|
|
6
7
|
export { buildIdentityTypeGuidanceMessage, getIdentityTypeSuggestion, IDENTITY_TYPE_VALUES, isIdentityTypeValue, } from "./identity-type.js";
|
|
7
8
|
export { isPublicGrantScope, publicGrantScopeIdSchema, } from "./public-grant-scope.js";
|
|
8
9
|
export { resolveApiBaseUrl, resolveCoreUrl, resolveTrpcBaseUrl, runtimeEndpointsSchema, } from "./runtime-endpoints.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getuserfeedback/protocol",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "getuserfeedback widget protocol — host surface and (later) wire protocol",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"getuserfeedback",
|
|
@@ -106,6 +106,12 @@
|
|
|
106
106
|
"import": "./dist/flow-assignments.js",
|
|
107
107
|
"default": "./dist/flow-assignments.js"
|
|
108
108
|
},
|
|
109
|
+
"./flow-display": {
|
|
110
|
+
"types": "./dist/flow-display.d.ts",
|
|
111
|
+
"bun": "./src/flow-display.ts",
|
|
112
|
+
"import": "./dist/flow-display.js",
|
|
113
|
+
"default": "./dist/flow-display.js"
|
|
114
|
+
},
|
|
109
115
|
"./trpc-envelope": {
|
|
110
116
|
"types": "./dist/trpc-envelope.d.ts",
|
|
111
117
|
"bun": "./src/trpc-envelope.ts",
|
package/src/flow-assignments.ts
CHANGED
|
@@ -25,7 +25,7 @@ const flowAssignmentExternalIdIdentityTypeSchema = z.string().check(
|
|
|
25
25
|
FlowAssignmentExternalIdIdentityTypeValue
|
|
26
26
|
>;
|
|
27
27
|
|
|
28
|
-
const flowAssignmentIdentitySchema = z.object({
|
|
28
|
+
export const flowAssignmentIdentitySchema = z.object({
|
|
29
29
|
type: z.union([
|
|
30
30
|
appEventIdentityTypeSchema,
|
|
31
31
|
flowAssignmentExternalIdIdentityTypeSchema,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
flowDisplaySyncRequestSchema,
|
|
4
|
+
flowDisplaySyncResponseSchema,
|
|
5
|
+
} from "./flow-display";
|
|
6
|
+
|
|
7
|
+
describe("flow display sync contracts", () => {
|
|
8
|
+
it("accepts assignment claim input plus broadcast manifest version", () => {
|
|
9
|
+
const result = flowDisplaySyncRequestSchema.parse({
|
|
10
|
+
holdOwnerKey: "inst_1",
|
|
11
|
+
identities: [{ type: "anonymousId", value: "anon_1" }],
|
|
12
|
+
context: {
|
|
13
|
+
page: { path: "/pricing" },
|
|
14
|
+
capabilities: [{ key: "checkout.drawer" }],
|
|
15
|
+
},
|
|
16
|
+
assignmentLimit: 2,
|
|
17
|
+
knownBroadcastManifestVersion: "broadcasts_1",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(result).toEqual({
|
|
21
|
+
holdOwnerKey: "inst_1",
|
|
22
|
+
identities: [{ type: "anonymousId", value: "anon_1" }],
|
|
23
|
+
context: {
|
|
24
|
+
page: { path: "/pricing" },
|
|
25
|
+
capabilities: [{ key: "checkout.drawer" }],
|
|
26
|
+
},
|
|
27
|
+
assignmentLimit: 2,
|
|
28
|
+
knownBroadcastManifestVersion: "broadcasts_1",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("accepts claimed assignments with an empty broadcast manifest", () => {
|
|
33
|
+
const result = flowDisplaySyncResponseSchema.parse({
|
|
34
|
+
fetchedAt: "2026-06-18T00:00:00.000Z",
|
|
35
|
+
assignments: {
|
|
36
|
+
claimed: [
|
|
37
|
+
{
|
|
38
|
+
flowAssignmentId: "fa_1",
|
|
39
|
+
flowId: "sur_1",
|
|
40
|
+
holdGroupToken: "hold_1",
|
|
41
|
+
latestFlowVersionId: "flv_1",
|
|
42
|
+
status: "held",
|
|
43
|
+
assignedAt: "2026-06-18T00:00:00.000Z",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
broadcasts: {
|
|
48
|
+
version: "empty",
|
|
49
|
+
opportunities: [],
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
expect(result.assignments.claimed[0]?.flowAssignmentId).toBe("fa_1");
|
|
54
|
+
expect(result.broadcasts.opportunities).toEqual([]);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
flowAssignmentIdentitySchema,
|
|
5
|
+
flowAssignmentRecordSchema,
|
|
6
|
+
flowAssignmentTargetingContextSchema,
|
|
7
|
+
} from "./flow-assignments.js";
|
|
8
|
+
|
|
9
|
+
export const runtimeDisplayBroadcastsSchema = z.object({
|
|
10
|
+
version: z.string().check(z.trim(), z.minLength(1)),
|
|
11
|
+
opportunities: z.array(z.never()),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const flowDisplaySyncRequestSchema = z.object({
|
|
15
|
+
identities: z._default(z.array(flowAssignmentIdentitySchema), []),
|
|
16
|
+
context: z.optional(flowAssignmentTargetingContextSchema),
|
|
17
|
+
holdOwnerKey: z.string().check(z.trim(), z.minLength(1)),
|
|
18
|
+
at: z.optional(z.number()),
|
|
19
|
+
assignmentLimit: z.optional(z.number()),
|
|
20
|
+
knownBroadcastManifestVersion: z.optional(
|
|
21
|
+
z.string().check(z.trim(), z.minLength(1)),
|
|
22
|
+
),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const flowDisplaySyncResponseSchema = z.object({
|
|
26
|
+
fetchedAt: z.string(),
|
|
27
|
+
assignments: z.object({
|
|
28
|
+
claimed: z.array(flowAssignmentRecordSchema),
|
|
29
|
+
}),
|
|
30
|
+
broadcasts: runtimeDisplayBroadcastsSchema,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type RuntimeDisplayBroadcasts = z.output<
|
|
34
|
+
typeof runtimeDisplayBroadcastsSchema
|
|
35
|
+
>;
|
|
36
|
+
export type FlowDisplaySyncRequest = z.output<
|
|
37
|
+
typeof flowDisplaySyncRequestSchema
|
|
38
|
+
>;
|
|
39
|
+
export type FlowDisplaySyncResponse = z.output<
|
|
40
|
+
typeof flowDisplaySyncResponseSchema
|
|
41
|
+
>;
|
package/src/index.ts
CHANGED
|
@@ -61,6 +61,14 @@ export {
|
|
|
61
61
|
updateFlowAssignmentLifecycleRequestSchema,
|
|
62
62
|
updateFlowAssignmentLifecycleResponseSchema,
|
|
63
63
|
} from "./flow-assignments.js";
|
|
64
|
+
export {
|
|
65
|
+
type FlowDisplaySyncRequest,
|
|
66
|
+
type FlowDisplaySyncResponse,
|
|
67
|
+
flowDisplaySyncRequestSchema,
|
|
68
|
+
flowDisplaySyncResponseSchema,
|
|
69
|
+
type RuntimeDisplayBroadcasts,
|
|
70
|
+
runtimeDisplayBroadcastsSchema,
|
|
71
|
+
} from "./flow-display.js";
|
|
64
72
|
export {
|
|
65
73
|
buildIdentityTypeGuidanceMessage,
|
|
66
74
|
getIdentityTypeSuggestion,
|