@infuro/cms-core 1.0.65 → 1.0.67

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 (36) hide show
  1. package/dist/admin.cjs +97 -24
  2. package/dist/admin.js +97 -24
  3. package/dist/api.cjs +38 -38
  4. package/dist/api.js +5 -5
  5. package/dist/auth.cjs +51 -51
  6. package/dist/auth.js +3 -3
  7. package/dist/{chunk-6DBDJ4VD.js → chunk-2ISSXYBZ.js} +2 -2
  8. package/dist/{chunk-NIRYYJIJ.cjs → chunk-5MZFQRDW.cjs} +73 -55
  9. package/dist/{chunk-MVHDC3XF.js → chunk-5NOZSG6J.js} +22 -11
  10. package/dist/{chunk-YHEITFHR.cjs → chunk-BVLN75LP.cjs} +540 -143
  11. package/dist/{chunk-YEAXE4U2.js → chunk-FLUF2GZH.js} +5 -11
  12. package/dist/{chunk-SANKKGB3.js → chunk-GLLCLRCQ.js} +464 -67
  13. package/dist/{chunk-ACBN6UWZ.js → chunk-NV5IRHI3.js} +26 -8
  14. package/dist/{chunk-J7FMZK66.cjs → chunk-O4AFPDQ4.cjs} +22 -11
  15. package/dist/{chunk-4U6DATGZ.cjs → chunk-OV5TRZET.cjs} +7 -7
  16. package/dist/{chunk-BXAKL2TF.cjs → chunk-PA6YDMFZ.cjs} +5 -11
  17. package/dist/{chunk-RDEVZMO5.js → chunk-RCE5SJBA.js} +2 -2
  18. package/dist/{chunk-KM2I6AFP.cjs → chunk-SS3K7OIM.cjs} +9 -9
  19. package/dist/{chunk-V6EYAC7X.cjs → chunk-WMMZZRDJ.cjs} +15 -15
  20. package/dist/{chunk-NR44CK5E.js → chunk-ZY64VJMS.js} +1 -1
  21. package/dist/{emit-order-notification-trigger-UCKJHDQK.js → emit-order-notification-trigger-EJJZ6XTS.js} +2 -2
  22. package/dist/{emit-order-notification-trigger-DR74TQXN.cjs → emit-order-notification-trigger-ZD5YN3JM.cjs} +4 -4
  23. package/dist/index.cjs +284 -280
  24. package/dist/index.d.cts +14 -1
  25. package/dist/index.d.ts +14 -1
  26. package/dist/index.js +10 -10
  27. package/dist/migrations/1783300000000-CreateOrderAssigneesTable.ts +43 -0
  28. package/dist/{order-assignees-handlers-NPKD64P6.cjs → order-assignees-handlers-KF7RMTV5.cjs} +77 -8
  29. package/dist/{order-assignees-handlers-LKMAGLG6.js → order-assignees-handlers-L3RVKUBS.js} +77 -8
  30. package/dist/{order-completion-otp-handlers-RW5RSXH3.cjs → order-completion-otp-handlers-DZAXK4GQ.cjs} +70 -16
  31. package/dist/{order-completion-otp-handlers-CH22ZRAI.js → order-completion-otp-handlers-HFGCPC4O.js} +69 -15
  32. package/dist/{order-notification-dispatcher-3TXUAJ7L.js → order-notification-dispatcher-ECPFI7CD.js} +2 -2
  33. package/dist/{order-notification-dispatcher-Y7NZAALH.cjs → order-notification-dispatcher-LL7ETKLU.cjs} +7 -7
  34. package/dist/{rbac-debug-db-5R6XFPSV.js → rbac-debug-db-DFZWZ6GV.js} +1 -1
  35. package/dist/{rbac-debug-db-JKK2MCWF.cjs → rbac-debug-db-KWV7D5PQ.cjs} +2 -2
  36. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { queueWhatsApp } from './chunk-GWDI752Q.js';
2
- import { notifyLog, maskNotifyToken, maskNotifyEmail, maskNotifyPhone, notificationTriggerEmitter } from './chunk-YEAXE4U2.js';
2
+ import { notifyLog, logFcmToken, maskNotifyEmail, maskNotifyPhone, notificationTriggerEmitter } from './chunk-FLUF2GZH.js';
3
3
  import { sesRegionSupportsSmtp, sesSmtpHost, EmailService, renderLayout } from './chunk-6YOQ7G5O.js';
