@infuro/cms-core 1.0.63 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/admin.cjs +183 -65
  2. package/dist/admin.js +183 -65
  3. package/dist/api.cjs +40 -40
  4. package/dist/api.d.cts +2 -0
  5. package/dist/api.d.ts +2 -0
  6. package/dist/api.js +8 -8
  7. package/dist/{chunk-KAOHOHCA.js → chunk-6YOQ7G5O.js} +92 -51
  8. package/dist/{chunk-BWOITUNI.js → chunk-ACBN6UWZ.js} +320 -81
  9. package/dist/chunk-BXAKL2TF.cjs +84 -0
  10. package/dist/{chunk-7L556RGL.cjs → chunk-GLD263KW.cjs} +3 -3
  11. package/dist/{chunk-EWXG4E74.cjs → chunk-NIRYYJIJ.cjs} +330 -91
  12. package/dist/{chunk-MWEK7N3F.js → chunk-OPJEV44S.js} +2 -2
  13. package/dist/{chunk-DTUL3Q5L.js → chunk-RDEVZMO5.js} +36 -20
  14. package/dist/{chunk-77YWLP4X.js → chunk-SANKKGB3.js} +68 -32
  15. package/dist/chunk-THL5JDWJ.cjs +101 -0
  16. package/dist/{chunk-RXTUSF3R.js → chunk-TU23GJPJ.js} +2 -2
  17. package/dist/{chunk-JLDHK2QE.cjs → chunk-TZEMLHSP.cjs} +20 -14
  18. package/dist/{chunk-RHYVNRYG.cjs → chunk-V6EYAC7X.cjs} +38 -22
  19. package/dist/{chunk-YVP4NQII.cjs → chunk-VM6OVUUM.cjs} +93 -52
  20. package/dist/{chunk-MXABMVF7.cjs → chunk-XFDIIVZB.cjs} +4 -4
  21. package/dist/chunk-XJNNOSJR.js +98 -0
  22. package/dist/chunk-YEAXE4U2.js +77 -0
  23. package/dist/{chunk-CJEOH6QC.cjs → chunk-YHEITFHR.cjs} +112 -76
  24. package/dist/{chunk-3VZAAQUV.js → chunk-YRCKEGL2.js} +20 -14
  25. package/dist/{email-queue-VTYL2KFA.cjs → email-queue-4OY45JIU.cjs} +7 -7
  26. package/dist/{email-queue-YPRSVG56.js → email-queue-HGXB2FIS.js} +3 -3
  27. package/dist/{email-service-ATCPJFWG.cjs → email-service-5O24BSFR.cjs} +7 -7
  28. package/dist/{email-service-DPKVQOKP.js → email-service-ADDF52PJ.js} +2 -2
  29. package/dist/{emit-order-notification-trigger-WI4HGMKH.cjs → emit-order-notification-trigger-DR74TQXN.cjs} +4 -4
  30. package/dist/{emit-order-notification-trigger-XVG2B5ZF.js → emit-order-notification-trigger-UCKJHDQK.js} +2 -2
  31. package/dist/{erp-order-invoice-3UGWLICU.js → erp-order-invoice-H6HCJ7YS.js} +2 -2
  32. package/dist/{erp-order-invoice-KJYJNWMG.cjs → erp-order-invoice-YUSPZ7CE.cjs} +6 -6
  33. package/dist/index.cjs +279 -265
  34. package/dist/index.d.cts +46 -22
  35. package/dist/index.d.ts +46 -22
  36. package/dist/index.js +43 -29
  37. package/dist/migrations/1783000000000-AddOrderPendingProcessingCompletedTriggers.ts +15 -39
  38. package/dist/migrations/1783300000000-SeedOrderNotificationTriggersAndTemplates.ts +155 -0
  39. package/dist/{order-completion-otp-handlers-WGM7HWG4.js → order-completion-otp-handlers-CH22ZRAI.js} +5 -5
  40. package/dist/{order-completion-otp-handlers-IMMQGHDR.cjs → order-completion-otp-handlers-RW5RSXH3.cjs} +7 -7
  41. package/dist/{order-notification-dispatcher-JKFQJYGG.js → order-notification-dispatcher-3TXUAJ7L.js} +6 -6
  42. package/dist/{order-notification-dispatcher-5TUFCDU7.cjs → order-notification-dispatcher-Y7NZAALH.cjs} +11 -11
  43. package/dist/{pg-boss-service-L6MTF4EQ.cjs → pg-boss-service-BDGOKM2T.cjs} +3 -3
  44. package/dist/pg-boss-service-WCBJD4JB.js +2 -0
  45. package/package.json +1 -1
  46. package/dist/chunk-AYWDQFJZ.js +0 -27
  47. package/dist/chunk-GO7PPYNU.js +0 -76
  48. package/dist/chunk-UEE4PTTB.cjs +0 -30
  49. package/dist/chunk-XQ3QUHWR.cjs +0 -83
  50. package/dist/pg-boss-service-4XF2TQ2E.js +0 -2
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkH3IVLIPR_cjs = require('./chunk-H3IVLIPR.cjs');
4
- var chunkUEE4PTTB_cjs = require('./chunk-UEE4PTTB.cjs');
5
- var chunkYVP4NQII_cjs = require('./chunk-YVP4NQII.cjs');
6
- var chunkMXABMVF7_cjs = require('./chunk-MXABMVF7.cjs');
7
- var chunkJLDHK2QE_cjs = require('./chunk-JLDHK2QE.cjs');
4
+ var chunkBXAKL2TF_cjs = require('./chunk-BXAKL2TF.cjs');
5
+ var chunkVM6OVUUM_cjs = require('./chunk-VM6OVUUM.cjs');
6
+ var chunkXFDIIVZB_cjs = require('./chunk-XFDIIVZB.cjs');
7
+ var chunkTZEMLHSP_cjs = require('./chunk-TZEMLHSP.cjs');
8
8
  var chunkOOTLNH63_cjs = require('./chunk-OOTLNH63.cjs');
9
9
  var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
10
10
  var crypto = require('crypto');
@@ -223,7 +223,10 @@ async function loadOrderNotificationContexts(orderId, deps) {
223
223
  deleted: false
224
224
  },
