@getuserfeedback/protocol 0.4.1 → 0.5.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.
@@ -0,0 +1,212 @@
1
+ import * as z from "zod";
2
+ export declare const appEventIdentityTypeSchema: z.ZodEnum<{
3
+ anonymousId: "anonymousId";
4
+ userId: "userId";
5
+ "traits.email": "traits.email";
6
+ "traits.phone": "traits.phone";
7
+ "context.device.id": "context.device.id";
8
+ "context.device.advertisingId": "context.device.advertisingId";
9
+ "context.device.token": "context.device.token";
10
+ }>;
11
+ export declare const appEventIdentitySchema: z.ZodObject<{
12
+ type: z.ZodEnum<{
13
+ anonymousId: "anonymousId";
14
+ userId: "userId";
15
+ "traits.email": "traits.email";
16
+ "traits.phone": "traits.phone";
17
+ "context.device.id": "context.device.id";
18
+ "context.device.advertisingId": "context.device.advertisingId";
19
+ "context.device.token": "context.device.token";
20
+ }>;
21
+ value: z.ZodString;
22
+ }, z.core.$strip>;
23
+ export declare const appEventContextSchema: z.ZodObject<{
24
+ page: z.ZodOptional<z.ZodObject<{
25
+ path: z.ZodOptional<z.ZodString>;
26
+ referrer: z.ZodOptional<z.ZodString>;
27
+ search: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>>;
29
+ locale: z.ZodOptional<z.ZodString>;
30
+ userAgent: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ export declare const appEventBaseSchema: z.ZodObject<{
33
+ traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
34
+ identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ type: z.ZodEnum<{
36
+ anonymousId: "anonymousId";
37
+ userId: "userId";
38
+ "traits.email": "traits.email";
39
+ "traits.phone": "traits.phone";
40
+ "context.device.id": "context.device.id";
41
+ "context.device.advertisingId": "context.device.advertisingId";
42
+ "context.device.token": "context.device.token";
43
+ }>;
44
+ value: z.ZodString;
45
+ }, z.core.$strip>>>;
46
+ context: z.ZodOptional<z.ZodObject<{
47
+ page: z.ZodOptional<z.ZodObject<{
48
+ path: z.ZodOptional<z.ZodString>;
49
+ referrer: z.ZodOptional<z.ZodString>;
50
+ search: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>>;
52
+ locale: z.ZodOptional<z.ZodString>;
53
+ userAgent: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strip>>;
55
+ messageId: z.ZodOptional<z.ZodString>;
56
+ timestamp: z.ZodOptional<z.ZodNumber>;
57
+ }, z.core.$strip>;
58
+ export declare const appEventSurveyViewedSchema: z.ZodObject<{
59
+ traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
+ identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
61
+ type: z.ZodEnum<{
62
+ anonymousId: "anonymousId";
63
+ userId: "userId";
64
+ "traits.email": "traits.email";
65
+ "traits.phone": "traits.phone";
66
+ "context.device.id": "context.device.id";
67
+ "context.device.advertisingId": "context.device.advertisingId";
68
+ "context.device.token": "context.device.token";
69
+ }>;
70
+ value: z.ZodString;
71
+ }, z.core.$strip>>>;
72
+ context: z.ZodOptional<z.ZodObject<{
73
+ page: z.ZodOptional<z.ZodObject<{
74
+ path: z.ZodOptional<z.ZodString>;
75
+ referrer: z.ZodOptional<z.ZodString>;
76
+ search: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strip>>;
78
+ locale: z.ZodOptional<z.ZodString>;
79
+ userAgent: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strip>>;
81
+ messageId: z.ZodOptional<z.ZodString>;
82
+ timestamp: z.ZodOptional<z.ZodNumber>;
83
+ event: z.ZodLiteral<"Flow Viewed">;
84
+ references: z.ZodObject<{
85
+ surveyId: z.ZodString;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>;
88
+ export declare const appEventFlowDismissedSchema: z.ZodObject<{
89
+ traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
+ identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
91
+ type: z.ZodEnum<{
92
+ anonymousId: "anonymousId";
93
+ userId: "userId";
94
+ "traits.email": "traits.email";
95
+ "traits.phone": "traits.phone";
96
+ "context.device.id": "context.device.id";
97
+ "context.device.advertisingId": "context.device.advertisingId";
98
+ "context.device.token": "context.device.token";
99
+ }>;
100
+ value: z.ZodString;
101
+ }, z.core.$strip>>>;
102
+ context: z.ZodOptional<z.ZodObject<{
103
+ page: z.ZodOptional<z.ZodObject<{
104
+ path: z.ZodOptional<z.ZodString>;
105
+ referrer: z.ZodOptional<z.ZodString>;
106
+ search: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strip>>;
108
+ locale: z.ZodOptional<z.ZodString>;
109
+ userAgent: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>>;
111
+ messageId: z.ZodOptional<z.ZodString>;
112
+ timestamp: z.ZodOptional<z.ZodNumber>;
113
+ event: z.ZodLiteral<"Flow Dismissed">;
114
+ references: z.ZodObject<{
115
+ surveyId: z.ZodString;
116
+ }, z.core.$strip>;
117
+ }, z.core.$strip>;
118
+ export declare const appEventTrackSchema: z.ZodObject<{
119
+ traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
120
+ identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
+ type: z.ZodEnum<{
122
+ anonymousId: "anonymousId";
123
+ userId: "userId";
124
+ "traits.email": "traits.email";
125
+ "traits.phone": "traits.phone";
126
+ "context.device.id": "context.device.id";
127
+ "context.device.advertisingId": "context.device.advertisingId";
128
+ "context.device.token": "context.device.token";
129
+ }>;
130
+ value: z.ZodString;
131
+ }, z.core.$strip>>>;
132
+ context: z.ZodOptional<z.ZodObject<{
133
+ page: z.ZodOptional<z.ZodObject<{
134
+ path: z.ZodOptional<z.ZodString>;
135
+ referrer: z.ZodOptional<z.ZodString>;
136
+ search: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ locale: z.ZodOptional<z.ZodString>;
139
+ userAgent: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>>;
141
+ messageId: z.ZodOptional<z.ZodString>;
142
+ timestamp: z.ZodOptional<z.ZodNumber>;
143
+ event: z.ZodEnum<{
144
+ "Flow Viewed": "Flow Viewed";
145
+ "Flow Dismissed": "Flow Dismissed";
146
+ }>;
147
+ references: z.ZodObject<{
148
+ surveyId: z.ZodString;
149
+ }, z.core.$strip>;
150
+ }, z.core.$strip>;
151
+ export declare const appEventPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
152
+ traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
153
+ identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
154
+ type: z.ZodEnum<{
155
+ anonymousId: "anonymousId";
156
+ userId: "userId";
157
+ "traits.email": "traits.email";
158
+ "traits.phone": "traits.phone";
159
+ "context.device.id": "context.device.id";
160
+ "context.device.advertisingId": "context.device.advertisingId";
161
+ "context.device.token": "context.device.token";
162
+ }>;
163
+ value: z.ZodString;
164
+ }, z.core.$strip>>>;
165
+ context: z.ZodOptional<z.ZodObject<{
166
+ page: z.ZodOptional<z.ZodObject<{
167
+ path: z.ZodOptional<z.ZodString>;
168
+ referrer: z.ZodOptional<z.ZodString>;
169
+ search: z.ZodOptional<z.ZodString>;
170
+ }, z.core.$strip>>;
171
+ locale: z.ZodOptional<z.ZodString>;
172
+ userAgent: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strip>>;
174
+ messageId: z.ZodOptional<z.ZodString>;
175
+ timestamp: z.ZodOptional<z.ZodNumber>;
176
+ event: z.ZodLiteral<"Flow Viewed">;
177
+ references: z.ZodObject<{
178
+ surveyId: z.ZodString;
179
+ }, z.core.$strip>;
180
+ }, z.core.$strip>, z.ZodObject<{
181
+ traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
182
+ identities: z.ZodOptional<z.ZodArray<z.ZodObject<{
183
+ type: z.ZodEnum<{
184
+ anonymousId: "anonymousId";
185
+ userId: "userId";
186
+ "traits.email": "traits.email";
187
+ "traits.phone": "traits.phone";
188
+ "context.device.id": "context.device.id";
189
+ "context.device.advertisingId": "context.device.advertisingId";
190
+ "context.device.token": "context.device.token";
191
+ }>;
192
+ value: z.ZodString;
193
+ }, z.core.$strip>>>;
194
+ context: z.ZodOptional<z.ZodObject<{
195
+ page: z.ZodOptional<z.ZodObject<{
196
+ path: z.ZodOptional<z.ZodString>;
197
+ referrer: z.ZodOptional<z.ZodString>;
198
+ search: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$strip>>;
200
+ locale: z.ZodOptional<z.ZodString>;
201
+ userAgent: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$strip>>;
203
+ messageId: z.ZodOptional<z.ZodString>;
204
+ timestamp: z.ZodOptional<z.ZodNumber>;
205
+ event: z.ZodLiteral<"Flow Dismissed">;
206
+ references: z.ZodObject<{
207
+ surveyId: z.ZodString;
208
+ }, z.core.$strip>;
209
+ }, z.core.$strip>], "event">;
210
+ export type AppEventTrackInput = z.output<typeof appEventTrackSchema>;
211
+ export type AppEventPayload = z.output<typeof appEventPayloadSchema>;
212
+ //# sourceMappingURL=app-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-event.d.ts","sourceRoot":"","sources":["../src/app-event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,0BAA0B;;;;;;;;EAQrC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAGjC,CAAC;AAQH,eAAO,MAAM,qBAAqB;;;;;;;;iBAIhC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;iBAM7B,CAAC;AAMH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGrC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGtC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAGhC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import * as z from "zod";
2
+ export const appEventIdentityTypeSchema = z.enum([
3
+ "anonymousId",
4
+ "userId",
5
+ "traits.email",
6
+ "traits.phone",
7
+ "context.device.id",
8
+ "context.device.advertisingId",
9
+ "context.device.token",
10
+ ]);
11
+ export const appEventIdentitySchema = z.object({
12
+ type: appEventIdentityTypeSchema,
13
+ value: z.string().trim().min(1),
14
+ });
15
+ const appEventPageSchema = z.object({
16
+ path: z.optional(z.string()),
17
+ referrer: z.optional(z.string()),
18
+ search: z.optional(z.string()),
19
+ });
20
+ export const appEventContextSchema = z.object({
21
+ page: z.optional(appEventPageSchema),
22
+ locale: z.optional(z.string()),
23
+ userAgent: z.optional(z.string()),
24
+ });
25
+ export const appEventBaseSchema = z.object({
26
+ traits: z.optional(z.record(z.string(), z.unknown())),
27
+ identities: z.optional(z.array(appEventIdentitySchema)),
28
+ context: z.optional(appEventContextSchema),
29
+ messageId: z.optional(z.string()),
30
+ timestamp: z.optional(z.number()),
31
+ });
32
+ const appEventSurveyReferenceSchema = z.object({
33
+ surveyId: z.string(),
34
+ });
35
+ export const appEventSurveyViewedSchema = appEventBaseSchema.extend({
36
+ event: z.literal("Flow Viewed"),
37
+ references: appEventSurveyReferenceSchema,
38
+ });
39
+ export const appEventFlowDismissedSchema = appEventBaseSchema.extend({
40
+ event: z.literal("Flow Dismissed"),
41
+ references: appEventSurveyReferenceSchema,
42
+ });
43
+ export const appEventTrackSchema = appEventBaseSchema.extend({
44
+ event: z.enum(["Flow Viewed", "Flow Dismissed"]),
45
+ references: appEventSurveyReferenceSchema,
46
+ });
47
+ export const appEventPayloadSchema = z.discriminatedUnion("event", [
48
+ appEventSurveyViewedSchema,
49
+ appEventFlowDismissedSchema,
50
+ ]);
@@ -1,12 +1,12 @@
1
1
  import * as z from "zod";
2
2
  export declare const clientMetaSchema: z.ZodObject<{
3
3
  loader: z.ZodEnum<{
4
+ custom: "custom";
4
5
  sdk: "sdk";
5
6
  gtm: "gtm";
6
7
  segment: "segment";
7
8
  rudderstack: "rudderstack";
8
9
  tealium: "tealium";
9
- custom: "custom";
10
10
  }>;
11
11
  clientName: z.ZodOptional<z.ZodString>;
12
12
  clientVersion: z.ZodOptional<z.ZodString>;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { type AppEventPayload, type AppEventTrackInput, appEventBaseSchema, appEventContextSchema, appEventFlowDismissedSchema, appEventIdentitySchema, appEventIdentityTypeSchema, appEventPayloadSchema, appEventSurveyViewedSchema, appEventTrackSchema, } from "./app-event.js";
1
2
  export { type ClientMeta, clientMetaSchema, } from "./client-meta.js";
2
3
  export { DEFAULT_AUTO_DETECT_COLOR_SCHEME_ATTRS } from "./defaults.js";
3
4
  export { getScopeMeta, isScope, listScopes, SCOPE_IDS, type Scope, scopeIdSchema, } from "./scopes.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,gBAAgB,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sCAAsC,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EACN,YAAY,EACZ,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,KAAK,EACV,aAAa,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,qBAAqB,EAC1B,2B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ChB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,wBAAwB,GACxB,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { appEventBaseSchema, appEventContextSchema, appEventFlowDismissedSchema, appEventIdentitySchema, appEventIdentityTypeSchema, appEventPayloadSchema, appEventSurveyViewedSchema, appEventTrackSchema, } from "./app-event.js";
1
2
  export { clientMetaSchema, } from "./client-meta.js";
2
3
  export { DEFAULT_AUTO_DETECT_COLOR_SCHEME_ATTRS } from "./defaults.js";
3
4
  export { getScopeMeta, isScope, listScopes, SCOPE_IDS, scopeIdSchema, } from "./scopes.js";
@@ -115,12 +115,12 @@ export declare const publicCommandPayloadSchema: z.ZodUnion<readonly [z.ZodDiscr
115
115
  }>>]>>;
116
116
  clientMeta: z.ZodOptional<z.ZodObject<{
117
117
  loader: z.ZodEnum<{
118
+ custom: "custom";
118
119
  sdk: "sdk";
119
120
  gtm: "gtm";
120
121
  segment: "segment";
121
122
  rudderstack: "rudderstack";
122
123
  tealium: "tealium";
123
- custom: "custom";
124
124
  }>;
125
125
  clientName: z.ZodOptional<z.ZodString>;
126
126
  clientVersion: z.ZodOptional<z.ZodString>;
@@ -91,12 +91,12 @@ export declare const initOptionsSchema: z.ZodObject<{
91
91
  }>>]>>;
92
92
  clientMeta: z.ZodOptional<z.ZodObject<{
93
93
  loader: z.ZodEnum<{
94
+ custom: "custom";
94
95
  sdk: "sdk";
95
96
  gtm: "gtm";
96
97
  segment: "segment";
97
98
  rudderstack: "rudderstack";
98
99
  tealium: "tealium";
99
- custom: "custom";
100
100
  }>;
101
101
  clientName: z.ZodOptional<z.ZodString>;
102
102
  clientVersion: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/protocol",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "getuserfeedback widget protocol — host surface and (later) wire protocol",
5
5
  "keywords": [
6
6
  "getuserfeedback",