@open-loyalty/mcp-server 1.0.3 → 1.3.1

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 (142) hide show
  1. package/README.md +180 -177
  2. package/dist/auth/provider.js +2 -14
  3. package/dist/auth/storage.js +22 -0
  4. package/dist/client/http.d.ts +5 -0
  5. package/dist/client/http.js +62 -3
  6. package/dist/config.d.ts +6 -5
  7. package/dist/config.js +15 -11
  8. package/dist/http.js +170 -65
  9. package/dist/instructions.d.ts +5 -0
  10. package/dist/instructions.js +420 -0
  11. package/dist/prompts/fan-engagement-setup.d.ts +107 -0
  12. package/dist/prompts/fan-engagement-setup.js +492 -0
  13. package/dist/server.d.ts +1 -1
  14. package/dist/server.js +68 -278
  15. package/dist/tools/achievement/handlers.d.ts +117 -0
  16. package/dist/tools/achievement/handlers.js +161 -0
  17. package/dist/tools/achievement/index.d.ts +479 -0
  18. package/dist/tools/achievement/index.js +74 -0
  19. package/dist/tools/achievement/schemas.d.ts +433 -0
  20. package/dist/tools/achievement/schemas.js +142 -0
  21. package/dist/tools/achievement.d.ts +155 -121
  22. package/dist/tools/achievement.js +82 -39
  23. package/dist/tools/admin.d.ts +18 -6
  24. package/dist/tools/admin.js +24 -12
  25. package/dist/tools/analytics.d.ts +29 -11
  26. package/dist/tools/analytics.js +58 -48
  27. package/dist/tools/apikey.d.ts +10 -3
  28. package/dist/tools/apikey.js +13 -6
  29. package/dist/tools/audit.d.ts +6 -2
  30. package/dist/tools/audit.js +8 -4
  31. package/dist/tools/badge.d.ts +14 -6
  32. package/dist/tools/badge.js +36 -27
  33. package/dist/tools/campaign/handlers.d.ts +42 -0
  34. package/dist/tools/campaign/handlers.js +223 -0
  35. package/dist/tools/campaign/index.d.ts +783 -0
  36. package/dist/tools/campaign/index.js +112 -0
  37. package/dist/tools/campaign/member-handlers.d.ts +60 -0
  38. package/dist/tools/campaign/member-handlers.js +159 -0
  39. package/dist/tools/campaign/schemas.d.ts +704 -0
  40. package/dist/tools/campaign/schemas.js +259 -0
  41. package/dist/tools/campaign/types.d.ts +161 -0
  42. package/dist/tools/campaign/types.js +2 -0
  43. package/dist/tools/campaign.d.ts +41 -16
  44. package/dist/tools/campaign.js +38 -25
  45. package/dist/tools/custom-event.d.ts +315 -0
  46. package/dist/tools/custom-event.js +270 -0
  47. package/dist/tools/export.d.ts +12 -4
  48. package/dist/tools/export.js +25 -20
  49. package/dist/tools/import.d.ts +9 -3
  50. package/dist/tools/import.js +33 -21
  51. package/dist/tools/index.d.ts +3 -11
  52. package/dist/tools/index.js +17 -475
  53. package/dist/tools/member/handlers.d.ts +111 -0
  54. package/dist/tools/member/handlers.js +206 -0
  55. package/dist/tools/member/index.d.ts +169 -0
  56. package/dist/tools/member/index.js +92 -0
  57. package/dist/tools/member/schemas.d.ts +89 -0
  58. package/dist/tools/member/schemas.js +65 -0
  59. package/dist/tools/member.d.ts +21 -0
  60. package/dist/tools/member.js +56 -62
  61. package/dist/tools/points.d.ts +19 -6
  62. package/dist/tools/points.js +51 -49
  63. package/dist/tools/referral/handlers.d.ts +47 -0
  64. package/dist/tools/referral/handlers.js +115 -0
  65. package/dist/tools/referral/index.d.ts +44 -0
  66. package/dist/tools/referral/index.js +44 -0
  67. package/dist/tools/referral/schemas.d.ts +34 -0
  68. package/dist/tools/referral/schemas.js +52 -0
  69. package/dist/tools/reward/handlers.d.ts +110 -0
  70. package/dist/tools/reward/handlers.js +289 -0
  71. package/dist/tools/reward/index.d.ts +177 -0
  72. package/dist/tools/reward/index.js +90 -0
  73. package/dist/tools/reward/schemas.d.ts +116 -0
  74. package/dist/tools/reward/schemas.js +91 -0
  75. package/dist/tools/reward.d.ts +18 -0
  76. package/dist/tools/reward.js +56 -66
  77. package/dist/tools/role.d.ts +26 -7
  78. package/dist/tools/role.js +25 -12
  79. package/dist/tools/segment/handlers.d.ts +87 -0
  80. package/dist/tools/segment/handlers.js +174 -0
  81. package/dist/tools/segment/index.d.ts +395 -0
  82. package/dist/tools/segment/index.js +87 -0
  83. package/dist/tools/segment/schemas.d.ts +337 -0
  84. package/dist/tools/segment/schemas.js +79 -0
  85. package/dist/tools/segment.d.ts +29 -10
  86. package/dist/tools/segment.js +84 -50
  87. package/dist/tools/store.d.ts +12 -4
  88. package/dist/tools/store.js +16 -8
  89. package/dist/tools/tierset.d.ts +19 -7
  90. package/dist/tools/tierset.js +44 -35
  91. package/dist/tools/transaction.d.ts +16 -8
  92. package/dist/tools/transaction.js +25 -21
  93. package/dist/tools/wallet-type.d.ts +7 -3
  94. package/dist/tools/wallet-type.js +14 -12
  95. package/dist/tools/webhook.d.ts +23 -10
  96. package/dist/tools/webhook.js +135 -33
  97. package/dist/types/schemas/achievement.d.ts +12 -309
  98. package/dist/types/schemas/achievement.js +0 -13
  99. package/dist/types/schemas/admin.d.ts +10 -97
  100. package/dist/types/schemas/admin.js +0 -38
  101. package/dist/types/schemas/badge.d.ts +0 -37
  102. package/dist/types/schemas/badge.js +0 -11
  103. package/dist/types/schemas/campaign.d.ts +64 -832
  104. package/dist/types/schemas/campaign.js +2 -25
  105. package/dist/types/schemas/common.d.ts +5 -0
  106. package/dist/types/schemas/common.js +5 -0
  107. package/dist/types/schemas/export.d.ts +0 -17
  108. package/dist/types/schemas/export.js +0 -7
  109. package/dist/types/schemas/member.d.ts +37 -176
  110. package/dist/types/schemas/member.js +0 -27
  111. package/dist/types/schemas/points.d.ts +0 -63
  112. package/dist/types/schemas/points.js +0 -22
  113. package/dist/types/schemas/reward.d.ts +71 -68
  114. package/dist/types/schemas/reward.js +8 -28
  115. package/dist/types/schemas/role.d.ts +0 -100
  116. package/dist/types/schemas/role.js +0 -29
  117. package/dist/types/schemas/segment.d.ts +0 -58
  118. package/dist/types/schemas/segment.js +0 -17
  119. package/dist/types/schemas/tierset.d.ts +0 -176
  120. package/dist/types/schemas/tierset.js +0 -27
  121. package/dist/types/schemas/transaction.d.ts +23 -254
  122. package/dist/types/schemas/transaction.js +0 -7
  123. package/dist/types/schemas/wallet-type.d.ts +8 -8
  124. package/dist/types/schemas/wallet-type.js +1 -1
  125. package/dist/types/schemas/webhook.d.ts +0 -58
  126. package/dist/types/schemas/webhook.js +0 -12
  127. package/dist/utils/errors.js +30 -3
  128. package/dist/utils/payload.d.ts +12 -0
  129. package/dist/utils/payload.js +14 -0
  130. package/dist/workflows/app-login-streak.d.ts +39 -0
  131. package/dist/workflows/app-login-streak.js +298 -0
  132. package/dist/workflows/early-arrival.d.ts +33 -0
  133. package/dist/workflows/early-arrival.js +148 -0
  134. package/dist/workflows/index.d.ts +101 -0
  135. package/dist/workflows/index.js +208 -0
  136. package/dist/workflows/match-attendance.d.ts +45 -0
  137. package/dist/workflows/match-attendance.js +308 -0
  138. package/dist/workflows/sportsbar-visit.d.ts +41 -0
  139. package/dist/workflows/sportsbar-visit.js +284 -0
  140. package/dist/workflows/vod-watching.d.ts +43 -0
  141. package/dist/workflows/vod-watching.js +326 -0
  142. package/package.json +10 -2
