@reactionary/core 0.3.0 → 0.3.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/client/client-builder.js +3 -4
- package/decorators/reactionary.decorator.js +2 -2
- package/initialization.js +9 -1
- package/package.json +1 -1
- package/providers/analytics.provider.js +62 -1
- package/providers/identity.provider.js +4 -0
- package/schemas/errors/invalid-input.error.js +1 -1
- package/schemas/errors/invalid-output.error.js +1 -1
- package/schemas/models/order.model.js +1 -1
- package/schemas/mutations/analytics/index.js +21 -0
- package/schemas/mutations/analytics/product-add-to-cart.mutation.js +19 -0
- package/schemas/mutations/analytics/product-details-view.mutation.js +10 -0
- package/schemas/mutations/analytics/product-summary-click.mutation.js +20 -0
- package/schemas/mutations/analytics/product-summary-view.mutation.js +19 -0
- package/schemas/mutations/analytics/purchase.mutation.js +10 -0
- package/schemas/mutations/index.js +1 -1
- package/schemas/session.schema.js +11 -2
- package/src/client/client.d.ts +2 -3
- package/src/initialization.d.ts +1 -1
- package/src/providers/analytics.provider.d.ts +14 -0
- package/src/providers/cart.provider.d.ts +3 -0
- package/src/providers/category.provider.d.ts +1 -0
- package/src/providers/identity.provider.d.ts +1 -0
- package/src/schemas/errors/invalid-input.error.d.ts +1 -1
- package/src/schemas/errors/invalid-output.error.d.ts +1 -1
- package/src/schemas/models/identifiers.model.d.ts +3 -0
- package/src/schemas/models/order.model.d.ts +1 -1
- package/src/schemas/mutations/analytics/index.d.ts +2441 -0
- package/src/schemas/mutations/analytics/product-add-to-cart.mutation.d.ts +32 -0
- package/src/schemas/mutations/analytics/product-details-view.mutation.d.ts +9 -0
- package/src/schemas/mutations/analytics/product-summary-click.mutation.d.ts +33 -0
- package/src/schemas/mutations/analytics/product-summary-view.mutation.d.ts +32 -0
- package/src/schemas/mutations/analytics/purchase.mutation.d.ts +2346 -0
- package/src/schemas/mutations/index.d.ts +1 -1
- package/src/schemas/queries/order-search.query.d.ts +3 -0
- package/src/schemas/session.schema.d.ts +73 -6
- package/src/zod-utils.d.ts +4 -1
- package/schemas/mutations/analytics.mutation.js +0 -20
- package/src/schemas/mutations/analytics.mutation.d.ts +0 -110
|
@@ -188,7 +188,42 @@ export declare const LanguageContextSchema: z.ZodObject<{
|
|
|
188
188
|
ZWL: "ZWL";
|
|
189
189
|
}>>;
|
|
190
190
|
}, z.core.$loose>;
|
|
191
|
-
export declare const
|
|
191
|
+
export declare const IdentityContextSchema: z.ZodObject<{
|
|
192
|
+
identity: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
193
|
+
type: z.ZodLiteral<"Anonymous">;
|
|
194
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
195
|
+
id: z.ZodObject<{
|
|
196
|
+
userId: z.ZodString;
|
|
197
|
+
}, z.core.$loose>;
|
|
198
|
+
type: z.ZodLiteral<"Guest">;
|
|
199
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
200
|
+
id: z.ZodObject<{
|
|
201
|
+
userId: z.ZodString;
|
|
202
|
+
}, z.core.$loose>;
|
|
203
|
+
type: z.ZodLiteral<"Registered">;
|
|
204
|
+
}, z.core.$loose>], "type">;
|
|
205
|
+
personalizationKey: z.ZodString;
|
|
206
|
+
lastUpdated: z.ZodDate;
|
|
207
|
+
}, z.core.$loose>;
|
|
208
|
+
export declare const SessionSchema: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
|
|
209
|
+
identityContext: z.ZodObject<{
|
|
210
|
+
identity: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
211
|
+
type: z.ZodLiteral<"Anonymous">;
|
|
212
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
213
|
+
id: z.ZodObject<{
|
|
214
|
+
userId: z.ZodString;
|
|
215
|
+
}, z.core.$loose>;
|
|
216
|
+
type: z.ZodLiteral<"Guest">;
|
|
217
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
218
|
+
id: z.ZodObject<{
|
|
219
|
+
userId: z.ZodString;
|
|
220
|
+
}, z.core.$loose>;
|
|
221
|
+
type: z.ZodLiteral<"Registered">;
|
|
222
|
+
}, z.core.$loose>], "type">;
|
|
223
|
+
personalizationKey: z.ZodString;
|
|
224
|
+
lastUpdated: z.ZodDate;
|
|
225
|
+
}, z.core.$loose>;
|
|
226
|
+
}, z.core.$strip>>;
|
|
192
227
|
export declare const TaxJurisdictionSchema: z.ZodObject<{
|
|
193
228
|
countryCode: z.ZodDefault<z.ZodString>;
|
|
194
229
|
stateCode: z.ZodDefault<z.ZodString>;
|
|
@@ -196,7 +231,25 @@ export declare const TaxJurisdictionSchema: z.ZodObject<{
|
|
|
196
231
|
cityCode: z.ZodDefault<z.ZodString>;
|
|
197
232
|
}, z.core.$strip>;
|
|
198
233
|
export declare const RequestContextSchema: z.ZodObject<{
|
|
199
|
-
session: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny
|
|
234
|
+
session: z.ZodDefault<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
|
|
235
|
+
identityContext: z.ZodObject<{
|
|
236
|
+
identity: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"Anonymous">;
|
|
238
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
239
|
+
id: z.ZodObject<{
|
|
240
|
+
userId: z.ZodString;
|
|
241
|
+
}, z.core.$loose>;
|
|
242
|
+
type: z.ZodLiteral<"Guest">;
|
|
243
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
244
|
+
id: z.ZodObject<{
|
|
245
|
+
userId: z.ZodString;
|
|
246
|
+
}, z.core.$loose>;
|
|
247
|
+
type: z.ZodLiteral<"Registered">;
|
|
248
|
+
}, z.core.$loose>], "type">;
|
|
249
|
+
personalizationKey: z.ZodString;
|
|
250
|
+
lastUpdated: z.ZodDate;
|
|
251
|
+
}, z.core.$loose>;
|
|
252
|
+
}, z.core.$strip>>>;
|
|
200
253
|
languageContext: z.ZodDefault<z.ZodObject<{
|
|
201
254
|
locale: z.ZodDefault<z.ZodString>;
|
|
202
255
|
currencyCode: z.ZodDefault<z.ZodEnum<{
|
|
@@ -398,7 +451,21 @@ export declare const RequestContextSchema: z.ZodObject<{
|
|
|
398
451
|
userAgent: z.ZodDefault<z.ZodString>;
|
|
399
452
|
referrer: z.ZodDefault<z.ZodString>;
|
|
400
453
|
}, z.core.$loose>;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
export type
|
|
454
|
+
/**
|
|
455
|
+
* @see {@link SessionSchema}
|
|
456
|
+
*/
|
|
457
|
+
export type Session = z.infer<typeof SessionSchema> & {
|
|
458
|
+
_?: never;
|
|
459
|
+
};
|
|
460
|
+
export type LanguageContext = z.infer<typeof LanguageContextSchema> & {
|
|
461
|
+
_?: never;
|
|
462
|
+
};
|
|
463
|
+
export type RequestContext = z.infer<typeof RequestContextSchema> & {
|
|
464
|
+
_?: never;
|
|
465
|
+
};
|
|
466
|
+
export type TaxJurisdiction = z.infer<typeof TaxJurisdictionSchema> & {
|
|
467
|
+
_?: never;
|
|
468
|
+
};
|
|
469
|
+
export type IdentityContext = z.infer<typeof IdentityContextSchema> & {
|
|
470
|
+
_?: never;
|
|
471
|
+
};
|
package/src/zod-utils.d.ts
CHANGED
|
@@ -2,4 +2,7 @@ import type z from "zod";
|
|
|
2
2
|
export type StripIndexSignature<T> = T extends (infer U)[] ? StripIndexSignature<U>[] : T extends readonly (infer U)[] ? readonly StripIndexSignature<U>[] : T extends Set<infer U> ? Set<StripIndexSignature<U>> : T extends Map<infer K, infer V> ? Map<StripIndexSignature<K>, StripIndexSignature<V>> : T extends Promise<infer U> ? Promise<StripIndexSignature<U>> : T extends object ? {
|
|
3
3
|
[K in keyof T as K extends string ? string extends K ? never : K : K]: StripIndexSignature<T[K]>;
|
|
4
4
|
} : T;
|
|
5
|
-
export type
|
|
5
|
+
export type AvoidSimplification<T> = T & {
|
|
6
|
+
_?: never;
|
|
7
|
+
};
|
|
8
|
+
export type InferType<T extends z.ZodTypeAny> = AvoidSimplification<StripIndexSignature<z.infer<T>>>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { BaseMutationSchema } from "./base.mutation.js";
|
|
3
|
-
import { ProductIdentifierSchema, ProductSearchIdentifierSchema } from "../models/identifiers.model.js";
|
|
4
|
-
const AnalyticsMutationSearchEventSchema = BaseMutationSchema.extend({
|
|
5
|
-
mutation: z.literal("search"),
|
|
6
|
-
search: ProductSearchIdentifierSchema,
|
|
7
|
-
products: z.array(ProductIdentifierSchema)
|
|
8
|
-
});
|
|
9
|
-
const AnalyticsMutationSearchProductClickEventSchema = BaseMutationSchema.extend({
|
|
10
|
-
mutation: z.literal("product-search-click"),
|
|
11
|
-
search: ProductSearchIdentifierSchema,
|
|
12
|
-
product: ProductIdentifierSchema,
|
|
13
|
-
position: z.number().min(0)
|
|
14
|
-
});
|
|
15
|
-
const AnalyticsMutationSchema = z.union([AnalyticsMutationSearchEventSchema, AnalyticsMutationSearchProductClickEventSchema]);
|
|
16
|
-
export {
|
|
17
|
-
AnalyticsMutationSchema,
|
|
18
|
-
AnalyticsMutationSearchEventSchema,
|
|
19
|
-
AnalyticsMutationSearchProductClickEventSchema
|
|
20
|
-
};
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { InferType } from '../../zod-utils.js';
|
|
3
|
-
export declare const AnalyticsMutationSearchEventSchema: z.ZodObject<{
|
|
4
|
-
mutation: z.ZodLiteral<"search">;
|
|
5
|
-
search: z.ZodObject<{
|
|
6
|
-
term: z.ZodString;
|
|
7
|
-
facets: z.ZodArray<z.ZodObject<{
|
|
8
|
-
facet: z.ZodObject<{
|
|
9
|
-
key: z.ZodString;
|
|
10
|
-
}, z.core.$loose>;
|
|
11
|
-
key: z.ZodString;
|
|
12
|
-
}, z.core.$strip>>;
|
|
13
|
-
filters: z.ZodArray<z.ZodString>;
|
|
14
|
-
paginationOptions: z.ZodObject<{
|
|
15
|
-
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
16
|
-
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
17
|
-
}, z.core.$loose>;
|
|
18
|
-
categoryFilter: z.ZodOptional<z.ZodObject<{
|
|
19
|
-
facet: z.ZodObject<{
|
|
20
|
-
key: z.ZodString;
|
|
21
|
-
}, z.core.$loose>;
|
|
22
|
-
key: z.ZodString;
|
|
23
|
-
}, z.core.$strip>>;
|
|
24
|
-
}, z.core.$loose>;
|
|
25
|
-
products: z.ZodArray<z.ZodObject<{
|
|
26
|
-
key: z.ZodString;
|
|
27
|
-
}, z.core.$loose>>;
|
|
28
|
-
}, z.core.$loose>;
|
|
29
|
-
export declare const AnalyticsMutationSearchProductClickEventSchema: z.ZodObject<{
|
|
30
|
-
mutation: z.ZodLiteral<"product-search-click">;
|
|
31
|
-
search: z.ZodObject<{
|
|
32
|
-
term: z.ZodString;
|
|
33
|
-
facets: z.ZodArray<z.ZodObject<{
|
|
34
|
-
facet: z.ZodObject<{
|
|
35
|
-
key: z.ZodString;
|
|
36
|
-
}, z.core.$loose>;
|
|
37
|
-
key: z.ZodString;
|
|
38
|
-
}, z.core.$strip>>;
|
|
39
|
-
filters: z.ZodArray<z.ZodString>;
|
|
40
|
-
paginationOptions: z.ZodObject<{
|
|
41
|
-
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
42
|
-
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
43
|
-
}, z.core.$loose>;
|
|
44
|
-
categoryFilter: z.ZodOptional<z.ZodObject<{
|
|
45
|
-
facet: z.ZodObject<{
|
|
46
|
-
key: z.ZodString;
|
|
47
|
-
}, z.core.$loose>;
|
|
48
|
-
key: z.ZodString;
|
|
49
|
-
}, z.core.$strip>>;
|
|
50
|
-
}, z.core.$loose>;
|
|
51
|
-
product: z.ZodObject<{
|
|
52
|
-
key: z.ZodString;
|
|
53
|
-
}, z.core.$loose>;
|
|
54
|
-
position: z.ZodNumber;
|
|
55
|
-
}, z.core.$loose>;
|
|
56
|
-
export declare const AnalyticsMutationSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
57
|
-
mutation: z.ZodLiteral<"search">;
|
|
58
|
-
search: z.ZodObject<{
|
|
59
|
-
term: z.ZodString;
|
|
60
|
-
facets: z.ZodArray<z.ZodObject<{
|
|
61
|
-
facet: z.ZodObject<{
|
|
62
|
-
key: z.ZodString;
|
|
63
|
-
}, z.core.$loose>;
|
|
64
|
-
key: z.ZodString;
|
|
65
|
-
}, z.core.$strip>>;
|
|
66
|
-
filters: z.ZodArray<z.ZodString>;
|
|
67
|
-
paginationOptions: z.ZodObject<{
|
|
68
|
-
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
69
|
-
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
70
|
-
}, z.core.$loose>;
|
|
71
|
-
categoryFilter: z.ZodOptional<z.ZodObject<{
|
|
72
|
-
facet: z.ZodObject<{
|
|
73
|
-
key: z.ZodString;
|
|
74
|
-
}, z.core.$loose>;
|
|
75
|
-
key: z.ZodString;
|
|
76
|
-
}, z.core.$strip>>;
|
|
77
|
-
}, z.core.$loose>;
|
|
78
|
-
products: z.ZodArray<z.ZodObject<{
|
|
79
|
-
key: z.ZodString;
|
|
80
|
-
}, z.core.$loose>>;
|
|
81
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
82
|
-
mutation: z.ZodLiteral<"product-search-click">;
|
|
83
|
-
search: z.ZodObject<{
|
|
84
|
-
term: z.ZodString;
|
|
85
|
-
facets: z.ZodArray<z.ZodObject<{
|
|
86
|
-
facet: z.ZodObject<{
|
|
87
|
-
key: z.ZodString;
|
|
88
|
-
}, z.core.$loose>;
|
|
89
|
-
key: z.ZodString;
|
|
90
|
-
}, z.core.$strip>>;
|
|
91
|
-
filters: z.ZodArray<z.ZodString>;
|
|
92
|
-
paginationOptions: z.ZodObject<{
|
|
93
|
-
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
94
|
-
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
95
|
-
}, z.core.$loose>;
|
|
96
|
-
categoryFilter: z.ZodOptional<z.ZodObject<{
|
|
97
|
-
facet: z.ZodObject<{
|
|
98
|
-
key: z.ZodString;
|
|
99
|
-
}, z.core.$loose>;
|
|
100
|
-
key: z.ZodString;
|
|
101
|
-
}, z.core.$strip>>;
|
|
102
|
-
}, z.core.$loose>;
|
|
103
|
-
product: z.ZodObject<{
|
|
104
|
-
key: z.ZodString;
|
|
105
|
-
}, z.core.$loose>;
|
|
106
|
-
position: z.ZodNumber;
|
|
107
|
-
}, z.core.$loose>]>;
|
|
108
|
-
export type AnalyticsMutation = InferType<typeof AnalyticsMutationSchema>;
|
|
109
|
-
export type AnalyticsMutationSearchEvent = InferType<typeof AnalyticsMutationSearchEventSchema>;
|
|
110
|
-
export type AnalyticsMutationSearchProductClickEvent = InferType<typeof AnalyticsMutationSearchProductClickEventSchema>;
|