4
4
  import { queueEmail } from './chunk-TU23GJPJ.js';
5
5
  import { mergeEmailLayoutCompanyDetails } from './chunk-YRCKEGL2.js';
@@ -217,7 +217,8 @@ async function loadOrderNotificationContexts(orderId, deps) {
217
217
  const contact = {
218
218
  name: metaBuyerName || rawContact.name,
219
219
  email: metaBuyerEmail || metaCheckoutEmail || rawContact.email,
220
- phone: rawContact.phone
220
+ phone: rawContact.phone,
221
+ userId: rawContact.userId ?? null
221
222
  };
222
223
  const currency = String(o.currency ?? "INR");
223
224
  const siteUrl = resolvePublicSiteUrl();
@@ -1502,7 +1503,17 @@ async function loadBoundTemplate(triggerKey, channel, audienceType = "customers"
1502
1503
  enabled: true
1503
1504
  }
1504
1505
  }).catch(() => null);
1505
- if (!template) {
1506
+ let resolvedTemplate = template;
1507
+ if (!resolvedTemplate && (channel === "mobile" || channel === "push")) {
1508
+ resolvedTemplate = await dataSource.getRepository(entityMap.message_templates).findOne({
1509
+ where: {
1510
+ id: templateId,
1511
+ deleted: false,
1512
+ enabled: true
1513
+ }
1514
+ }).catch(() => null);
1515
+ }
1516
+ if (!resolvedTemplate) {
1506
1517
  const defChannel = ORDER_NOTIFICATION_DEFAULTS[channel];
1507
1518
  const def = defChannel ? defChannel[triggerKey] : null;
1508
1519
  if (def) {
@@ -1527,7 +1538,7 @@ async function loadBoundTemplate(triggerKey, channel, audienceType = "customers"
1527
1538
  });
1528
1539
  return null;
1529
1540
  }
1530
- return template;
1541
+ return resolvedTemplate;
1531
1542
  } catch (err) {
1532
1543
  const defChannel = ORDER_NOTIFICATION_DEFAULTS[channel];
1533
1544
  const def = defChannel ? defChannel[triggerKey] : null;
@@ -1680,7 +1691,7 @@ async function sendPushNotificationForTrigger(triggerKey, orderId, audienceType,
1680
1691
  targetId,
1681
1692
  title,
1682
1693
  tokenCount: tokens.length,
1683
- tokens: tokens.map((t) => maskNotifyToken(t))
1694
+ fcmTokens: tokens.map((t) => logFcmToken(t))
1684
1695
  });