@@ -13,10 +13,11 @@ export declare const RewardCategorySchema: z.ZodObject<{
13
13
  active: boolean;
14
14
  categoryId: string;
15
15
  }>;
16
- export declare const RewardSchema: z.ZodObject<{
16
+ export declare const RewardSchema: z.ZodEffects<z.ZodObject<{
17
17
  rewardId: z.ZodString;
18
18
  name: z.ZodString;
19
- type: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
19
+ reward: z.ZodOptional<z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>>;
20
+ type: z.ZodOptional<z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>>;
20
21
  costInPoints: z.ZodOptional<z.ZodNumber>;
21
22
  active: z.ZodBoolean;
22
23
  description: z.ZodOptional<z.ZodString>;
@@ -26,15 +27,16 @@ export declare const RewardSchema: z.ZodObject<{
26
27
  segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
28
  target: z.ZodOptional<z.ZodNullable<z.ZodEnum<["level", "segment"]>>>;
28
29
  couponValue: z.ZodOptional<z.ZodNumber>;
29
- couponValueType: z.ZodOptional<z.ZodEnum<["Money", "Percentage"]>>;
30
+ couponValueType: z.ZodOptional<z.ZodEnum<["money", "percentage", "Money", "Percentage"]>>;
30
31
  daysValid: z.ZodOptional<z.ZodNumber>;
31
32
  stock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
32
33
  }, "strip", z.ZodTypeAny, {
33
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
34
34
  name: string;
35
35
  active: boolean;
36
36
  rewardId: string;
37
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
37
38
  description?: string | undefined;
39
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
38
40
  costInPoints?: number | undefined;
39
41
  usageInstruction?: string | undefined;
40
42
  categories?: string[] | undefined;
@@ -42,15 +44,16 @@ export declare const RewardSchema: z.ZodObject<{
42
44
  segments?: string[] | undefined;
43
45
  target?: "level" | "segment" | null | undefined;
44
46
  couponValue?: number | undefined;
45
- couponValueType?: "Money" | "Percentage" | undefined;
47
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
46
48
  daysValid?: number | undefined;
47
49
  stock?: number | null | undefined;
48
50
  }, {
49
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
50
51
  name: string;
51
52
  active: boolean;
52
53
  rewardId: string;
54
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
53
55
  description?: string | undefined;
56
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
54
57
  costInPoints?: number | undefined;
55
58
  usageInstruction?: string | undefined;
56
59
  categories?: string[] | undefined;
@@ -58,32 +61,16 @@ export declare const RewardSchema: z.ZodObject<{
58
61
  segments?: string[] | undefined;
59
62
  target?: "level" | "segment" | null | undefined;
60
63
  couponValue?: number | undefined;
61
- couponValueType?: "Money" | "Percentage" | undefined;
64
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
62
65
  daysValid?: number | undefined;
63
66
  stock?: number | null | undefined;
64
- }>;
65
- export declare const RewardCreateInputSchema: z.ZodObject<{
66
- storeCode: z.ZodOptional<z.ZodString>;
67
- name: z.ZodString;
68
- type: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
69
- costInPoints: z.ZodOptional<z.ZodNumber>;
70
- description: z.ZodOptional<z.ZodString>;
71
- usageInstruction: z.ZodOptional<z.ZodString>;
72
- active: z.ZodOptional<z.ZodBoolean>;
73
- categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
74
- levels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
75
- segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
76
- target: z.ZodOptional<z.ZodNullable<z.ZodEnum<["level", "segment"]>>>;
77
- couponValue: z.ZodOptional<z.ZodNumber>;
78
- couponValueType: z.ZodOptional<z.ZodEnum<["Money", "Percentage"]>>;
79
- daysValid: z.ZodOptional<z.ZodNumber>;
80
- stock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
81
- }, "strip", z.ZodTypeAny, {
82
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
67
+ }>, {
68
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
83
69
  name: string;
84
- active?: boolean | undefined;
70
+ active: boolean;
71
+ rewardId: string;
85
72
  description?: string | undefined;
86
- storeCode?: string | undefined;
73
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
87
74
  costInPoints?: number | undefined;
88
75
  usageInstruction?: string | undefined;
89
76
  categories?: string[] | undefined;
@@ -91,15 +78,16 @@ export declare const RewardCreateInputSchema: z.ZodObject<{
91
78
  segments?: string[] | undefined;
92
79
  target?: "level" | "segment" | null | undefined;
93
80
  couponValue?: number | undefined;
94
- couponValueType?: "Money" | "Percentage" | undefined;
81
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
95
82
  daysValid?: number | undefined;
96
83
  stock?: number | null | undefined;
97
84
  }, {
98
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
99
85
  name: string;
100
- active?: boolean | undefined;
86
+ active: boolean;
87
+ rewardId: string;
88
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
101
89
  description?: string | undefined;
102
- storeCode?: string | undefined;
90
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
103
91
  costInPoints?: number | undefined;
104
92
  usageInstruction?: string | undefined;
105
93
  categories?: string[] | undefined;
@@ -107,32 +95,10 @@ export declare const RewardCreateInputSchema: z.ZodObject<{
107
95
  segments?: string[] | undefined;
108
96
  target?: "level" | "segment" | null | undefined;
109
97
  couponValue?: number | undefined;
110
- couponValueType?: "Money" | "Percentage" | undefined;
98
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
111
99
  daysValid?: number | undefined;
112
100
  stock?: number | null | undefined;
113
101
  }>;
114
- export declare const RewardBuyInputSchema: z.ZodObject<{
115
- storeCode: z.ZodOptional<z.ZodString>;
116
- rewardId: z.ZodString;
117
- memberId: z.ZodString;
118
- quantity: z.ZodOptional<z.ZodNumber>;
119
- couponValue: z.ZodOptional<z.ZodNumber>;
120
- withoutPoints: z.ZodOptional<z.ZodBoolean>;
121
- }, "strip", z.ZodTypeAny, {
122
- memberId: string;
123
- rewardId: string;
124
- storeCode?: string | undefined;
125
- couponValue?: number | undefined;
126
- quantity?: number | undefined;
127
- withoutPoints?: boolean | undefined;
128
- }, {
129
- memberId: string;
130
- rewardId: string;
131
- storeCode?: string | undefined;
132
- couponValue?: number | undefined;
133
- quantity?: number | undefined;
134
- withoutPoints?: boolean | undefined;
135
- }>;
136
102
  export declare const IssuedRewardSchema: z.ZodObject<{
137
103
  issuedRewardId: z.ZodString;
138
104
  rewardId: z.ZodString;
@@ -156,10 +122,11 @@ export declare const IssuedRewardSchema: z.ZodObject<{
156
122
  issuedAt?: string | undefined;
157
123
  }>;
158
124
  export declare const RewardListResponseSchema: z.ZodObject<{
159
- items: z.ZodArray<z.ZodObject<{
125
+ items: z.ZodArray<z.ZodEffects<z.ZodObject<{
160
126
  rewardId: z.ZodString;
161
127
  name: z.ZodString;
162
- type: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
128
+ reward: z.ZodOptional<z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>>;
129
+ type: z.ZodOptional<z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>>;
163
130
  costInPoints: z.ZodOptional<z.ZodNumber>;
164
131
  active: z.ZodBoolean;
165
132
  description: z.ZodOptional<z.ZodString>;
@@ -169,15 +136,50 @@ export declare const RewardListResponseSchema: z.ZodObject<{
169
136
  segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
170
137
  target: z.ZodOptional<z.ZodNullable<z.ZodEnum<["level", "segment"]>>>;
171
138
  couponValue: z.ZodOptional<z.ZodNumber>;
172
- couponValueType: z.ZodOptional<z.ZodEnum<["Money", "Percentage"]>>;
139
+ couponValueType: z.ZodOptional<z.ZodEnum<["money", "percentage", "Money", "Percentage"]>>;
173
140
  daysValid: z.ZodOptional<z.ZodNumber>;
174
141
  stock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
175
142
  }, "strip", z.ZodTypeAny, {
176
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
143
+ name: string;
144
+ active: boolean;
145
+ rewardId: string;
146
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
147
+ description?: string | undefined;
148
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
149
+ costInPoints?: number | undefined;
150
+ usageInstruction?: string | undefined;
151
+ categories?: string[] | undefined;
152
+ levels?: string[] | undefined;
153
+ segments?: string[] | undefined;
154
+ target?: "level" | "segment" | null | undefined;
155
+ couponValue?: number | undefined;
156
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
157
+ daysValid?: number | undefined;
158
+ stock?: number | null | undefined;
159
+ }, {
160
+ name: string;
161
+ active: boolean;
162
+ rewardId: string;
163
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
164
+ description?: string | undefined;
165
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
166
+ costInPoints?: number | undefined;
167
+ usageInstruction?: string | undefined;
168
+ categories?: string[] | undefined;
169
+ levels?: string[] | undefined;
170
+ segments?: string[] | undefined;
171
+ target?: "level" | "segment" | null | undefined;
172
+ couponValue?: number | undefined;
173
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
174
+ daysValid?: number | undefined;
175
+ stock?: number | null | undefined;
176
+ }>, {
177
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
177
178
  name: string;
178
179
  active: boolean;
179
180
  rewardId: string;
180
181
  description?: string | undefined;
182
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
181
183
  costInPoints?: number | undefined;
182
184
  usageInstruction?: string | undefined;
183
185
  categories?: string[] | undefined;
@@ -185,15 +187,16 @@ export declare const RewardListResponseSchema: z.ZodObject<{
185
187
  segments?: string[] | undefined;
186
188
  target?: "level" | "segment" | null | undefined;
187
189
  couponValue?: number | undefined;
188
- couponValueType?: "Money" | "Percentage" | undefined;
190
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
189
191
  daysValid?: number | undefined;
190
192
  stock?: number | null | undefined;
191
193
  }, {
192
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
193
194
  name: string;
194
195
  active: boolean;
195
196
  rewardId: string;
197
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
196
198
  description?: string | undefined;
199
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
197
200
  costInPoints?: number | undefined;
198
201
  usageInstruction?: string | undefined;
199
202
  categories?: string[] | undefined;
@@ -201,7 +204,7 @@ export declare const RewardListResponseSchema: z.ZodObject<{
201
204
  segments?: string[] | undefined;
202
205
  target?: "level" | "segment" | null | undefined;
203
206
  couponValue?: number | undefined;
204
- couponValueType?: "Money" | "Percentage" | undefined;
207
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
205
208
  daysValid?: number | undefined;
206
209
  stock?: number | null | undefined;
207
210
  }>, "many">;
@@ -220,11 +223,12 @@ export declare const RewardListResponseSchema: z.ZodObject<{
220
223
  }, z.ZodTypeAny, "passthrough">>;
221
224
  }, "strip", z.ZodTypeAny, {
222
225
  items: {
223
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
226
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
224
227
  name: string;
225
228
  active: boolean;
226
229
  rewardId: string;
227
230
  description?: string | undefined;
231
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
228
232
  costInPoints?: number | undefined;
229
233
  usageInstruction?: string | undefined;
230
234
  categories?: string[] | undefined;
@@ -232,7 +236,7 @@ export declare const RewardListResponseSchema: z.ZodObject<{
232
236
  segments?: string[] | undefined;
233
237
  target?: "level" | "segment" | null | undefined;
234
238
  couponValue?: number | undefined;
235
- couponValueType?: "Money" | "Percentage" | undefined;
239
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
236
240
  daysValid?: number | undefined;
237
241
  stock?: number | null | undefined;
238
242
  }[];
@@ -245,11 +249,12 @@ export declare const RewardListResponseSchema: z.ZodObject<{
245
249
  };
246
250
  }, {
247
251
  items: {
248
- type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
249
252
  name: string;
250
253
  active: boolean;
251
254
  rewardId: string;
255
+ type?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
252
256
  description?: string | undefined;
257
+ reward?: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel" | undefined;
253
258
  costInPoints?: number | undefined;
254
259
  usageInstruction?: string | undefined;
255
260
  categories?: string[] | undefined;
@@ -257,7 +262,7 @@ export declare const RewardListResponseSchema: z.ZodObject<{
257
262
  segments?: string[] | undefined;
258
263
  target?: "level" | "segment" | null | undefined;
259
264
  couponValue?: number | undefined;
260
- couponValueType?: "Money" | "Percentage" | undefined;
265
+ couponValueType?: "money" | "percentage" | "Money" | "Percentage" | undefined;
261
266
  daysValid?: number | undefined;
262
267
  stock?: number | null | undefined;
263
268
  }[];
@@ -272,7 +277,5 @@ export declare const RewardListResponseSchema: z.ZodObject<{
272
277
  export type RewardType = z.infer<typeof RewardTypeEnum>;
273
278
  export type RewardCategory = z.infer<typeof RewardCategorySchema>;
274
279
  export type Reward = z.infer<typeof RewardSchema>;
275
- export type RewardCreateInput = z.infer<typeof RewardCreateInputSchema>;
276
- export type RewardBuyInput = z.infer<typeof RewardBuyInputSchema>;
277
280
  export type IssuedReward = z.infer<typeof IssuedRewardSchema>;
278
281
  export type RewardListResponse = z.infer<typeof RewardListResponseSchema>;
@@ -12,10 +12,12 @@ export const RewardCategorySchema = z.object({
12
12
  name: z.string(),
13
13
  active: z.boolean(),
14
14
  });
15
+ // API returns "reward" field for type, and lowercase couponValueType
15
16
  export const RewardSchema = z.object({
16
17
  rewardId: z.string(),
17
18
  name: z.string(),
18
- type: RewardTypeEnum,
19
+ reward: RewardTypeEnum.optional(), // API uses "reward" field for type
20
+ type: RewardTypeEnum.optional(), // Fallback if API returns "type"
19
21
  costInPoints: z.number().optional(),
20
22
  active: z.boolean(),
21
23
  description: z.string().optional(),
@@ -25,35 +27,13 @@ export const RewardSchema = z.object({
25
27
  segments: z.array(z.string()).optional(),
26
28
  target: z.enum(["level", "segment"]).nullable().optional(),
27
29
  couponValue: z.number().optional(),
28
- couponValueType: z.enum(["Money", "Percentage"]).optional(),
30
+ couponValueType: z.enum(["money", "percentage", "Money", "Percentage"]).optional(), // API returns lowercase
29
31
  daysValid: z.number().optional(),
30
32
  stock: z.number().nullable().optional(),
31
- });
32
- export const RewardCreateInputSchema = z.object({
33
- storeCode: z.string().optional(),
34
- name: z.string(),
35
- type: RewardTypeEnum,
36
- costInPoints: z.number().optional(),
37
- description: z.string().optional(),
38
- usageInstruction: z.string().optional(),
39
- active: z.boolean().optional(),
40
- categories: z.array(z.string()).optional(),
41
- levels: z.array(z.string()).optional(),
42
- segments: z.array(z.string()).optional(),
43
- target: z.enum(["level", "segment"]).nullable().optional(),
44
- couponValue: z.number().optional(),
45
- couponValueType: z.enum(["Money", "Percentage"]).optional(),
46
- daysValid: z.number().optional(),
47
- stock: z.number().nullable().optional(),
48
- });
49
- export const RewardBuyInputSchema = z.object({
50
- storeCode: z.string().optional(),
51
- rewardId: z.string(),
52
- memberId: z.string(),
53
- quantity: z.number().optional(),
54
- couponValue: z.number().optional(),
55
- withoutPoints: z.boolean().optional(),
56
- });
33
+ }).transform((data) => ({
34
+ ...data,
35
+ type: data.reward || data.type, // Normalize to "type" field
36
+ }));
57
37
  export const IssuedRewardSchema = z.object({
58
38
  issuedRewardId: z.string(),
59
39
  rewardId: z.string(),
@@ -143,106 +143,6 @@ export declare const RoleListItemSchema: z.ZodObject<{
143
143
  stores?: string[] | undefined;
144
144
  }>;
145
145
  export type RoleListItem = z.infer<typeof RoleListItemSchema>;
146
- /**
147
- * Role Permission Input Schema.
148
- * Used when creating/updating a role.
149
- */
150
- export declare const RolePermissionInputSchema: z.ZodObject<{
151
- resource: z.ZodString;
152
- access: z.ZodString;
153
- filterQuery: z.ZodOptional<z.ZodString>;
154
- }, "strip", z.ZodTypeAny, {
155
- resource: string;
156
- access: string;
157
- filterQuery?: string | undefined;
158
- }, {
159
- resource: string;
160
- access: string;
161
- filterQuery?: string | undefined;
162
- }>;
163
- export type RolePermissionInput = z.infer<typeof RolePermissionInputSchema>;
164
- /**
165
- * Role Create Input Schema.
166
- * Input for POST /api/acl/role - uses { role: {...} } wrapper
167
- */
168
- export declare const RoleCreateInputSchema: z.ZodObject<{
169
- name: z.ZodString;
170
- default: z.ZodOptional<z.ZodBoolean>;
171
- permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
172
- resource: z.ZodString;
173
- access: z.ZodString;
174
- filterQuery: z.ZodOptional<z.ZodString>;
175
- }, "strip", z.ZodTypeAny, {
176
- resource: string;
177
- access: string;
178
- filterQuery?: string | undefined;
179
- }, {
180
- resource: string;
181
- access: string;
182
- filterQuery?: string | undefined;
183
- }>, "many">>;
184
- stores: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
185
- }, "strip", z.ZodTypeAny, {
186
- name: string;
187
- default?: boolean | undefined;
188
- permissions?: {
189
- resource: string;
190
- access: string;
191
- filterQuery?: string | undefined;
192
- }[] | undefined;
193
- stores?: string[] | undefined;
194
- }, {
195
- name: string;
196
- default?: boolean | undefined;
197
- permissions?: {
198
- resource: string;
199
- access: string;
200
- filterQuery?: string | undefined;
201
- }[] | undefined;
202
- stores?: string[] | undefined;
203
- }>;
204
- export type RoleCreateInput = z.infer<typeof RoleCreateInputSchema>;
205
- /**
206
- * Role Update Input Schema.
207
- * Input for PUT /api/acl/role/{roleId}
208
- */
209
- export declare const RoleUpdateInputSchema: z.ZodObject<{
210
- name: z.ZodOptional<z.ZodString>;
211
- default: z.ZodOptional<z.ZodBoolean>;
212
- permissions: z.ZodOptional<z.ZodArray<z.ZodObject<{
213
- resource: z.ZodString;
214
- access: z.ZodString;
215
- filterQuery: z.ZodOptional<z.ZodString>;
216
- }, "strip", z.ZodTypeAny, {
217
- resource: string;
218
- access: string;
219
- filterQuery?: string | undefined;
220
- }, {
221
- resource: string;
222
- access: string;
223
- filterQuery?: string | undefined;
224
- }>, "many">>;
225
- stores: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
226
- }, "strip", z.ZodTypeAny, {
227
- name?: string | undefined;
228
- default?: boolean | undefined;
229
- permissions?: {
230
- resource: string;
231
- access: string;
232
- filterQuery?: string | undefined;
233
- }[] | undefined;
234
- stores?: string[] | undefined;
235
- }, {
236
- name?: string | undefined;
237
- default?: boolean | undefined;
238
- permissions?: {
239
- resource: string;
240
- access: string;
241
- filterQuery?: string | undefined;
242
- }[] | undefined;
243
- stores?: string[] | undefined;
244
- }>;
245
- export type RoleUpdateInput = z.infer<typeof RoleUpdateInputSchema>;
246
146
  /**
247
147
  * ACL Resource Schema.
248
148
  * Represents an available ACL resource from GET /api/acl/resources
@@ -36,35 +36,6 @@ export const RoleListItemSchema = z.object({
36
36
  permissions: z.array(RolePermissionSchema).optional().describe("Permissions assigned to this role."),
37
37
  stores: z.array(z.string()).optional().describe("Store codes this role has access to."),
38
38
  });
39
- /**
40
- * Role Permission Input Schema.
41
- * Used when creating/updating a role.
42
- */
43
- export const RolePermissionInputSchema = z.object({
44
- resource: z.string().describe("Resource name (e.g., ANALYTICS, EVENTS)."),
45
- access: z.string().describe("Access level (e.g., VIEW, MODIFY)."),
46
- filterQuery: z.string().optional().describe("Optional filter query."),
47
- });
48
- /**
49
- * Role Create Input Schema.
50
- * Input for POST /api/acl/role - uses { role: {...} } wrapper
51
- */
52
- export const RoleCreateInputSchema = z.object({
53
- name: z.string().describe("Role name (required)."),
54
- default: z.boolean().optional().describe("Whether this is a default role for new admins."),
55
- permissions: z.array(RolePermissionInputSchema).optional().describe("Permissions to assign."),
56
- stores: z.array(z.string()).optional().describe("Store codes to assign access."),
57
- });
58
- /**
59
- * Role Update Input Schema.
60
- * Input for PUT /api/acl/role/{roleId}
61
- */
62
- export const RoleUpdateInputSchema = z.object({
63
- name: z.string().optional().describe("Role name."),
64
- default: z.boolean().optional().describe("Whether this is a default role."),
65
- permissions: z.array(RolePermissionInputSchema).optional().describe("Permissions to assign."),
66
- stores: z.array(z.string()).optional().describe("Store codes to assign access."),
67
- });
68
39
  /**
69
40
  * ACL Resource Schema.
70
41
  * Represents an available ACL resource from GET /api/acl/resources
@@ -532,61 +532,3 @@ export declare const SegmentListItemSchema: z.ZodObject<{
532
532
  customersCount?: number | undefined;
533
533
  }>;
534
534
  export type SegmentListItem = z.infer<typeof SegmentListItemSchema>;
535
- /**
536
- * Segment Create Input Schema.
537
- * Matches the POST /api/{storeCode}/segment body structure.
538
- * IMPORTANT: Request must be wrapped as { segment: {...} }
539
- */
540
- export declare const SegmentCreateInputSchema: z.ZodObject<{
541
- name: z.ZodString;
542
- description: z.ZodOptional<z.ZodString>;
543
- active: z.ZodOptional<z.ZodBoolean>;
544
- parts: z.ZodArray<z.ZodObject<{
545
- segmentPartId: z.ZodOptional<z.ZodString>;
546
- criteria: z.ZodArray<z.ZodObject<{
547
- type: z.ZodString;
548
- criterionId: z.ZodOptional<z.ZodString>;
549
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
550
- type: z.ZodString;
551
- criterionId: z.ZodOptional<z.ZodString>;
552
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
553
- type: z.ZodString;
554
- criterionId: z.ZodOptional<z.ZodString>;
555
- }, z.ZodTypeAny, "passthrough">>, "many">;
556
- }, "strip", z.ZodTypeAny, {
557
- criteria: z.objectOutputType<{
558
- type: z.ZodString;
559
- criterionId: z.ZodOptional<z.ZodString>;
560
- }, z.ZodTypeAny, "passthrough">[];
561
- segmentPartId?: string | undefined;
562
- }, {
563
- criteria: z.objectInputType<{
564
- type: z.ZodString;
565
- criterionId: z.ZodOptional<z.ZodString>;
566
- }, z.ZodTypeAny, "passthrough">[];
567
- segmentPartId?: string | undefined;
568
- }>, "many">;
569
- }, "strip", z.ZodTypeAny, {
570
- name: string;
571
- parts: {
572
- criteria: z.objectOutputType<{
573
- type: z.ZodString;
574
- criterionId: z.ZodOptional<z.ZodString>;
575
- }, z.ZodTypeAny, "passthrough">[];
576
- segmentPartId?: string | undefined;
577
- }[];
578
- active?: boolean | undefined;
579
- description?: string | undefined;
580
- }, {
581
- name: string;
582
- parts: {
583
- criteria: z.objectInputType<{
584
- type: z.ZodString;
585
- criterionId: z.ZodOptional<z.ZodString>;
586
- }, z.ZodTypeAny, "passthrough">[];
587
- segmentPartId?: string | undefined;
588
- }[];
589
- active?: boolean | undefined;
590
- description?: string | undefined;
591
- }>;
592
- export type SegmentCreateInput = z.infer<typeof SegmentCreateInputSchema>;
@@ -95,20 +95,3 @@ export const SegmentListItemSchema = z.object({
95
95
  customersCount: z.number().optional(),
96
96
  createdAt: z.string().optional(),
97
97
  });
98
- /**
99
- * Segment Create Input Schema.
100
- * Matches the POST /api/{storeCode}/segment body structure.
101
- * IMPORTANT: Request must be wrapped as { segment: {...} }
102
- */
103
- export const SegmentCreateInputSchema = z.object({
104
- name: z.string().describe("Segment name (required)."),
105
- description: z.string().optional().describe("Segment description."),
106
- active: z.boolean().optional().describe("Whether segment is active (default: false)."),
107
- parts: z.array(z.object({
108
- segmentPartId: z.string().optional().describe("Part ID (optional, generated if not provided)."),
109
- criteria: z.array(z.object({
110
- type: z.string().describe("Criterion type."),
111
- criterionId: z.string().optional().describe("Criterion ID (optional)."),
112
- }).passthrough()).describe("Criteria for this part."),
113
- })).describe("Segment parts. Parts use OR logic, criteria within parts use AND logic."),
114
- });