@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.
- package/README.md +180 -177
- package/dist/auth/provider.js +2 -14
- package/dist/auth/storage.js +22 -0
- package/dist/client/http.d.ts +5 -0
- package/dist/client/http.js +62 -3
- package/dist/config.d.ts +6 -5
- package/dist/config.js +15 -11
- package/dist/http.js +170 -65
- package/dist/instructions.d.ts +5 -0
- package/dist/instructions.js +420 -0
- package/dist/prompts/fan-engagement-setup.d.ts +107 -0
- package/dist/prompts/fan-engagement-setup.js +492 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +68 -278
- package/dist/tools/achievement/handlers.d.ts +117 -0
- package/dist/tools/achievement/handlers.js +161 -0
- package/dist/tools/achievement/index.d.ts +479 -0
- package/dist/tools/achievement/index.js +74 -0
- package/dist/tools/achievement/schemas.d.ts +433 -0
- package/dist/tools/achievement/schemas.js +142 -0
- package/dist/tools/achievement.d.ts +155 -121
- package/dist/tools/achievement.js +82 -39
- package/dist/tools/admin.d.ts +18 -6
- package/dist/tools/admin.js +24 -12
- package/dist/tools/analytics.d.ts +29 -11
- package/dist/tools/analytics.js +58 -48
- package/dist/tools/apikey.d.ts +10 -3
- package/dist/tools/apikey.js +13 -6
- package/dist/tools/audit.d.ts +6 -2
- package/dist/tools/audit.js +8 -4
- package/dist/tools/badge.d.ts +14 -6
- package/dist/tools/badge.js +36 -27
- package/dist/tools/campaign/handlers.d.ts +42 -0
- package/dist/tools/campaign/handlers.js +223 -0
- package/dist/tools/campaign/index.d.ts +783 -0
- package/dist/tools/campaign/index.js +112 -0
- package/dist/tools/campaign/member-handlers.d.ts +60 -0
- package/dist/tools/campaign/member-handlers.js +159 -0
- package/dist/tools/campaign/schemas.d.ts +704 -0
- package/dist/tools/campaign/schemas.js +259 -0
- package/dist/tools/campaign/types.d.ts +161 -0
- package/dist/tools/campaign/types.js +2 -0
- package/dist/tools/campaign.d.ts +41 -16
- package/dist/tools/campaign.js +38 -25
- package/dist/tools/custom-event.d.ts +315 -0
- package/dist/tools/custom-event.js +270 -0
- package/dist/tools/export.d.ts +12 -4
- package/dist/tools/export.js +25 -20
- package/dist/tools/import.d.ts +9 -3
- package/dist/tools/import.js +33 -21
- package/dist/tools/index.d.ts +3 -11
- package/dist/tools/index.js +17 -475
- package/dist/tools/member/handlers.d.ts +111 -0
- package/dist/tools/member/handlers.js +206 -0
- package/dist/tools/member/index.d.ts +169 -0
- package/dist/tools/member/index.js +92 -0
- package/dist/tools/member/schemas.d.ts +89 -0
- package/dist/tools/member/schemas.js +65 -0
- package/dist/tools/member.d.ts +21 -0
- package/dist/tools/member.js +56 -62
- package/dist/tools/points.d.ts +19 -6
- package/dist/tools/points.js +51 -49
- package/dist/tools/referral/handlers.d.ts +47 -0
- package/dist/tools/referral/handlers.js +115 -0
- package/dist/tools/referral/index.d.ts +44 -0
- package/dist/tools/referral/index.js +44 -0
- package/dist/tools/referral/schemas.d.ts +34 -0
- package/dist/tools/referral/schemas.js +52 -0
- package/dist/tools/reward/handlers.d.ts +110 -0
- package/dist/tools/reward/handlers.js +289 -0
- package/dist/tools/reward/index.d.ts +177 -0
- package/dist/tools/reward/index.js +90 -0
- package/dist/tools/reward/schemas.d.ts +116 -0
- package/dist/tools/reward/schemas.js +91 -0
- package/dist/tools/reward.d.ts +18 -0
- package/dist/tools/reward.js +56 -66
- package/dist/tools/role.d.ts +26 -7
- package/dist/tools/role.js +25 -12
- package/dist/tools/segment/handlers.d.ts +87 -0
- package/dist/tools/segment/handlers.js +174 -0
- package/dist/tools/segment/index.d.ts +395 -0
- package/dist/tools/segment/index.js +87 -0
- package/dist/tools/segment/schemas.d.ts +337 -0
- package/dist/tools/segment/schemas.js +79 -0
- package/dist/tools/segment.d.ts +29 -10
- package/dist/tools/segment.js +84 -50
- package/dist/tools/store.d.ts +12 -4
- package/dist/tools/store.js +16 -8
- package/dist/tools/tierset.d.ts +19 -7
- package/dist/tools/tierset.js +44 -35
- package/dist/tools/transaction.d.ts +16 -8
- package/dist/tools/transaction.js +25 -21
- package/dist/tools/wallet-type.d.ts +7 -3
- package/dist/tools/wallet-type.js +14 -12
- package/dist/tools/webhook.d.ts +23 -10
- package/dist/tools/webhook.js +135 -33
- package/dist/types/schemas/achievement.d.ts +12 -309
- package/dist/types/schemas/achievement.js +0 -13
- package/dist/types/schemas/admin.d.ts +10 -97
- package/dist/types/schemas/admin.js +0 -38
- package/dist/types/schemas/badge.d.ts +0 -37
- package/dist/types/schemas/badge.js +0 -11
- package/dist/types/schemas/campaign.d.ts +64 -832
- package/dist/types/schemas/campaign.js +2 -25
- package/dist/types/schemas/common.d.ts +5 -0
- package/dist/types/schemas/common.js +5 -0
- package/dist/types/schemas/export.d.ts +0 -17
- package/dist/types/schemas/export.js +0 -7
- package/dist/types/schemas/member.d.ts +37 -176
- package/dist/types/schemas/member.js +0 -27
- package/dist/types/schemas/points.d.ts +0 -63
- package/dist/types/schemas/points.js +0 -22
- package/dist/types/schemas/reward.d.ts +71 -68
- package/dist/types/schemas/reward.js +8 -28
- package/dist/types/schemas/role.d.ts +0 -100
- package/dist/types/schemas/role.js +0 -29
- package/dist/types/schemas/segment.d.ts +0 -58
- package/dist/types/schemas/segment.js +0 -17
- package/dist/types/schemas/tierset.d.ts +0 -176
- package/dist/types/schemas/tierset.js +0 -27
- package/dist/types/schemas/transaction.d.ts +23 -254
- package/dist/types/schemas/transaction.js +0 -7
- package/dist/types/schemas/wallet-type.d.ts +8 -8
- package/dist/types/schemas/wallet-type.js +1 -1
- package/dist/types/schemas/webhook.d.ts +0 -58
- package/dist/types/schemas/webhook.js +0 -12
- package/dist/utils/errors.js +30 -3
- package/dist/utils/payload.d.ts +12 -0
- package/dist/utils/payload.js +14 -0
- package/dist/workflows/app-login-streak.d.ts +39 -0
- package/dist/workflows/app-login-streak.js +298 -0
- package/dist/workflows/early-arrival.d.ts +33 -0
- package/dist/workflows/early-arrival.js +148 -0
- package/dist/workflows/index.d.ts +101 -0
- package/dist/workflows/index.js +208 -0
- package/dist/workflows/match-attendance.d.ts +45 -0
- package/dist/workflows/match-attendance.js +308 -0
- package/dist/workflows/sportsbar-visit.d.ts +41 -0
- package/dist/workflows/sportsbar-visit.js +284 -0
- package/dist/workflows/vod-watching.d.ts +43 -0
- package/dist/workflows/vod-watching.js +326 -0
- package/package.json +10 -2
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AchievementListInputSchema: {
|
|
3
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
4
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
};
|
|
9
|
+
export declare const AchievementCreateInputSchema: {
|
|
10
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
11
|
+
translations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string | undefined;
|
|
20
|
+
}>>;
|
|
21
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
activity: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
startsAt: z.ZodOptional<z.ZodString>;
|
|
24
|
+
endsAt: z.ZodOptional<z.ZodString>;
|
|
25
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
operator?: string | undefined;
|
|
28
|
+
startsAt?: string | undefined;
|
|
29
|
+
endsAt?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
operator?: string | undefined;
|
|
32
|
+
startsAt?: string | undefined;
|
|
33
|
+
endsAt?: string | undefined;
|
|
34
|
+
}>>;
|
|
35
|
+
limit: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
interval: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
type: z.ZodString;
|
|
39
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
type: string;
|
|
42
|
+
value?: number | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
type: string;
|
|
45
|
+
value?: number | undefined;
|
|
46
|
+
}>>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
value?: number | undefined;
|
|
49
|
+
interval?: {
|
|
50
|
+
type: string;
|
|
51
|
+
value?: number | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
value?: number | undefined;
|
|
55
|
+
interval?: {
|
|
56
|
+
type: string;
|
|
57
|
+
value?: number | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
}>>;
|
|
60
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
61
|
+
achievementRuleId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
translations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
description: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
name: string;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
name: string;
|
|
70
|
+
description?: string | undefined;
|
|
71
|
+
}>>>;
|
|
72
|
+
trigger: z.ZodEnum<["transaction", "custom_event", "points_transfer", "reward_redemption", "referral", "achievement", "tier_change", "profile_update"]>;
|
|
73
|
+
type: z.ZodEnum<["direct", "referral"]>;
|
|
74
|
+
event: z.ZodOptional<z.ZodString>;
|
|
75
|
+
completeRule: z.ZodObject<{
|
|
76
|
+
periodGoal: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
77
|
+
period: z.ZodObject<{
|
|
78
|
+
type: z.ZodEnum<["day", "week", "month", "year", "last_day", "calendarDays", "calendarWeeks", "calendarMonths", "calendarYears"]>;
|
|
79
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
consecutive: z.ZodNumber;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
83
|
+
consecutive: number;
|
|
84
|
+
value?: number | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
87
|
+
consecutive: number;
|
|
88
|
+
value?: number | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
uniqueAttribute: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
periodGoal: string | number;
|
|
93
|
+
period: {
|
|
94
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
95
|
+
consecutive: number;
|
|
96
|
+
value?: number | undefined;
|
|
97
|
+
};
|
|
98
|
+
uniqueAttribute?: string | undefined;
|
|
99
|
+
}, {
|
|
100
|
+
periodGoal: string | number;
|
|
101
|
+
period: {
|
|
102
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
103
|
+
consecutive: number;
|
|
104
|
+
value?: number | undefined;
|
|
105
|
+
};
|
|
106
|
+
uniqueAttribute?: string | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
aggregation: z.ZodObject<{
|
|
109
|
+
type: z.ZodEnum<["quantity"]>;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
type: "quantity";
|
|
112
|
+
}, {
|
|
113
|
+
type: "quantity";
|
|
114
|
+
}>;
|
|
115
|
+
conditions: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
116
|
+
limit: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
interval: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
type: z.ZodString;
|
|
120
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
type: string;
|
|
123
|
+
value?: number | undefined;
|
|
124
|
+
}, {
|
|
125
|
+
type: string;
|
|
126
|
+
value?: number | undefined;
|
|
127
|
+
}>>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
value?: number | undefined;
|
|
130
|
+
interval?: {
|
|
131
|
+
type: string;
|
|
132
|
+
value?: number | undefined;
|
|
133
|
+
} | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
value?: number | undefined;
|
|
136
|
+
interval?: {
|
|
137
|
+
type: string;
|
|
138
|
+
value?: number | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
}>>;
|
|
141
|
+
uniqueReferee: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
type: "direct" | "referral";
|
|
144
|
+
trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
|
|
145
|
+
completeRule: {
|
|
146
|
+
periodGoal: string | number;
|
|
147
|
+
period: {
|
|
148
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
149
|
+
consecutive: number;
|
|
150
|
+
value?: number | undefined;
|
|
151
|
+
};
|
|
152
|
+
uniqueAttribute?: string | undefined;
|
|
153
|
+
};
|
|
154
|
+
aggregation: {
|
|
155
|
+
type: "quantity";
|
|
156
|
+
};
|
|
157
|
+
conditions?: Record<string, unknown>[] | undefined;
|
|
158
|
+
translations?: Record<string, {
|
|
159
|
+
name: string;
|
|
160
|
+
description?: string | undefined;
|
|
161
|
+
}> | undefined;
|
|
162
|
+
event?: string | undefined;
|
|
163
|
+
achievementRuleId?: string | undefined;
|
|
164
|
+
limit?: {
|
|
165
|
+
value?: number | undefined;
|
|
166
|
+
interval?: {
|
|
167
|
+
type: string;
|
|
168
|
+
value?: number | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
} | undefined;
|
|
171
|
+
uniqueReferee?: boolean | undefined;
|
|
172
|
+
}, {
|
|
173
|
+
type: "direct" | "referral";
|
|
174
|
+
trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
|
|
175
|
+
completeRule: {
|
|
176
|
+
periodGoal: string | number;
|
|
177
|
+
period: {
|
|
178
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
179
|
+
consecutive: number;
|
|
180
|
+
value?: number | undefined;
|
|
181
|
+
};
|
|
182
|
+
uniqueAttribute?: string | undefined;
|
|
183
|
+
};
|
|
184
|
+
aggregation: {
|
|
185
|
+
type: "quantity";
|
|
186
|
+
};
|
|
187
|
+
conditions?: Record<string, unknown>[] | undefined;
|
|
188
|
+
translations?: Record<string, {
|
|
189
|
+
name: string;
|
|
190
|
+
description?: string | undefined;
|
|
191
|
+
}> | undefined;
|
|
192
|
+
event?: string | undefined;
|
|
193
|
+
achievementRuleId?: string | undefined;
|
|
194
|
+
limit?: {
|
|
195
|
+
value?: number | undefined;
|
|
196
|
+
interval?: {
|
|
197
|
+
type: string;
|
|
198
|
+
value?: number | undefined;
|
|
199
|
+
} | undefined;
|
|
200
|
+
} | undefined;
|
|
201
|
+
uniqueReferee?: boolean | undefined;
|
|
202
|
+
}>, "many">;
|
|
203
|
+
badgeTypeId: z.ZodOptional<z.ZodString>;
|
|
204
|
+
};
|
|
205
|
+
export declare const AchievementGetInputSchema: {
|
|
206
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
207
|
+
achievementId: z.ZodString;
|
|
208
|
+
};
|
|
209
|
+
export declare const AchievementUpdateInputSchema: {
|
|
210
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
211
|
+
achievementId: z.ZodString;
|
|
212
|
+
translations: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
213
|
+
name: z.ZodString;
|
|
214
|
+
description: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
name: string;
|
|
217
|
+
description?: string | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
name: string;
|
|
220
|
+
description?: string | undefined;
|
|
221
|
+
}>>;
|
|
222
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
223
|
+
activity: z.ZodOptional<z.ZodObject<{
|
|
224
|
+
startsAt: z.ZodOptional<z.ZodString>;
|
|
225
|
+
endsAt: z.ZodOptional<z.ZodString>;
|
|
226
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
operator?: string | undefined;
|
|
229
|
+
startsAt?: string | undefined;
|
|
230
|
+
endsAt?: string | undefined;
|
|
231
|
+
}, {
|
|
232
|
+
operator?: string | undefined;
|
|
233
|
+
startsAt?: string | undefined;
|
|
234
|
+
endsAt?: string | undefined;
|
|
235
|
+
}>>;
|
|
236
|
+
limit: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
interval: z.ZodOptional<z.ZodObject<{
|
|
239
|
+
type: z.ZodString;
|
|
240
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
}, "strip", z.ZodTypeAny, {
|
|
242
|
+
type: string;
|
|
243
|
+
value?: number | undefined;
|
|
244
|
+
}, {
|
|
245
|
+
type: string;
|
|
246
|
+
value?: number | undefined;
|
|
247
|
+
}>>;
|
|
248
|
+
}, "strip", z.ZodTypeAny, {
|
|
249
|
+
value?: number | undefined;
|
|
250
|
+
interval?: {
|
|
251
|
+
type: string;
|
|
252
|
+
value?: number | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
}, {
|
|
255
|
+
value?: number | undefined;
|
|
256
|
+
interval?: {
|
|
257
|
+
type: string;
|
|
258
|
+
value?: number | undefined;
|
|
259
|
+
} | undefined;
|
|
260
|
+
}>>;
|
|
261
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
262
|
+
achievementRuleId: z.ZodOptional<z.ZodString>;
|
|
263
|
+
translations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
264
|
+
name: z.ZodString;
|
|
265
|
+
description: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
name: string;
|
|
268
|
+
description?: string | undefined;
|
|
269
|
+
}, {
|
|
270
|
+
name: string;
|
|
271
|
+
description?: string | undefined;
|
|
272
|
+
}>>>;
|
|
273
|
+
trigger: z.ZodEnum<["transaction", "custom_event", "points_transfer", "reward_redemption", "referral", "achievement", "tier_change", "profile_update"]>;
|
|
274
|
+
type: z.ZodEnum<["direct", "referral"]>;
|
|
275
|
+
event: z.ZodOptional<z.ZodString>;
|
|
276
|
+
completeRule: z.ZodObject<{
|
|
277
|
+
periodGoal: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
278
|
+
period: z.ZodObject<{
|
|
279
|
+
type: z.ZodEnum<["day", "week", "month", "year", "last_day", "calendarDays", "calendarWeeks", "calendarMonths", "calendarYears"]>;
|
|
280
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
consecutive: z.ZodNumber;
|
|
282
|
+
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
284
|
+
consecutive: number;
|
|
285
|
+
value?: number | undefined;
|
|
286
|
+
}, {
|
|
287
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
288
|
+
consecutive: number;
|
|
289
|
+
value?: number | undefined;
|
|
290
|
+
}>;
|
|
291
|
+
uniqueAttribute: z.ZodOptional<z.ZodString>;
|
|
292
|
+
}, "strip", z.ZodTypeAny, {
|
|
293
|
+
periodGoal: string | number;
|
|
294
|
+
period: {
|
|
295
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
296
|
+
consecutive: number;
|
|
297
|
+
value?: number | undefined;
|
|
298
|
+
};
|
|
299
|
+
uniqueAttribute?: string | undefined;
|
|
300
|
+
}, {
|
|
301
|
+
periodGoal: string | number;
|
|
302
|
+
period: {
|
|
303
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
304
|
+
consecutive: number;
|
|
305
|
+
value?: number | undefined;
|
|
306
|
+
};
|
|
307
|
+
uniqueAttribute?: string | undefined;
|
|
308
|
+
}>;
|
|
309
|
+
aggregation: z.ZodObject<{
|
|
310
|
+
type: z.ZodEnum<["quantity"]>;
|
|
311
|
+
}, "strip", z.ZodTypeAny, {
|
|
312
|
+
type: "quantity";
|
|
313
|
+
}, {
|
|
314
|
+
type: "quantity";
|
|
315
|
+
}>;
|
|
316
|
+
conditions: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
317
|
+
limit: z.ZodOptional<z.ZodObject<{
|
|
318
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
interval: z.ZodOptional<z.ZodObject<{
|
|
320
|
+
type: z.ZodString;
|
|
321
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
type: string;
|
|
324
|
+
value?: number | undefined;
|
|
325
|
+
}, {
|
|
326
|
+
type: string;
|
|
327
|
+
value?: number | undefined;
|
|
328
|
+
}>>;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
value?: number | undefined;
|
|
331
|
+
interval?: {
|
|
332
|
+
type: string;
|
|
333
|
+
value?: number | undefined;
|
|
334
|
+
} | undefined;
|
|
335
|
+
}, {
|
|
336
|
+
value?: number | undefined;
|
|
337
|
+
interval?: {
|
|
338
|
+
type: string;
|
|
339
|
+
value?: number | undefined;
|
|
340
|
+
} | undefined;
|
|
341
|
+
}>>;
|
|
342
|
+
uniqueReferee: z.ZodOptional<z.ZodBoolean>;
|
|
343
|
+
}, "strip", z.ZodTypeAny, {
|
|
344
|
+
type: "direct" | "referral";
|
|
345
|
+
trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
|
|
346
|
+
completeRule: {
|
|
347
|
+
periodGoal: string | number;
|
|
348
|
+
period: {
|
|
349
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
350
|
+
consecutive: number;
|
|
351
|
+
value?: number | undefined;
|
|
352
|
+
};
|
|
353
|
+
uniqueAttribute?: string | undefined;
|
|
354
|
+
};
|
|
355
|
+
aggregation: {
|
|
356
|
+
type: "quantity";
|
|
357
|
+
};
|
|
358
|
+
conditions?: Record<string, unknown>[] | undefined;
|
|
359
|
+
translations?: Record<string, {
|
|
360
|
+
name: string;
|
|
361
|
+
description?: string | undefined;
|
|
362
|
+
}> | undefined;
|
|
363
|
+
event?: string | undefined;
|
|
364
|
+
achievementRuleId?: string | undefined;
|
|
365
|
+
limit?: {
|
|
366
|
+
value?: number | undefined;
|
|
367
|
+
interval?: {
|
|
368
|
+
type: string;
|
|
369
|
+
value?: number | undefined;
|
|
370
|
+
} | undefined;
|
|
371
|
+
} | undefined;
|
|
372
|
+
uniqueReferee?: boolean | undefined;
|
|
373
|
+
}, {
|
|
374
|
+
type: "direct" | "referral";
|
|
375
|
+
trigger: "referral" | "transaction" | "custom_event" | "achievement" | "points_transfer" | "reward_redemption" | "tier_change" | "profile_update";
|
|
376
|
+
completeRule: {
|
|
377
|
+
periodGoal: string | number;
|
|
378
|
+
period: {
|
|
379
|
+
type: "day" | "week" | "month" | "calendarDays" | "calendarWeeks" | "calendarMonths" | "calendarYears" | "year" | "last_day";
|
|
380
|
+
consecutive: number;
|
|
381
|
+
value?: number | undefined;
|
|
382
|
+
};
|
|
383
|
+
uniqueAttribute?: string | undefined;
|
|
384
|
+
};
|
|
385
|
+
aggregation: {
|
|
386
|
+
type: "quantity";
|
|
387
|
+
};
|
|
388
|
+
conditions?: Record<string, unknown>[] | undefined;
|
|
389
|
+
translations?: Record<string, {
|
|
390
|
+
name: string;
|
|
391
|
+
description?: string | undefined;
|
|
392
|
+
}> | undefined;
|
|
393
|
+
event?: string | undefined;
|
|
394
|
+
achievementRuleId?: string | undefined;
|
|
395
|
+
limit?: {
|
|
396
|
+
value?: number | undefined;
|
|
397
|
+
interval?: {
|
|
398
|
+
type: string;
|
|
399
|
+
value?: number | undefined;
|
|
400
|
+
} | undefined;
|
|
401
|
+
} | undefined;
|
|
402
|
+
uniqueReferee?: boolean | undefined;
|
|
403
|
+
}>, "many">;
|
|
404
|
+
badgeTypeId: z.ZodOptional<z.ZodString>;
|
|
405
|
+
};
|
|
406
|
+
export declare const AchievementPatchInputSchema: {
|
|
407
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
408
|
+
achievementId: z.ZodString;
|
|
409
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
410
|
+
translations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
411
|
+
name: z.ZodOptional<z.ZodString>;
|
|
412
|
+
description: z.ZodOptional<z.ZodString>;
|
|
413
|
+
}, "strip", z.ZodTypeAny, {
|
|
414
|
+
name?: string | undefined;
|
|
415
|
+
description?: string | undefined;
|
|
416
|
+
}, {
|
|
417
|
+
name?: string | undefined;
|
|
418
|
+
description?: string | undefined;
|
|
419
|
+
}>>>;
|
|
420
|
+
};
|
|
421
|
+
export declare const AchievementGetMemberProgressInputSchema: {
|
|
422
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
423
|
+
memberId: z.ZodString;
|
|
424
|
+
achievementId: z.ZodString;
|
|
425
|
+
};
|
|
426
|
+
export declare const AchievementListMemberAchievementsInputSchema: {
|
|
427
|
+
storeCode: z.ZodOptional<z.ZodString>;
|
|
428
|
+
memberId: z.ZodString;
|
|
429
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
430
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
431
|
+
name: z.ZodOptional<z.ZodString>;
|
|
432
|
+
achievementId: z.ZodOptional<z.ZodString>;
|
|
433
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Period type enum for achievements
|
|
3
|
+
// NOTE: "forever" is NOT valid - use "day" with consecutive=1 for all-time tracking
|
|
4
|
+
const AchievementPeriodTypeEnum = z.enum([
|
|
5
|
+
"day",
|
|
6
|
+
"week",
|
|
7
|
+
"month",
|
|
8
|
+
"year",
|
|
9
|
+
"last_day",
|
|
10
|
+
"calendarDays",
|
|
11
|
+
"calendarWeeks",
|
|
12
|
+
"calendarMonths",
|
|
13
|
+
"calendarYears",
|
|
14
|
+
]);
|
|
15
|
+
// Aggregation type enum for achievements
|
|
16
|
+
// NOTE: Only "quantity" is currently supported by the API.
|
|
17
|
+
// "sum", "average", "min", "max" are rejected by the API despite being documented.
|
|
18
|
+
const AchievementAggregationTypeEnum = z.enum([
|
|
19
|
+
"quantity",
|
|
20
|
+
]);
|
|
21
|
+
// Rule input schema
|
|
22
|
+
const AchievementRuleInputSchema = z.object({
|
|
23
|
+
achievementRuleId: z.string().optional().describe("Rule ID (for updates)."),
|
|
24
|
+
translations: z.record(z.string(), z.object({
|
|
25
|
+
name: z.string(),
|
|
26
|
+
description: z.string().optional(),
|
|
27
|
+
})).optional().describe("Rule name and description translations."),
|
|
28
|
+
trigger: z.enum([
|
|
29
|
+
"transaction",
|
|
30
|
+
"custom_event",
|
|
31
|
+
"points_transfer",
|
|
32
|
+
"reward_redemption",
|
|
33
|
+
"referral",
|
|
34
|
+
"achievement",
|
|
35
|
+
"tier_change",
|
|
36
|
+
"profile_update",
|
|
37
|
+
]).describe("Event type that triggers rule progress. For login tracking, use custom_event with a custom 'app_login' event schema. NOTE: 'registration' and 'login' are NOT supported despite being documented."),
|
|
38
|
+
type: z.enum(["direct", "referral"]).describe("Rule type: direct (default) or referral."),
|
|
39
|
+
event: z.string().optional().describe("Custom event code (required for trigger='custom_event'). Must match an existing custom event schema."),
|
|
40
|
+
completeRule: z.object({
|
|
41
|
+
periodGoal: z.union([z.number(), z.string()]).describe("Goal value to reach (e.g., 5 for 5 purchases, 100 for 100 points)."),
|
|
42
|
+
period: z.object({
|
|
43
|
+
type: AchievementPeriodTypeEnum.describe("Period type: 'day' (all-time when consecutive=1), 'last_day' (rolling N days), " +
|
|
44
|
+
"'calendarDays' (reset daily), 'calendarWeeks' (reset weekly), 'calendarMonths' (reset monthly)."),
|
|
45
|
+
value: z.number().optional().describe("Period value (e.g., 7 for last 7 days when type='last_day')."),
|
|
46
|
+
consecutive: z.number().min(1).describe("Required consecutive periods. Use 1 for all-time tracking, 7 for weekly streaks, etc."),
|
|
47
|
+
}).describe("Period configuration. REQUIRED: both type and consecutive must be provided."),
|
|
48
|
+
uniqueAttribute: z.string().optional().describe("Attribute for unique counting (e.g., 'sku' to count unique products)."),
|
|
49
|
+
}).describe("Completion goal configuration."),
|
|
50
|
+
aggregation: z.object({
|
|
51
|
+
type: AchievementAggregationTypeEnum.describe("How to aggregate: 'quantity' (count events). NOTE: Only 'quantity' is supported by the API."),
|
|
52
|
+
}).describe("Value aggregation. Use type='quantity' for event counting. NOTE: 'sum', 'average', 'min', 'max' are NOT supported by the API."),
|
|
53
|
+
conditions: z.array(z.record(z.unknown())).optional().describe("Conditions that must be met."),
|
|
54
|
+
limit: z.object({
|
|
55
|
+
value: z.number().optional().describe("Max events per interval (e.g., 1 for once-per-day limit)."),
|
|
56
|
+
interval: z.object({
|
|
57
|
+
type: z.string().describe("Interval type: 'calendarDays', 'calendarWeeks', etc."),
|
|
58
|
+
value: z.number().optional().describe("Interval value."),
|
|
59
|
+
}).optional().describe("Time interval for the limit."),
|
|
60
|
+
}).optional().describe("Per-rule execution limit (use for streak patterns: limit 1 per day)."),
|
|
61
|
+
uniqueReferee: z.boolean().optional().describe("Whether referee must be unique (for referral achievements)."),
|
|
62
|
+
});
|
|
63
|
+
export const AchievementListInputSchema = {
|
|
64
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
65
|
+
page: z.number().optional().describe("Page number (default: 1)."),
|
|
66
|
+
perPage: z.number().optional().describe("Items per page (default: 10)."),
|
|
67
|
+
active: z.boolean().optional().describe("Filter by active status."),
|
|
68
|
+
name: z.string().optional().describe("Filter by achievement name."),
|
|
69
|
+
};
|
|
70
|
+
export const AchievementCreateInputSchema = {
|
|
71
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
72
|
+
translations: z.record(z.string(), z.object({
|
|
73
|
+
name: z.string(),
|
|
74
|
+
description: z.string().optional(),
|
|
75
|
+
})).describe("Achievement name and description. At least 'en' key required."),
|
|
76
|
+
active: z.boolean().optional().describe("Whether achievement is active (default: false)."),
|
|
77
|
+
activity: z.object({
|
|
78
|
+
startsAt: z.string().optional().describe("ISO datetime when achievement becomes active."),
|
|
79
|
+
endsAt: z.string().optional().describe("ISO datetime when achievement ends."),
|
|
80
|
+
operator: z.string().optional().describe("Activity condition operator."),
|
|
81
|
+
}).optional().describe("Time period configuration."),
|
|
82
|
+
limit: z.object({
|
|
83
|
+
value: z.number().optional().describe("Maximum completions."),
|
|
84
|
+
interval: z.object({
|
|
85
|
+
type: z.string(),
|
|
86
|
+
value: z.number().optional(),
|
|
87
|
+
}).optional(),
|
|
88
|
+
}).optional().describe("Overall limit configuration."),
|
|
89
|
+
rules: z.array(AchievementRuleInputSchema).describe("Achievement rules defining completion criteria."),
|
|
90
|
+
badgeTypeId: z.string().optional().describe("Badge type ID to award upon completion. " +
|
|
91
|
+
"NOTE: This field may cause 'extra fields' validation errors in some API versions. " +
|
|
92
|
+
"If creation fails, try without badgeTypeId - the system will assign a default badge."),
|
|
93
|
+
};
|
|
94
|
+
export const AchievementGetInputSchema = {
|
|
95
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
96
|
+
achievementId: z.string().describe("The achievement ID (UUID) to retrieve."),
|
|
97
|
+
};
|
|
98
|
+
export const AchievementUpdateInputSchema = {
|
|
99
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
100
|
+
achievementId: z.string().describe("The achievement ID (UUID) to update."),
|
|
101
|
+
translations: z.record(z.string(), z.object({
|
|
102
|
+
name: z.string(),
|
|
103
|
+
description: z.string().optional(),
|
|
104
|
+
})).describe("Achievement name and description."),
|
|
105
|
+
active: z.boolean().optional().describe("Whether achievement is active."),
|
|
106
|
+
activity: z.object({
|
|
107
|
+
startsAt: z.string().optional(),
|
|
108
|
+
endsAt: z.string().optional(),
|
|
109
|
+
operator: z.string().optional(),
|
|
110
|
+
}).optional().describe("Time period configuration."),
|
|
111
|
+
limit: z.object({
|
|
112
|
+
value: z.number().optional(),
|
|
113
|
+
interval: z.object({
|
|
114
|
+
type: z.string(),
|
|
115
|
+
value: z.number().optional(),
|
|
116
|
+
}).optional(),
|
|
117
|
+
}).optional().describe("Limit configuration."),
|
|
118
|
+
rules: z.array(AchievementRuleInputSchema).describe("Achievement rules."),
|
|
119
|
+
badgeTypeId: z.string().optional().describe("Badge type ID to award."),
|
|
120
|
+
};
|
|
121
|
+
export const AchievementPatchInputSchema = {
|
|
122
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
123
|
+
achievementId: z.string().describe("The achievement ID (UUID) to patch."),
|
|
124
|
+
active: z.boolean().optional().describe("Whether achievement is active."),
|
|
125
|
+
translations: z.record(z.string(), z.object({
|
|
126
|
+
name: z.string().optional(),
|
|
127
|
+
description: z.string().optional(),
|
|
128
|
+
})).optional().describe("Partial translation updates."),
|
|
129
|
+
};
|
|
130
|
+
export const AchievementGetMemberProgressInputSchema = {
|
|
131
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
132
|
+
memberId: z.string().describe("The member ID (UUID)."),
|
|
133
|
+
achievementId: z.string().describe("The achievement ID (UUID)."),
|
|
134
|
+
};
|
|
135
|
+
export const AchievementListMemberAchievementsInputSchema = {
|
|
136
|
+
storeCode: z.string().optional().describe("Store code for multi-tenant routing. DO NOT pass this parameter - the configured default will be used automatically. Only provide a value if the user explicitly asks to work with a different store."),
|
|
137
|
+
memberId: z.string().describe("The member ID (UUID)."),
|
|
138
|
+
page: z.number().optional().describe("Page number (default: 1)."),
|
|
139
|
+
perPage: z.number().optional().describe("Items per page (default: 25)."),
|
|
140
|
+
name: z.string().optional().describe("Filter by achievement name."),
|
|
141
|
+
achievementId: z.string().optional().describe("Filter by specific achievement ID."),
|
|
142
|
+
};
|