225
225
  relations: [
226
- "contact"
226
+ "contact",
227
+ "assignedUser",
228
+ "shippingAddress",
229
+ "billingAddress"
227
230
  ]
228
231
  });
229
232
  if (!order) return null;
@@ -278,7 +281,7 @@ async function loadOrderNotificationContexts(orderId, deps) {
278
281
  }
279
282
  }
280
283
  const effectiveEvent = eventsEnabled ? event : void 0;
281
- const variables = effectiveEvent ? buildEventOrderTemplateVariables({
284
+ const baseVariables = effectiveEvent ? buildEventOrderTemplateVariables({
282
285
  event: effectiveEvent,
283
286
  order: {
284
287
  orderNumber: o.orderNumber,
@@ -310,13 +313,42 @@ async function loadOrderNotificationContexts(orderId, deps) {
310
313
  orderLines,
311
314
  siteUrl
312
315
  });
316
+ const assignedUser = o.assignedUser ?? null;
317
+ const assigneeName = assignedUser?.name?.trim() || "";
318
+ const assigneePhone = assignedUser?.phone?.trim() || "";
319
+ const assigneeEmail = assignedUser?.email?.trim() || "";
320
+ const timeSlot = String(meta.timeSlot || meta.slot || meta.serviceSlot || "").trim();
321
+ const rawServiceDate = meta.bookingDate || meta.serviceDate || meta.orderDate || o.createdAt;
322
+ const serviceDate = rawServiceDate ? formatScheduleDate(rawServiceDate) : "";
323
+ const addr = o.shippingAddress || o.billingAddress;
324
+ const customerAddress = addr ? [
325
+ addr.line1,
326
+ addr.line2,
327
+ addr.city,
328
+ addr.state,
329
+ addr.postalCode,
330
+ addr.country
331
+ ].map((p) => String(p ?? "").trim()).filter(Boolean).join(", ") : "";
332
+ const taskDescription = productNames || (orderLines.length > 0 ? orderLines.map((l) => `${l.quantity}x ${l.name}`).join(", ") : "Order service");
333
+ const variables = {
334
+ ...baseVariables,
335
+ assigneeName,
336
+ assigneePhone,
337
+ assigneeEmail,
338
+ timeSlot,
339
+ serviceDate,
340
+ customerAddress,
341
+ taskDescription
342
+ };
313
343
  return {
314
344
  order: {
315
345
  id: o.id,
316
346
  orderNumber: String(o.orderNumber ?? ""),
317
347
  total: o.total,
318
348
  currency,
319
- qrToken: o.qrToken
349
+ qrToken: o.qrToken,
350
+ assignedUserId: o.assignedUserId ?? null,
351
+ assignedUser
320
352
  },
321
353
  contact,
322
354
  orderLines,
@@ -326,6 +358,16 @@ async function loadOrderNotificationContexts(orderId, deps) {
326
358
  };
327
359
  }
328
360
  chunkUSNT2KNT_cjs.__name(loadOrderNotificationContexts, "loadOrderNotificationContexts");
361
+ function formatScheduleDate(val) {
362
+ if (!val || typeof val !== "string" && !(val instanceof Date)) return "";
363
+ const str = String(val).trim();
364
+ if (!str) return "";
365
+ const d = new Date(str.includes("T") ? str : `${str}T00:00:00`);
366
+ return isNaN(d.getTime()) ? str : d.toLocaleDateString(void 0, {
367
+ dateStyle: "medium"
368
+ });
369
+ }
370
+ chunkUSNT2KNT_cjs.__name(formatScheduleDate, "formatScheduleDate");
329
371
 
330
372
  // src/plugins/whatsapp/whatsapp-service.ts
331
373
  function norm(v) {
@@ -1010,14 +1052,14 @@ async function sendChatLeadEmail(cms, emailSettings, brandingSettings, input) {
1010
1052
  recipients,
1011
1053
  source: input.recipients?.length ? "intent_email_to" : "crm_or_smtp_fallback"
1012
1054
  });
1013
- const companyDetails = chunkJLDHK2QE_cjs.mergeEmailLayoutCompanyDetails(brandingSettings, emailSettings);
1055
+ const companyDetails = chunkTZEMLHSP_cjs.mergeEmailLayoutCompanyDetails(brandingSettings, emailSettings);
1014
1056
  const ctx = {
1015
1057
  ...input,
1016
1058
  companyDetails: input.companyDetails ?? companyDetails
1017
1059
  };
1018
1060
  let anySent = false;
1019
1061
  for (const to of recipients) {
1020
- await chunkMXABMVF7_cjs.queueEmail(cms, {
1062
+ await chunkXFDIIVZB_cjs.queueEmail(cms, {
1021
1063
  to,
1022
1064
  templateName: "chatLead",
1023
1065
  ctx
@@ -1092,7 +1134,7 @@ function emailPlugin(config) {
1092
1134
  context.logger.warn("Email plugin skipped: AWS SES requires AWS_SES_REGION or AWS_REGION");
1093
1135
  return void 0;
1094
1136
  }
1095
- if (type === "AWS" && merged.region && merged.user && merged.password && !chunkYVP4NQII_cjs.sesRegionSupportsSmtp(merged.region)) {
1137
+ if (type === "AWS" && merged.region && merged.user && merged.password && !chunkVM6OVUUM_cjs.sesRegionSupportsSmtp(merged.region)) {
1096
1138
  context.logger.warn(`Email plugin: region ${merged.region} has no SES SMTP endpoint (ENOTFOUND). Set AWS_SES_REGION=ap-south-1 and create SMTP credentials in that SES region.`);
1097
1139
  }
1098
1140
  if (type === "AWS" && !(merged.user && merged.password || merged.accessKeyId && merged.secretAccessKey)) {
@@ -1107,13 +1149,13 @@ function emailPlugin(config) {
1107
1149
  context.logger.warn("Email plugin skipped: SMTP_TYPE=SMTP requires SMTP_HOST (or use SMTP_TYPE=AWS with AWS_REGION and SES SMTP credentials)");
1108
1150
  return void 0;
1109
1151
  }
1110
- const resolvedHost = type === "AWS" && merged.region ? merged.host || chunkYVP4NQII_cjs.sesSmtpHost(merged.region) : merged.host;
1152
+ const resolvedHost = type === "AWS" && merged.region ? merged.host || chunkVM6OVUUM_cjs.sesSmtpHost(merged.region) : merged.host;
1111
1153
  context.logger.info("Email plugin initialized", {
1112
1154
  type,
1113
1155
  host: resolvedHost,
1114
1156
  region: merged.region
1115
1157
  });
1116
- return new chunkYVP4NQII_cjs.EmailService(merged);
1158
+ return new chunkVM6OVUUM_cjs.EmailService(merged);
1117
1159
  }
1118
1160
  };
1119
1161
  }
@@ -1276,60 +1318,68 @@ chunkUSNT2KNT_cjs.__name(validateFcmCredentials, "validateFcmCredentials");
1276
1318
  var ORDER_NOTIFICATION_DEFAULTS = {
1277
1319
  email: {
1278
1320
  pending: {
1279
- subject: "Your Order #{{orderNumber}} is Pending",
1280
- body: "<p>Thank you for your order! It is currently pending.</p>"
1321
+ subject: "Your order {{orderNumber}} is Pending",
1322
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} is currently pending.\n\nOrder Details:\n{{orderDetails}}\n\nWe will update you as soon as your order status changes.\n\nThank you!"
1281
1323
  },
1282
1324
  order_pending: {
1283
- subject: "Your Order #{{orderNumber}} is Pending",
1284
- body: "<p>Thank you for your order! It is currently pending.</p>"
1325
+ subject: "Your order {{orderNumber}} is Pending",
1326
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} is currently pending.\n\nOrder Details:\n{{orderDetails}}\n\nWe will update you as soon as your order status changes.\n\nThank you!"
1285
1327
  },
1286
1328
  confirmed: {
1287
- subject: "Your Order #{{orderNumber}} is Confirmed",
1288
- body: "<p>Your order has been confirmed!</p>"
1329
+ subject: "Your order {{orderNumber}} is confirmed",
1330
+ body: "Hi {{customerName}},\n\nThank you for your order! Your order {{orderNumber}} for {{total}} {{currency}} has been confirmed.\n\nOrder Details:\n{{orderDetails}}\n\nYour Tax Invoice PDF is attached to this email for your records.\n\nThank you!"
1289
1331
  },
1290
1332
  order_confirmed: {
1291
- subject: "Your Order #{{orderNumber}} is Confirmed",
1292
- body: "<p>Your order has been confirmed!</p>"
1333
+ subject: "Your order {{orderNumber}} is confirmed",
1334
+ body: "Hi {{customerName}},\n\nThank you for your order! Your order {{orderNumber}} for {{total}} {{currency}} has been confirmed.\n\nOrder Details:\n{{orderDetails}}\n\nYour Tax Invoice PDF is attached to this email for your records.\n\nThank you!"
1293
1335
  },
1294
1336
  order_placed: {
1295
- subject: "Your Order #{{orderNumber}} is Placed",
1296
- body: "<p>Thank you for your order! Your order #{{orderNumber}} has been placed.</p>"
1337
+ subject: "Your order {{orderNumber}} is confirmed",
1338
+ body: "Hi {{customerName}},\n\nThank you for your order! Your order {{orderNumber}} for {{total}} {{currency}} has been confirmed.\n\nOrder Details:\n{{orderDetails}}\n\nYour Tax Invoice PDF is attached to this email for your records.\n\nThank you!"
1297
1339
  },
1298
1340
  processing: {
1299
- subject: "Your Order #{{orderNumber}} is Processing",
1300
- body: "<p>Your order is now being processed by our team.</p>"
1341
+ subject: "Your order {{orderNumber}} is now Processing",
1342
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} is currently being processed.\n\nOrder Details:\n{{orderDetails}}\n\nWe will notify you once it is completed.\n\nThank you!"
1301
1343
  },
1302
1344
  order_processing: {
1303
- subject: "Your Order #{{orderNumber}} is Processing",
1304
- body: "<p>Your order is now being processed by our team.</p>"
1345
+ subject: "Your order {{orderNumber}} is now Processing",
1346
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} is currently being processed.\n\nOrder Details:\n{{orderDetails}}\n\nWe will notify you once it is completed.\n\nThank you!"
1305
1347
  },
1306
1348
  completed: {
1307
- subject: "Your Order #{{orderNumber}} is Completed",
1308
- body: "<p>Your order has been completed. Thank you!</p>"
1349
+ subject: "Your order {{orderNumber}} is Completed",
1350
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} has been completed.\n\nOrder Details:\n{{orderDetails}}\n\nThank you for choosing us!"
1309
1351
  },
1310
1352
  order_completed: {
1311
- subject: "Your Order #{{orderNumber}} is Completed",
1312
- body: "<p>Your order has been completed. Thank you!</p>"
1353
+ subject: "Your order {{orderNumber}} is Completed",
1354
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} has been completed.\n\nOrder Details:\n{{orderDetails}}\n\nThank you for choosing us!"
1313
1355
  },
1314
1356
  cancelled: {
1315
- subject: "Your Order #{{orderNumber}} is Cancelled",
1316
- body: "<p>Your order has been cancelled.</p>"
1357
+ subject: "Your order {{orderNumber}} has been cancelled",
1358
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} has been cancelled.\n\nIf a refund is due, you will receive {{refundAmount}} {{currency}} back to your original payment method.\n\nIf you have any questions, please contact us.\n\nThank you!"
1317
1359
  },
1318
1360
  order_cancelled: {
1319
- subject: "Your Order #{{orderNumber}} is Cancelled",
1320
- body: "<p>Your order has been cancelled.</p>"
1361
+ subject: "Your order {{orderNumber}} has been cancelled",
1362
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} for {{total}} {{currency}} has been cancelled.\n\nIf a refund is due, you will receive {{refundAmount}} {{currency}} back to your original payment method.\n\nIf you have any questions, please contact us.\n\nThank you!"
1321
1363
  },
1322
1364
  payment_success: {
1323
- subject: "Payment Received for Order #{{orderNumber}}",
1324
- body: "<p>Payment of {{currency}} {{total}} has been successfully received for order #{{orderNumber}}.</p>"
1365
+ subject: "Payment Successful for Order {{orderNumber}}",
1366
+ body: "Hi {{customerName}},\n\nWe have received your payment for order {{orderNumber}} of {{total}} {{currency}}.\n\nOrder Details:\n{{orderDetails}}\n\nThank you!"
1325
1367
  },
1326
1368
  payment_failed: {
1327
- subject: "Payment Failed for Order #{{orderNumber}}",
1328
- body: "<p>Payment for order #{{orderNumber}} could not be completed.</p>"
1369
+ subject: "Payment Failed for Order {{orderNumber}}",
1370
+ body: "Hi {{customerName}},\n\nYour payment for order {{orderNumber}} of {{total}} {{currency}} could not be completed or remains unpaid.\n\nIf you were charged, please contact us with your order number {{orderNumber}}.\n\nThank you!"
1329
1371
  },
1330
1372
  payment_refund_initiated: {
1331
- subject: "Refund Initiated for Order #{{orderNumber}}",
1332
- body: "<p>A refund of {{currency}} {{refundAmount}} has been initiated for order #{{orderNumber}}.</p>"
1373
+ subject: "Refund Initiated for Order {{orderNumber}}",
1374
+ body: "Hi {{customerName}},\n\nYour order {{orderNumber}} has been cancelled and a refund of {{refundAmount}} {{currency}} has been initiated.\n\nThe amount will be credited back to your original payment method.\n\nThank you!"
1375
+ },
1376
+ order_assigned: {
1377
+ subject: "Your service expert has been assigned for order {{orderNumber}}",
1378
+ body: "Hi {{customerName}},\n\nA service expert has been assigned to your order {{orderNumber}}.\n\nAssignee Details:\n\u2022 Name: {{assigneeName}}\n\u2022 Phone: {{assigneePhone}}\n\nYour expert will reach you by your scheduled time slot:\n\u2022 Date: {{serviceDate}}\n\u2022 Slot: {{timeSlot}}\n\nOrder Details:\n{{orderDetails}}\n\nThank you!"
1379
+ },
1380
+ order_assigned_assignee: {
1381
+ subject: "New task assigned: Order {{orderNumber}}",
1382
+ body: "Hi {{assigneeName}},\n\nA new task has been assigned to you for order {{orderNumber}}.\n\nTask Details:\n{{taskDescription}}\n\nCustomer Details:\n\u2022 Name: {{customerName}}\n\u2022 Phone: {{customerPhone}}\n\u2022 Address: {{customerAddress}}\n\nSchedule:\n\u2022 Date: {{serviceDate}}\n\u2022 Slot: {{timeSlot}}\n\nPlease arrive promptly within the scheduled time slot."
1333
1383
  }
1334
1384
  },
1335
1385
  sms: {
@@ -1338,6 +1388,8 @@ var ORDER_NOTIFICATION_DEFAULTS = {
1338
1388
  confirmed: "Your Order #{{orderNumber}} is confirmed. Total: {{total}}.",
1339
1389
  order_confirmed: "Your Order #{{orderNumber}} is confirmed. Total: {{total}}.",
1340
1390
  order_placed: "Your Order #{{orderNumber}} is placed. Total: {{total}}.",
1391
+ order_assigned: "Hi {{customerName}}, your service expert {{assigneeName}} ({{assigneePhone}}) has been assigned for order {{orderNumber}}. Arrival slot: {{timeSlot}}.",
1392
+ order_assigned_assignee: "Hi {{assigneeName}}, new task assigned: Order {{orderNumber}}. Customer: {{customerName}}, Phone: {{customerPhone}}, Address: {{customerAddress}}, Slot: {{timeSlot}}.",
1341
1393
  processing: "Your Order #{{orderNumber}} is now processing.",
1342
1394
  order_processing: "Your Order #{{orderNumber}} is now processing.",
1343
1395
  completed: "Your Order #{{orderNumber}} has been completed. Thank you!",
@@ -1354,6 +1406,8 @@ var ORDER_NOTIFICATION_DEFAULTS = {
1354
1406
  confirmed: "Hi {{customerName}}, your Order #{{orderNumber}} is confirmed.",
1355
1407
  order_confirmed: "Hi {{customerName}}, your Order #{{orderNumber}} is confirmed.",
1356
1408
  order_placed: "Hi {{customerName}}, your Order #{{orderNumber}} is placed.",
1409
+ order_assigned: "Hi {{customerName}}, expert {{assigneeName}} ({{assigneePhone}}) has been assigned to your order #{{orderNumber}}. Scheduled slot: {{timeSlot}} on {{serviceDate}}.",
1410
+ order_assigned_assignee: "Hi {{assigneeName}}, you have been assigned to order #{{orderNumber}}. Customer: {{customerName}} ({{customerPhone}}), Address: {{customerAddress}}, Slot: {{timeSlot}} on {{serviceDate}}.",
1357
1411
  processing: "Hi {{customerName}}, your Order #{{orderNumber}} is now being processed.",
1358
1412
  order_processing: "Hi {{customerName}}, your Order #{{orderNumber}} is now being processed.",
1359
1413
  completed: "Hi {{customerName}}, your Order #{{orderNumber}} is completed.",
@@ -1368,12 +1422,6 @@ var ORDER_NOTIFICATION_DEFAULTS = {
1368
1422
 
1369
1423
  // src/lib/order-notification-dispatcher.ts
1370
1424
  var initialized = false;
1371
- function maskPhone2(raw) {
1372
- const digits = String(raw ?? "").replace(/\D/g, "");
1373
- if (digits.length <= 4) return "(none)";
1374
- return `***${digits.slice(-4)}`;
1375
- }
1376
- chunkUSNT2KNT_cjs.__name(maskPhone2, "maskPhone");
1377
1425
  async function getSettingsGroup(dataSource, entityMap, group) {
1378
1426
  if (!entityMap.configs) return {};
1379
1427
  const rows = await dataSource.getRepository(entityMap.configs).find({
@@ -1583,11 +1631,26 @@ async function sendPushNotificationForTrigger(triggerKey, orderId, audienceType,
1583
1631
  if (!template) {
1584
1632
  template = await loadBoundTemplate(triggerKey, "push", audienceType, dataSource, entityMap);
1585
1633
  }
1586
- if (!template || !template.body) return;
1634
+ if (!template || !template.body) {
1635
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "no mobile/push template or empty body", {
1636
+ triggerKey,
1637
+ orderId,
1638
+ audienceType,
1639
+ targetId
1640
+ });
1641
+ return;
1642
+ }
1587
1643
  const rawTitle = template.subject?.trim() || "Order Notification";
1588
1644
  const title = chunkOOTLNH63_cjs.applyTemplateVars(rawTitle, variables);
1589
1645
  const body = chunkOOTLNH63_cjs.applyTemplateVars(template.body, variables);
1590
- if (!entityMap.user_device_tokens) return;
1646
+ if (!entityMap.user_device_tokens) {
1647
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "user_device_tokens entity not registered", {
1648
+ triggerKey,
1649
+ orderId,
1650
+ audienceType
1651
+ });
1652
+ return;
1653
+ }
1591
1654
  const tokenRepo = dataSource.getRepository(entityMap.user_device_tokens);
1592
1655
  let targetTokens = [];
1593
1656
  try {
@@ -1622,19 +1685,60 @@ async function sendPushNotificationForTrigger(triggerKey, orderId, audienceType,
1622
1685
  });
1623
1686
  }
1624
1687
  } catch (err) {
1625
- console.error("[order-notifications] Error querying device tokens for push", err);
1688
+ chunkBXAKL2TF_cjs.notifyLog.error("PUSH", "device token query failed", {
1689
+ triggerKey,
1690
+ orderId,
1691
+ audienceType,
1692
+ targetId,
1693
+ error: err instanceof Error ? err.message : String(err)
1694
+ });
1626
1695
  return;
1627
1696
  }
1628
- for (const t of targetTokens) {
1629
- if (t.token?.trim()) {
1630
- await sendFcmPushNotification(dataSource, entityMap, {
1631
- token: t.token.trim(),
1632
- title,
1633
- body,
1634
- data: {
1635
- orderId: String(orderId),
1636
- triggerKey
1637
- }
1697
+ const tokens = targetTokens.map((t) => t.token?.trim()).filter(Boolean);
1698
+ chunkBXAKL2TF_cjs.notifyLog.push("sending", {
1699
+ triggerKey,
1700
+ orderId,
1701
+ audienceType,
1702
+ targetId,
1703
+ title,
1704
+ tokenCount: tokens.length,
1705
+ tokens: tokens.map((t) => chunkBXAKL2TF_cjs.maskNotifyToken(t))
1706
+ });
1707
+ if (tokens.length === 0) {
1708
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "no active FCM tokens for target", {
1709
+ triggerKey,
1710
+ orderId,
1711
+ audienceType,
1712
+ targetId,
1713
+ hint: "App must POST /api/user-device-tokens after login"
1714
+ });
1715
+ return;
1716
+ }
1717
+ for (const token of tokens) {
1718
+ const res = await sendFcmPushNotification(dataSource, entityMap, {
1719
+ token,
1720
+ title,
1721
+ body,
1722
+ data: {
1723
+ orderId: String(orderId),
1724
+ triggerKey
1725
+ }
1726
+ });
1727
+ if (res.success) {
1728
+ chunkBXAKL2TF_cjs.notifyLog.push("FCM sent", {
1729
+ triggerKey,
1730
+ orderId,
1731
+ audienceType,
1732
+ token: chunkBXAKL2TF_cjs.maskNotifyToken(token),
1733
+ messageId: res.messageId ?? null
1734
+ });
1735
+ } else {
1736
+ chunkBXAKL2TF_cjs.notifyLog.error("PUSH", "FCM send failed", {
1737
+ triggerKey,
1738
+ orderId,
1739
+ audienceType,
1740
+ token: chunkBXAKL2TF_cjs.maskNotifyToken(token),
1741
+ error: res.error ?? "unknown"
1638
1742
  });
1639
1743
  }
1640
1744
  }
@@ -1778,13 +1882,21 @@ function formatBodyForEmailHtml(body) {
1778
1882
  chunkUSNT2KNT_cjs.__name(formatBodyForEmailHtml, "formatBodyForEmailHtml");
1779
1883
  async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables, contactEmail, dataSource, entityMap, getCms) {
1780
1884
  const template = await loadBoundTemplate(triggerKey, "email", audienceType, dataSource, entityMap);
1781
- if (!template) return;
1885
+ if (!template) {
1886
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "no bound/default email template", {
1887
+ triggerKey,
1888
+ orderId,
1889
+ audienceType,
1890
+ to: chunkBXAKL2TF_cjs.maskNotifyEmail(contactEmail)
1891
+ });
1892
+ return;
1893
+ }
1782
1894
  const [branding, emailSettings, storeSettings] = await Promise.all([
1783
1895
  getSettingsGroup(dataSource, entityMap, "branding"),
1784
1896
  getSettingsGroup(dataSource, entityMap, "email"),
1785
1897
  getSettingsGroup(dataSource, entityMap, "store")
1786
1898
  ]);
1787
- const companyDetails = chunkJLDHK2QE_cjs.mergeEmailLayoutCompanyDetails(branding, emailSettings, storeSettings);
1899
+ const companyDetails = chunkTZEMLHSP_cjs.mergeEmailLayoutCompanyDetails(branding, emailSettings, storeSettings);
1788
1900
  const templateContent = (template.body ?? "") + (template.subject ?? "");
1789
1901
  const shouldAttachInvoice = /\{\{\s*(invoiceAttachment|invoicePdf|invoice|attachInvoice)\s*\}\}/i.test(templateContent);
1790
1902
  const cleanVariables = {
@@ -1798,12 +1910,12 @@ async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables,
1798
1910
  const subject = chunkOOTLNH63_cjs.applyTemplateVars(template.subject ?? "Order update", cleanVariables);
1799
1911
  const rawBody = chunkOOTLNH63_cjs.applyTemplateVars(template.body, cleanVariables);
1800
1912
  const bodyHtml = formatBodyForEmailHtml(rawBody);
1801
- const html = chunkYVP4NQII_cjs.renderLayout({
1913
+ const html = chunkVM6OVUUM_cjs.renderLayout({
1802
1914
  bodyHtml,
1803
1915
  companyDetails
1804
1916
  });
1805
1917
  const cms = await getCms();
1806
- await chunkMXABMVF7_cjs.queueEmail(cms, {
1918
+ await chunkXFDIIVZB_cjs.queueEmail(cms, {
1807
1919
  to: contactEmail,
1808
1920
  subject,
1809
1921
  html,
@@ -1813,22 +1925,31 @@ async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables,
1813
1925
  attachInvoice: true
1814
1926
  } : {}
1815
1927
  });
1816
- console.log("[order-notifications] email queued", {
1928
+ chunkBXAKL2TF_cjs.notifyLog.email("queued", {
1817
1929
  triggerKey,
1818
1930
  audienceType,
1819
1931
  orderId,
1820
- to: contactEmail,
1932
+ to: chunkBXAKL2TF_cjs.maskNotifyEmail(contactEmail),
1933
+ subject,
1821
1934
  attachInvoice: shouldAttachInvoice
1822
1935
  });
1823
1936
  }
1824
1937
  chunkUSNT2KNT_cjs.__name(sendEmailForTrigger, "sendEmailForTrigger");
1825
1938
  async function sendWhatsAppForTrigger(triggerKey, orderId, phone, variables, dataSource, entityMap, getCms) {
1826
1939
  const template = await loadBoundTemplate(triggerKey, "whatsapp", "customers", dataSource, entityMap);
1827
- if (!template) return;
1940
+ if (!template) {
1941
+ chunkBXAKL2TF_cjs.notifyLog.skip("WHATSAPP", "no bound/default WhatsApp template", {
1942
+ triggerKey,
1943
+ orderId,
1944
+ phone: chunkBXAKL2TF_cjs.maskNotifyPhone(phone)
1945
+ });
1946
+ return;
1947
+ }
1828
1948
  const paramOrder = template.providerMeta?.paramOrder ?? [];
1829
1949
  if (paramOrder.length === 0) {
1830
- console.warn("[order-notifications] WhatsApp template has no paramOrder set \u2014 variables may send blank/wrong", {
1831
- triggerKey
1950
+ chunkBXAKL2TF_cjs.notifyLog.skip("WHATSAPP", "template has no paramOrder \u2014 variables may send blank/wrong", {
1951
+ triggerKey,
1952
+ orderId
1832
1953
  });
1833
1954
  }
1834
1955
  const cms = await getCms();
@@ -1837,8 +1958,10 @@ async function sendWhatsAppForTrigger(triggerKey, orderId, phone, variables, dat
1837
1958
  name: template.name
1838
1959
  });
1839
1960
  if (!metaTemplateName) {
1840
- console.warn("[order-notifications] bound WhatsApp template has no Meta template name", {
1961
+ chunkBXAKL2TF_cjs.notifyLog.skip("WHATSAPP", "template has no Meta template name", {
1841
1962
  triggerKey,
1963
+ orderId,
1964
+ phone: chunkBXAKL2TF_cjs.maskNotifyPhone(phone),
1842
1965
  templateId: template.id
1843
1966
  });
1844
1967
  return;
@@ -1853,37 +1976,57 @@ async function sendWhatsAppForTrigger(triggerKey, orderId, phone, variables, dat
1853
1976
  templateParamOrder: paramOrder
1854
1977
  });
1855
1978
  if (!sent) {
1856
- console.warn("[order-notifications] WhatsApp send failed", {
1979
+ chunkBXAKL2TF_cjs.notifyLog.error("WHATSAPP", "send failed / not queued", {
1857
1980
  triggerKey,
1858
1981
  orderId,
1982
+ phone: chunkBXAKL2TF_cjs.maskNotifyPhone(phone),
1859
1983
  hint: "Register whatsappPlugin() + queuePlugin() in getCms(), or set WHATSAPP_ACCESS_TOKEN and WHATSAPP_PHONE_NUMBER_ID"
1860
1984
  });
1861
1985
  } else {
1862
- console.log("[order-notifications] WhatsApp queued/sent", {
1986
+ chunkBXAKL2TF_cjs.notifyLog.whatsapp("queued/sent", {
1863
1987
  triggerKey,
1864
1988
  orderId,
1865
- phone: maskPhone2(phone)
1989
+ phone: chunkBXAKL2TF_cjs.maskNotifyPhone(phone),
1990
+ metaTemplateName
1866
1991
  });
1867
1992
  }
1868
1993
  }
1869
1994
  chunkUSNT2KNT_cjs.__name(sendWhatsAppForTrigger, "sendWhatsAppForTrigger");
1870
1995
  async function handleTrigger(triggerKey, payload, dataSource, entityMap, getCms) {
1871
- console.log("[order-notifications] received", {
1996
+ chunkBXAKL2TF_cjs.notifyLog.trigger("dispatcher received", {
1872
1997
  triggerKey,
1873
1998
  orderId: payload.orderId,
1874
- phone: maskPhone2(payload.customerPhone)
1999
+ orderNumber: payload.orderNumber,
2000
+ phone: chunkBXAKL2TF_cjs.maskNotifyPhone(payload.customerPhone),
2001
+ vendorId: payload.vendorId ?? null
1875
2002
  });
1876
2003
  const [emailChannelEnabled, whatsappChannelEnabled, pushChannelEnabled] = await Promise.all([
1877
2004
  isEmailNotificationsEnabled(dataSource, entityMap),
1878
2005
  isWhatsappNotificationsEnabled(dataSource, entityMap),
1879
2006
  isPushNotificationsEnabled(dataSource, entityMap)
1880
2007
  ]);
2008
+ chunkBXAKL2TF_cjs.notifyLog.trigger("channel switches", {
2009
+ triggerKey,
2010
+ orderId: payload.orderId,
2011
+ email: emailChannelEnabled,
2012
+ whatsapp: whatsappChannelEnabled,
2013
+ push: pushChannelEnabled
2014
+ });
1881
2015
  if (!emailChannelEnabled && !whatsappChannelEnabled && !pushChannelEnabled) {
1882
- console.warn("[order-notifications] skip: Email, WhatsApp, and Mobile Push notifications are disabled");
2016
+ chunkBXAKL2TF_cjs.notifyLog.skip("ALL", "Email, WhatsApp, and Mobile Push are disabled in event_notifications", {
2017
+ triggerKey,
2018
+ orderId: payload.orderId
2019
+ });
1883
2020
  return;
1884
2021
  }
1885
2022
  const triggerEnabled = await isTriggerCatalogEnabled(triggerKey, dataSource, entityMap);
1886
- if (!triggerEnabled) return;
2023
+ if (!triggerEnabled) {
2024
+ chunkBXAKL2TF_cjs.notifyLog.skip("TRIGGER", "trigger catalog disabled", {
2025
+ triggerKey,
2026
+ orderId: payload.orderId
2027
+ });
2028
+ return;
2029
+ }
1887
2030
  const context = await loadOrderNotificationContexts(payload.orderId, {
1888
2031
  dataSource,
1889
2032
  entityMap
@@ -1891,32 +2034,86 @@ async function handleTrigger(triggerKey, payload, dataSource, entityMap, getCms)
1891
2034
  const variables = mergeTriggerVariables(payload, context?.variables);
1892
2035
  const contactEmail = context?.contact.email?.trim() || "";
1893
2036
  const contactPhone = context?.contact.phone?.trim() || payload.customerPhone?.trim() || "";
2037
+ chunkBXAKL2TF_cjs.notifyLog.trigger("recipients resolved", {
2038
+ triggerKey,
2039
+ orderId: payload.orderId,
2040
+ contactEmail: chunkBXAKL2TF_cjs.maskNotifyEmail(contactEmail),
2041
+ contactPhone: chunkBXAKL2TF_cjs.maskNotifyPhone(contactPhone)
2042
+ });
1894
2043
  if (emailChannelEnabled) {
1895
2044
  const [customerEnabled, vendorEnabled, adminEnabled] = await Promise.all([
1896
2045
  isAudienceEmailEnabled(dataSource, entityMap, "customer"),
1897
2046
  isAudienceEmailEnabled(dataSource, entityMap, "vendor"),
1898
2047
  isAudienceEmailEnabled(dataSource, entityMap, "admin")
1899
2048
  ]);
1900
- if (customerEnabled && contactEmail) {
2049
+ chunkBXAKL2TF_cjs.notifyLog.email("audience switches", {
2050
+ triggerKey,
2051
+ orderId: payload.orderId,
2052
+ customer: customerEnabled,
2053
+ vendor: vendorEnabled,
2054
+ admin: adminEnabled
2055
+ });
2056
+ if (triggerKey === "order_assigned_assignee") {
2057
+ const assigneeEmail = context?.order?.assignedUser?.email?.trim();
2058
+ if (assigneeEmail) {
2059
+ await sendEmailForTrigger(triggerKey, payload.orderId, "customers", variables, assigneeEmail, dataSource, entityMap, getCms);
2060
+ } else {
2061
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "order_assigned_assignee has no assignee email", {
2062
+ triggerKey,
2063
+ orderId: payload.orderId
2064
+ });
2065
+ }
2066
+ } else if (customerEnabled && contactEmail) {
1901
2067
  await sendEmailForTrigger(triggerKey, payload.orderId, "customers", variables, contactEmail, dataSource, entityMap, getCms);
2068
+ } else if (!customerEnabled) {
2069
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "customer email audience disabled", {
2070
+ triggerKey,
2071
+ orderId: payload.orderId
2072
+ });
2073
+ } else {
2074
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "no customer email on order contact", {
2075
+ triggerKey,
2076
+ orderId: payload.orderId
2077
+ });
1902
2078
  }
1903
- if (vendorEnabled) {
2079
+ if (vendorEnabled && triggerKey !== "order_assigned_assignee") {
1904
2080
  const multiVendorSettings = await getSettingsGroup(dataSource, entityMap, "multi_vendor");
1905
2081
  if (multiVendorSettings.enabled !== "false" && multiVendorSettings.enabled !== "0") {
1906
2082
  const vendorEmails = await getOrderVendorEmails(payload.orderId, payload.vendorId, dataSource, entityMap);
2083
+ if (vendorEmails.length === 0) {
2084
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "no vendor emails for order", {
2085
+ triggerKey,
2086
+ orderId: payload.orderId,
2087
+ vendorId: payload.vendorId ?? null
2088
+ });
2089
+ }
1907
2090
  for (const vEmail of vendorEmails) {
1908
2091
  await sendEmailForTrigger(triggerKey, payload.orderId, "vendors", variables, vEmail, dataSource, entityMap, getCms);
1909
2092
  }
2093
+ } else {
2094
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "multi-vendor off \u2014 skip vendor email", {
2095
+ triggerKey,
2096
+ orderId: payload.orderId
2097
+ });
1910
2098
  }
1911
2099
  }
1912
- if (adminEnabled) {
2100
+ if (adminEnabled && triggerKey !== "order_assigned_assignee") {
1913
2101
  const adminEmails = await getAdminRecipientEmails(dataSource, entityMap);
2102
+ if (adminEmails.length === 0) {
2103
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "no admin recipient emails", {
2104
+ triggerKey,
2105
+ orderId: payload.orderId
2106
+ });
2107
+ }
1914
2108
  for (const aEmail of adminEmails) {
1915
2109
  await sendEmailForTrigger(triggerKey, payload.orderId, "admin", variables, aEmail, dataSource, entityMap, getCms);
1916
2110
  }
1917
2111
  }
1918
2112
  } else {
1919
- console.log("[order-notifications] skip email: Email notifications channel is disabled");
2113
+ chunkBXAKL2TF_cjs.notifyLog.skip("EMAIL", "email channel disabled", {
2114
+ triggerKey,
2115
+ orderId: payload.orderId
2116
+ });
1920
2117
  }
1921
2118
  if (pushChannelEnabled) {
1922
2119
  const [pushCustomerEnabled, pushVendorEnabled, pushAdminEnabled] = await Promise.all([
@@ -1924,28 +2121,59 @@ async function handleTrigger(triggerKey, payload, dataSource, entityMap, getCms)
1924
2121
  isAudiencePushEnabled(dataSource, entityMap, "vendor"),
1925
2122
  isAudiencePushEnabled(dataSource, entityMap, "admin")
1926
2123
  ]);
1927
- const targetCustomerId = context?.order?.customerContactId || context?.order?.contactId || context?.order?.userId || context?.order?.id;
2124
+ chunkBXAKL2TF_cjs.notifyLog.push("audience switches", {
2125
+ triggerKey,
2126
+ orderId: payload.orderId,
2127
+ customer: pushCustomerEnabled,
2128
+ vendor: pushVendorEnabled,
2129
+ admin: pushAdminEnabled
2130
+ });
2131
+ const targetCustomerId = triggerKey === "order_assigned_assignee" ? context?.order?.assignedUser?.id : context?.order?.customerContactId || context?.order?.contactId || context?.order?.userId || context?.order?.id;
1928
2132
  if (pushCustomerEnabled && targetCustomerId) {
1929
2133
  await sendPushNotificationForTrigger(triggerKey, payload.orderId, "customers", String(targetCustomerId), variables, dataSource, entityMap);
2134
+ } else if (!pushCustomerEnabled) {
2135
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "customer push audience disabled", {
2136
+ triggerKey,
2137
+ orderId: payload.orderId
2138
+ });
2139
+ } else {
2140
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "no customer user/contact id for push", {
2141
+ triggerKey,
2142
+ orderId: payload.orderId
2143
+ });
1930
2144
  }
1931
- if (pushVendorEnabled && payload.vendorId) {
2145
+ if (pushVendorEnabled && payload.vendorId && triggerKey !== "order_assigned_assignee") {
1932
2146
  await sendPushNotificationForTrigger(triggerKey, payload.orderId, "vendors", String(payload.vendorId), variables, dataSource, entityMap);
2147
+ } else if (pushVendorEnabled && triggerKey !== "order_assigned_assignee" && !payload.vendorId) {
2148
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "no vendorId on order \u2014 skip vendor push", {
2149
+ triggerKey,
2150
+ orderId: payload.orderId
2151
+ });
1933
2152
  }
1934
- if (pushAdminEnabled) {
2153
+ if (pushAdminEnabled && triggerKey !== "order_assigned_assignee") {
1935
2154
  await sendPushNotificationForTrigger(triggerKey, payload.orderId, "admin", "admin", variables, dataSource, entityMap);
1936
2155
  }
2156
+ } else {
2157
+ chunkBXAKL2TF_cjs.notifyLog.skip("PUSH", "push channel disabled", {
2158
+ triggerKey,
2159
+ orderId: payload.orderId
2160
+ });
1937
2161
  }
1938
2162
  if (whatsappChannelEnabled) {
1939
- if (contactPhone) {
1940
- await sendWhatsAppForTrigger(triggerKey, payload.orderId, contactPhone, variables, dataSource, entityMap, getCms);
2163
+ const targetPhone = triggerKey === "order_assigned_assignee" ? context?.order?.assignedUser?.phone?.trim() : contactPhone;
2164
+ if (targetPhone) {
2165
+ await sendWhatsAppForTrigger(triggerKey, payload.orderId, targetPhone, variables, dataSource, entityMap, getCms);
1941
2166
  } else {
1942
- console.warn("[order-notifications] skip WhatsApp: no customer phone", {
2167
+ chunkBXAKL2TF_cjs.notifyLog.skip("WHATSAPP", "no recipient phone", {
1943
2168
  triggerKey,
1944
2169
  orderId: payload.orderId
1945
2170
  });
1946
2171
  }
1947
2172
  } else {
1948
- console.log("[order-notifications] skip WhatsApp: WhatsApp notifications channel is disabled");
2173
+ chunkBXAKL2TF_cjs.notifyLog.skip("WHATSAPP", "WhatsApp channel disabled", {
2174
+ triggerKey,
2175
+ orderId: payload.orderId
2176
+ });
1949
2177
  }
1950
2178
  }
1951
2179
  chunkUSNT2KNT_cjs.__name(handleTrigger, "handleTrigger");
@@ -1957,12 +2185,23 @@ function initWhatsappTriggerDispatcher(deps) {
1957
2185
  const { dataSource, entityMap, getCms } = deps;
1958
2186
  void dataSource.query(`ALTER TYPE "order_notification_bindings_channel_enum" ADD VALUE IF NOT EXISTS 'mobile'`).catch(() => {
1959
2187
  });
1960
- chunkUEE4PTTB_cjs.notificationTriggerEmitter.onAnyTrigger((triggerKey, payload) => {
2188
+ chunkBXAKL2TF_cjs.notificationTriggerEmitter.onAnyTrigger((triggerKey, payload) => {
1961
2189
  void handleTrigger(triggerKey, payload, dataSource, entityMap, getCms).catch((err) => {
1962
- console.error("[order-notifications]", triggerKey, err);
2190
+ chunkBXAKL2TF_cjs.notifyLog.error("TRIGGER", "dispatcher handleTrigger failed", {
2191
+ triggerKey,
2192
+ orderId: payload.orderId,
2193
+ error: err instanceof Error ? err.message : String(err),
2194
+ stack: err instanceof Error ? err.stack : void 0
2195
+ });
1963
2196
  });
1964
2197
  });
1965
- console.log("[order-notifications] dispatcher initialized (email + WhatsApp, unified via order_notification_bindings)");
2198
+ chunkBXAKL2TF_cjs.notifyLog.trigger("dispatcher initialized", {
2199
+ channels: [
2200
+ "email",
2201
+ "whatsapp",
2202
+ "push"
2203
+ ]
2204
+ });
1966
2205
  }
1967
2206
  chunkUSNT2KNT_cjs.__name(initWhatsappTriggerDispatcher, "initWhatsappTriggerDispatcher");
1968
2207
  async function dispatchOrderNotificationDirectly(triggerKey, payload, dataSource, entityMap, getCms) {
@@ -2030,7 +2269,7 @@ async function emitOrderNotificationTrigger(dataSource, entityMap, triggerKey, p
2030
2269
  if (settings.whatsapp_enabled !== "false" && settings.whatsapp_enabled !== "0") enabledChannels.push("whatsapp");
2031
2270
  if (settings.sms_enabled !== "false" && settings.sms_enabled !== "0") enabledChannels.push("sms");
2032
2271
  if (settings.push_enabled !== "false" && settings.push_enabled !== "0") enabledChannels.push("push");
2033
- chunkUEE4PTTB_cjs.notificationTriggerEmitter.emitTrigger(triggerKey, payload);
2272
+ chunkBXAKL2TF_cjs.notificationTriggerEmitter.emitTrigger(triggerKey, payload);
2034
2273
  return {
2035
2274
  ok: true,
2036
2275
  channels: enabledChannels