1685
1696
  if (tokens.length === 0) {
1686
1697
  notifyLog.skip("PUSH", "no active FCM tokens for target", {
@@ -1693,6 +1704,13 @@ async function sendPushNotificationForTrigger(triggerKey, orderId, audienceType,
1693
1704
  return;
1694
1705
  }
1695
1706
  for (const token of tokens) {
1707
+ notifyLog.push("FCM target", {
1708
+ triggerKey,
1709
+ orderId,
1710
+ audienceType,
1711
+ targetId,
1712
+ fcmToken: logFcmToken(token)
1713
+ });
1696
1714
  const res = await sendFcmPushNotification(dataSource, entityMap, {
1697
1715
  token,
1698
1716
  title,
@@ -1707,7 +1725,7 @@ async function sendPushNotificationForTrigger(triggerKey, orderId, audienceType,
1707
1725
  triggerKey,
1708
1726
  orderId,
1709
1727
  audienceType,
1710
- token: maskNotifyToken(token),
1728
+ fcmToken: logFcmToken(token),
1711
1729
  messageId: res.messageId ?? null
1712
1730
  });
1713
1731
  } else {
@@ -1715,7 +1733,7 @@ async function sendPushNotificationForTrigger(triggerKey, orderId, audienceType,
1715
1733
  triggerKey,
1716
1734
  orderId,
1717
1735
  audienceType,
1718
- token: maskNotifyToken(token),
1736
+ fcmToken: logFcmToken(token),
1719
1737
  error: res.error ?? "unknown"
1720
1738
  });
1721
1739
  }
@@ -2106,7 +2124,7 @@ async function handleTrigger(triggerKey, payload, dataSource, entityMap, getCms)
2106
2124
  vendor: pushVendorEnabled,
2107
2125
  admin: pushAdminEnabled
2108
2126
  });
2109
- const targetCustomerId = triggerKey === "order_assigned_assignee" ? context?.order?.assignedUser?.id : context?.order?.customerContactId || context?.order?.contactId || context?.order?.userId || context?.order?.id;
2127
+ const targetCustomerId = triggerKey === "order_assigned_assignee" ? context?.order?.assignedUser?.id : context?.contact?.userId;
2110
2128
  if (pushCustomerEnabled && targetCustomerId) {
2111
2129
  await sendPushNotificationForTrigger(triggerKey, payload.orderId, "customers", String(targetCustomerId), variables, dataSource, entityMap);
2112
2130
  } else if (!pushCustomerEnabled) {
@@ -192,23 +192,34 @@ function canOnboardVendors(user) {
192
192
  }
193
193
  chunkUSNT2KNT_cjs.__name(canOnboardVendors, "canOnboardVendors");
194
194
  function resolveVendorScopeFromSessionUser(user) {
195
- if (!user?.email) return {
196
- type: "deny"
197
- };
198
- if (isPlatformAdministrator(user)) return {
199
- type: "all"
200
- };
195
+ if (!user?.email) {
196
+ console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] No user email -> deny");
197
+ return {
198
+ type: "deny"
199
+ };
200
+ }
201
+ if (isPlatformAdministrator(user)) {
202
+ console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] User is Platform Admin -> all");
203
+ return {
204
+ type: "all"
205
+ };
206
+ }
201
207
  const vendorIds = user.vendorIds ?? [];
202
- if (vendorIds.length === 0) return {
203
- type: "deny"
204
- };
208
+ if (vendorIds.length === 0) {
209
+ console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] User has 0 vendorIds -> deny. User:", user.email);
210
+ return {
211
+ type: "deny"
212
+ };
213
+ }
205
214
  const preferred = user.activeVendorId ?? vendorIds[0];
206
215
  const vendorId = vendorIds.includes(preferred) ? preferred : vendorIds[0];
207
- return {
216
+ const res = {
208
217
  type: "vendor",
209
218
  vendorId,
210
219
  vendorIds
211
220
  };
221
+ console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] User:", user.email, "-> scope:", res);
222
+ return res;
212
223
  }
213
224
  chunkUSNT2KNT_cjs.__name(resolveVendorScopeFromSessionUser, "resolveVendorScopeFromSessionUser");
