@open-loyalty/mcp-server 1.0.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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +654 -0
  3. package/dist/client/http.d.ts +8 -0
  4. package/dist/client/http.js +69 -0
  5. package/dist/config.d.ts +17 -0
  6. package/dist/config.js +40 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +20 -0
  9. package/dist/server.d.ts +4 -0
  10. package/dist/server.js +334 -0
  11. package/dist/tools/achievement.d.ts +983 -0
  12. package/dist/tools/achievement.js +311 -0
  13. package/dist/tools/admin.d.ts +153 -0
  14. package/dist/tools/admin.js +193 -0
  15. package/dist/tools/analytics.d.ts +162 -0
  16. package/dist/tools/analytics.js +245 -0
  17. package/dist/tools/apikey.d.ts +72 -0
  18. package/dist/tools/apikey.js +78 -0
  19. package/dist/tools/audit.d.ts +107 -0
  20. package/dist/tools/audit.js +90 -0
  21. package/dist/tools/badge.d.ts +135 -0
  22. package/dist/tools/badge.js +165 -0
  23. package/dist/tools/campaign.d.ts +1775 -0
  24. package/dist/tools/campaign.js +724 -0
  25. package/dist/tools/export.d.ts +110 -0
  26. package/dist/tools/export.js +147 -0
  27. package/dist/tools/import.d.ts +110 -0
  28. package/dist/tools/import.js +126 -0
  29. package/dist/tools/index.d.ts +22 -0
  30. package/dist/tools/index.js +527 -0
  31. package/dist/tools/member.d.ts +345 -0
  32. package/dist/tools/member.js +358 -0
  33. package/dist/tools/member.test.d.ts +1 -0
  34. package/dist/tools/member.test.js +213 -0
  35. package/dist/tools/points.d.ts +188 -0
  36. package/dist/tools/points.js +306 -0
  37. package/dist/tools/points.test.d.ts +1 -0
  38. package/dist/tools/points.test.js +292 -0
  39. package/dist/tools/reward.d.ts +261 -0
  40. package/dist/tools/reward.js +371 -0
  41. package/dist/tools/reward.test.d.ts +1 -0
  42. package/dist/tools/reward.test.js +240 -0
  43. package/dist/tools/role.d.ts +161 -0
  44. package/dist/tools/role.js +160 -0
  45. package/dist/tools/segment.d.ts +797 -0
  46. package/dist/tools/segment.js +299 -0
  47. package/dist/tools/store.d.ts +101 -0
  48. package/dist/tools/store.js +117 -0
  49. package/dist/tools/tierset.d.ts +288 -0
  50. package/dist/tools/tierset.js +244 -0
  51. package/dist/tools/transaction.d.ts +357 -0
  52. package/dist/tools/transaction.js +242 -0
  53. package/dist/tools/transaction.test.d.ts +1 -0
  54. package/dist/tools/transaction.test.js +235 -0
  55. package/dist/tools/wallet-type.d.ts +32 -0
  56. package/dist/tools/wallet-type.js +58 -0
  57. package/dist/tools/webhook.d.ts +179 -0
  58. package/dist/tools/webhook.js +171 -0
  59. package/dist/types/schemas/achievement.d.ts +1116 -0
  60. package/dist/types/schemas/achievement.js +172 -0
  61. package/dist/types/schemas/admin.d.ts +263 -0
  62. package/dist/types/schemas/admin.js +99 -0
  63. package/dist/types/schemas/analytics.d.ts +542 -0
  64. package/dist/types/schemas/analytics.js +130 -0
  65. package/dist/types/schemas/badge.d.ts +131 -0
  66. package/dist/types/schemas/badge.js +48 -0
  67. package/dist/types/schemas/campaign.d.ts +2005 -0
  68. package/dist/types/schemas/campaign.js +189 -0
  69. package/dist/types/schemas/common.d.ts +52 -0
  70. package/dist/types/schemas/common.js +26 -0
  71. package/dist/types/schemas/export.d.ts +127 -0
  72. package/dist/types/schemas/export.js +43 -0
  73. package/dist/types/schemas/import.d.ts +344 -0
  74. package/dist/types/schemas/import.js +68 -0
  75. package/dist/types/schemas/member.d.ts +443 -0
  76. package/dist/types/schemas/member.js +92 -0
  77. package/dist/types/schemas/points.d.ts +188 -0
  78. package/dist/types/schemas/points.js +54 -0
  79. package/dist/types/schemas/reward.d.ts +278 -0
  80. package/dist/types/schemas/reward.js +69 -0
  81. package/dist/types/schemas/role.d.ts +260 -0
  82. package/dist/types/schemas/role.js +75 -0
  83. package/dist/types/schemas/segment.d.ts +592 -0
  84. package/dist/types/schemas/segment.js +114 -0
  85. package/dist/types/schemas/tierset.d.ts +552 -0
  86. package/dist/types/schemas/tierset.js +87 -0
  87. package/dist/types/schemas/transaction.d.ts +1022 -0
  88. package/dist/types/schemas/transaction.js +63 -0
  89. package/dist/types/schemas/wallet-type.d.ts +99 -0
  90. package/dist/types/schemas/wallet-type.js +17 -0
  91. package/dist/types/schemas/webhook.d.ts +195 -0
  92. package/dist/types/schemas/webhook.js +39 -0
  93. package/dist/utils/cursor.d.ts +84 -0
  94. package/dist/utils/cursor.js +117 -0
  95. package/dist/utils/errors.d.ts +12 -0
  96. package/dist/utils/errors.js +69 -0
  97. package/dist/utils/pagination.d.ts +39 -0
  98. package/dist/utils/pagination.js +77 -0
  99. package/package.json +65 -0
