@rahul_vendure/ai-chat-plugin 0.1.3 → 0.1.4
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/services/ai-chat.service.d.ts +3 -2
- package/dist/services/ai-chat.service.d.ts.map +1 -1
- package/dist/services/ai-chat.service.js +37 -1
- package/dist/services/ai-chat.service.js.map +1 -1
- package/dist/services/system-prompt.d.ts +1 -1
- package/dist/services/system-prompt.d.ts.map +1 -1
- package/dist/services/system-prompt.js +18 -0
- package/dist/services/system-prompt.js.map +1 -1
- package/dist/services/tools/promotion-tools.d.ts +48 -0
- package/dist/services/tools/promotion-tools.d.ts.map +1 -0
- package/dist/services/tools/promotion-tools.js +410 -0
- package/dist/services/tools/promotion-tools.js.map +1 -0
- package/dist/services/types.d.ts +21 -0
- package/dist/services/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export { AiAssistantController } from './controllers/ai-assistant.controller';
|
|
|
20
20
|
export { AdminChatController } from './controllers/admin-chat.controller';
|
|
21
21
|
export type { AdminChatRequest, AdminChatResponse } from './controllers/admin-chat.controller';
|
|
22
22
|
export type { AiChatRequest, AiChatResponse, AiChatProduct, AddToCartAction, AiChatOrder, AiChatOrderLine, AiActiveOrder, AiCartLine, SetShippingAddressAction, SetBillingAddressAction, SetShippingMethodAction, } from './controllers/ai-assistant.controller';
|
|
23
|
+
export type { AiPromotion, ApplyCouponAction } from './services/types';
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAu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AAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,EACV,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,GAC1B,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -6,8 +6,8 @@ import { type AiAssistantPluginOptions } from '../constants';
|
|
|
6
6
|
import { EmbeddingService } from './embedding.service';
|
|
7
7
|
import { ProductEmbeddingService } from './product-embedding.service';
|
|
8
8
|
import { CollectionEmbeddingService } from './collection-embedding.service';
|
|
9
|
-
import type { AiChatProduct, AiChatCollection, AddToCartAction, AiChatOrder, AiChatOrderLine, AiActiveOrder, AiCartLine, SetShippingAddressAction, SetBillingAddressAction, SetShippingMethodAction, ChatResult, StreamingChatResult } from './types';
|
|
10
|
-
export type { AiChatProduct, AiChatCollection, AddToCartAction, AiChatOrder, AiChatOrderLine, AiActiveOrder, AiCartLine, SetShippingAddressAction, SetBillingAddressAction, SetShippingMethodAction, ChatResult, StreamingChatResult, };
|
|
9
|
+
import type { AiChatProduct, AiChatCollection, AddToCartAction, AiChatOrder, AiChatOrderLine, AiActiveOrder, AiCartLine, AiPromotion, ApplyCouponAction, SetShippingAddressAction, SetBillingAddressAction, SetShippingMethodAction, ChatResult, StreamingChatResult } from './types';
|
|
10
|
+
export type { AiChatProduct, AiChatCollection, AddToCartAction, AiChatOrder, AiChatOrderLine, AiActiveOrder, AiCartLine, AiPromotion, ApplyCouponAction, SetShippingAddressAction, SetBillingAddressAction, SetShippingMethodAction, ChatResult, StreamingChatResult, };
|
|
11
11
|
export declare class AiChatService implements OnModuleInit {
|
|
12
12
|
private options;
|
|
13
13
|
private connection;
|
|
@@ -27,6 +27,7 @@ export declare class AiChatService implements OnModuleInit {
|
|
|
27
27
|
private cartTools;
|
|
28
28
|
private orderTools;
|
|
29
29
|
private checkoutTools;
|
|
30
|
+
private promotionTools;
|
|
30
31
|
constructor(options: AiAssistantPluginOptions, connection: TransactionalConnection, moduleRef: ModuleRef, embeddingService: EmbeddingService, productEmbeddingService: ProductEmbeddingService, collectionEmbeddingService: CollectionEmbeddingService, orderService: OrderService, customerService: CustomerService, configService: ConfigService);
|
|
31
32
|
onModuleInit(): Promise<void>;
|
|
32
33
|
private buildTools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-chat.service.d.ts","sourceRoot":"","sources":["../../src/services/ai-chat.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAmC,MAAM,IAAI,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAwB,KAAK,wBAAwB,EAA2C,MAAM,cAAc,CAAC;AAC5H,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-chat.service.d.ts","sourceRoot":"","sources":["../../src/services/ai-chat.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAmC,MAAM,IAAI,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAwB,KAAK,wBAAwB,EAA2C,MAAM,cAAc,CAAC;AAC5H,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBA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AuB,EAAE,uBAAuB,EAChD,0BAA0B,EAAE,0BAA0B,EACtD,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa;IAKlC,YAAY;IA8ClB,OAAO,CAAC,UAAU;IAsJlB,UAAU,CACN,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,MAAM,EACnB,mBAAmB,GAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAM,EAChF,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAC7B,UAAU,CAAC,OAAO,UAAU,CAAC;IA8B1B,IAAI,CACN,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,MAAM,EACnB,mBAAmB,GAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAM,EAChF,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAC7B,OAAO,CAAC,UAAU,CAAC;CAqEzB"}
|
|
@@ -29,6 +29,7 @@ const search_tools_1 = require("./tools/search-tools");
|
|
|
29
29
|
const cart_tools_1 = require("./tools/cart-tools");
|
|
30
30
|
const order_tools_1 = require("./tools/order-tools");
|
|
31
31
|
const checkout_tools_1 = require("./tools/checkout-tools");
|
|
32
|
+
const promotion_tools_1 = require("./tools/promotion-tools");
|
|
32
33
|
const system_prompt_1 = require("./system-prompt");
|
|
33
34
|
// Tool definitions are created inline in the chat/streamChat methods using Vercel AI SDK tool() + zod schemas
|
|
34
35
|
let AiChatService = AiChatService_1 = class AiChatService {
|
|
@@ -83,6 +84,7 @@ let AiChatService = AiChatService_1 = class AiChatService {
|
|
|
83
84
|
this.cartTools = new cart_tools_1.CartTools(this.connection, this.orderService, this.mapper);
|
|
84
85
|
this.orderTools = new order_tools_1.OrderTools(this.connection, this.mapper);
|
|
85
86
|
this.checkoutTools = new checkout_tools_1.CheckoutTools(this.connection, this.orderService);
|
|
87
|
+
this.promotionTools = new promotion_tools_1.PromotionTools(this.connection, this.orderService);
|
|
86
88
|
}
|
|
87
89
|
buildTools(ctx, customerId) {
|
|
88
90
|
return {
|
|
@@ -206,6 +208,30 @@ let AiChatService = AiChatService_1 = class AiChatService {
|
|
|
206
208
|
}),
|
|
207
209
|
execute: async ({ shippingMethodId }) => this.checkoutTools.setShippingMethod(ctx, { shippingMethodId }),
|
|
208
210
|
}),
|
|
211
|
+
getAvailablePromotions: (0, ai_1.tool)({
|
|
212
|
+
description: 'Get all currently active promotions and deals available in the store. Shows both automatic promotions and coupon-based promotions with their discount details and conditions.',
|
|
213
|
+
inputSchema: zod_1.z.object({}),
|
|
214
|
+
execute: async () => this.promotionTools.getAvailablePromotions(ctx),
|
|
215
|
+
}),
|
|
216
|
+
applyCouponCode: (0, ai_1.tool)({
|
|
217
|
+
description: 'Apply a coupon/promo code to the customer\'s active order. The customer must be logged in and have items in their cart.',
|
|
218
|
+
inputSchema: zod_1.z.object({
|
|
219
|
+
couponCode: zod_1.z.string().describe('The coupon code to apply'),
|
|
220
|
+
}),
|
|
221
|
+
execute: async ({ couponCode }) => this.promotionTools.applyCouponCode(ctx, { couponCode }),
|
|
222
|
+
}),
|
|
223
|
+
removeCouponCode: (0, ai_1.tool)({
|
|
224
|
+
description: 'Remove a previously applied coupon code from the customer\'s active order.',
|
|
225
|
+
inputSchema: zod_1.z.object({
|
|
226
|
+
couponCode: zod_1.z.string().describe('The coupon code to remove'),
|
|
227
|
+
}),
|
|
228
|
+
execute: async ({ couponCode }) => this.promotionTools.removeCouponCode(ctx, { couponCode }),
|
|
229
|
+
}),
|
|
230
|
+
getCartDiscounts: (0, ai_1.tool)({
|
|
231
|
+
description: 'Get details about discounts currently applied to the cart, applied coupon codes, and promotions the customer is close to qualifying for (e.g. "spend $X more to get free shipping").',
|
|
232
|
+
inputSchema: zod_1.z.object({}),
|
|
233
|
+
execute: async () => this.promotionTools.getCartDiscounts(ctx),
|
|
234
|
+
}),
|
|
209
235
|
};
|
|
210
236
|
}
|
|
211
237
|
streamChat(ctx, userMessage, conversationHistory = [], customerId) {
|
|
@@ -236,15 +262,17 @@ let AiChatService = AiChatService_1 = class AiChatService {
|
|
|
236
262
|
}
|
|
237
263
|
// yo chai stream bina use garna paryo vanee kailee
|
|
238
264
|
async chat(ctx, userMessage, conversationHistory = [], customerId) {
|
|
239
|
-
var _a, _b, _c, _d;
|
|
265
|
+
var _a, _b, _c, _d, _e;
|
|
240
266
|
const result = this.streamChat(ctx, userMessage, conversationHistory, customerId);
|
|
241
267
|
const text = await result.text;
|
|
242
268
|
const steps = await result.steps;
|
|
243
269
|
let allProducts = [];
|
|
244
270
|
let allCollections = [];
|
|
245
271
|
let allOrders = [];
|
|
272
|
+
let allPromotions = [];
|
|
246
273
|
let addToCartAction;
|
|
247
274
|
let activeOrder;
|
|
275
|
+
let applyCouponAction;
|
|
248
276
|
let setShippingAddressAction;
|
|
249
277
|
let setBillingAddressAction;
|
|
250
278
|
let setShippingMethodAction;
|
|
@@ -262,12 +290,18 @@ let AiChatService = AiChatService_1 = class AiChatService {
|
|
|
262
290
|
if (((_d = data.orders) === null || _d === void 0 ? void 0 : _d.length) > 0) {
|
|
263
291
|
allOrders = data.orders;
|
|
264
292
|
}
|
|
293
|
+
if (((_e = data.promotions) === null || _e === void 0 ? void 0 : _e.length) > 0) {
|
|
294
|
+
allPromotions = data.promotions;
|
|
295
|
+
}
|
|
265
296
|
if (data.addToCartAction) {
|
|
266
297
|
addToCartAction = data.addToCartAction;
|
|
267
298
|
}
|
|
268
299
|
if (data.activeOrder) {
|
|
269
300
|
activeOrder = data.activeOrder;
|
|
270
301
|
}
|
|
302
|
+
if (data.applyCouponAction) {
|
|
303
|
+
applyCouponAction = data.applyCouponAction;
|
|
304
|
+
}
|
|
271
305
|
if (data.setShippingAddressAction) {
|
|
272
306
|
setShippingAddressAction = data.setShippingAddressAction;
|
|
273
307
|
}
|
|
@@ -286,6 +320,8 @@ let AiChatService = AiChatService_1 = class AiChatService {
|
|
|
286
320
|
addToCartAction,
|
|
287
321
|
orders: allOrders.length > 0 ? allOrders : undefined,
|
|
288
322
|
activeOrder,
|
|
323
|
+
promotions: allPromotions.length > 0 ? allPromotions : undefined,
|
|
324
|
+
applyCouponAction,
|
|
289
325
|
setShippingAddressAction,
|
|
290
326
|
setBillingAddressAction,
|
|
291
327
|
setShippingMethodAction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-chat.service.js","sourceRoot":"","sources":["../../src/services/ai-chat.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAC1E,uCAAyC;AACzC,2BAAiE;AACjE,2CAA8C;AAC9C,6BAAwB;AACxB,wCAAsH;AACtH,4CAA4H;AAC5H,2DAAuD;AACvD,2EAAsE;AACtE,iFAA4E;AAC5E,6DAAwD;AACxD,uDAAmD;AACnD,mDAA+C;AAC/C,qDAAiD;AACjD,2DAAuD;AACvD,mDAAgD;AAgChD,8GAA8G;AAGvG,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAYtB,YACkC,OAAyC,EAC/D,UAAmC,EACnC,SAAoB,EACpB,gBAAkC,EAClC,uBAAgD,EAChD,0BAAsD,EACtD,YAA0B,EAC1B,eAAgC,EAChC,aAA4B;QARE,YAAO,GAAP,OAAO,CAA0B;QAC/D,eAAU,GAAV,UAAU,CAAyB;QACnC,cAAS,GAAT,SAAS,CAAW;QACpB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,+BAA0B,GAA1B,0BAA0B,CAA4B;QACtD,iBAAY,GAAZ,YAAY,CAAc;QAC1B,oBAAe,GAAf,eAAe,CAAiB;QAChC,kBAAa,GAAb,aAAa,CAAe;QApBvB,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;QAGjD,mBAAc,GAAW,EAAE,CAAC;QAmBh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AC,EAAE,gCAAoB,CAAC;YAC1D,eAAe;YACf,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACpD,WAAW;YACX,wBAAwB;YACxB,uBAAuB;YACvB,uBAAuB;SAC1B,CAAC;IACN,CAAC;CACJ,CAAA;AAxSY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAcJ,WAAA,IAAA,eAAM,EAAC,gCAAoB,CAAC,CAAA;6CACT,8BAAuB;QACxB,gBAAS;QACF,oCAAgB;QACT,mDAAuB;QACpB,yDAA0B;QACxC,mBAAY;QACT,sBAAe;QACjB,oBAAa;GArB/B,aAAa,CAwSzB"}
|
|
1
|
+
{"version":3,"file":"ai-chat.service.js","sourceRoot":"","sources":["../../src/services/ai-chat.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAC1E,uCAAyC;AACzC,2BAAiE;AACjE,2CAA8C;AAC9C,6BAAwB;AACxB,wCAAsH;AACtH,4CAA4H;AAC5H,2DAAuD;AACvD,2EAAsE;AACtE,iFAA4E;AAC5E,6DAAwD;AACxD,uDAAmD;AACnD,mDAA+C;AAC/C,qDAAiD;AACjD,2DAAuD;AACvD,6DAAyD;AACzD,mDAAgD;AAoChD,8GAA8G;AAGvG,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAatB,YACkC,OAAyC,EAC/D,UAAmC,EACnC,SAAoB,EACpB,gBAAkC,EAClC,uBAAgD,EAChD,0BAAsD,EACtD,YAA0B,EAC1B,eAAgC,EAChC,aAA4B;QARE,YAAO,GAAP,OAAO,CAA0B;QAC/D,eAAU,GAAV,UAAU,CAAyB;QACnC,cAAS,GAAT,SAAS,CAAW;QACpB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,+BAA0B,GAA1B,0BAA0B,CAA4B;QACtD,iBAAY,GAAZ,YAAY,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CAAC;gBAC/C,CAAC;gBACD,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;oBAChC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC;gBAC7D,CAAC;gBACD,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;oBAC/B,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,CAAC;gBAC3D,CAAC;gBACD,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;oBAC/B,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,CAAC;gBAC3D,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO;YACH,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,6BAAiB,CAAC;YACjD,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,gCAAoB,CAAC;YAC1D,eAAe;YACf,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YACpD,WAAW;YACX,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;YAChE,iBAAiB;YACjB,wBAAwB;YACxB,uBAAuB;YACvB,uBAAuB;SAC1B,CAAC;IACN,CAAC;CACJ,CAAA;AA5UY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAeJ,WAAA,IAAA,eAAM,EAAC,gCAAoB,CAAC,CAAA;6CACT,8BAAuB;QACxB,gBAAS;QACF,oCAAgB;QACT,mDAAuB;QACpB,yDAA0B;QACxC,mBAAY;QACT,sBAAe;QACjB,oBAAa;GAtB/B,aAAa,CA4UzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SYSTEM_PROMPT = "You are a friendly and helpful shopping assistant for our online store. Your job is to help customers find products, browse collections, manage their cart, view order history, and track their orders.\n\n## What you CAN do:\n- Help customers find products using search, semantic search, or browsing by collections\n- Answer questions about products (features, prices, availability based on tool data)\n- Help customers filter products by price/budget\n- Recommend products based on intent (e.g. \"gift for dad\", \"something for gaming\")\n- Greet customers, have polite small talk ONLY about shopping/store context\n- Answer questions about the store, shipping, returns (give general helpful answers)\n- Add items to the customer's cart when they ask\n- Show the customer their current cart and adjust quantities or remove items\n- Show the customer their order history\n- Track the status of their orders and provide fulfillment/tracking info\n\n## What you MUST NOT do:\n- Answer questions unrelated to the store (e.g. \"who is Elon Musk\", \"capital of France\", \"write me a poem\")\n- Make up or fabricate product information - ONLY use data from tool results\n- Discuss politics, celebrities, news, science, or any topic outside the store\n\n## How to handle off-topic questions:\nPolitely redirect: \"I'm your shopping assistant and can only help with store-related questions. Can I help you find a product instead?\"\n\n## Tool usage:\n- `searchProducts` \u2014 keyword search (e.g. \"laptop\", \"camera\", \"headphones\")\n- `vectorSearch` \u2014 intent/semantic search (e.g. \"gift for dad\", \"something romantic\")\n- `getCollections` \u2014 list product categories/collections\n- `filterByPrice` \u2014 filter by budget/price range\n- `addToCart` \u2014 add a product to the customer's cart\n- `getActiveOrder` \u2014 get the customer's current cart/active order with all line items (requires login)\n- `adjustOrderLine` \u2014 change the quantity of an item in the cart, or remove it by setting quantity to 0 (requires login)\n- `getOrderHistory` \u2014 show the customer's past orders (requires login)\n- `trackOrder` \u2014 get status and tracking info for an order (requires login)\n- `getAvailableCountries` \u2014 list countries available for shipping/billing addresses\n- `getEligibleShippingMethods` \u2014 get available shipping methods for the active order (after address is set)\n- `getEligiblePaymentMethods` \u2014 get available payment methods for the active order\n- `setShippingAddress` \u2014 set shipping address on the active order (requires login and active order)\n- `setBillingAddress` \u2014 set billing address on the active order (requires login and active order)\n- `setShippingMethod` \u2014 set shipping method on the active order (requires login and active order)\n\n## CRITICAL response rules for products:\n- When tools return product data, do NOT list product names, prices, or images in your text. The UI automatically renders product cards with images, names, prices, and \"Add to Cart\" buttons below your message.\n- Keep your text to a brief friendly comment like \"Here are some cameras I found!\" \u2014 NOT a detailed listing.\n- NEVER include markdown images () in your response.\n- NEVER list individual product names with prices. The product cards handle that.\n\n## CRITICAL rules for addToCart:\n- The variantId MUST be the EXACT numeric ID string from the MOST RECENT search results for that specific product (e.g. \"42\", \"15\", \"103\"). It is always a number.\n- NEVER fabricate or guess a variantId. If you are not 100% certain of the correct variantId, search for the product AGAIN first.\n- When the user says \"buy this\" or \"add this\", look at the MOST RECENTLY shown product results. Do NOT reuse variantIds from older search results for different products.\n- You may confirm ONCE: mention the product name, price, and ask about quantity. But if the user has ALREADY confirmed (said \"yes\", \"sure\", \"go ahead\", \"do it\", given a quantity, etc.), call addToCart IMMEDIATELY. NEVER ask for confirmation more than once.\n- Once confirmed, call addToCart with the exact variantId AND productName from the search results and the requested quantity.\n- If there is ANY ambiguity about WHICH product the user means, ASK. But if the product is clear and user said yes, just add it.\n- ALWAYS provide the productName parameter when calling addToCart so the backend can verify the correct product.\n\n## Rules for cart tools (getActiveOrder, adjustOrderLine):\n- Use `getActiveOrder` when the customer asks about their cart, what's in their cart, cart total, or wants to review before checkout.\n- **CRITICAL: ALWAYS call `getActiveOrder` every time the customer asks about their cart, even if you already showed it earlier in the conversation.** The customer may have modified their cart outside of this chat (e.g. on the cart page). NEVER rely on previous tool results for cart state \u2014 always fetch fresh data.\n- Use `adjustOrderLine` to change quantities or remove items. You need the orderLineId from getActiveOrder results.\n- When adjusting quantity, set the new absolute quantity (not a delta). To remove an item, set quantity to 0.\n- Always call `getActiveOrder` first if you don't already have the orderLineId from the conversation context.\n- When showing the cart, summarize each item: product name, quantity, and line price. Also mention the cart total.\n\n## Rules for order tools:\n- Use `getOrderHistory` when the customer asks about their past orders, recent purchases, or order history.\n- Use `trackOrder` when the customer asks about a specific order's status, tracking, or shipment.\n- When showing order history, summarize each order briefly: order code, status, total, and what they ordered.\n- When tracking an order, mention the order state, fulfillment status, tracking code (if available), and items.\n- If a customer says \"where's my order?\" or \"track my order\" without specifying which one, use getOrderHistory first to find their most recent order, then use trackOrder on that order.\n\n## Rules for checkout tools:\n- **IMPORTANT \u2014 Country codes:** ALWAYS call `getAvailableCountries` FIRST before setting any address. Only use country codes returned by that tool. If the customer gives a country name or code not in the list, tell them which countries are available and ask them to pick one. NEVER guess or assume a country code \u2014 the backend will reject invalid ones.\n- Use `setShippingAddress` when the customer provides their shipping address. Collect all required fields: fullName, streetLine1, city, province, postalCode, countryCode, phoneNumber. Ask for missing fields before calling.\n- Use `setBillingAddress` when the customer provides a billing address. If they say \"same as shipping\", use the same address data.\n- Use `getEligibleShippingMethods` after the shipping address is set to show available shipping options.\n- Use `setShippingMethod` with the id from getEligibleShippingMethods when the customer chooses a shipping option.\n- You CANNOT process payments directly. After shipping address, billing address, and shipping method are all set, call `getEligiblePaymentMethods` to show the customer their available payment options (e.g. \"You can pay with Credit Card or PayPal\"), then tell them: \"Head to the [checkout page](/checkout) to complete your payment.\" Do NOT attempt to handle payment in the chat.\n- Always ensure there is an active order before calling checkout tools. If no active order exists, suggest adding items first.\n- The typical checkout flow is: getAvailableCountries \u2192 set shipping address \u2192 (optionally) set billing address \u2192 get eligible shipping methods \u2192 set shipping method \u2192 getEligiblePaymentMethods \u2192 direct user to /checkout for payment.\n- If the customer asks \"how can I pay?\" or \"what payment methods do you accept?\" at any point, call `getEligiblePaymentMethods` to answer.\n\n## IMPORTANT \u2014 matching products from conversation context:\n- When the user refers to a product that was ALREADY shown in the MOST RECENT search results, use the variantId from that specific search. Do NOT reuse variantIds from older/different searches.\n- If the user switches topics to a different product, ALWAYS search again to get the correct variantId for the new product. Do NOT mix up variantIds between different products.\n- Users will often use partial names, abbreviations, or slightly different wording. For example:\n - \"the wooden desk\" \u2192 matches \"Wooden Side Desk\"\n - \"add the camera\" \u2192 if only one camera was shown, use that one\n - \"the first one\" \u2192 use the first product from the last search\n - \"that laptop\" \u2192 matches the laptop shown earlier\n- Be smart about fuzzy matching. If the user's reference clearly maps to a product already in the conversation, just use it. Only search again if you genuinely cannot tell which product they mean.\n\n## Price formatting:\n- All prices in tool result summaries are already formatted in dollars (e.g. \"$42.63\"). Do NOT divide, convert, or reformat them \u2014 use them as-is.\n- When calling filterByPrice, prices must be provided in cents (smallest currency unit). For example, $50 = 5000 cents.\n\n## Response style:\n- Be concise and helpful\n- Keep product-related messages SHORT since product cards are shown separately\n- Always be honest - if something isn't available, say so\n- NEVER echo or repeat raw tool result text in your response. Tool results are internal data for you to use \u2014 do NOT include \"[Tool result: ...]\" or the summary text verbatim. Instead, paraphrase the result naturally in your own words.\n- When addToCart succeeds, simply confirm with something like \"Done! I've added X to your cart.\" Do NOT repeat the tool output summary.";
|
|
1
|
+
export declare const SYSTEM_PROMPT = "You are a friendly and helpful shopping assistant for our online store. Your job is to help customers find products, browse collections, manage their cart, view order history, and track their orders.\n\n## What you CAN do:\n- Help customers find products using search, semantic search, or browsing by collections\n- Answer questions about products (features, prices, availability based on tool data)\n- Help customers filter products by price/budget\n- Recommend products based on intent (e.g. \"gift for dad\", \"something for gaming\")\n- Greet customers, have polite small talk ONLY about shopping/store context\n- Answer questions about the store, shipping, returns (give general helpful answers)\n- Add items to the customer's cart when they ask\n- Show the customer their current cart and adjust quantities or remove items\n- Show the customer their order history\n- Track the status of their orders and provide fulfillment/tracking info\n- Show available promotions, deals, and coupon codes\n- Apply and remove coupon codes on the customer's cart\n- Tell the customer how much more they need to spend to qualify for promotions\n\n## What you MUST NOT do:\n- Answer questions unrelated to the store (e.g. \"who is Elon Musk\", \"capital of France\", \"write me a poem\")\n- Make up or fabricate product information - ONLY use data from tool results\n- Discuss politics, celebrities, news, science, or any topic outside the store\n\n## How to handle off-topic questions:\nPolitely redirect: \"I'm your shopping assistant and can only help with store-related questions. Can I help you find a product instead?\"\n\n## Tool usage:\n- `searchProducts` \u2014 keyword search (e.g. \"laptop\", \"camera\", \"headphones\")\n- `vectorSearch` \u2014 intent/semantic search (e.g. \"gift for dad\", \"something romantic\")\n- `getCollections` \u2014 list product categories/collections\n- `filterByPrice` \u2014 filter by budget/price range\n- `addToCart` \u2014 add a product to the customer's cart\n- `getActiveOrder` \u2014 get the customer's current cart/active order with all line items (requires login)\n- `adjustOrderLine` \u2014 change the quantity of an item in the cart, or remove it by setting quantity to 0 (requires login)\n- `getOrderHistory` \u2014 show the customer's past orders (requires login)\n- `trackOrder` \u2014 get status and tracking info for an order (requires login)\n- `getAvailableCountries` \u2014 list countries available for shipping/billing addresses\n- `getEligibleShippingMethods` \u2014 get available shipping methods for the active order (after address is set)\n- `getEligiblePaymentMethods` \u2014 get available payment methods for the active order\n- `setShippingAddress` \u2014 set shipping address on the active order (requires login and active order)\n- `setBillingAddress` \u2014 set billing address on the active order (requires login and active order)\n- `setShippingMethod` \u2014 set shipping method on the active order (requires login and active order)\n- `getAvailablePromotions` \u2014 list all active promotions and deals (automatic + coupon-based) with their conditions and discounts\n- `applyCouponCode` \u2014 apply a coupon/promo code to the active order (requires login and active order)\n- `removeCouponCode` \u2014 remove a coupon code from the active order (requires login and active order)\n- `getCartDiscounts` \u2014 show discounts on the current cart, applied coupons, and how close the customer is to qualifying for other promotions\n\n## CRITICAL response rules for products:\n- When tools return product data, do NOT list product names, prices, or images in your text. The UI automatically renders product cards with images, names, prices, and \"Add to Cart\" buttons below your message.\n- Keep your text to a brief friendly comment like \"Here are some cameras I found!\" \u2014 NOT a detailed listing.\n- NEVER include markdown images () in your response.\n- NEVER list individual product names with prices. The product cards handle that.\n\n## CRITICAL rules for addToCart:\n- The variantId MUST be the EXACT numeric ID string from the MOST RECENT search results for that specific product (e.g. \"42\", \"15\", \"103\"). It is always a number.\n- NEVER fabricate or guess a variantId. If you are not 100% certain of the correct variantId, search for the product AGAIN first.\n- When the user says \"buy this\" or \"add this\", look at the MOST RECENTLY shown product results. Do NOT reuse variantIds from older search results for different products.\n- You may confirm ONCE: mention the product name, price, and ask about quantity. But if the user has ALREADY confirmed (said \"yes\", \"sure\", \"go ahead\", \"do it\", given a quantity, etc.), call addToCart IMMEDIATELY. NEVER ask for confirmation more than once.\n- Once confirmed, call addToCart with the exact variantId AND productName from the search results and the requested quantity.\n- If there is ANY ambiguity about WHICH product the user means, ASK. But if the product is clear and user said yes, just add it.\n- ALWAYS provide the productName parameter when calling addToCart so the backend can verify the correct product.\n\n## Rules for cart tools (getActiveOrder, adjustOrderLine):\n- Use `getActiveOrder` when the customer asks about their cart, what's in their cart, cart total, or wants to review before checkout.\n- **CRITICAL: ALWAYS call `getActiveOrder` every time the customer asks about their cart, even if you already showed it earlier in the conversation.** The customer may have modified their cart outside of this chat (e.g. on the cart page). NEVER rely on previous tool results for cart state \u2014 always fetch fresh data.\n- Use `adjustOrderLine` to change quantities or remove items. You need the orderLineId from getActiveOrder results.\n- When adjusting quantity, set the new absolute quantity (not a delta). To remove an item, set quantity to 0.\n- Always call `getActiveOrder` first if you don't already have the orderLineId from the conversation context.\n- When showing the cart, summarize each item: product name, quantity, and line price. Also mention the cart total.\n\n## Rules for order tools:\n- Use `getOrderHistory` when the customer asks about their past orders, recent purchases, or order history.\n- Use `trackOrder` when the customer asks about a specific order's status, tracking, or shipment.\n- When showing order history, summarize each order briefly: order code, status, total, and what they ordered.\n- When tracking an order, mention the order state, fulfillment status, tracking code (if available), and items.\n- If a customer says \"where's my order?\" or \"track my order\" without specifying which one, use getOrderHistory first to find their most recent order, then use trackOrder on that order.\n\n## Rules for checkout tools:\n- **IMPORTANT \u2014 Country codes:** ALWAYS call `getAvailableCountries` FIRST before setting any address. Only use country codes returned by that tool. If the customer gives a country name or code not in the list, tell them which countries are available and ask them to pick one. NEVER guess or assume a country code \u2014 the backend will reject invalid ones.\n- Use `setShippingAddress` when the customer provides their shipping address. Collect all required fields: fullName, streetLine1, city, province, postalCode, countryCode, phoneNumber. Ask for missing fields before calling.\n- Use `setBillingAddress` when the customer provides a billing address. If they say \"same as shipping\", use the same address data.\n- Use `getEligibleShippingMethods` after the shipping address is set to show available shipping options.\n- Use `setShippingMethod` with the id from getEligibleShippingMethods when the customer chooses a shipping option.\n- You CANNOT process payments directly. After shipping address, billing address, and shipping method are all set, call `getEligiblePaymentMethods` to show the customer their available payment options (e.g. \"You can pay with Credit Card or PayPal\"), then tell them: \"Head to the [checkout page](/checkout) to complete your payment.\" Do NOT attempt to handle payment in the chat.\n- Always ensure there is an active order before calling checkout tools. If no active order exists, suggest adding items first.\n- The typical checkout flow is: getAvailableCountries \u2192 set shipping address \u2192 (optionally) set billing address \u2192 get eligible shipping methods \u2192 set shipping method \u2192 getEligiblePaymentMethods \u2192 direct user to /checkout for payment.\n- If the customer asks \"how can I pay?\" or \"what payment methods do you accept?\" at any point, call `getEligiblePaymentMethods` to answer.\n\n## IMPORTANT \u2014 matching products from conversation context:\n- When the user refers to a product that was ALREADY shown in the MOST RECENT search results, use the variantId from that specific search. Do NOT reuse variantIds from older/different searches.\n- If the user switches topics to a different product, ALWAYS search again to get the correct variantId for the new product. Do NOT mix up variantIds between different products.\n- Users will often use partial names, abbreviations, or slightly different wording. For example:\n - \"the wooden desk\" \u2192 matches \"Wooden Side Desk\"\n - \"add the camera\" \u2192 if only one camera was shown, use that one\n - \"the first one\" \u2192 use the first product from the last search\n - \"that laptop\" \u2192 matches the laptop shown earlier\n- Be smart about fuzzy matching. If the user's reference clearly maps to a product already in the conversation, just use it. Only search again if you genuinely cannot tell which product they mean.\n\n## Rules for promotion/coupon tools:\n- Use `getAvailablePromotions` when the customer asks about deals, discounts, promotions, sales, or coupon codes.\n- When showing promotions, clearly distinguish between **automatic promotions** (applied automatically when conditions are met) and **coupon promotions** (require entering a code). The UI will render promotion cards automatically \u2014 keep your text brief.\n- Use `applyCouponCode` when the customer wants to apply a coupon or promo code. Ensure there is an active order first.\n- Use `removeCouponCode` when the customer wants to remove a coupon code they previously applied.\n- Use `getCartDiscounts` when the customer asks about discounts on their current cart, wants to know if they qualify for any promotions, or asks \"how much more do I need to spend for X?\".\n- When a coupon code is successfully applied, confirm the savings and new total. The frontend will handle the cart update.\n- If a coupon code fails, explain why (invalid, expired, usage limit reached, conditions not met) and suggest alternatives if available.\n- NEVER fabricate coupon codes. Only use codes returned by `getAvailablePromotions`.\n- When the customer's cart is close to qualifying for a promotion (e.g. \"spend $10 more for free shipping\"), proactively mention it if you are already showing cart information.\n\n## Price formatting:\n- All prices in tool result summaries are already formatted in dollars (e.g. \"$42.63\"). Do NOT divide, convert, or reformat them \u2014 use them as-is.\n- When calling filterByPrice, prices must be provided in cents (smallest currency unit). For example, $50 = 5000 cents.\n\n## Response style:\n- Be concise and helpful\n- Keep product-related messages SHORT since product cards are shown separately\n- Always be honest - if something isn't available, say so\n- NEVER echo or repeat raw tool result text in your response. Tool results are internal data for you to use \u2014 do NOT include \"[Tool result: ...]\" or the summary text verbatim. Instead, paraphrase the result naturally in your own words.\n- When addToCart succeeds, simply confirm with something like \"Done! I've added X to your cart.\" Do NOT repeat the tool output summary.";
|
|
2
2
|
//# sourceMappingURL=system-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/services/system-prompt.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/services/system-prompt.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,gpXAqH8G,CAAC"}
|
|
@@ -17,6 +17,9 @@ exports.SYSTEM_PROMPT = `You are a friendly and helpful shopping assistant for o
|
|
|
17
17
|
- Show the customer their current cart and adjust quantities or remove items
|
|
18
18
|
- Show the customer their order history
|
|
19
19
|
- Track the status of their orders and provide fulfillment/tracking info
|
|
20
|
+
- Show available promotions, deals, and coupon codes
|
|
21
|
+
- Apply and remove coupon codes on the customer's cart
|
|
22
|
+
- Tell the customer how much more they need to spend to qualify for promotions
|
|
20
23
|
|
|
21
24
|
## What you MUST NOT do:
|
|
22
25
|
- Answer questions unrelated to the store (e.g. "who is Elon Musk", "capital of France", "write me a poem")
|
|
@@ -42,6 +45,10 @@ Politely redirect: "I'm your shopping assistant and can only help with store-rel
|
|
|
42
45
|
- \`setShippingAddress\` — set shipping address on the active order (requires login and active order)
|
|
43
46
|
- \`setBillingAddress\` — set billing address on the active order (requires login and active order)
|
|
44
47
|
- \`setShippingMethod\` — set shipping method on the active order (requires login and active order)
|
|
48
|
+
- \`getAvailablePromotions\` — list all active promotions and deals (automatic + coupon-based) with their conditions and discounts
|
|
49
|
+
- \`applyCouponCode\` — apply a coupon/promo code to the active order (requires login and active order)
|
|
50
|
+
- \`removeCouponCode\` — remove a coupon code from the active order (requires login and active order)
|
|
51
|
+
- \`getCartDiscounts\` — show discounts on the current cart, applied coupons, and how close the customer is to qualifying for other promotions
|
|
45
52
|
|
|
46
53
|
## CRITICAL response rules for products:
|
|
47
54
|
- When tools return product data, do NOT list product names, prices, or images in your text. The UI automatically renders product cards with images, names, prices, and "Add to Cart" buttons below your message.
|
|
@@ -94,6 +101,17 @@ Politely redirect: "I'm your shopping assistant and can only help with store-rel
|
|
|
94
101
|
- "that laptop" → matches the laptop shown earlier
|
|
95
102
|
- Be smart about fuzzy matching. If the user's reference clearly maps to a product already in the conversation, just use it. Only search again if you genuinely cannot tell which product they mean.
|
|
96
103
|
|
|
104
|
+
## Rules for promotion/coupon tools:
|
|
105
|
+
- Use \`getAvailablePromotions\` when the customer asks about deals, discounts, promotions, sales, or coupon codes.
|
|
106
|
+
- When showing promotions, clearly distinguish between **automatic promotions** (applied automatically when conditions are met) and **coupon promotions** (require entering a code). The UI will render promotion cards automatically — keep your text brief.
|
|
107
|
+
- Use \`applyCouponCode\` when the customer wants to apply a coupon or promo code. Ensure there is an active order first.
|
|
108
|
+
- Use \`removeCouponCode\` when the customer wants to remove a coupon code they previously applied.
|
|
109
|
+
- Use \`getCartDiscounts\` when the customer asks about discounts on their current cart, wants to know if they qualify for any promotions, or asks "how much more do I need to spend for X?".
|
|
110
|
+
- When a coupon code is successfully applied, confirm the savings and new total. The frontend will handle the cart update.
|
|
111
|
+
- If a coupon code fails, explain why (invalid, expired, usage limit reached, conditions not met) and suggest alternatives if available.
|
|
112
|
+
- NEVER fabricate coupon codes. Only use codes returned by \`getAvailablePromotions\`.
|
|
113
|
+
- When the customer's cart is close to qualifying for a promotion (e.g. "spend $10 more for free shipping"), proactively mention it if you are already showing cart information.
|
|
114
|
+
|
|
97
115
|
## Price formatting:
|
|
98
116
|
- All prices in tool result summaries are already formatted in dollars (e.g. "$42.63"). Do NOT divide, convert, or reformat them — use them as-is.
|
|
99
117
|
- When calling filterByPrice, prices must be provided in cents (smallest currency unit). For example, $50 = 5000 cents.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/services/system-prompt.ts"],"names":[],"mappings":";;;AAAA,iDAAiD;AACjD,gBAAgB;AAChB,iDAAiD;AACpC,QAAA,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/services/system-prompt.ts"],"names":[],"mappings":";;;AAAA,iDAAiD;AACjD,gBAAgB;AAChB,iDAAiD;AACpC,QAAA,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wIAqH2G,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RequestContext, TransactionalConnection, OrderService } from '@vendure/core';
|
|
2
|
+
import type { ToolResult } from '../types';
|
|
3
|
+
export declare class PromotionTools {
|
|
4
|
+
private connection;
|
|
5
|
+
private orderService;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(connection: TransactionalConnection, orderService: OrderService);
|
|
8
|
+
/**
|
|
9
|
+
* Get all currently active promotions available to the customer.
|
|
10
|
+
* Shows coupon-based and automatic promotions with their conditions and discounts.
|
|
11
|
+
*/
|
|
12
|
+
getAvailablePromotions(ctx: RequestContext): Promise<ToolResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Apply a coupon code to the customer's active order.
|
|
15
|
+
*/
|
|
16
|
+
applyCouponCode(ctx: RequestContext, params: {
|
|
17
|
+
couponCode: string;
|
|
18
|
+
}): Promise<ToolResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Remove a coupon code from the customer's active order.
|
|
21
|
+
*/
|
|
22
|
+
removeCouponCode(ctx: RequestContext, params: {
|
|
23
|
+
couponCode: string;
|
|
24
|
+
}): Promise<ToolResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Get the current discounts/promotions applied to the active order,
|
|
27
|
+
* including how much more the customer needs to spend to qualify for other promotions.
|
|
28
|
+
*/
|
|
29
|
+
getCartDiscounts(ctx: RequestContext): Promise<ToolResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Parse a simple-json column value into an array.
|
|
32
|
+
* Vendure stores conditions/actions as JSON arrays in the promotion table.
|
|
33
|
+
* Each entry has { code, args } where args is an array of { name, value } pairs.
|
|
34
|
+
*/
|
|
35
|
+
private parseJsonColumn;
|
|
36
|
+
private parseCondition;
|
|
37
|
+
private parseAction;
|
|
38
|
+
/**
|
|
39
|
+
* Normalize args from Vendure's condition/action format.
|
|
40
|
+
* Args can be:
|
|
41
|
+
* - An array of { name, value } objects
|
|
42
|
+
* - A JSON string of such an array
|
|
43
|
+
* - An object with { argName: value } pairs
|
|
44
|
+
*/
|
|
45
|
+
private normalizeArgs;
|
|
46
|
+
private extractAmountFromArgs;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=promotion-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotion-tools.d.ts","sourceRoot":"","sources":["../../../src/services/tools/promotion-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,YAAY,EAA+B,MAAM,eAAe,CAAC;AAEnH,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,UAAU,CAAC;AAE3E,qBAAa,cAAc;IAInB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,YAAY;IAJxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAG9C,UAAU,EAAE,uBAAuB,EACnC,YAAY,EAAE,YAAY;IAGtC;;;OAGG;IACG,sBAAsB,CACxB,GAAG,EAAE,cAAc,GACpB,OAAO,CAAC,UAAU,CAAC;IA4FtB;;OAEG;IACG,eAAe,CACjB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,UAAU,CAAC;IA4DtB;;OAEG;IACG,gBAAgB,CAClB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,UAAU,CAAC;IAoCtB;;;OAGG;IACG,gBAAgB,CAClB,GAAG,EAAE,cAAc,GACpB,OAAO,CAAC,UAAU,CAAC;IA6FtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,WAAW;IAyCnB;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,qBAAqB;CAchC"}
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PromotionTools = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const core_1 = require("@vendure/core");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
class PromotionTools {
|
|
8
|
+
constructor(connection, orderService) {
|
|
9
|
+
this.connection = connection;
|
|
10
|
+
this.orderService = orderService;
|
|
11
|
+
this.logger = new common_1.Logger(PromotionTools.name);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get all currently active promotions available to the customer.
|
|
15
|
+
* Shows coupon-based and automatic promotions with their conditions and discounts.
|
|
16
|
+
*/
|
|
17
|
+
async getAvailablePromotions(ctx) {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
try {
|
|
20
|
+
// Query active promotions that haven't expired.
|
|
21
|
+
// Conditions and actions are stored as simple-json columns directly on the promotion table.
|
|
22
|
+
// Use NOW() directly in SQL so PostgreSQL handles timezone comparison natively
|
|
23
|
+
// instead of passing a JS-generated ISO string which can cause timezone mismatches.
|
|
24
|
+
const result = await this.connection.rawConnection.query(`SELECT p.id, p."couponCode", p."perCustomerUsageLimit", p."usageLimit",
|
|
25
|
+
p."startsAt", p."endsAt", p.enabled,
|
|
26
|
+
p.conditions, p.actions,
|
|
27
|
+
t.name, t.description
|
|
28
|
+
FROM promotion p
|
|
29
|
+
JOIN promotion_translation t ON t."baseId" = p.id
|
|
30
|
+
WHERE p.enabled = true
|
|
31
|
+
AND p."deletedAt" IS NULL
|
|
32
|
+
AND (p."startsAt" IS NULL OR p."startsAt" <= NOW())
|
|
33
|
+
AND (p."endsAt" IS NULL OR p."endsAt" >= NOW())
|
|
34
|
+
ORDER BY p.id ASC`);
|
|
35
|
+
this.logger.log(`getAvailablePromotions: query returned ${result.length} rows`);
|
|
36
|
+
const promotions = [];
|
|
37
|
+
for (const row of result) {
|
|
38
|
+
const promo = {
|
|
39
|
+
id: String(row.id),
|
|
40
|
+
name: String((_a = row.name) !== null && _a !== void 0 ? _a : ''),
|
|
41
|
+
description: String((_b = row.description) !== null && _b !== void 0 ? _b : ''),
|
|
42
|
+
couponCode: row.couponCode ? String(row.couponCode) : undefined,
|
|
43
|
+
startsAt: row.startsAt ? new Date(row.startsAt).toISOString() : undefined,
|
|
44
|
+
endsAt: row.endsAt ? new Date(row.endsAt).toISOString() : undefined,
|
|
45
|
+
perCustomerUsageLimit: row.perCustomerUsageLimit ? Number(row.perCustomerUsageLimit) : undefined,
|
|
46
|
+
};
|
|
47
|
+
// Parse conditions from the simple-json column
|
|
48
|
+
const conditions = this.parseJsonColumn(row.conditions);
|
|
49
|
+
const conditionDetails = [];
|
|
50
|
+
for (const c of conditions) {
|
|
51
|
+
const parsed = this.parseCondition((_c = c.code) !== null && _c !== void 0 ? _c : c.type, c.args);
|
|
52
|
+
if (parsed)
|
|
53
|
+
conditionDetails.push(parsed);
|
|
54
|
+
}
|
|
55
|
+
if (conditionDetails.length > 0) {
|
|
56
|
+
promo.conditions = conditionDetails;
|
|
57
|
+
}
|
|
58
|
+
// Parse actions from the simple-json column
|
|
59
|
+
const actions = this.parseJsonColumn(row.actions);
|
|
60
|
+
const actionDetails = [];
|
|
61
|
+
for (const a of actions) {
|
|
62
|
+
const parsed = this.parseAction((_d = a.code) !== null && _d !== void 0 ? _d : a.type, a.args);
|
|
63
|
+
if (parsed)
|
|
64
|
+
actionDetails.push(parsed);
|
|
65
|
+
}
|
|
66
|
+
if (actionDetails.length > 0) {
|
|
67
|
+
promo.discountSummary = actionDetails.join('; ');
|
|
68
|
+
}
|
|
69
|
+
promotions.push(promo);
|
|
70
|
+
}
|
|
71
|
+
const couponPromos = promotions.filter(p => p.couponCode);
|
|
72
|
+
const autoPromos = promotions.filter(p => !p.couponCode);
|
|
73
|
+
let summary = '';
|
|
74
|
+
if (promotions.length === 0) {
|
|
75
|
+
summary = 'No active promotions available at this time.';
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const parts = [];
|
|
79
|
+
if (autoPromos.length > 0) {
|
|
80
|
+
parts.push(`Automatic promotions (applied automatically): ${autoPromos.map(p => { var _a; return `"${p.name}"${p.discountSummary ? ' — ' + p.discountSummary : ''}${((_a = p.conditions) === null || _a === void 0 ? void 0 : _a.length) ? ' (requires: ' + p.conditions.join(', ') + ')' : ''}`; }).join('; ')}`);
|
|
81
|
+
}
|
|
82
|
+
if (couponPromos.length > 0) {
|
|
83
|
+
parts.push(`Coupon promotions (need a coupon code): ${couponPromos.map(p => { var _a; return `"${p.name}" — code: "${p.couponCode}"${p.discountSummary ? ', discount: ' + p.discountSummary : ''}${((_a = p.conditions) === null || _a === void 0 ? void 0 : _a.length) ? ' (requires: ' + p.conditions.join(', ') + ')' : ''}${p.endsAt ? ', expires: ' + new Date(p.endsAt).toLocaleDateString() : ''}`; }).join('; ')}`);
|
|
84
|
+
}
|
|
85
|
+
summary = parts.join('. ');
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
products: [],
|
|
89
|
+
collections: [],
|
|
90
|
+
promotions,
|
|
91
|
+
summary,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
this.logger.error(`Error fetching promotions: ${e}`);
|
|
96
|
+
return { products: [], collections: [], summary: 'Error fetching available promotions.' };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Apply a coupon code to the customer's active order.
|
|
101
|
+
*/
|
|
102
|
+
async applyCouponCode(ctx, params) {
|
|
103
|
+
var _a, _b, _c, _d, _e;
|
|
104
|
+
if (!ctx.activeUserId) {
|
|
105
|
+
return { products: [], collections: [], summary: 'Error: You must be logged in to apply a coupon code.' };
|
|
106
|
+
}
|
|
107
|
+
const couponCode = (_a = params.couponCode) === null || _a === void 0 ? void 0 : _a.trim();
|
|
108
|
+
if (!couponCode) {
|
|
109
|
+
return { products: [], collections: [], summary: 'Error: No coupon code provided.' };
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const order = await this.orderService.getActiveOrderForUser(ctx, ctx.activeUserId);
|
|
113
|
+
if (!order) {
|
|
114
|
+
return { products: [], collections: [], summary: 'Error: No active order found. Add items to your cart first.' };
|
|
115
|
+
}
|
|
116
|
+
const result = await this.orderService.applyCouponCode(ctx, order.id, couponCode);
|
|
117
|
+
if ((0, core_1.isGraphQlErrorResult)(result)) {
|
|
118
|
+
const errorMsg = (_c = (_b = result.message) !== null && _b !== void 0 ? _b : result.errorCode) !== null && _c !== void 0 ? _c : 'Unknown error';
|
|
119
|
+
this.logger.warn(`applyCouponCode error: ${errorMsg}`);
|
|
120
|
+
// Provide a user-friendly message
|
|
121
|
+
if (errorMsg.includes('COUPON_CODE_INVALID') || errorMsg.toLowerCase().includes('invalid')) {
|
|
122
|
+
return { products: [], collections: [], summary: `The coupon code "${couponCode}" is not valid. Please check the code and try again.` };
|
|
123
|
+
}
|
|
124
|
+
if (errorMsg.includes('COUPON_CODE_EXPIRED') || errorMsg.toLowerCase().includes('expired')) {
|
|
125
|
+
return { products: [], collections: [], summary: `The coupon code "${couponCode}" has expired.` };
|
|
126
|
+
}
|
|
127
|
+
if (errorMsg.includes('COUPON_CODE_LIMIT_ERROR') || errorMsg.toLowerCase().includes('limit')) {
|
|
128
|
+
return { products: [], collections: [], summary: `The coupon code "${couponCode}" has reached its usage limit.` };
|
|
129
|
+
}
|
|
130
|
+
return { products: [], collections: [], summary: `Error applying coupon code: ${errorMsg}` };
|
|
131
|
+
}
|
|
132
|
+
// Get the updated order to show the new total
|
|
133
|
+
const updatedOrder = result;
|
|
134
|
+
const totalBefore = (_d = order.totalWithTax) !== null && _d !== void 0 ? _d : 0;
|
|
135
|
+
const totalAfter = (_e = updatedOrder.totalWithTax) !== null && _e !== void 0 ? _e : 0;
|
|
136
|
+
const discount = totalBefore - totalAfter;
|
|
137
|
+
let summaryText = `Coupon code "${couponCode}" applied successfully!`;
|
|
138
|
+
if (discount > 0) {
|
|
139
|
+
summaryText += ` You saved ${(0, constants_1.formatPrice)(discount)}. New order total: ${(0, constants_1.formatPrice)(totalAfter)}.`;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
summaryText += ` Order total: ${(0, constants_1.formatPrice)(totalAfter)}.`;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
products: [],
|
|
146
|
+
collections: [],
|
|
147
|
+
summary: summaryText,
|
|
148
|
+
applyCouponAction: { couponCode, applied: true },
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
this.logger.error(`Error applying coupon code: ${e}`);
|
|
153
|
+
return { products: [], collections: [], summary: 'Error applying coupon code. Please try again.' };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Remove a coupon code from the customer's active order.
|
|
158
|
+
*/
|
|
159
|
+
async removeCouponCode(ctx, params) {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
if (!ctx.activeUserId) {
|
|
162
|
+
return { products: [], collections: [], summary: 'Error: You must be logged in to remove a coupon code.' };
|
|
163
|
+
}
|
|
164
|
+
const couponCode = (_a = params.couponCode) === null || _a === void 0 ? void 0 : _a.trim();
|
|
165
|
+
if (!couponCode) {
|
|
166
|
+
return { products: [], collections: [], summary: 'Error: No coupon code provided.' };
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const order = await this.orderService.getActiveOrderForUser(ctx, ctx.activeUserId);
|
|
170
|
+
if (!order) {
|
|
171
|
+
return { products: [], collections: [], summary: 'Error: No active order found.' };
|
|
172
|
+
}
|
|
173
|
+
const result = await this.orderService.removeCouponCode(ctx, order.id, couponCode);
|
|
174
|
+
// removeCouponCode returns the updated Order (not an error result)
|
|
175
|
+
if (!result) {
|
|
176
|
+
return { products: [], collections: [], summary: `Could not remove coupon code "${couponCode}". It may not be applied to your order.` };
|
|
177
|
+
}
|
|
178
|
+
const totalAfter = (_b = result.totalWithTax) !== null && _b !== void 0 ? _b : 0;
|
|
179
|
+
return {
|
|
180
|
+
products: [],
|
|
181
|
+
collections: [],
|
|
182
|
+
summary: `Coupon code "${couponCode}" removed. Updated order total: ${(0, constants_1.formatPrice)(totalAfter)}.`,
|
|
183
|
+
applyCouponAction: { couponCode, applied: false },
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
this.logger.error(`Error removing coupon code: ${e}`);
|
|
188
|
+
return { products: [], collections: [], summary: 'Error removing coupon code. Please try again.' };
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get the current discounts/promotions applied to the active order,
|
|
193
|
+
* including how much more the customer needs to spend to qualify for other promotions.
|
|
194
|
+
*/
|
|
195
|
+
async getCartDiscounts(ctx) {
|
|
196
|
+
var _a, _b, _c;
|
|
197
|
+
if (!ctx.activeUserId) {
|
|
198
|
+
return { products: [], collections: [], summary: 'Error: You must be logged in to view cart discounts.' };
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
const order = await this.orderService.getActiveOrderForUser(ctx, ctx.activeUserId);
|
|
202
|
+
if (!order) {
|
|
203
|
+
return { products: [], collections: [], summary: 'No active order found. Add items to your cart first.' };
|
|
204
|
+
}
|
|
205
|
+
// Load full order with discounts
|
|
206
|
+
const fullOrder = await this.connection.rawConnection.query(`SELECT o.id, o.code, o."subTotalWithTax", o."totalWithTax",
|
|
207
|
+
o."couponCodes"
|
|
208
|
+
FROM "order" o
|
|
209
|
+
WHERE o.id = $1`, [order.id]);
|
|
210
|
+
if (!fullOrder || fullOrder.length === 0) {
|
|
211
|
+
return { products: [], collections: [], summary: 'Could not load order details.' };
|
|
212
|
+
}
|
|
213
|
+
const orderData = fullOrder[0];
|
|
214
|
+
const subTotal = Number((_a = orderData.subTotalWithTax) !== null && _a !== void 0 ? _a : 0);
|
|
215
|
+
const total = Number((_b = orderData.totalWithTax) !== null && _b !== void 0 ? _b : 0);
|
|
216
|
+
const discount = subTotal - total;
|
|
217
|
+
const couponCodes = orderData.couponCodes
|
|
218
|
+
? (typeof orderData.couponCodes === 'string' ? JSON.parse(orderData.couponCodes) : orderData.couponCodes)
|
|
219
|
+
: [];
|
|
220
|
+
// Check which promotions customer could still qualify for
|
|
221
|
+
const allPromotions = await this.connection.rawConnection.query(`SELECT p.id, p."couponCode", p.conditions,
|
|
222
|
+
t.name, t.description
|
|
223
|
+
FROM promotion p
|
|
224
|
+
JOIN promotion_translation t ON t."baseId" = p.id
|
|
225
|
+
WHERE p.enabled = true
|
|
226
|
+
AND p."deletedAt" IS NULL
|
|
227
|
+
AND (p."startsAt" IS NULL OR p."startsAt" <= NOW())
|
|
228
|
+
AND (p."endsAt" IS NULL OR p."endsAt" >= NOW())`);
|
|
229
|
+
// Check for minimum order amount conditions
|
|
230
|
+
const nearbyPromotions = [];
|
|
231
|
+
for (const promo of allPromotions) {
|
|
232
|
+
const conditions = this.parseJsonColumn(promo.conditions);
|
|
233
|
+
for (const c of conditions) {
|
|
234
|
+
const code = (_c = c.code) !== null && _c !== void 0 ? _c : c.type;
|
|
235
|
+
if (code === 'minimum_order_amount' || code === 'minimumOrderAmount') {
|
|
236
|
+
const minAmount = this.extractAmountFromArgs(c.args);
|
|
237
|
+
if (minAmount && subTotal < minAmount) {
|
|
238
|
+
const remaining = minAmount - subTotal;
|
|
239
|
+
nearbyPromotions.push(`"${promo.name}" — spend ${(0, constants_1.formatPrice)(remaining)} more to qualify${promo.couponCode ? ` (use code: "${promo.couponCode}")` : ' (applied automatically)'}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Build summary
|
|
245
|
+
const parts = [];
|
|
246
|
+
parts.push(`Cart subtotal: ${(0, constants_1.formatPrice)(subTotal)}, total: ${(0, constants_1.formatPrice)(total)}.`);
|
|
247
|
+
if (couponCodes.length > 0) {
|
|
248
|
+
parts.push(`Applied coupon codes: ${couponCodes.map((c) => `"${c}"`).join(', ')}.`);
|
|
249
|
+
}
|
|
250
|
+
if (discount > 0) {
|
|
251
|
+
parts.push(`Total discount: ${(0, constants_1.formatPrice)(discount)}.`);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
parts.push('No discounts currently applied.');
|
|
255
|
+
}
|
|
256
|
+
if (nearbyPromotions.length > 0) {
|
|
257
|
+
parts.push(`Promotions you're close to qualifying for: ${nearbyPromotions.join('; ')}`);
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
products: [],
|
|
261
|
+
collections: [],
|
|
262
|
+
summary: parts.join(' '),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
catch (e) {
|
|
266
|
+
this.logger.error(`Error fetching cart discounts: ${e}`);
|
|
267
|
+
return { products: [], collections: [], summary: 'Error fetching cart discount information.' };
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// ── Helper methods ──
|
|
271
|
+
/**
|
|
272
|
+
* Parse a simple-json column value into an array.
|
|
273
|
+
* Vendure stores conditions/actions as JSON arrays in the promotion table.
|
|
274
|
+
* Each entry has { code, args } where args is an array of { name, value } pairs.
|
|
275
|
+
*/
|
|
276
|
+
parseJsonColumn(value) {
|
|
277
|
+
try {
|
|
278
|
+
if (!value)
|
|
279
|
+
return [];
|
|
280
|
+
if (Array.isArray(value))
|
|
281
|
+
return value;
|
|
282
|
+
if (typeof value === 'string') {
|
|
283
|
+
const parsed = JSON.parse(value);
|
|
284
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
285
|
+
}
|
|
286
|
+
return [];
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
parseCondition(code, argsRaw) {
|
|
293
|
+
var _a;
|
|
294
|
+
if (!code)
|
|
295
|
+
return null;
|
|
296
|
+
try {
|
|
297
|
+
const args = this.normalizeArgs(argsRaw);
|
|
298
|
+
const argsMap = new Map(args.map((a) => [a.name, a.value]));
|
|
299
|
+
switch (code) {
|
|
300
|
+
case 'minimum_order_amount':
|
|
301
|
+
case 'minimumOrderAmount': {
|
|
302
|
+
const amount = this.extractAmountFromArgs(argsRaw);
|
|
303
|
+
return amount ? `Minimum order of ${(0, constants_1.formatPrice)(amount)}` : 'Minimum order amount required';
|
|
304
|
+
}
|
|
305
|
+
case 'at_least_n_with_facets':
|
|
306
|
+
case 'atLeastNWithFacets': {
|
|
307
|
+
const minimum = (_a = argsMap.get('minimum')) !== null && _a !== void 0 ? _a : argsMap.get('count');
|
|
308
|
+
return minimum ? `At least ${minimum} qualifying items` : 'Specific items required';
|
|
309
|
+
}
|
|
310
|
+
case 'buy_x_get_y_free':
|
|
311
|
+
case 'buyXGetYFree': {
|
|
312
|
+
const amountX = argsMap.get('amountX');
|
|
313
|
+
const amountY = argsMap.get('amountY');
|
|
314
|
+
return amountX && amountY ? `Buy ${amountX} get ${amountY} free` : 'Buy X get Y free';
|
|
315
|
+
}
|
|
316
|
+
case 'customer_group':
|
|
317
|
+
case 'customerGroup':
|
|
318
|
+
return 'Available to specific customer groups';
|
|
319
|
+
default:
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
parseAction(code, argsRaw) {
|
|
328
|
+
if (!code)
|
|
329
|
+
return null;
|
|
330
|
+
try {
|
|
331
|
+
const args = this.normalizeArgs(argsRaw);
|
|
332
|
+
const argsMap = new Map(args.map((a) => [a.name, a.value]));
|
|
333
|
+
switch (code) {
|
|
334
|
+
case 'order_percentage_discount':
|
|
335
|
+
case 'orderPercentageDiscount': {
|
|
336
|
+
const discount = argsMap.get('discount');
|
|
337
|
+
return discount ? `${discount}% off entire order` : 'Percentage discount on order';
|
|
338
|
+
}
|
|
339
|
+
case 'order_fixed_discount':
|
|
340
|
+
case 'orderFixedDiscount': {
|
|
341
|
+
const discount = argsMap.get('discount');
|
|
342
|
+
return discount ? `${(0, constants_1.formatPrice)(Number(discount))} off entire order` : 'Fixed discount on order';
|
|
343
|
+
}
|
|
344
|
+
case 'facet_based_discount':
|
|
345
|
+
case 'discountOnItemWithFacets': {
|
|
346
|
+
const discount = argsMap.get('discount');
|
|
347
|
+
return discount ? `${discount}% off qualifying items` : 'Discount on qualifying items';
|
|
348
|
+
}
|
|
349
|
+
case 'products_percentage_discount':
|
|
350
|
+
case 'productsPercentageDiscount': {
|
|
351
|
+
const discount = argsMap.get('discount');
|
|
352
|
+
return discount ? `${discount}% off specific products` : 'Percentage discount on products';
|
|
353
|
+
}
|
|
354
|
+
case 'free_shipping':
|
|
355
|
+
case 'freeShipping':
|
|
356
|
+
return 'Free shipping';
|
|
357
|
+
case 'buy_x_get_y_free':
|
|
358
|
+
case 'buyXGetYFree':
|
|
359
|
+
return 'Buy X get Y free';
|
|
360
|
+
default:
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
catch {
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Normalize args from Vendure's condition/action format.
|
|
370
|
+
* Args can be:
|
|
371
|
+
* - An array of { name, value } objects
|
|
372
|
+
* - A JSON string of such an array
|
|
373
|
+
* - An object with { argName: value } pairs
|
|
374
|
+
*/
|
|
375
|
+
normalizeArgs(argsRaw) {
|
|
376
|
+
try {
|
|
377
|
+
if (!argsRaw)
|
|
378
|
+
return [];
|
|
379
|
+
const args = typeof argsRaw === 'string' ? JSON.parse(argsRaw) : argsRaw;
|
|
380
|
+
if (Array.isArray(args))
|
|
381
|
+
return args;
|
|
382
|
+
// Handle { key: value } format
|
|
383
|
+
if (typeof args === 'object') {
|
|
384
|
+
return Object.entries(args).map(([name, value]) => ({ name, value }));
|
|
385
|
+
}
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
catch {
|
|
389
|
+
return [];
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
extractAmountFromArgs(argsRaw) {
|
|
393
|
+
try {
|
|
394
|
+
const args = this.normalizeArgs(argsRaw);
|
|
395
|
+
for (const a of args) {
|
|
396
|
+
if (a.name === 'amount' || a.name === 'orderMinimum' || a.name === 'minimum') {
|
|
397
|
+
const val = Number(a.value);
|
|
398
|
+
if (!isNaN(val) && val > 0)
|
|
399
|
+
return val;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
exports.PromotionTools = PromotionTools;
|
|
410
|
+
//# sourceMappingURL=promotion-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;wBAAE,OAAO,GAAG,CAAC;gBAC3C,CAAC;YACL,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;CACJ;AA3bD,wCA2bC"}
|
package/dist/services/types.d.ts
CHANGED
|
@@ -87,6 +87,23 @@ export interface SetBillingAddressAction {
|
|
|
87
87
|
export interface SetShippingMethodAction {
|
|
88
88
|
shippingMethodId: string;
|
|
89
89
|
}
|
|
90
|
+
/** A promotion available to the customer */
|
|
91
|
+
export interface AiPromotion {
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
description: string;
|
|
95
|
+
couponCode?: string;
|
|
96
|
+
startsAt?: string;
|
|
97
|
+
endsAt?: string;
|
|
98
|
+
perCustomerUsageLimit?: number;
|
|
99
|
+
conditions?: string[];
|
|
100
|
+
discountSummary?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Action signal for applying/removing a coupon code */
|
|
103
|
+
export interface ApplyCouponAction {
|
|
104
|
+
couponCode: string;
|
|
105
|
+
applied: boolean;
|
|
106
|
+
}
|
|
90
107
|
export interface ChatResult {
|
|
91
108
|
message: string;
|
|
92
109
|
products: AiChatProduct[];
|
|
@@ -97,6 +114,8 @@ export interface ChatResult {
|
|
|
97
114
|
setShippingAddressAction?: SetShippingAddressAction;
|
|
98
115
|
setBillingAddressAction?: SetBillingAddressAction;
|
|
99
116
|
setShippingMethodAction?: SetShippingMethodAction;
|
|
117
|
+
promotions?: AiPromotion[];
|
|
118
|
+
applyCouponAction?: ApplyCouponAction;
|
|
100
119
|
}
|
|
101
120
|
/** Result type for streaming chat — returns a ReadableStream + structured data promise */
|
|
102
121
|
export interface StreamingChatResult {
|
|
@@ -114,5 +133,7 @@ export interface ToolResult {
|
|
|
114
133
|
setShippingAddressAction?: SetShippingAddressAction;
|
|
115
134
|
setBillingAddressAction?: SetBillingAddressAction;
|
|
116
135
|
setShippingMethodAction?: SetShippingMethodAction;
|
|
136
|
+
promotions?: AiPromotion[];
|
|
137
|
+
applyCouponAction?: ApplyCouponAction;
|
|
117
138
|
}
|
|
118
139
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/services/types.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,kDAAkD;AAClD,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,kDAAkD;AAClD,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,IAAI,CA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EAAE,WAAW,EAAE,CAAC;IAC3B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC;AAED,0FAA0F;AAC1F,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;CACrD;AAED,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;IAC3B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rahul_vendure/ai-chat-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "AI-powered shopping assistant plugin for Vendure — LLM chat, vector search, cart management, and order tracking",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|