@open-loyalty/mcp-server 1.3.7 → 1.5.3
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/dist/config.d.ts +4 -3
- package/dist/config.js +9 -7
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +26 -8
- package/dist/tools/achievement/handlers.js +60 -1
- package/dist/tools/achievement/index.d.ts +8 -8
- package/dist/tools/achievement/index.js +10 -11
- package/dist/tools/achievement/schemas.d.ts +8 -8
- package/dist/tools/achievement/schemas.js +36 -32
- package/dist/tools/analytics.js +9 -9
- package/dist/tools/badge.js +4 -4
- package/dist/tools/campaign/handlers.js +35 -1
- package/dist/tools/campaign/index.d.ts +97 -34
- package/dist/tools/campaign/index.js +14 -12
- package/dist/tools/campaign/schemas.d.ts +96 -33
- package/dist/tools/campaign/schemas.js +89 -55
- package/dist/tools/custom-event.js +10 -9
- package/dist/tools/export.js +4 -4
- package/dist/tools/import.d.ts +1 -1
- package/dist/tools/import.js +11 -6
- package/dist/tools/index.js +4 -4
- package/dist/tools/member/handlers.js +48 -1
- package/dist/tools/member/index.d.ts +1 -1
- package/dist/tools/member/index.js +3 -1
- package/dist/tools/member/schemas.js +12 -12
- package/dist/tools/points/handlers.d.ts +75 -0
- package/dist/tools/{points.js → points/handlers.js} +21 -112
- package/dist/tools/points/index.d.ts +84 -0
- package/dist/tools/points/index.js +63 -0
- package/dist/tools/points/schemas.d.ts +45 -0
- package/dist/tools/points/schemas.js +47 -0
- package/dist/tools/referral/schemas.js +3 -3
- package/dist/tools/reward/handlers.d.ts +2 -0
- package/dist/tools/reward/handlers.js +79 -6
- package/dist/tools/reward/index.d.ts +2 -0
- package/dist/tools/reward/index.js +10 -10
- package/dist/tools/reward/schemas.d.ts +2 -0
- package/dist/tools/reward/schemas.js +42 -23
- package/dist/tools/segment/index.js +7 -5
- package/dist/tools/segment/schemas.js +11 -11
- package/dist/tools/tierset/handlers.d.ts +26 -0
- package/dist/tools/tierset/handlers.js +196 -0
- package/dist/tools/tierset/index.d.ts +124 -0
- package/dist/tools/tierset/index.js +88 -0
- package/dist/tools/tierset/schemas.d.ts +127 -0
- package/dist/tools/tierset/schemas.js +62 -0
- package/dist/tools/transaction/handlers.d.ts +89 -0
- package/dist/tools/transaction/handlers.js +159 -0
- package/dist/tools/transaction/index.d.ts +153 -0
- package/dist/tools/transaction/index.js +54 -0
- package/dist/tools/transaction/schemas.d.ts +126 -0
- package/dist/tools/transaction/schemas.js +60 -0
- package/dist/tools/wallet-type/handlers.d.ts +63 -0
- package/dist/tools/{wallet-type.js → wallet-type/handlers.js} +15 -78
- package/dist/tools/{wallet-type.d.ts → wallet-type/index.d.ts} +3 -64
- package/dist/tools/wallet-type/index.js +65 -0
- package/dist/tools/wallet-type/schemas.d.ts +1 -0
- package/dist/tools/wallet-type/schemas.js +1 -0
- package/dist/tools/webhook.js +6 -6
- package/dist/types/schemas/achievement.d.ts +48 -48
- package/dist/types/schemas/admin.d.ts +10 -10
- package/dist/types/schemas/campaign.d.ts +12 -12
- package/dist/types/schemas/common.js +1 -1
- package/dist/types/schemas/member.d.ts +18 -18
- package/dist/types/schemas/role.d.ts +4 -4
- package/dist/types/schemas/tierset.js +2 -1
- package/dist/types/schemas/transaction.d.ts +12 -12
- package/dist/types/schemas/wallet-type.js +12 -10
- package/dist/types/schemas/webhook.d.ts +6 -6
- package/dist/utils/errors.js +40 -0
- package/package.json +3 -2
- package/dist/prompts/fan-engagement-setup.d.ts +0 -107
- package/dist/prompts/fan-engagement-setup.js +0 -492
- package/dist/tools/achievement.d.ts +0 -1017
- package/dist/tools/achievement.js +0 -354
- package/dist/tools/campaign.d.ts +0 -1800
- package/dist/tools/campaign.js +0 -737
- package/dist/tools/member.d.ts +0 -366
- package/dist/tools/member.js +0 -352
- package/dist/tools/points.d.ts +0 -201
- package/dist/tools/reward.d.ts +0 -279
- package/dist/tools/reward.js +0 -361
- package/dist/tools/segment.d.ts +0 -816
- package/dist/tools/segment.js +0 -333
- package/dist/tools/tierset.d.ts +0 -273
- package/dist/tools/tierset.js +0 -289
- package/dist/tools/transaction.d.ts +0 -365
- package/dist/tools/transaction.js +0 -259
- package/dist/workflows/app-login-streak.d.ts +0 -39
- package/dist/workflows/app-login-streak.js +0 -298
- package/dist/workflows/early-arrival.d.ts +0 -33
- package/dist/workflows/early-arrival.js +0 -148
- package/dist/workflows/index.d.ts +0 -101
- package/dist/workflows/index.js +0 -208
- package/dist/workflows/match-attendance.d.ts +0 -45
- package/dist/workflows/match-attendance.js +0 -308
- package/dist/workflows/sportsbar-visit.d.ts +0 -41
- package/dist/workflows/sportsbar-visit.js +0 -284
- package/dist/workflows/vod-watching.d.ts +0 -43
- package/dist/workflows/vod-watching.js +0 -326
package/dist/tools/segment.js
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { apiGet, apiPost, apiPut, apiDelete } from "../client/http.js";
|
|
3
|
-
import { formatApiError } from "../utils/errors.js";
|
|
4
|
-
import { getStoreCode } from "../config.js";
|
|
5
|
-
// Input Schemas
|
|
6
|
-
export const SegmentListInputSchema = {
|
|
7
|
-
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."),
|
|
8
|
-
page: z.number().optional().describe("Page number (default: 1)."),
|
|
9
|
-
perPage: z.number().optional().describe("Items per page (default: 10)."),
|
|
10
|
-
active: z.boolean().optional().describe("Filter by active status."),
|
|
11
|
-
name: z.string().optional().describe("Filter by segment name."),
|
|
12
|
-
};
|
|
13
|
-
// Criterion input schema - flexible to support all criterion types
|
|
14
|
-
// NOTE: Only certain criterion types are supported by the API.
|
|
15
|
-
// WORKING: transaction_count (requires both min AND max; MCP will auto-fill max if omitted)
|
|
16
|
-
// NOT WORKING: tier, points_balance (rejected by API despite being documented)
|
|
17
|
-
const SegmentCriterionInputSchema = z.object({
|
|
18
|
-
type: z.string().describe("Criterion type. WORKING: 'transaction_count' (requires both min AND max; MCP auto-fills max if omitted). NOT WORKING: 'tier', 'points_balance' are rejected by the API."),
|
|
19
|
-
criterionId: z.string().optional().describe("Criterion ID (optional, generated if not provided)."),
|
|
20
|
-
// Common criterion data fields
|
|
21
|
-
days: z.number().optional().describe("Days for time-based criteria."),
|
|
22
|
-
fromDate: z.string().optional().describe("Start date (ISO format)."),
|
|
23
|
-
toDate: z.string().optional().describe("End date (ISO format)."),
|
|
24
|
-
min: z.number().optional().describe("Minimum value."),
|
|
25
|
-
max: z.number().optional().describe("Maximum value."),
|
|
26
|
-
posIds: z.array(z.string()).optional().describe("POS IDs."),
|
|
27
|
-
skus: z.array(z.string()).optional().describe("SKU codes."),
|
|
28
|
-
makers: z.array(z.string()).optional().describe("Maker/brand names."),
|
|
29
|
-
labels: z.array(z.object({ key: z.string(), value: z.string() })).optional().describe("Label key-value pairs."),
|
|
30
|
-
tierIds: z.array(z.string()).optional().describe("Tier level IDs."),
|
|
31
|
-
campaignId: z.string().optional().describe("Campaign ID for campaign_completion criterion."),
|
|
32
|
-
countries: z.array(z.string()).optional().describe("Country codes."),
|
|
33
|
-
anniversaryType: z.string().optional().describe("Anniversary type."),
|
|
34
|
-
customAttributeKey: z.string().optional().describe("Custom attribute key."),
|
|
35
|
-
customAttributeValue: z.string().optional().describe("Custom attribute value."),
|
|
36
|
-
}).passthrough();
|
|
37
|
-
// Part input schema
|
|
38
|
-
const SegmentPartInputSchema = z.object({
|
|
39
|
-
segmentPartId: z.string().optional().describe("Part ID (optional)."),
|
|
40
|
-
criteria: z.array(SegmentCriterionInputSchema).describe("Criteria for this part (AND logic)."),
|
|
41
|
-
});
|
|
42
|
-
export const SegmentCreateInputSchema = {
|
|
43
|
-
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."),
|
|
44
|
-
name: z.string().describe("Segment name (required)."),
|
|
45
|
-
description: z.string().optional().describe("Segment description."),
|
|
46
|
-
active: z.boolean().optional().describe("Whether segment is active (default: false)."),
|
|
47
|
-
parts: z.array(SegmentPartInputSchema).describe("Segment parts. Parts use OR logic (ANY part matches), criteria within parts use AND logic (ALL criteria must match)."),
|
|
48
|
-
};
|
|
49
|
-
export const SegmentGetInputSchema = {
|
|
50
|
-
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."),
|
|
51
|
-
segmentId: z.string().describe("The segment ID (UUID) to retrieve."),
|
|
52
|
-
};
|
|
53
|
-
export const SegmentUpdateInputSchema = {
|
|
54
|
-
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."),
|
|
55
|
-
segmentId: z.string().describe("The segment ID (UUID) to update."),
|
|
56
|
-
name: z.string().describe("Segment name."),
|
|
57
|
-
description: z.string().optional().describe("Segment description."),
|
|
58
|
-
active: z.boolean().optional().describe("Whether segment is active."),
|
|
59
|
-
parts: z.array(SegmentPartInputSchema).describe("Segment parts."),
|
|
60
|
-
};
|
|
61
|
-
export const SegmentDeleteInputSchema = {
|
|
62
|
-
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."),
|
|
63
|
-
segmentId: z.string().describe("The segment ID (UUID) to delete."),
|
|
64
|
-
};
|
|
65
|
-
export const SegmentGetMembersInputSchema = {
|
|
66
|
-
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."),
|
|
67
|
-
segmentId: z.string().describe("The segment ID (UUID) to get members for."),
|
|
68
|
-
page: z.number().optional().describe("Page number (default: 1)."),
|
|
69
|
-
perPage: z.number().optional().describe("Items per page (default: 25)."),
|
|
70
|
-
};
|
|
71
|
-
export const SegmentActivateInputSchema = {
|
|
72
|
-
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."),
|
|
73
|
-
segmentId: z.string().describe("The segment ID (UUID) to activate."),
|
|
74
|
-
};
|
|
75
|
-
export const SegmentDeactivateInputSchema = {
|
|
76
|
-
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."),
|
|
77
|
-
segmentId: z.string().describe("The segment ID (UUID) to deactivate."),
|
|
78
|
-
};
|
|
79
|
-
export const SegmentGetResourcesInputSchema = {
|
|
80
|
-
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."),
|
|
81
|
-
segmentId: z.string().describe("The segment ID (UUID) to get associated resources for."),
|
|
82
|
-
};
|
|
83
|
-
// Handler functions
|
|
84
|
-
export async function segmentList(input) {
|
|
85
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
86
|
-
const params = new URLSearchParams();
|
|
87
|
-
if (input.page)
|
|
88
|
-
params.append("_page", String(input.page));
|
|
89
|
-
if (input.perPage)
|
|
90
|
-
params.append("_itemsOnPage", String(input.perPage));
|
|
91
|
-
if (input.active !== undefined)
|
|
92
|
-
params.append("active", String(input.active));
|
|
93
|
-
if (input.name)
|
|
94
|
-
params.append("name", input.name);
|
|
95
|
-
const queryString = params.toString();
|
|
96
|
-
const url = `/${storeCode}/segment${queryString ? `?${queryString}` : ""}`;
|
|
97
|
-
try {
|
|
98
|
-
const response = await apiGet(url);
|
|
99
|
-
const segments = (response.items || []).map((item) => ({
|
|
100
|
-
segmentId: item.segmentId,
|
|
101
|
-
name: item.name,
|
|
102
|
-
description: item.description,
|
|
103
|
-
active: item.active,
|
|
104
|
-
customersCount: item.customersCount,
|
|
105
|
-
createdAt: item.createdAt,
|
|
106
|
-
}));
|
|
107
|
-
const total = response.total || {};
|
|
108
|
-
return {
|
|
109
|
-
segments,
|
|
110
|
-
total: {
|
|
111
|
-
all: typeof total.all === "number" ? total.all : undefined,
|
|
112
|
-
filtered: typeof total.filtered === "number" ? total.filtered : undefined,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
throw formatApiError(error, "ol_segment_list");
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const DEFAULT_TRANSACTION_COUNT_MAX = 999999;
|
|
121
|
-
function normalizeSegmentParts(parts) {
|
|
122
|
-
return parts.map((part) => ({
|
|
123
|
-
...part,
|
|
124
|
-
criteria: part.criteria.map((criterion) => {
|
|
125
|
-
if (!criterion || typeof criterion !== "object") {
|
|
126
|
-
return criterion;
|
|
127
|
-
}
|
|
128
|
-
const normalized = { ...criterion };
|
|
129
|
-
if (normalized.type === "transaction_count" &&
|
|
130
|
-
normalized.min !== undefined &&
|
|
131
|
-
normalized.max === undefined) {
|
|
132
|
-
normalized.max = DEFAULT_TRANSACTION_COUNT_MAX;
|
|
133
|
-
}
|
|
134
|
-
return normalized;
|
|
135
|
-
}),
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
export async function segmentCreate(input) {
|
|
139
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
140
|
-
const segmentPayload = {
|
|
141
|
-
name: input.name,
|
|
142
|
-
parts: normalizeSegmentParts(input.parts),
|
|
143
|
-
};
|
|
144
|
-
if (input.description)
|
|
145
|
-
segmentPayload.description = input.description;
|
|
146
|
-
if (input.active !== undefined)
|
|
147
|
-
segmentPayload.active = input.active;
|
|
148
|
-
try {
|
|
149
|
-
// CRITICAL: Wrap body as { segment: {...} }
|
|
150
|
-
const response = await apiPost(`/${storeCode}/segment`, { segment: segmentPayload });
|
|
151
|
-
return { segmentId: response.segmentId };
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
throw formatApiError(error, "ol_segment_create");
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
export async function segmentGet(input) {
|
|
158
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
159
|
-
try {
|
|
160
|
-
const response = await apiGet(`/${storeCode}/segment/${input.segmentId}`);
|
|
161
|
-
return response;
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
throw formatApiError(error, "ol_segment_get");
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
export async function segmentUpdate(input) {
|
|
168
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
169
|
-
const segmentPayload = {
|
|
170
|
-
name: input.name,
|
|
171
|
-
parts: normalizeSegmentParts(input.parts),
|
|
172
|
-
};
|
|
173
|
-
if (input.description !== undefined)
|
|
174
|
-
segmentPayload.description = input.description;
|
|
175
|
-
if (input.active !== undefined)
|
|
176
|
-
segmentPayload.active = input.active;
|
|
177
|
-
try {
|
|
178
|
-
// CRITICAL: Wrap body as { segment: {...} }
|
|
179
|
-
await apiPut(`/${storeCode}/segment/${input.segmentId}`, { segment: segmentPayload });
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
throw formatApiError(error, "ol_segment_update");
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
export async function segmentDelete(input) {
|
|
186
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
187
|
-
try {
|
|
188
|
-
await apiDelete(`/${storeCode}/segment/${input.segmentId}`);
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
throw formatApiError(error, "ol_segment_delete");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
export async function segmentGetMembers(input) {
|
|
195
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
196
|
-
const params = new URLSearchParams();
|
|
197
|
-
if (input.page)
|
|
198
|
-
params.append("_page", String(input.page));
|
|
199
|
-
if (input.perPage)
|
|
200
|
-
params.append("_itemsOnPage", String(input.perPage));
|
|
201
|
-
const queryString = params.toString();
|
|
202
|
-
const url = `/${storeCode}/segment/${input.segmentId}/members${queryString ? `?${queryString}` : ""}`;
|
|
203
|
-
try {
|
|
204
|
-
const response = await apiGet(url);
|
|
205
|
-
const members = (response.items || []).map((item) => ({
|
|
206
|
-
customerId: item.customerId,
|
|
207
|
-
firstName: item.firstName,
|
|
208
|
-
lastName: item.lastName,
|
|
209
|
-
email: item.email,
|
|
210
|
-
loyaltyCardNumber: item.loyaltyCardNumber,
|
|
211
|
-
active: item.active,
|
|
212
|
-
}));
|
|
213
|
-
const total = response.total || {};
|
|
214
|
-
return {
|
|
215
|
-
members,
|
|
216
|
-
total: {
|
|
217
|
-
all: typeof total.all === "number" ? total.all : undefined,
|
|
218
|
-
filtered: typeof total.filtered === "number" ? total.filtered : undefined,
|
|
219
|
-
},
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
catch (error) {
|
|
223
|
-
throw formatApiError(error, "ol_segment_get_members");
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
export async function segmentActivate(input) {
|
|
227
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
228
|
-
try {
|
|
229
|
-
await apiPost(`/${storeCode}/segment/${input.segmentId}/activate`, {});
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
throw formatApiError(error, "ol_segment_activate");
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
export async function segmentDeactivate(input) {
|
|
236
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
237
|
-
try {
|
|
238
|
-
await apiPost(`/${storeCode}/segment/${input.segmentId}/deactivate`, {});
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
throw formatApiError(error, "ol_segment_deactivate");
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
export async function segmentGetResources(input) {
|
|
245
|
-
const storeCode = getStoreCode(input.storeCode);
|
|
246
|
-
try {
|
|
247
|
-
const response = await apiGet(`/${storeCode}/segment/${input.segmentId}/resources`);
|
|
248
|
-
const resources = response.items || response.resources || [];
|
|
249
|
-
return { resources };
|
|
250
|
-
}
|
|
251
|
-
catch (error) {
|
|
252
|
-
throw formatApiError(error, "ol_segment_get_resources");
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
// Tool definitions
|
|
256
|
-
export const segmentToolDefinitions = [
|
|
257
|
-
{
|
|
258
|
-
name: "ol_segment_list",
|
|
259
|
-
title: "List Segments",
|
|
260
|
-
description: "List customer segments. Segments group members by criteria (purchase behavior, tier, location, etc). Use for campaign targeting and analytics.",
|
|
261
|
-
readOnly: true,
|
|
262
|
-
inputSchema: SegmentListInputSchema,
|
|
263
|
-
handler: segmentList,
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
name: "ol_segment_create",
|
|
267
|
-
title: "Create Segment",
|
|
268
|
-
description: "Create segment to group members. Parts use OR logic (member matches if ANY part matches). Criteria within parts use AND logic (must match ALL criteria in that part). " +
|
|
269
|
-
"WORKING criterion types: 'transaction_count' (requires BOTH min AND max). " +
|
|
270
|
-
"NOT WORKING: 'tier', 'points_balance' are rejected by the API. " +
|
|
271
|
-
"Example - High activity segment: parts: [{ criteria: [{ type: 'transaction_count', min: 5, max: 999999 }] }]",
|
|
272
|
-
readOnly: false,
|
|
273
|
-
inputSchema: SegmentCreateInputSchema,
|
|
274
|
-
handler: segmentCreate,
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
name: "ol_segment_get",
|
|
278
|
-
title: "Get Segment Details",
|
|
279
|
-
description: "Get full segment details including all parts and criteria configurations.",
|
|
280
|
-
readOnly: true,
|
|
281
|
-
inputSchema: SegmentGetInputSchema,
|
|
282
|
-
handler: segmentGet,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: "ol_segment_update",
|
|
286
|
-
title: "Update Segment",
|
|
287
|
-
description: "Update segment configuration. Requires full segment definition (name, parts with criteria). Use segment_get first to retrieve current configuration.",
|
|
288
|
-
readOnly: false,
|
|
289
|
-
inputSchema: SegmentUpdateInputSchema,
|
|
290
|
-
handler: segmentUpdate,
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
name: "ol_segment_delete",
|
|
294
|
-
title: "Delete Segment (Permanent)",
|
|
295
|
-
description: "Permanently delete a segment. Cannot be undone. Check segment_get_resources first to see what uses this segment.",
|
|
296
|
-
readOnly: false,
|
|
297
|
-
destructive: true,
|
|
298
|
-
inputSchema: SegmentDeleteInputSchema,
|
|
299
|
-
handler: segmentDelete,
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: "ol_segment_get_members",
|
|
303
|
-
title: "Get Segment Members",
|
|
304
|
-
description: "Get members belonging to a segment. Returns paginated list of member details. Use for verifying segment criteria or exporting member lists.",
|
|
305
|
-
readOnly: true,
|
|
306
|
-
inputSchema: SegmentGetMembersInputSchema,
|
|
307
|
-
handler: segmentGetMembers,
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: "ol_segment_activate",
|
|
311
|
-
title: "Activate Segment",
|
|
312
|
-
description: "Activate a segment. Active segments are used for campaign targeting and can be queried for members.",
|
|
313
|
-
readOnly: false,
|
|
314
|
-
inputSchema: SegmentActivateInputSchema,
|
|
315
|
-
handler: segmentActivate,
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
name: "ol_segment_deactivate",
|
|
319
|
-
title: "Deactivate Segment",
|
|
320
|
-
description: "Deactivate a segment. Deactivated segments are not used for campaign targeting but retain their configuration.",
|
|
321
|
-
readOnly: false,
|
|
322
|
-
inputSchema: SegmentDeactivateInputSchema,
|
|
323
|
-
handler: segmentDeactivate,
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: "ol_segment_get_resources",
|
|
327
|
-
title: "Get Segment Resources",
|
|
328
|
-
description: "Get resources (campaigns, rewards, etc.) that use this segment for targeting. Check before deleting a segment.",
|
|
329
|
-
readOnly: true,
|
|
330
|
-
inputSchema: SegmentGetResourcesInputSchema,
|
|
331
|
-
handler: segmentGetResources,
|
|
332
|
-
},
|
|
333
|
-
];
|
package/dist/tools/tierset.d.ts
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { TierSet, TierSetListItem, Tier } from "../types/schemas/tierset.js";
|
|
3
|
-
export declare const TierSetListInputSchema: {
|
|
4
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
5
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
6
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
};
|
|
8
|
-
export declare const TierSetCreateInputSchema: {
|
|
9
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
10
|
-
name: z.ZodString;
|
|
11
|
-
description: z.ZodOptional<z.ZodString>;
|
|
12
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
13
|
-
attribute: z.ZodEnum<["activeUnits", "totalEarnedUnits", "totalSpending", "monthsSinceJoiningProgram", "cumulatedEarnedUnits"]>;
|
|
14
|
-
walletType: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
attribute: "activeUnits" | "totalEarnedUnits" | "totalSpending" | "monthsSinceJoiningProgram" | "cumulatedEarnedUnits";
|
|
17
|
-
walletType?: string | undefined;
|
|
18
|
-
}, {
|
|
19
|
-
attribute: "activeUnits" | "totalEarnedUnits" | "totalSpending" | "monthsSinceJoiningProgram" | "cumulatedEarnedUnits";
|
|
20
|
-
walletType?: string | undefined;
|
|
21
|
-
}>, "many">;
|
|
22
|
-
};
|
|
23
|
-
export declare const TierSetGetInputSchema: {
|
|
24
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
25
|
-
tierSetId: z.ZodString;
|
|
26
|
-
};
|
|
27
|
-
export declare const TierSetUpdateInputSchema: {
|
|
28
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
29
|
-
tierSetId: z.ZodString;
|
|
30
|
-
name: z.ZodOptional<z.ZodString>;
|
|
31
|
-
description: z.ZodOptional<z.ZodString>;
|
|
32
|
-
active: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
-
downgrade: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
mode: z.ZodEnum<["none", "automatic", "x_days"]>;
|
|
35
|
-
days: z.ZodOptional<z.ZodNumber>;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
mode: "none" | "automatic" | "x_days";
|
|
38
|
-
days?: number | undefined;
|
|
39
|
-
}, {
|
|
40
|
-
mode: "none" | "automatic" | "x_days";
|
|
41
|
-
days?: number | undefined;
|
|
42
|
-
}>>;
|
|
43
|
-
};
|
|
44
|
-
export declare const TierSetUpdateTiersInputSchema: {
|
|
45
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
46
|
-
tierSetId: z.ZodString;
|
|
47
|
-
tiers: z.ZodArray<z.ZodObject<{
|
|
48
|
-
levelId: z.ZodOptional<z.ZodString>;
|
|
49
|
-
name: z.ZodString;
|
|
50
|
-
description: z.ZodOptional<z.ZodString>;
|
|
51
|
-
active: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
53
|
-
conditionId: z.ZodString;
|
|
54
|
-
value: z.ZodNumber;
|
|
55
|
-
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
value: number;
|
|
57
|
-
conditionId: string;
|
|
58
|
-
}, {
|
|
59
|
-
value: number;
|
|
60
|
-
conditionId: string;
|
|
61
|
-
}>, "many">;
|
|
62
|
-
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
name: string;
|
|
64
|
-
conditions: {
|
|
65
|
-
value: number;
|
|
66
|
-
conditionId: string;
|
|
67
|
-
}[];
|
|
68
|
-
active?: boolean | undefined;
|
|
69
|
-
description?: string | undefined;
|
|
70
|
-
levelId?: string | undefined;
|
|
71
|
-
}, {
|
|
72
|
-
name: string;
|
|
73
|
-
conditions: {
|
|
74
|
-
value: number;
|
|
75
|
-
conditionId: string;
|
|
76
|
-
}[];
|
|
77
|
-
active?: boolean | undefined;
|
|
78
|
-
description?: string | undefined;
|
|
79
|
-
levelId?: string | undefined;
|
|
80
|
-
}>, "many">;
|
|
81
|
-
};
|
|
82
|
-
export declare const TierSetGetTiersInputSchema: {
|
|
83
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
84
|
-
tierSetId: z.ZodString;
|
|
85
|
-
};
|
|
86
|
-
type TierSetListInput = {
|
|
87
|
-
storeCode?: string;
|
|
88
|
-
page?: number;
|
|
89
|
-
perPage?: number;
|
|
90
|
-
};
|
|
91
|
-
type TierSetCreateInput = {
|
|
92
|
-
storeCode?: string;
|
|
93
|
-
name: string;
|
|
94
|
-
description?: string;
|
|
95
|
-
conditions: {
|
|
96
|
-
attribute: string;
|
|
97
|
-
walletType?: string;
|
|
98
|
-
}[];
|
|
99
|
-
};
|
|
100
|
-
type TierSetGetInput = {
|
|
101
|
-
storeCode?: string;
|
|
102
|
-
tierSetId: string;
|
|
103
|
-
};
|
|
104
|
-
type TierSetUpdateInput = {
|
|
105
|
-
storeCode?: string;
|
|
106
|
-
tierSetId: string;
|
|
107
|
-
name?: string;
|
|
108
|
-
description?: string;
|
|
109
|
-
active?: boolean;
|
|
110
|
-
downgrade?: {
|
|
111
|
-
mode: string;
|
|
112
|
-
days?: number;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
type TierSetUpdateTiersInput = {
|
|
116
|
-
storeCode?: string;
|
|
117
|
-
tierSetId: string;
|
|
118
|
-
tiers: {
|
|
119
|
-
levelId?: string;
|
|
120
|
-
name: string;
|
|
121
|
-
description?: string;
|
|
122
|
-
active?: boolean;
|
|
123
|
-
conditions: {
|
|
124
|
-
conditionId: string;
|
|
125
|
-
value: number;
|
|
126
|
-
}[];
|
|
127
|
-
}[];
|
|
128
|
-
};
|
|
129
|
-
export declare function tiersetList(input: TierSetListInput): Promise<{
|
|
130
|
-
items: TierSetListItem[];
|
|
131
|
-
total: {
|
|
132
|
-
all?: number;
|
|
133
|
-
filtered?: number;
|
|
134
|
-
};
|
|
135
|
-
}>;
|
|
136
|
-
export declare function tiersetCreate(input: TierSetCreateInput): Promise<{
|
|
137
|
-
tierSetId: string;
|
|
138
|
-
conditions: {
|
|
139
|
-
conditionId: string;
|
|
140
|
-
attribute: string;
|
|
141
|
-
}[];
|
|
142
|
-
}>;
|
|
143
|
-
export declare function tiersetGet(input: TierSetGetInput): Promise<TierSet>;
|
|
144
|
-
export declare function tiersetUpdate(input: TierSetUpdateInput): Promise<void>;
|
|
145
|
-
export declare function tiersetUpdateTiers(input: TierSetUpdateTiersInput): Promise<void>;
|
|
146
|
-
export declare function tiersetGetTiers(input: TierSetGetInput): Promise<{
|
|
147
|
-
items: Tier[];
|
|
148
|
-
total: {
|
|
149
|
-
all?: number;
|
|
150
|
-
filtered?: number;
|
|
151
|
-
};
|
|
152
|
-
}>;
|
|
153
|
-
export declare const tiersetToolDefinitions: readonly [{
|
|
154
|
-
readonly name: "ol_tierset_list";
|
|
155
|
-
readonly title: "List Loyalty Programs";
|
|
156
|
-
readonly description: string;
|
|
157
|
-
readonly readOnly: true;
|
|
158
|
-
readonly inputSchema: {
|
|
159
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
160
|
-
page: z.ZodOptional<z.ZodNumber>;
|
|
161
|
-
perPage: z.ZodOptional<z.ZodNumber>;
|
|
162
|
-
};
|
|
163
|
-
readonly handler: typeof tiersetList;
|
|
164
|
-
}, {
|
|
165
|
-
readonly name: "ol_tierset_create";
|
|
166
|
-
readonly title: "Create Loyalty Program";
|
|
167
|
-
readonly description: string;
|
|
168
|
-
readonly readOnly: false;
|
|
169
|
-
readonly inputSchema: {
|
|
170
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
171
|
-
name: z.ZodString;
|
|
172
|
-
description: z.ZodOptional<z.ZodString>;
|
|
173
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
174
|
-
attribute: z.ZodEnum<["activeUnits", "totalEarnedUnits", "totalSpending", "monthsSinceJoiningProgram", "cumulatedEarnedUnits"]>;
|
|
175
|
-
walletType: z.ZodOptional<z.ZodString>;
|
|
176
|
-
}, "strip", z.ZodTypeAny, {
|
|
177
|
-
attribute: "activeUnits" | "totalEarnedUnits" | "totalSpending" | "monthsSinceJoiningProgram" | "cumulatedEarnedUnits";
|
|
178
|
-
walletType?: string | undefined;
|
|
179
|
-
}, {
|
|
180
|
-
attribute: "activeUnits" | "totalEarnedUnits" | "totalSpending" | "monthsSinceJoiningProgram" | "cumulatedEarnedUnits";
|
|
181
|
-
walletType?: string | undefined;
|
|
182
|
-
}>, "many">;
|
|
183
|
-
};
|
|
184
|
-
readonly handler: typeof tiersetCreate;
|
|
185
|
-
}, {
|
|
186
|
-
readonly name: "ol_tierset_get";
|
|
187
|
-
readonly title: "Get Loyalty Program Details";
|
|
188
|
-
readonly description: string;
|
|
189
|
-
readonly readOnly: true;
|
|
190
|
-
readonly inputSchema: {
|
|
191
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
192
|
-
tierSetId: z.ZodString;
|
|
193
|
-
};
|
|
194
|
-
readonly handler: typeof tiersetGet;
|
|
195
|
-
}, {
|
|
196
|
-
readonly name: "ol_tierset_update";
|
|
197
|
-
readonly title: "Update Loyalty Program";
|
|
198
|
-
readonly description: string;
|
|
199
|
-
readonly readOnly: false;
|
|
200
|
-
readonly inputSchema: {
|
|
201
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
202
|
-
tierSetId: z.ZodString;
|
|
203
|
-
name: z.ZodOptional<z.ZodString>;
|
|
204
|
-
description: z.ZodOptional<z.ZodString>;
|
|
205
|
-
active: z.ZodOptional<z.ZodBoolean>;
|
|
206
|
-
downgrade: z.ZodOptional<z.ZodObject<{
|
|
207
|
-
mode: z.ZodEnum<["none", "automatic", "x_days"]>;
|
|
208
|
-
days: z.ZodOptional<z.ZodNumber>;
|
|
209
|
-
}, "strip", z.ZodTypeAny, {
|
|
210
|
-
mode: "none" | "automatic" | "x_days";
|
|
211
|
-
days?: number | undefined;
|
|
212
|
-
}, {
|
|
213
|
-
mode: "none" | "automatic" | "x_days";
|
|
214
|
-
days?: number | undefined;
|
|
215
|
-
}>>;
|
|
216
|
-
};
|
|
217
|
-
readonly handler: typeof tiersetUpdate;
|
|
218
|
-
}, {
|
|
219
|
-
readonly name: "ol_tierset_update_tiers";
|
|
220
|
-
readonly title: "Configure Tier Thresholds";
|
|
221
|
-
readonly description: "Define tier thresholds for a tier set. PREREQUISITE: Call tierset_get first to obtain conditionId values. Each tier's conditions array uses conditionId from the parent tier set plus a threshold value.\n\nExample for a 3-tier program with points-based progression:\n- Bronze tier: conditions: [{ conditionId: \"xxx\", value: 400 }]\n- Silver tier: conditions: [{ conditionId: \"xxx\", value: 800 }]\n- Gold tier: conditions: [{ conditionId: \"xxx\", value: 1200 }]\n\nThe conditionId must match one from tierset_get response.";
|
|
222
|
-
readonly readOnly: false;
|
|
223
|
-
readonly inputSchema: {
|
|
224
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
225
|
-
tierSetId: z.ZodString;
|
|
226
|
-
tiers: z.ZodArray<z.ZodObject<{
|
|
227
|
-
levelId: z.ZodOptional<z.ZodString>;
|
|
228
|
-
name: z.ZodString;
|
|
229
|
-
description: z.ZodOptional<z.ZodString>;
|
|
230
|
-
active: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
232
|
-
conditionId: z.ZodString;
|
|
233
|
-
value: z.ZodNumber;
|
|
234
|
-
}, "strip", z.ZodTypeAny, {
|
|
235
|
-
value: number;
|
|
236
|
-
conditionId: string;
|
|
237
|
-
}, {
|
|
238
|
-
value: number;
|
|
239
|
-
conditionId: string;
|
|
240
|
-
}>, "many">;
|
|
241
|
-
}, "strip", z.ZodTypeAny, {
|
|
242
|
-
name: string;
|
|
243
|
-
conditions: {
|
|
244
|
-
value: number;
|
|
245
|
-
conditionId: string;
|
|
246
|
-
}[];
|
|
247
|
-
active?: boolean | undefined;
|
|
248
|
-
description?: string | undefined;
|
|
249
|
-
levelId?: string | undefined;
|
|
250
|
-
}, {
|
|
251
|
-
name: string;
|
|
252
|
-
conditions: {
|
|
253
|
-
value: number;
|
|
254
|
-
conditionId: string;
|
|
255
|
-
}[];
|
|
256
|
-
active?: boolean | undefined;
|
|
257
|
-
description?: string | undefined;
|
|
258
|
-
levelId?: string | undefined;
|
|
259
|
-
}>, "many">;
|
|
260
|
-
};
|
|
261
|
-
readonly handler: typeof tiersetUpdateTiers;
|
|
262
|
-
}, {
|
|
263
|
-
readonly name: "ol_tierset_get_tiers";
|
|
264
|
-
readonly title: "Get Tier Configuration";
|
|
265
|
-
readonly description: "Get all tiers in a tier set. Returns levelId values that can be used for campaign targeting. Includes each tier's name and condition thresholds.";
|
|
266
|
-
readonly readOnly: true;
|
|
267
|
-
readonly inputSchema: {
|
|
268
|
-
storeCode: z.ZodOptional<z.ZodString>;
|
|
269
|
-
tierSetId: z.ZodString;
|
|
270
|
-
};
|
|
271
|
-
readonly handler: typeof tiersetGetTiers;
|
|
272
|
-
}];
|
|
273
|
-
export {};
|