@infuro/cms-core 1.0.65 → 1.0.66
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/admin.cjs +4 -4
- package/dist/admin.js +4 -4
- package/dist/api.cjs +35 -35
- package/dist/api.js +3 -3
- package/dist/{chunk-NIRYYJIJ.cjs → chunk-5MZFQRDW.cjs} +73 -55
- package/dist/{chunk-YEAXE4U2.js → chunk-FLUF2GZH.js} +5 -11
- package/dist/{chunk-ACBN6UWZ.js → chunk-NV5IRHI3.js} +26 -8
- package/dist/{chunk-BXAKL2TF.cjs → chunk-PA6YDMFZ.cjs} +5 -11
- package/dist/{chunk-YHEITFHR.cjs → chunk-QYRXLURF.cjs} +100 -68
- package/dist/{chunk-RDEVZMO5.js → chunk-RCE5SJBA.js} +2 -2
- package/dist/{chunk-SANKKGB3.js → chunk-T33KU5G5.js} +73 -41
- package/dist/{chunk-V6EYAC7X.cjs → chunk-WMMZZRDJ.cjs} +15 -15
- package/dist/{emit-order-notification-trigger-UCKJHDQK.js → emit-order-notification-trigger-EJJZ6XTS.js} +2 -2
- package/dist/{emit-order-notification-trigger-DR74TQXN.cjs → emit-order-notification-trigger-ZD5YN3JM.cjs} +4 -4
- package/dist/index.cjs +220 -220
- package/dist/index.js +6 -6
- package/dist/{order-completion-otp-handlers-CH22ZRAI.js → order-completion-otp-handlers-LFRHXWK4.js} +2 -2
- package/dist/{order-completion-otp-handlers-RW5RSXH3.cjs → order-completion-otp-handlers-NK65LOLV.cjs} +3 -3
- package/dist/{order-notification-dispatcher-3TXUAJ7L.js → order-notification-dispatcher-ECPFI7CD.js} +2 -2
- package/dist/{order-notification-dispatcher-Y7NZAALH.cjs → order-notification-dispatcher-LL7ETKLU.cjs} +7 -7
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizePhoneE164, generateNumericOtp, createOtpChallenge, queueSms, verifyAndConsumeOtpChallenge } from './chunk-OVTOP42W.js';
|
|
2
2
|
import { JOB_RUNNER_QUEUE } from './chunk-XJNNOSJR.js';
|
|
3
3
|
import { validateInventoryForConfirmedOrderLines, orderStatusHoldsStock, reconcileOrderInventoryBetweenSnapshots, orderInventorySnapshotFromRow, validateInventoryForOrderBecomingConfirmed } from './chunk-3K5AIEIZ.js';
|
|
4
|
-
import { resolveChatEmailToolSettings, CHAT_EMAIL_LOG, detectChatLeadIntent, parseIntentRecipientEmails, sendChatLeadEmail, buildTranscriptForLeadEmail, buildChatbotSystemPromptWithEmailTool, validateFcmCredentials, sendFcmPushNotification, parseEmailRecipientsFromConfig, isWhatsAppPluginEnabled, WhatsAppService, emailPlugin, initWhatsappTriggerDispatcher } from './chunk-
|
|
4
|
+
import { resolveChatEmailToolSettings, CHAT_EMAIL_LOG, detectChatLeadIntent, parseIntentRecipientEmails, sendChatLeadEmail, buildTranscriptForLeadEmail, buildChatbotSystemPromptWithEmailTool, validateFcmCredentials, sendFcmPushNotification, parseEmailRecipientsFromConfig, isWhatsAppPluginEnabled, WhatsAppService, emailPlugin, initWhatsappTriggerDispatcher } from './chunk-NV5IRHI3.js';
|
|
5
5
|
import { registerWhatsAppQueueProcessor } from './chunk-GWDI752Q.js';
|
|
6
6
|
import { inviteStatusForActivation } from './chunk-JXF23MPG.js';
|
|
7
7
|
import { queueEmail, queueVendorOnboardEmails, registerEmailQueueProcessor } from './chunk-TU23GJPJ.js';
|
|
@@ -5229,7 +5229,7 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
5229
5229
|
const orderIdForNotify = created.id;
|
|
5230
5230
|
const finalCreatedStatus = String(created.status ?? createdStatus ?? "pending").toLowerCase();
|
|
5231
5231
|
const initialPayStatus = String(persistBody.paymentStatus ?? body.paymentStatus ?? "unpaid").toLowerCase();
|
|
5232
|
-
void import('./emit-order-notification-trigger-
|
|
5232
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
5233
5233
|
if (finalCreatedStatus === "pending") {
|
|
5234
5234
|
if (initialPayStatus === "failed") {
|
|
5235
5235
|
fireOrderNotificationTrigger("payment_failed", orderIdForNotify, {
|
|
@@ -6309,7 +6309,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
6309
6309
|
const paymentUpdated = Boolean(rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null);
|
|
6310
6310
|
const assigneeUpdated = Boolean(rawBody && typeof rawBody === "object" && "assignedUserId" in rawBody && rawBody.assignedUserId !== void 0 && Number(rawBody.assignedUserId) > 0 && Number(rawBody.assignedUserId) !== Number(existingOrderRow?.assignedUserId));
|
|
6311
6311
|
if (assigneeUpdated) {
|
|
6312
|
-
void import('./emit-order-notification-trigger-
|
|
6312
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
6313
6313
|
fireOrderNotificationTrigger("order_assigned", updatedOrder.id, {
|
|
6314
6314
|
dataSource,
|
|
6315
6315
|
entityMap
|
|
@@ -6326,7 +6326,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
6326
6326
|
const payments = Array.isArray(updatedOrder.payments) ? updatedOrder.payments : [];
|
|
6327
6327
|
const bodyPayStatus = rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null ? String(rawBody.paymentStatus).toLowerCase() : null;
|
|
6328
6328
|
const curPayStatus = bodyPayStatus || String(payments[0]?.status || "unpaid").toLowerCase();
|
|
6329
|
-
void import('./emit-order-notification-trigger-
|
|
6329
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
6330
6330
|
if (newStatus === "pending") {
|
|
6331
6331
|
if (curPayStatus === "failed") {
|
|
6332
6332
|
fireOrderNotificationTrigger("payment_failed", updatedOrder.id, {
|
|
@@ -6980,7 +6980,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
6980
6980
|
});
|
|
6981
6981
|
}
|
|
6982
6982
|
if (ordStatus === "pending" || ordStatus === "confirmed") {
|
|
6983
|
-
void import('./emit-order-notification-trigger-
|
|
6983
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
6984
6984
|
fireOrderNotificationTrigger("order_placed", pOrder, {
|
|
6985
6985
|
dataSource,
|
|
6986
6986
|
entityMap
|
|
@@ -6994,7 +6994,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
6994
6994
|
}
|
|
6995
6995
|
}
|
|
6996
6996
|
} else if (newPayStatus === "failed") {
|
|
6997
|
-
void import('./emit-order-notification-trigger-
|
|
6997
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
6998
6998
|
fireOrderNotificationTrigger("payment_failed", pOrder, {
|
|
6999
6999
|
dataSource,
|
|
7000
7000
|
entityMap
|
|
@@ -7002,7 +7002,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7002
7002
|
}).catch(() => {
|
|
7003
7003
|
});
|
|
7004
7004
|
} else if (newPayStatus === "refunded") {
|
|
7005
|
-
void import('./emit-order-notification-trigger-
|
|
7005
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
7006
7006
|
fireOrderNotificationTrigger("payment_refund_initiated", pOrder, {
|
|
7007
7007
|
dataSource,
|
|
7008
7008
|
entityMap
|
|
@@ -7129,7 +7129,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7129
7129
|
const paymentUpdated = Boolean(rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null);
|
|
7130
7130
|
const assigneeUpdated = Boolean(rawBody && typeof rawBody === "object" && "assignedUserId" in rawBody && rawBody.assignedUserId !== void 0 && Number(rawBody.assignedUserId) > 0 && Number(rawBody.assignedUserId) !== Number(existingOrderRow?.assignedUserId));
|
|
7131
7131
|
if (assigneeUpdated) {
|
|
7132
|
-
void import('./emit-order-notification-trigger-
|
|
7132
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
7133
7133
|
fireOrderNotificationTrigger("order_assigned", ord.id, {
|
|
7134
7134
|
dataSource,
|
|
7135
7135
|
entityMap
|
|
@@ -7146,7 +7146,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7146
7146
|
const payments = Array.isArray(ord.payments) ? ord.payments : [];
|
|
7147
7147
|
const bodyPayStatus = rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null ? String(rawBody.paymentStatus).toLowerCase() : null;
|
|
7148
7148
|
const curPayStatus = bodyPayStatus || String(payments[0]?.status || "unpaid").toLowerCase();
|
|
7149
|
-
void import('./emit-order-notification-trigger-
|
|
7149
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
7150
7150
|
if (newStatus === "pending") {
|
|
7151
7151
|
if (curPayStatus === "failed") {
|
|
7152
7152
|
fireOrderNotificationTrigger("payment_failed", ord.id, {
|
|
@@ -28314,7 +28314,7 @@ function slugify2(input) {
|
|
|
28314
28314
|
return input.toLowerCase().trim().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 64) || "template";
|
|
28315
28315
|
}
|
|
28316
28316
|
__name(slugify2, "slugify");
|
|
28317
|
-
function
|
|
28317
|
+
function createTextMessageTemplatesHandlers(config, channel) {
|
|
28318
28318
|
const { dataSource, entityMap, json, requireAuth, requireEntityPermission } = config;
|
|
28319
28319
|
const templateRepo = /* @__PURE__ */ __name(() => dataSource.getRepository(entityMap.message_templates), "templateRepo");
|
|
28320
28320
|
async function requireRead(req, entity) {
|
|
@@ -28337,6 +28337,10 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28337
28337
|
return null;
|
|
28338
28338
|
}
|
|
28339
28339
|
__name(requireUpdate, "requireUpdate");
|
|
28340
|
+
function isLegacyPushTemplate(row) {
|
|
28341
|
+
return row.channel === "email" && typeof row.name === "string" && row.name.includes("_push_");
|
|
28342
|
+
}
|
|
28343
|
+
__name(isLegacyPushTemplate, "isLegacyPushTemplate");
|
|
28340
28344
|
return {
|
|
28341
28345
|
async listCached(req) {
|
|
28342
28346
|
const err = await requireRead(req, "settings");
|
|
@@ -28344,15 +28348,19 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28344
28348
|
try {
|
|
28345
28349
|
const rows = await templateRepo().find({
|
|
28346
28350
|
where: {
|
|
28347
|
-
channel: "email",
|
|
28348
28351
|
deleted: false
|
|
28349
28352
|
},
|
|
28350
28353
|
order: {
|
|
28351
28354
|
name: "ASC"
|
|
28352
28355
|
}
|
|
28353
28356
|
});
|
|
28357
|
+
const items = rows.filter((row) => {
|
|
28358
|
+
const r = row;
|
|
28359
|
+
if (channel === "email") return r.channel === "email" && !isLegacyPushTemplate(r);
|
|
28360
|
+
return r.channel === "mobile" || isLegacyPushTemplate(r);
|
|
28361
|
+
});
|
|
28354
28362
|
return json({
|
|
28355
|
-
items
|
|
28363
|
+
items
|
|
28356
28364
|
});
|
|
28357
28365
|
} catch {
|
|
28358
28366
|
return json({
|
|
@@ -28393,7 +28401,7 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28393
28401
|
let suffix = 1;
|
|
28394
28402
|
while (await templateRepo().findOne({
|
|
28395
28403
|
where: {
|
|
28396
|
-
channel
|
|
28404
|
+
channel,
|
|
28397
28405
|
templateKey,
|
|
28398
28406
|
deleted: false
|
|
28399
28407
|
}
|
|
@@ -28402,7 +28410,7 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28402
28410
|
templateKey = `${baseKey}_${suffix}`;
|
|
28403
28411
|
}
|
|
28404
28412
|
const row = await templateRepo().save(templateRepo().create({
|
|
28405
|
-
channel
|
|
28413
|
+
channel,
|
|
28406
28414
|
templateKey,
|
|
28407
28415
|
name,
|
|
28408
28416
|
subject,
|
|
@@ -28440,7 +28448,6 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28440
28448
|
const existing = await templateRepo().findOne({
|
|
28441
28449
|
where: {
|
|
28442
28450
|
id: numId,
|
|
28443
|
-
channel: "email",
|
|
28444
28451
|
deleted: false
|
|
28445
28452
|
}
|
|
28446
28453
|
});
|
|
@@ -28449,9 +28456,25 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28449
28456
|
}, {
|
|
28450
28457
|
status: 404
|
|
28451
28458
|
});
|
|
28459
|
+
const row = existing;
|
|
28460
|
+
if (channel === "email" && row.channel !== "email") {
|
|
28461
|
+
return json({
|
|
28462
|
+
error: "Template not found"
|
|
28463
|
+
}, {
|
|
28464
|
+
status: 404
|
|
28465
|
+
});
|
|
28466
|
+
}
|
|
28467
|
+
if (channel === "mobile" && row.channel !== "mobile" && !isLegacyPushTemplate(row)) {
|
|
28468
|
+
return json({
|
|
28469
|
+
error: "Template not found"
|
|
28470
|
+
}, {
|
|
28471
|
+
status: 404
|
|
28472
|
+
});
|
|
28473
|
+
}
|
|
28452
28474
|
const patch = {
|
|
28453
28475
|
updatedAt: /* @__PURE__ */ new Date()
|
|
28454
28476
|
};
|
|
28477
|
+
if (channel === "mobile") patch.channel = "mobile";
|
|
28455
28478
|
if (typeof body.name === "string" && body.name.trim()) patch.name = body.name.trim();
|
|
28456
28479
|
if (typeof body.subject === "string") patch.subject = body.subject;
|
|
28457
28480
|
if (typeof body.body === "string") {
|
|
@@ -28474,7 +28497,15 @@ function createEmailMessageTemplatesHandlers(config) {
|
|
|
28474
28497
|
}
|
|
28475
28498
|
};
|
|
28476
28499
|
}
|
|
28500
|
+
__name(createTextMessageTemplatesHandlers, "createTextMessageTemplatesHandlers");
|
|
28501
|
+
function createEmailMessageTemplatesHandlers(config) {
|
|
28502
|
+
return createTextMessageTemplatesHandlers(config, "email");
|
|
28503
|
+
}
|
|
28477
28504
|
__name(createEmailMessageTemplatesHandlers, "createEmailMessageTemplatesHandlers");
|
|
28505
|
+
function createMobileMessageTemplatesHandlers(config) {
|
|
28506
|
+
return createTextMessageTemplatesHandlers(config, "mobile");
|
|
28507
|
+
}
|
|
28508
|
+
__name(createMobileMessageTemplatesHandlers, "createMobileMessageTemplatesHandlers");
|
|
28478
28509
|
function connectionFromUrl(redisUrl) {
|
|
28479
28510
|
const u = new URL(redisUrl);
|
|
28480
28511
|
return {
|
|
@@ -29234,6 +29265,13 @@ function createCmsApiHandler(config) {
|
|
|
29234
29265
|
requireAuth: config.requireAuth,
|
|
29235
29266
|
requireEntityPermission: requireEntityPermissionEffective
|
|
29236
29267
|
});
|
|
29268
|
+
const mobileMessageTemplatesHandlers = createMobileMessageTemplatesHandlers({
|
|
29269
|
+
dataSource,
|
|
29270
|
+
entityMap,
|
|
29271
|
+
json: config.json,
|
|
29272
|
+
requireAuth: config.requireAuth,
|
|
29273
|
+
requireEntityPermission: requireEntityPermissionEffective
|
|
29274
|
+
});
|
|
29237
29275
|
const deviceTokensHandlers = createDeviceTokensHandlers({
|
|
29238
29276
|
dataSource,
|
|
29239
29277
|
entityMap,
|
|
@@ -30268,9 +30306,16 @@ function createCmsApiHandler(config) {
|
|
|
30268
30306
|
if (m === "GET") return emailMessageTemplatesHandlers.listCached(req);
|
|
30269
30307
|
if (m === "POST") return emailMessageTemplatesHandlers.create(req);
|
|
30270
30308
|
}
|
|
30271
|
-
if (isMsgTemplatesRoute &&
|
|
30309
|
+
if (isMsgTemplatesRoute && path2[1] === "mobile" && path2.length === 2) {
|
|
30310
|
+
if (m === "GET") return mobileMessageTemplatesHandlers.listCached(req);
|
|
30311
|
+
if (m === "POST") return mobileMessageTemplatesHandlers.create(req);
|
|
30312
|
+
}
|
|
30313
|
+
if (isMsgTemplatesRoute && (path2[1] === "email" || path2.length === 2) && path2.length === 3 && path2[1] !== "mobile") {
|
|
30272
30314
|
if (m === "PATCH") return emailMessageTemplatesHandlers.update(req, path2[2]);
|
|
30273
30315
|
}
|
|
30316
|
+
if (isMsgTemplatesRoute && path2[1] === "mobile" && path2.length === 3) {
|
|
30317
|
+
if (m === "PATCH") return mobileMessageTemplatesHandlers.update(req, path2[2]);
|
|
30318
|
+
}
|
|
30274
30319
|
if (path2[0] === "llm_agents") {
|
|
30275
30320
|
if (!entityMap.llm_agents) {
|
|
30276
30321
|
console.error(CMS_API_LOG, "llm_agents route: entity missing after merge", {
|
|
@@ -30713,7 +30758,7 @@ function createCmsApiHandler(config) {
|
|
|
30713
30758
|
status: 400
|
|
30714
30759
|
});
|
|
30715
30760
|
}
|
|
30716
|
-
const { resendOrderNotification } = await import('./order-notification-dispatcher-
|
|
30761
|
+
const { resendOrderNotification } = await import('./order-notification-dispatcher-ECPFI7CD.js');
|
|
30717
30762
|
const result = await resendOrderNotification(triggerKey, orderId, {
|
|
30718
30763
|
dataSource,
|
|
30719
30764
|
entityMap,
|
|
@@ -30812,7 +30857,7 @@ function createCmsApiHandler(config) {
|
|
|
30812
30857
|
status: "cancelled"
|
|
30813
30858
|
});
|
|
30814
30859
|
const fireOrderCancelledNotification = /* @__PURE__ */ __name((refundAmount) => {
|
|
30815
|
-
void import('./emit-order-notification-trigger-
|
|
30860
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
30816
30861
|
fireOrderNotificationTrigger("order_cancelled", orderId, {
|
|
30817
30862
|
dataSource,
|
|
30818
30863
|
entityMap
|
|
@@ -31057,7 +31102,7 @@ function createCmsApiHandler(config) {
|
|
|
31057
31102
|
}, {
|
|
31058
31103
|
status: 400
|
|
31059
31104
|
});
|
|
31060
|
-
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-
|
|
31105
|
+
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-LFRHXWK4.js');
|
|
31061
31106
|
const handlers = createOrderCompletionOtpHandlers(dataSource, entityMap, getCms);
|
|
31062
31107
|
return handlers.getChannels(req, orderId);
|
|
31063
31108
|
}
|
|
@@ -31072,7 +31117,7 @@ function createCmsApiHandler(config) {
|
|
|
31072
31117
|
}, {
|
|
31073
31118
|
status: 400
|
|
31074
31119
|
});
|
|
31075
|
-
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-
|
|
31120
|
+
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-LFRHXWK4.js');
|
|
31076
31121
|
const handlers = createOrderCompletionOtpHandlers(dataSource, entityMap, getCms);
|
|
31077
31122
|
return handlers.sendOtp(req, orderId);
|
|
31078
31123
|
}
|
|
@@ -31087,7 +31132,7 @@ function createCmsApiHandler(config) {
|
|
|
31087
31132
|
}, {
|
|
31088
31133
|
status: 400
|
|
31089
31134
|
});
|
|
31090
|
-
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-
|
|
31135
|
+
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-LFRHXWK4.js');
|
|
31091
31136
|
const handlers = createOrderCompletionOtpHandlers(dataSource, entityMap, getCms);
|
|
31092
31137
|
return handlers.verifyOtp(req, orderId);
|
|
31093
31138
|
}
|
|
@@ -31718,32 +31763,17 @@ function createStorefrontApiHandler(config) {
|
|
|
31718
31763
|
const otpFlags = config.otpFlags;
|
|
31719
31764
|
const otpPepper = config.otpPepper;
|
|
31720
31765
|
const defaultPhoneCc = config.defaultPhoneCountryCode;
|
|
31721
|
-
function
|
|
31722
|
-
void import('./emit-order-notification-trigger-
|
|
31723
|
-
fireOrderNotificationTrigger("
|
|
31766
|
+
function fireStorefrontCheckoutNotifications(orderId) {
|
|
31767
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
31768
|
+
fireOrderNotificationTrigger("order_pending", orderId, {
|
|
31724
31769
|
dataSource,
|
|
31725
31770
|
entityMap
|
|
31726
31771
|
}, {
|
|
31727
31772
|
source: "storefront"
|
|
31728
31773
|
});
|
|
31729
|
-
if (isPaid) {
|
|
31730
|
-
fireOrderNotificationTrigger("payment_success", orderId, {
|
|
31731
|
-
dataSource,
|
|
31732
|
-
entityMap
|
|
31733
|
-
}, {
|
|
31734
|
-
source: "storefront"
|
|
31735
|
-
});
|
|
31736
|
-
} else {
|
|
31737
|
-
fireOrderNotificationTrigger("payment_failed", orderId, {
|
|
31738
|
-
dataSource,
|
|
31739
|
-
entityMap
|
|
31740
|
-
}, {
|
|
31741
|
-
source: "storefront"
|
|
31742
|
-
});
|
|
31743
|
-
}
|
|
31744
31774
|
}).catch((err) => console.error("[notification-triggers] import failed", err));
|
|
31745
31775
|
}
|
|
31746
|
-
__name(
|
|
31776
|
+
__name(fireStorefrontCheckoutNotifications, "fireStorefrontCheckoutNotifications");
|
|
31747
31777
|
const otpAllowPhoneLogin = config.otpAllowPhoneLogin !== false;
|
|
31748
31778
|
function otpOff(key) {
|
|
31749
31779
|
return !otpFlags || otpFlags[key] !== true;
|
|
@@ -34240,6 +34270,7 @@ function createStorefrontApiHandler(config) {
|
|
|
34240
34270
|
}));
|
|
34241
34271
|
}
|
|
34242
34272
|
await linkOrderContactToVendors(contactId, vendorRes.vendorIds);
|
|
34273
|
+
fireStorefrontCheckoutNotifications(oid);
|
|
34243
34274
|
return json({
|
|
34244
34275
|
orderId: oid,
|
|
34245
34276
|
orderNumber: ord.orderNumber,
|
|
@@ -34320,6 +34351,7 @@ function createStorefrontApiHandler(config) {
|
|
|
34320
34351
|
cartId: cart.id
|
|
34321
34352
|
});
|
|
34322
34353
|
await cartRepo().delete(cart.id);
|
|
34354
|
+
fireStorefrontCheckoutNotifications(oid);
|
|
34323
34355
|
return json({
|
|
34324
34356
|
orderId: oid,
|
|
34325
34357
|
orderNumber: ord.orderNumber,
|
|
@@ -34662,7 +34694,7 @@ function createStorefrontApiHandler(config) {
|
|
|
34662
34694
|
} catch {
|
|
34663
34695
|
}
|
|
34664
34696
|
try {
|
|
34665
|
-
void import('./emit-order-notification-trigger-
|
|
34697
|
+
void import('./emit-order-notification-trigger-EJJZ6XTS.js').then(({ fireOrderNotificationTrigger }) => {
|
|
34666
34698
|
fireOrderNotificationTrigger("order_cancelled", orderId, {
|
|
34667
34699
|
dataSource,
|
|
34668
34700
|
entityMap
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
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
|
-
|
|
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 =
|
|
15
|
+
const listenerCount = chunkPA6YDMFZ_cjs.notificationTriggerEmitter.listenerCount("__any__");
|
|
16
16
|
if (listenerCount === 0) {
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
41
|
+
chunkPA6YDMFZ_cjs.notifyLog.trigger("emit", {
|
|
42
42
|
triggerKey,
|
|
43
43
|
orderId,
|
|
44
44
|
orderNumber: fo.orderNumber ?? null,
|
|
45
|
-
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
|
-
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
110
|
+
chunkPA6YDMFZ_cjs.notifyLog.trigger("emit to dispatcher listener", {
|
|
111
111
|
triggerKey,
|
|
112
112
|
orderId,
|
|
113
113
|
listeners: listenerCount
|
|
114
114
|
});
|
|
115
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,3 +1,3 @@
|
|
|
1
|
-
export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-
|
|
2
|
-
import './chunk-
|
|
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
|
|
4
|
-
require('./chunk-
|
|
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
|
|
11
|
+
get: function () { return chunkWMMZZRDJ_cjs.emitOrderNotificationTrigger; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "fireOrderNotificationTrigger", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkWMMZZRDJ_cjs.fireOrderNotificationTrigger; }
|
|
16
16
|
});
|