@@ -0,0 +1,443 @@
1
+ import { z } from "zod";
2
+ export declare const MemberAddressSchema: z.ZodObject<{
3
+ street: z.ZodOptional<z.ZodString>;
4
+ city: z.ZodOptional<z.ZodString>;
5
+ postal: z.ZodOptional<z.ZodString>;
6
+ country: z.ZodOptional<z.ZodString>;
7
+ province: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ street?: string | undefined;
10
+ city?: string | undefined;
11
+ postal?: string | undefined;
12
+ country?: string | undefined;
13
+ province?: string | undefined;
14
+ }, {
15
+ street?: string | undefined;
16
+ city?: string | undefined;
17
+ postal?: string | undefined;
18
+ country?: string | undefined;
19
+ province?: string | undefined;
20
+ }>;
21
+ export declare const MemberAgreementSchema: z.ZodObject<{
22
+ agreement1: z.ZodOptional<z.ZodBoolean>;
23
+ agreement2: z.ZodOptional<z.ZodBoolean>;
24
+ agreement3: z.ZodOptional<z.ZodBoolean>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ agreement1?: boolean | undefined;
27
+ agreement2?: boolean | undefined;
28
+ agreement3?: boolean | undefined;
29
+ }, {
30
+ agreement1?: boolean | undefined;
31
+ agreement2?: boolean | undefined;
32
+ agreement3?: boolean | undefined;
33
+ }>;
34
+ export declare const MemberSchema: z.ZodObject<{
35
+ memberId: z.ZodString;
36
+ email: z.ZodString;
37
+ firstName: z.ZodOptional<z.ZodString>;
38
+ lastName: z.ZodOptional<z.ZodString>;
39
+ phone: z.ZodOptional<z.ZodString>;
40
+ birthDate: z.ZodOptional<z.ZodString>;
41
+ gender: z.ZodOptional<z.ZodEnum<["male", "female", "not_disclosed"]>>;
42
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
43
+ active: z.ZodBoolean;
44
+ createdAt: z.ZodOptional<z.ZodString>;
45
+ address: z.ZodOptional<z.ZodObject<{
46
+ street: z.ZodOptional<z.ZodString>;
47
+ city: z.ZodOptional<z.ZodString>;
48
+ postal: z.ZodOptional<z.ZodString>;
49
+ country: z.ZodOptional<z.ZodString>;
50
+ province: z.ZodOptional<z.ZodString>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ street?: string | undefined;
53
+ city?: string | undefined;
54
+ postal?: string | undefined;
55
+ country?: string | undefined;
56
+ province?: string | undefined;
57
+ }, {
58
+ street?: string | undefined;
59
+ city?: string | undefined;
60
+ postal?: string | undefined;
61
+ country?: string | undefined;
62
+ province?: string | undefined;
63
+ }>>;
64
+ agreement1: z.ZodOptional<z.ZodBoolean>;
65
+ agreement2: z.ZodOptional<z.ZodBoolean>;
66
+ agreement3: z.ZodOptional<z.ZodBoolean>;
67
+ levelId: z.ZodOptional<z.ZodString>;
68
+ levelName: z.ZodOptional<z.ZodString>;
69
+ points: z.ZodOptional<z.ZodNumber>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ active: boolean;
72
+ memberId: string;
73
+ email: string;
74
+ createdAt?: string | undefined;
75
+ levelId?: string | undefined;
76
+ agreement1?: boolean | undefined;
77
+ agreement2?: boolean | undefined;
78
+ agreement3?: boolean | undefined;
79
+ firstName?: string | undefined;
80
+ lastName?: string | undefined;
81
+ phone?: string | undefined;
82
+ birthDate?: string | undefined;
83
+ gender?: "male" | "female" | "not_disclosed" | undefined;
84
+ loyaltyCardNumber?: string | undefined;
85
+ address?: {
86
+ street?: string | undefined;
87
+ city?: string | undefined;
88
+ postal?: string | undefined;
89
+ country?: string | undefined;
90
+ province?: string | undefined;
91
+ } | undefined;
92
+ levelName?: string | undefined;
93
+ points?: number | undefined;
94
+ }, {
95
+ active: boolean;
96
+ memberId: string;
97
+ email: string;
98
+ createdAt?: string | undefined;
99
+ levelId?: string | undefined;
100
+ agreement1?: boolean | undefined;
101
+ agreement2?: boolean | undefined;
102
+ agreement3?: boolean | undefined;
103
+ firstName?: string | undefined;
104
+ lastName?: string | undefined;
105
+ phone?: string | undefined;
106
+ birthDate?: string | undefined;
107
+ gender?: "male" | "female" | "not_disclosed" | undefined;
108
+ loyaltyCardNumber?: string | undefined;
109
+ address?: {
110
+ street?: string | undefined;
111
+ city?: string | undefined;
112
+ postal?: string | undefined;
113
+ country?: string | undefined;
114
+ province?: string | undefined;
115
+ } | undefined;
116
+ levelName?: string | undefined;
117
+ points?: number | undefined;
118
+ }>;
119
+ export declare const MemberCreateInputSchema: z.ZodObject<{
120
+ storeCode: z.ZodOptional<z.ZodString>;
121
+ email: z.ZodString;
122
+ firstName: z.ZodOptional<z.ZodString>;
123
+ lastName: z.ZodOptional<z.ZodString>;
124
+ phone: z.ZodOptional<z.ZodString>;
125
+ birthDate: z.ZodOptional<z.ZodString>;
126
+ gender: z.ZodOptional<z.ZodEnum<["male", "female", "not_disclosed"]>>;
127
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
128
+ agreement1: z.ZodOptional<z.ZodBoolean>;
129
+ agreement2: z.ZodOptional<z.ZodBoolean>;
130
+ agreement3: z.ZodOptional<z.ZodBoolean>;
131
+ address: z.ZodOptional<z.ZodObject<{
132
+ street: z.ZodOptional<z.ZodString>;
133
+ city: z.ZodOptional<z.ZodString>;
134
+ postal: z.ZodOptional<z.ZodString>;
135
+ country: z.ZodOptional<z.ZodString>;
136
+ province: z.ZodOptional<z.ZodString>;
137
+ }, "strip", z.ZodTypeAny, {
138
+ street?: string | undefined;
139
+ city?: string | undefined;
140
+ postal?: string | undefined;
141
+ country?: string | undefined;
142
+ province?: string | undefined;
143
+ }, {
144
+ street?: string | undefined;
145
+ city?: string | undefined;
146
+ postal?: string | undefined;
147
+ country?: string | undefined;
148
+ province?: string | undefined;
149
+ }>>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ email: string;
152
+ storeCode?: string | undefined;
153
+ agreement1?: boolean | undefined;
154
+ agreement2?: boolean | undefined;
155
+ agreement3?: boolean | undefined;
156
+ firstName?: string | undefined;
157
+ lastName?: string | undefined;
158
+ phone?: string | undefined;
159
+ birthDate?: string | undefined;
160
+ gender?: "male" | "female" | "not_disclosed" | undefined;
161
+ loyaltyCardNumber?: string | undefined;
162
+ address?: {
163
+ street?: string | undefined;
164
+ city?: string | undefined;
165
+ postal?: string | undefined;
166
+ country?: string | undefined;
167
+ province?: string | undefined;
168
+ } | undefined;
169
+ }, {
170
+ email: string;
171
+ storeCode?: string | undefined;
172
+ agreement1?: boolean | undefined;
173
+ agreement2?: boolean | undefined;
174
+ agreement3?: boolean | undefined;
175
+ firstName?: string | undefined;
176
+ lastName?: string | undefined;
177
+ phone?: string | undefined;
178
+ birthDate?: string | undefined;
179
+ gender?: "male" | "female" | "not_disclosed" | undefined;
180
+ loyaltyCardNumber?: string | undefined;
181
+ address?: {
182
+ street?: string | undefined;
183
+ city?: string | undefined;
184
+ postal?: string | undefined;
185
+ country?: string | undefined;
186
+ province?: string | undefined;
187
+ } | undefined;
188
+ }>;
189
+ export declare const MemberUpdateInputSchema: z.ZodObject<{
190
+ storeCode: z.ZodOptional<z.ZodString>;
191
+ memberId: z.ZodString;
192
+ firstName: z.ZodOptional<z.ZodString>;
193
+ lastName: z.ZodOptional<z.ZodString>;
194
+ phone: z.ZodOptional<z.ZodString>;
195
+ birthDate: z.ZodOptional<z.ZodString>;
196
+ gender: z.ZodOptional<z.ZodEnum<["male", "female", "not_disclosed"]>>;
197
+ address: z.ZodOptional<z.ZodObject<{
198
+ street: z.ZodOptional<z.ZodString>;
199
+ city: z.ZodOptional<z.ZodString>;
200
+ postal: z.ZodOptional<z.ZodString>;
201
+ country: z.ZodOptional<z.ZodString>;
202
+ province: z.ZodOptional<z.ZodString>;
203
+ }, "strip", z.ZodTypeAny, {
204
+ street?: string | undefined;
205
+ city?: string | undefined;
206
+ postal?: string | undefined;
207
+ country?: string | undefined;
208
+ province?: string | undefined;
209
+ }, {
210
+ street?: string | undefined;
211
+ city?: string | undefined;
212
+ postal?: string | undefined;
213
+ country?: string | undefined;
214
+ province?: string | undefined;
215
+ }>>;
216
+ agreement1: z.ZodOptional<z.ZodBoolean>;
217
+ agreement2: z.ZodOptional<z.ZodBoolean>;
218
+ agreement3: z.ZodOptional<z.ZodBoolean>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ memberId: string;
221
+ storeCode?: string | undefined;
222
+ agreement1?: boolean | undefined;
223
+ agreement2?: boolean | undefined;
224
+ agreement3?: boolean | undefined;
225
+ firstName?: string | undefined;
226
+ lastName?: string | undefined;
227
+ phone?: string | undefined;
228
+ birthDate?: string | undefined;
229
+ gender?: "male" | "female" | "not_disclosed" | undefined;
230
+ address?: {
231
+ street?: string | undefined;
232
+ city?: string | undefined;
233
+ postal?: string | undefined;
234
+ country?: string | undefined;
235
+ province?: string | undefined;
236
+ } | undefined;
237
+ }, {
238
+ memberId: string;
239
+ storeCode?: string | undefined;
240
+ agreement1?: boolean | undefined;
241
+ agreement2?: boolean | undefined;
242
+ agreement3?: boolean | undefined;
243
+ firstName?: string | undefined;
244
+ lastName?: string | undefined;
245
+ phone?: string | undefined;
246
+ birthDate?: string | undefined;
247
+ gender?: "male" | "female" | "not_disclosed" | undefined;
248
+ address?: {
249
+ street?: string | undefined;
250
+ city?: string | undefined;
251
+ postal?: string | undefined;
252
+ country?: string | undefined;
253
+ province?: string | undefined;
254
+ } | undefined;
255
+ }>;
256
+ export declare const MemberListItemSchema: z.ZodObject<{
257
+ customerId: z.ZodString;
258
+ email: z.ZodString;
259
+ firstName: z.ZodOptional<z.ZodString>;
260
+ lastName: z.ZodOptional<z.ZodString>;
261
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
262
+ active: z.ZodBoolean;
263
+ phone: z.ZodOptional<z.ZodString>;
264
+ gender: z.ZodOptional<z.ZodString>;
265
+ birthDate: z.ZodOptional<z.ZodString>;
266
+ createdAt: z.ZodOptional<z.ZodString>;
267
+ registeredAt: z.ZodOptional<z.ZodString>;
268
+ }, "strip", z.ZodTypeAny, {
269
+ active: boolean;
270
+ email: string;
271
+ customerId: string;
272
+ createdAt?: string | undefined;
273
+ firstName?: string | undefined;
274
+ lastName?: string | undefined;
275
+ phone?: string | undefined;
276
+ birthDate?: string | undefined;
277
+ gender?: string | undefined;
278
+ loyaltyCardNumber?: string | undefined;
279
+ registeredAt?: string | undefined;
280
+ }, {
281
+ active: boolean;
282
+ email: string;
283
+ customerId: string;
284
+ createdAt?: string | undefined;
285
+ firstName?: string | undefined;
286
+ lastName?: string | undefined;
287
+ phone?: string | undefined;
288
+ birthDate?: string | undefined;
289
+ gender?: string | undefined;
290
+ loyaltyCardNumber?: string | undefined;
291
+ registeredAt?: string | undefined;
292
+ }>;
293
+ export declare const MemberListResponseSchema: z.ZodObject<{
294
+ items: z.ZodArray<z.ZodObject<{
295
+ customerId: z.ZodString;
296
+ email: z.ZodString;
297
+ firstName: z.ZodOptional<z.ZodString>;
298
+ lastName: z.ZodOptional<z.ZodString>;
299
+ loyaltyCardNumber: z.ZodOptional<z.ZodString>;
300
+ active: z.ZodBoolean;
301
+ phone: z.ZodOptional<z.ZodString>;
302
+ gender: z.ZodOptional<z.ZodString>;
303
+ birthDate: z.ZodOptional<z.ZodString>;
304
+ createdAt: z.ZodOptional<z.ZodString>;
305
+ registeredAt: z.ZodOptional<z.ZodString>;
306
+ }, "strip", z.ZodTypeAny, {
307
+ active: boolean;
308
+ email: string;
309
+ customerId: string;
310
+ createdAt?: string | undefined;
311
+ firstName?: string | undefined;
312
+ lastName?: string | undefined;
313
+ phone?: string | undefined;
314
+ birthDate?: string | undefined;
315
+ gender?: string | undefined;
316
+ loyaltyCardNumber?: string | undefined;
317
+ registeredAt?: string | undefined;
318
+ }, {
319
+ active: boolean;
320
+ email: string;
321
+ customerId: string;
322
+ createdAt?: string | undefined;
323
+ firstName?: string | undefined;
324
+ lastName?: string | undefined;
325
+ phone?: string | undefined;
326
+ birthDate?: string | undefined;
327
+ gender?: string | undefined;
328
+ loyaltyCardNumber?: string | undefined;
329
+ registeredAt?: string | undefined;
330
+ }>, "many">;
331
+ total: z.ZodObject<{
332
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
333
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
334
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
335
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
336
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
337
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
338
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
339
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
340
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
341
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
342
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
343
+ }, z.ZodTypeAny, "passthrough">>;
344
+ }, "strip", z.ZodTypeAny, {
345
+ items: {
346
+ active: boolean;
347
+ email: string;
348
+ customerId: string;
349
+ createdAt?: string | undefined;
350
+ firstName?: string | undefined;
351
+ lastName?: string | undefined;
352
+ phone?: string | undefined;
353
+ birthDate?: string | undefined;
354
+ gender?: string | undefined;
355
+ loyaltyCardNumber?: string | undefined;
356
+ registeredAt?: string | undefined;
357
+ }[];
358
+ total: {
359
+ all?: number | boolean | undefined;
360
+ filtered?: string | number | boolean | undefined;
361
+ estimated?: string | number | boolean | undefined;
362
+ } & {
363
+ [k: string]: unknown;
364
+ };
365
+ }, {
366
+ items: {
367
+ active: boolean;
368
+ email: string;
369
+ customerId: string;
370
+ createdAt?: string | undefined;
371
+ firstName?: string | undefined;
372
+ lastName?: string | undefined;
373
+ phone?: string | undefined;
374
+ birthDate?: string | undefined;
375
+ gender?: string | undefined;
376
+ loyaltyCardNumber?: string | undefined;
377
+ registeredAt?: string | undefined;
378
+ }[];
379
+ total: {
380
+ all?: number | boolean | undefined;
381
+ filtered?: string | number | boolean | undefined;
382
+ estimated?: string | number | boolean | undefined;
383
+ } & {
384
+ [k: string]: unknown;
385
+ };
386
+ }>;
387
+ export declare const MemberTierProgressSchema: z.ZodObject<{
388
+ currentTier: z.ZodOptional<z.ZodObject<{
389
+ levelId: z.ZodString;
390
+ name: z.ZodString;
391
+ }, "strip", z.ZodTypeAny, {
392
+ name: string;
393
+ levelId: string;
394
+ }, {
395
+ name: string;
396
+ levelId: string;
397
+ }>>;
398
+ nextTier: z.ZodOptional<z.ZodObject<{
399
+ levelId: z.ZodString;
400
+ name: z.ZodString;
401
+ }, "strip", z.ZodTypeAny, {
402
+ name: string;
403
+ levelId: string;
404
+ }, {
405
+ name: string;
406
+ levelId: string;
407
+ }>>;
408
+ currentValue: z.ZodNumber;
409
+ requiredValue: z.ZodOptional<z.ZodNumber>;
410
+ progressPercent: z.ZodNumber;
411
+ }, "strip", z.ZodTypeAny, {
412
+ currentValue: number;
413
+ progressPercent: number;
414
+ currentTier?: {
415
+ name: string;
416
+ levelId: string;
417
+ } | undefined;
418
+ nextTier?: {
419
+ name: string;
420
+ levelId: string;
421
+ } | undefined;
422
+ requiredValue?: number | undefined;
423
+ }, {
424
+ currentValue: number;
425
+ progressPercent: number;
426
+ currentTier?: {
427
+ name: string;
428
+ levelId: string;
429
+ } | undefined;
430
+ nextTier?: {
431
+ name: string;
432
+ levelId: string;
433
+ } | undefined;
434
+ requiredValue?: number | undefined;
435
+ }>;
436
+ export type MemberAddress = z.infer<typeof MemberAddressSchema>;
437
+ export type MemberAgreement = z.infer<typeof MemberAgreementSchema>;
438
+ export type Member = z.infer<typeof MemberSchema>;
439
+ export type MemberCreateInput = z.infer<typeof MemberCreateInputSchema>;
440
+ export type MemberUpdateInput = z.infer<typeof MemberUpdateInputSchema>;
441
+ export type MemberListItem = z.infer<typeof MemberListItemSchema>;
442
+ export type MemberListResponse = z.infer<typeof MemberListResponseSchema>;
443
+ export type MemberTierProgress = z.infer<typeof MemberTierProgressSchema>;
@@ -0,0 +1,92 @@
1
+ import { z } from "zod";
2
+ import { TotalSchema } from "./common.js";
3
+ export const MemberAddressSchema = z.object({
4
+ street: z.string().optional(),
5
+ city: z.string().optional(),
6
+ postal: z.string().optional(),
7
+ country: z.string().optional(),
8
+ province: z.string().optional(),
9
+ });
10
+ export const MemberAgreementSchema = z.object({
11
+ agreement1: z.boolean().optional(),
12
+ agreement2: z.boolean().optional(),
13
+ agreement3: z.boolean().optional(),
14
+ });
15
+ export const MemberSchema = z.object({
16
+ memberId: z.string(),
17
+ email: z.string(),
18
+ firstName: z.string().optional(),
19
+ lastName: z.string().optional(),
20
+ phone: z.string().optional(),
21
+ birthDate: z.string().optional(),
22
+ gender: z.enum(["male", "female", "not_disclosed"]).optional(),
23
+ loyaltyCardNumber: z.string().optional(),
24
+ active: z.boolean(),
25
+ createdAt: z.string().optional(),
26
+ address: MemberAddressSchema.optional(),
27
+ agreement1: z.boolean().optional(),
28
+ agreement2: z.boolean().optional(),
29
+ agreement3: z.boolean().optional(),
30
+ levelId: z.string().optional(),
31
+ levelName: z.string().optional(),
32
+ points: z.number().optional(),
33
+ });
34
+ export const MemberCreateInputSchema = z.object({
35
+ storeCode: z.string().optional(),
36
+ email: z.string().email(),
37
+ firstName: z.string().optional(),
38
+ lastName: z.string().optional(),
39
+ phone: z.string().optional(),
40
+ birthDate: z.string().optional(),
41
+ gender: z.enum(["male", "female", "not_disclosed"]).optional(),
42
+ loyaltyCardNumber: z.string().optional(),
43
+ agreement1: z.boolean().optional(),
44
+ agreement2: z.boolean().optional(),
45
+ agreement3: z.boolean().optional(),
46
+ address: MemberAddressSchema.optional(),
47
+ });
48
+ export const MemberUpdateInputSchema = z.object({
49
+ storeCode: z.string().optional(),
50
+ memberId: z.string(),
51
+ firstName: z.string().optional(),
52
+ lastName: z.string().optional(),
53
+ phone: z.string().optional(),
54
+ birthDate: z.string().optional(),
55
+ gender: z.enum(["male", "female", "not_disclosed"]).optional(),
56
+ address: MemberAddressSchema.optional(),
57
+ agreement1: z.boolean().optional(),
58
+ agreement2: z.boolean().optional(),
59
+ agreement3: z.boolean().optional(),
60
+ });
61
+ // API uses customerId not memberId in responses
62
+ export const MemberListItemSchema = z.object({
63
+ customerId: z.string(),
64
+ email: z.string(),
65
+ firstName: z.string().optional(),
66
+ lastName: z.string().optional(),
67
+ loyaltyCardNumber: z.string().optional(),
68
+ active: z.boolean(),
69
+ phone: z.string().optional(),
70
+ gender: z.string().optional(),
71
+ birthDate: z.string().optional(),
72
+ createdAt: z.string().optional(),
73
+ registeredAt: z.string().optional(),
74
+ });
75
+ // API returns { items: [...], total: {} }
76
+ export const MemberListResponseSchema = z.object({
77
+ items: z.array(MemberListItemSchema),
78
+ total: TotalSchema,
79
+ });
80
+ export const MemberTierProgressSchema = z.object({
81
+ currentTier: z.object({
82
+ levelId: z.string(),
83
+ name: z.string(),
84
+ }).optional(),
85
+ nextTier: z.object({
86
+ levelId: z.string(),
87
+ name: z.string(),
88
+ }).optional(),
89
+ currentValue: z.number(),
90
+ requiredValue: z.number().optional(),
91
+ progressPercent: z.number(),
92
+ });