214
225
  function vendorPortalFlagsFromUser(input) {
@@ -614,7 +625,7 @@ async function logEntityAccessDecision(dataSource, context, user, entity, action
614
625
  const id = Number(user.id);
615
626
  if (Number.isFinite(id)) {
616
627
  try {
617
- const { loadDbPermissionsForUser } = await import('./rbac-debug-db-JKK2MCWF.cjs');
628
+ const { loadDbPermissionsForUser } = await import('./rbac-debug-db-KWV7D5PQ.cjs');
618
629
  dbPermissions = await loadDbPermissionsForUser(dataSource, id);
619
630
  } catch (e) {
620
631
  dbPermissions = {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkJ7FMZK66_cjs = require('./chunk-J7FMZK66.cjs');
3
+ var chunkO4AFPDQ4_cjs = require('./chunk-O4AFPDQ4.cjs');
4
4
  var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
5
5
  var typeorm = require('typeorm');
6
6
 
@@ -273,7 +273,7 @@ var RBAC_ADMIN_ONLY_ENTITIES = /* @__PURE__ */ new Set([
273
273
  "permissions"
274
274
  ]);
275
275
  function sessionHasEntityAccess(user, entity, action) {
276
- return chunkJ7FMZK66_cjs.explainSessionEntityAccess(user, entity, action).allowed;
276
+ return chunkO4AFPDQ4_cjs.explainSessionEntityAccess(user, entity, action).allowed;
277
277
  }
278
278
  chunkUSNT2KNT_cjs.__name(sessionHasEntityAccess, "sessionHasEntityAccess");
279
279
  function canManageRoles(user) {
@@ -364,8 +364,8 @@ function createAuthHelpersFromGetSession(getSession, NextResponse) {
364
364
  }
365
365
  const u = session.user;
366
366
  const allowed = sessionHasEntityAccess(u, entity, action);
367
- const { reason } = chunkJ7FMZK66_cjs.explainSessionEntityAccess(u, entity, action);
368
- chunkJ7FMZK66_cjs.logRbac("authHelpers.requireEntityPermission", {
367
+ const { reason } = chunkO4AFPDQ4_cjs.explainSessionEntityAccess(u, entity, action);
368
+ chunkO4AFPDQ4_cjs.logRbac("authHelpers.requireEntityPermission", {
369
369
  entity,
370
370
  action,
371
371
  allowed,
@@ -397,10 +397,10 @@ function createAuthHelpersFromGetSession(getSession, NextResponse) {
397
397
  }
398
398
  const u = session.user;
399
399
  if (u.isRBACAdmin) return null;
400
- if (chunkJ7FMZK66_cjs.isVendorPortalUser(u)) return null;
400
+ if (chunkO4AFPDQ4_cjs.isVendorPortalUser(u)) return null;
401
401
  if (u.adminAccess === true) return null;
402
402
  if (u.adminAccess === false) {
403
- chunkJ7FMZK66_cjs.logRbac("requireAdminAccess denied (adminAccess:false)", {
403
+ chunkO4AFPDQ4_cjs.logRbac("requireAdminAccess denied (adminAccess:false)", {
404
404
  email: u.email,
405
405
  groupName: u.groupName,
406
406
  isVendorPortal: u.isVendorPortal
@@ -412,7 +412,7 @@ function createAuthHelpersFromGetSession(getSession, NextResponse) {
412
412
  status: 403
413
413
  });
414
414
  }
415
- chunkJ7FMZK66_cjs.logRbac("requireAdminAccess denied (no matching rule)", {
415
+ chunkO4AFPDQ4_cjs.logRbac("requireAdminAccess denied (no matching rule)", {
416
416
  email: u.email,
417
417
  adminAccess: u.adminAccess,
418
418
  groupName: u.groupName,
@@ -27,13 +27,6 @@ var NotificationTriggerEmitter = class NotificationTriggerEmitter2 extends event
27
27
  var notificationTriggerEmitter = new NotificationTriggerEmitter();
28
28
 
29
29
  // src/lib/notify-log.ts
30
- function maskTail(raw, keep = 6) {
31
- const s = String(raw ?? "").trim();
32
- if (!s) return "(none)";
33
- if (s.length <= keep) return "***";
34
- return `***${s.slice(-keep)}`;
35
- }
36
- chunkUSNT2KNT_cjs.__name(maskTail, "maskTail");
37
30
  function maskNotifyPhone(raw) {
38
31
  const digits = String(raw ?? "").replace(/\D/g, "");
39
32
  if (digits.length <= 4) return "(none)";
@@ -48,10 +41,11 @@ function maskNotifyEmail(raw) {
48
41
  return `${u}@${domain}`;
49
42
  }
50
43
  chunkUSNT2KNT_cjs.__name(maskNotifyEmail, "maskNotifyEmail");
51
- function maskNotifyToken(raw) {
52
- return maskTail(raw, 8);
44
+ function logFcmToken(raw) {
45
+ const s = String(raw ?? "").trim();
46
+ return s || "(none)";
53
47
  }
54
- chunkUSNT2KNT_cjs.__name(maskNotifyToken, "maskNotifyToken");
48
+ chunkUSNT2KNT_cjs.__name(logFcmToken, "logFcmToken");
55
49
  function write(level, channel, message, data) {
56
50
  const banner = `========== [NOTIFY] ${channel} | ${message} ==========`;
57
51
  const payload = data ?? {};
@@ -77,8 +71,8 @@ var notifyLog = {
77
71
  };
78
72
 
79
73
  exports.KNOWN_NOTIFICATION_TRIGGERS = KNOWN_NOTIFICATION_TRIGGERS;
74
+ exports.logFcmToken = logFcmToken;
80
75
  exports.maskNotifyEmail = maskNotifyEmail;
81
76
  exports.maskNotifyPhone = maskNotifyPhone;
82
- exports.maskNotifyToken = maskNotifyToken;
83
77
  exports.notificationTriggerEmitter = notificationTriggerEmitter;
84
78
  exports.notifyLog = notifyLog;
@@ -1,4 +1,4 @@
1
- import { notifyLog, notificationTriggerEmitter, maskNotifyPhone } from './chunk-YEAXE4U2.js';
1
+ import { notifyLog, notificationTriggerEmitter, maskNotifyPhone } from './chunk-FLUF2GZH.js';
2
2
  import { __name } from './chunk-SHUYVCID.js';
3
3
 
4
4
  // src/lib/emit-order-notification-trigger.ts
@@ -94,7 +94,7 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
94
94
  orderId
95
95
  });
96
96
  try {
97
- const { dispatchOrderNotificationDirectly } = await import('./order-notification-dispatcher-3TXUAJ7L.js');
97
+ const { dispatchOrderNotificationDirectly } = await import('./order-notification-dispatcher-ECPFI7CD.js');
98
98
  await dispatchOrderNotificationDirectly(triggerKey, triggerPayload, deps.dataSource, deps.entityMap);
99
99
  } catch (err) {
100
100
  notifyLog.error("TRIGGER", "direct dispatch failed", {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk4U6DATGZ_cjs = require('./chunk-4U6DATGZ.cjs');
3
+ var chunkOV5TRZET_cjs = require('./chunk-OV5TRZET.cjs');
4
4
  var chunkOY2YTBMP_cjs = require('./chunk-OY2YTBMP.cjs');
5
- var chunkJ7FMZK66_cjs = require('./chunk-J7FMZK66.cjs');
5
+ var chunkO4AFPDQ4_cjs = require('./chunk-O4AFPDQ4.cjs');
6
6
  var chunk7L6KWI7S_cjs = require('./chunk-7L6KWI7S.cjs');
7
7
  var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
8
8
  var _CredentialsProvider = require('next-auth/providers/credentials');
@@ -15,12 +15,12 @@ var _GoogleProvider__default = /*#__PURE__*/_interopDefault(_GoogleProvider);
15
15
 
16
16
  // src/auth/seed-permissions.ts
17
17
  async function seedAdministratorPermissions(dataSource, entityMap) {
18
- const entities = chunkJ7FMZK66_cjs.getPermissionableEntityKeys(entityMap);
18
+ const entities = chunkO4AFPDQ4_cjs.getPermissionableEntityKeys(entityMap);
19
19
  const groupRepo = dataSource.getRepository(entityMap.user_groups);
20
20
  const permRepo = dataSource.getRepository(entityMap.permissions);
21
21
  const adminGroup = await groupRepo.findOne({
22
22
  where: {
23
- name: chunkJ7FMZK66_cjs.ADMIN_GROUP_NAME,
23
+ name: chunkO4AFPDQ4_cjs.ADMIN_GROUP_NAME,
24
24
  deleted: false
25
25
  }
26
26
  });
@@ -260,13 +260,13 @@ async function createCustomerUserFromGoogleOAuth(input) {
260
260
  }
261
261
  if (input.entityMap.contacts) {
262
262
  try {
263
- await chunk4U6DATGZ_cjs.linkUnclaimedContactToUser(input.dataSource, input.entityMap.contacts, userId, email);
263
+ await chunkOV5TRZET_cjs.linkUnclaimedContactToUser(input.dataSource, input.entityMap.contacts, userId, email);
264
264
  } catch {
265
265
  }
266
266
  }
267
267
  if (input.entityMap.customer) {
268
268
  try {
269
- await chunk4U6DATGZ_cjs.ensureCustomerForUser(input.dataSource, input.entityMap.customer, {
269
+ await chunkOV5TRZET_cjs.ensureCustomerForUser(input.dataSource, input.entityMap.customer, {
270
270
  id: userId,
271
271
  name: displayName,
272
272
  email,
@@ -387,18 +387,18 @@ async function checkMultiVendorEnabledViaSettingsApi() {
387
387
  chunkUSNT2KNT_cjs.__name(checkMultiVendorEnabledViaSettingsApi, "checkMultiVendorEnabledViaSettingsApi");
388
388
  function sessionUserFromNextAuthUser(user) {
389
389
  const g = user.group;
390
- const isRBACAdmin = chunkJ7FMZK66_cjs.isSuperAdmin({
390
+ const isRBACAdmin = chunkO4AFPDQ4_cjs.isSuperAdmin({
391
391
  groupId: user.groupId ?? void 0,
392
392
  groupName: g?.name,
393
393
  isRBACAdmin: false
394
394
  });
395
- const entityPerms = chunkJ7FMZK66_cjs.permissionRowsToRecord(g?.permissions);
395
+ const entityPerms = chunkO4AFPDQ4_cjs.permissionRowsToRecord(g?.permissions);
396
396
  const rawAdminAccess = user.adminAccess;
397
397
  const adminAccess = rawAdminAccess === true ? true : rawAdminAccess === false ? false : void 0;
398
398
  const vendorIds = user.vendorIds ?? [];
399
399
  const vendorRole = user.vendorRole ?? null;
400
400
  const isVendorRoleOwner = user.isVendorRoleOwner ?? false;
401
- const { isVendorPortal, isVendorOwner: isVendorOwner2 } = chunkJ7FMZK66_cjs.vendorPortalFlagsFromUser({
401
+ const { isVendorPortal, isVendorOwner: isVendorOwner2 } = chunkO4AFPDQ4_cjs.vendorPortalFlagsFromUser({
402
402
  email: user.email,
403
403
  isRBACAdmin,
404
404
  groupName: g?.name,
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkBXAKL2TF_cjs = require('./chunk-BXAKL2TF.cjs');
3
+ var chunkPA6YDMFZ_cjs = require('./chunk-PA6YDMFZ.cjs');
4
4
  var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
5
5
 
6
6
  // src/lib/emit-order-notification-trigger.ts
7
7
  async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
8
8
  if (!deps.entityMap.orders) {
9
- chunkBXAKL2TF_cjs.notifyLog.skip("TRIGGER", "orders entity missing from entityMap", {
9
+ chunkPA6YDMFZ_cjs.notifyLog.skip("TRIGGER", "orders entity missing from entityMap", {
10
10
  triggerKey,
11
11
  orderId
12
12
  });
13
13
  return;
14
14
  }
15
- const listenerCount = chunkBXAKL2TF_cjs.notificationTriggerEmitter.listenerCount("__any__");
15
+ const listenerCount = chunkPA6YDMFZ_cjs.notificationTriggerEmitter.listenerCount("__any__");
16
16
  if (listenerCount === 0) {
17
- chunkBXAKL2TF_cjs.notifyLog.skip("TRIGGER", "no dispatcher listener \u2014 will try direct dispatch (pass getCms to createCmsApiHandler)", {
17
+ chunkPA6YDMFZ_cjs.notifyLog.skip("TRIGGER", "no dispatcher listener \u2014 will try direct dispatch (pass getCms to createCmsApiHandler)", {
18
18
  triggerKey,
19
19
  orderId
20
20
  });
@@ -30,7 +30,7 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
30
30
  ]
31
31
  });
32
32
  if (!fullOrder) {
33
- chunkBXAKL2TF_cjs.notifyLog.skip("TRIGGER", "order not found", {
33
+ chunkPA6YDMFZ_cjs.notifyLog.skip("TRIGGER", "order not found", {
34
34
  triggerKey,
35
35
  orderId
36
36
  });
@@ -38,17 +38,17 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
38
38
  }
39
39
  const fo = fullOrder;
40
40
  const phone = fo.contact?.phone ?? null;
41
- chunkBXAKL2TF_cjs.notifyLog.trigger("emit", {
41
+ chunkPA6YDMFZ_cjs.notifyLog.trigger("emit", {
42
42
  triggerKey,
43
43
  orderId,
44
44
  orderNumber: fo.orderNumber ?? null,
45
- phone: chunkBXAKL2TF_cjs.maskNotifyPhone(phone),
45
+ phone: chunkPA6YDMFZ_cjs.maskNotifyPhone(phone),
46
46
  listeners: listenerCount,
47
47
  vendorId: fo.vendorId ?? null,
48
48
  source: extra?.source ?? "api"
49
49
  });
50
50
  if (!phone?.trim()) {
51
- chunkBXAKL2TF_cjs.notifyLog.skip("WHATSAPP", "order contact has no phone", {
51
+ chunkPA6YDMFZ_cjs.notifyLog.skip("WHATSAPP", "order contact has no phone", {
52
52
  triggerKey,
53
53
  orderId
54
54
  });
@@ -91,15 +91,15 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
91
91
  refundAmount: resolvedRefundAmount
92
92
  };
93
93
  if (listenerCount === 0) {
94
- chunkBXAKL2TF_cjs.notifyLog.trigger("direct dispatch (no in-process listener)", {
94
+ chunkPA6YDMFZ_cjs.notifyLog.trigger("direct dispatch (no in-process listener)", {
95
95
  triggerKey,
96
96
  orderId
97
97
  });
98
98
  try {
99
- const { dispatchOrderNotificationDirectly } = await import('./order-notification-dispatcher-Y7NZAALH.cjs');
99
+ const { dispatchOrderNotificationDirectly } = await import('./order-notification-dispatcher-LL7ETKLU.cjs');
100
100
  await dispatchOrderNotificationDirectly(triggerKey, triggerPayload, deps.dataSource, deps.entityMap);
101
101
  } catch (err) {
102
- chunkBXAKL2TF_cjs.notifyLog.error("TRIGGER", "direct dispatch failed", {
102
+ chunkPA6YDMFZ_cjs.notifyLog.error("TRIGGER", "direct dispatch failed", {
103
103
  triggerKey,
104
104
  orderId,
105
105
  error: err instanceof Error ? err.message : String(err),
@@ -107,23 +107,23 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
107
107
  });
108
108
  }
109
109
  } else {
110
- chunkBXAKL2TF_cjs.notifyLog.trigger("emit to dispatcher listener", {
110
+ chunkPA6YDMFZ_cjs.notifyLog.trigger("emit to dispatcher listener", {
111
111
  triggerKey,
112
112
  orderId,
113
113
  listeners: listenerCount
114
114
  });
115
- chunkBXAKL2TF_cjs.notificationTriggerEmitter.emitTrigger(triggerKey, triggerPayload);
115
+ chunkPA6YDMFZ_cjs.notificationTriggerEmitter.emitTrigger(triggerKey, triggerPayload);
116
116
  }
117
117
  }
118
118
  chunkUSNT2KNT_cjs.__name(emitOrderNotificationTrigger, "emitOrderNotificationTrigger");
119
119
  function fireOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
120
- chunkBXAKL2TF_cjs.notifyLog.trigger("FIRE", {
120
+ chunkPA6YDMFZ_cjs.notifyLog.trigger("FIRE", {
121
121
  triggerKey,
122
122
  orderId,
123
123
  source: extra?.source ?? "api"
124
124
  });
125
125
  void emitOrderNotificationTrigger(triggerKey, orderId, deps, extra).catch((err) => {
126
- chunkBXAKL2TF_cjs.notifyLog.error("TRIGGER", "fire failed", {
126
+ chunkPA6YDMFZ_cjs.notifyLog.error("TRIGGER", "fire failed", {
127
127
  triggerKey,
128
128
  orderId,
129
129
  error: err instanceof Error ? err.message : String(err),
@@ -1,4 +1,4 @@
1
- import { explainSessionEntityAccess, isVendorPortalUser, logRbac } from './chunk-MVHDC3XF.js';
1
+ import { explainSessionEntityAccess, isVendorPortalUser, logRbac } from './chunk-5NOZSG6J.js';
2
2
  import { __name } from './chunk-SHUYVCID.js';
3
3
  import { IsNull } from 'typeorm';
4
4
 
@@ -1,3 +1,3 @@
1
- export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-RDEVZMO5.js';
2
- import './chunk-YEAXE4U2.js';
1
+ export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-RCE5SJBA.js';
2
+ import './chunk-FLUF2GZH.js';
3
3
  import './chunk-SHUYVCID.js';
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkV6EYAC7X_cjs = require('./chunk-V6EYAC7X.cjs');
4
- require('./chunk-BXAKL2TF.cjs');
3
+ var chunkWMMZZRDJ_cjs = require('./chunk-WMMZZRDJ.cjs');
4
+ require('./chunk-PA6YDMFZ.cjs');
5
5
  require('./chunk-USNT2KNT.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "emitOrderNotificationTrigger", {
10
10
  enumerable: true,
11
- get: function () { return chunkV6EYAC7X_cjs.emitOrderNotificationTrigger; }
11
+ get: function () { return chunkWMMZZRDJ_cjs.emitOrderNotificationTrigger; }
12
12
  });
13
13
  Object.defineProperty(exports, "fireOrderNotificationTrigger", {
14
14
  enumerable: true,
15
- get: function () { return chunkV6EYAC7X_cjs.fireOrderNotificationTrigger; }
15
+ get: function () { return chunkWMMZZRDJ_cjs.fireOrderNotificationTrigger; }
16
16
  });