@infuro/cms-core 1.0.67 → 1.0.68
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 +121 -12
- package/dist/admin.js +121 -12
- package/dist/api.cjs +43 -40
- package/dist/api.js +11 -8
- package/dist/auth.cjs +12 -12
- package/dist/auth.js +2 -2
- package/dist/{chunk-BVLN75LP.cjs → chunk-22XKONB5.cjs} +201 -71
- package/dist/{chunk-TU23GJPJ.js → chunk-7JCCPQEF.js} +1 -1
- package/dist/{chunk-WMMZZRDJ.cjs → chunk-GN4LKG4V.cjs} +1 -1
- package/dist/chunk-IKTBZJHT.js +16 -0
- package/dist/chunk-M5GPOPGX.cjs +49 -0
- package/dist/{chunk-GLLCLRCQ.js → chunk-MYUGQHU4.js} +158 -28
- package/dist/{chunk-NV5IRHI3.js → chunk-N4LBZXBG.js} +2 -2
- package/dist/chunk-P6S4XFZO.cjs +18 -0
- package/dist/{chunk-RCE5SJBA.js → chunk-SKJH7PX4.js} +1 -1
- package/dist/{chunk-5MZFQRDW.cjs → chunk-SMHQV3WL.cjs} +4 -4
- package/dist/chunk-SUUD7OUG.cjs +455 -0
- package/dist/{chunk-XFDIIVZB.cjs → chunk-UMC7W5G3.cjs} +3 -3
- package/dist/chunk-WKDBMDUX.js +45 -0
- package/dist/chunk-Z5OB5QGN.js +465 -0
- package/dist/chunk-ZIT4IP6N.js +445 -0
- package/dist/chunk-ZX5U3VCB.cjs +471 -0
- package/dist/email-queue-3QBQ63F7.js +8 -0
- package/dist/{email-queue-4OY45JIU.cjs → email-queue-K4E4OFI7.cjs} +9 -6
- package/dist/{emit-order-notification-trigger-ZD5YN3JM.cjs → emit-order-notification-trigger-ROASTYQP.cjs} +3 -3
- package/dist/{emit-order-notification-trigger-EJJZ6XTS.js → emit-order-notification-trigger-YUQTPELC.js} +1 -1
- package/dist/{erp-order-invoice-YUSPZ7CE.cjs → erp-order-invoice-AZ5MX2JB.cjs} +8 -5
- package/dist/{erp-order-invoice-H6HCJ7YS.js → erp-order-invoice-XSYHAMBS.js} +4 -1
- package/dist/generate-local-invoice-pdf-BQTCL5MW.cjs +12 -0
- package/dist/generate-local-invoice-pdf-OCFG47SE.js +3 -0
- package/dist/index.cjs +286 -283
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +16 -13
- package/dist/invoice-templates-GZ33OENC.js +2 -0
- package/dist/invoice-templates-RB462AQN.cjs +19 -0
- package/dist/{order-completion-otp-handlers-DZAXK4GQ.cjs → order-completion-otp-handlers-DDQREULW.cjs} +8 -5
- package/dist/{order-completion-otp-handlers-HFGCPC4O.js → order-completion-otp-handlers-NROWBGXN.js} +6 -3
- package/dist/{order-notification-dispatcher-LL7ETKLU.cjs → order-notification-dispatcher-6HCJ6Q75.cjs} +12 -9
- package/dist/{order-notification-dispatcher-ECPFI7CD.js → order-notification-dispatcher-KM2SY7TX.js} +7 -4
- package/dist/resolve-invoice-asset-url-JEZRENJW.cjs +11 -0
- package/dist/resolve-invoice-asset-url-QZ2FRDHI.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-GLD263KW.cjs +0 -862
- package/dist/chunk-OPJEV44S.js +0 -847
- package/dist/email-queue-HGXB2FIS.js +0 -5
- package/dist/{chunk-SS3K7OIM.cjs → chunk-HBUV73RB.cjs} +1 -1
- package/dist/{chunk-2ISSXYBZ.js → chunk-Z5G54EGD.js} +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk7NMT3GBR_cjs = require('./chunk-7NMT3GBR.cjs');
|
|
3
4
|
var chunkWFMVD567_cjs = require('./chunk-WFMVD567.cjs');
|
|
5
|
+
var chunkTJ2MIQUT_cjs = require('./chunk-TJ2MIQUT.cjs');
|
|
4
6
|
var chunkTHL5JDWJ_cjs = require('./chunk-THL5JDWJ.cjs');
|
|
5
7
|
var chunkHY3AXLOI_cjs = require('./chunk-HY3AXLOI.cjs');
|
|
6
|
-
var
|
|
8
|
+
var chunkSMHQV3WL_cjs = require('./chunk-SMHQV3WL.cjs');
|
|
7
9
|
var chunkH3IVLIPR_cjs = require('./chunk-H3IVLIPR.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var chunkGLD263KW_cjs = require('./chunk-GLD263KW.cjs');
|
|
10
|
+
var chunkUMC7W5G3_cjs = require('./chunk-UMC7W5G3.cjs');
|
|
11
|
+
var chunkSUUD7OUG_cjs = require('./chunk-SUUD7OUG.cjs');
|
|
11
12
|
var chunkUPLVMVRX_cjs = require('./chunk-UPLVMVRX.cjs');
|
|
12
13
|
var chunkTZEMLHSP_cjs = require('./chunk-TZEMLHSP.cjs');
|
|
13
14
|
var chunk3DZRIZOD_cjs = require('./chunk-3DZRIZOD.cjs');
|
|
14
|
-
var chunkTJ2MIQUT_cjs = require('./chunk-TJ2MIQUT.cjs');
|
|
15
15
|
var chunkOV5TRZET_cjs = require('./chunk-OV5TRZET.cjs');
|
|
16
|
-
var chunkOY2YTBMP_cjs = require('./chunk-OY2YTBMP.cjs');
|
|
17
16
|
var chunkO4AFPDQ4_cjs = require('./chunk-O4AFPDQ4.cjs');
|
|
17
|
+
var chunkOY2YTBMP_cjs = require('./chunk-OY2YTBMP.cjs');
|
|
18
18
|
var chunkD5FBNKQM_cjs = require('./chunk-D5FBNKQM.cjs');
|
|
19
19
|
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
20
20
|
var typeorm = require('typeorm');
|
|
@@ -5323,7 +5323,7 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
5323
5323
|
const orderIdForNotify = created.id;
|
|
5324
5324
|
const finalCreatedStatus = String(created.status ?? createdStatus ?? "pending").toLowerCase();
|
|
5325
5325
|
const initialPayStatus = String(persistBody.paymentStatus ?? body.paymentStatus ?? "unpaid").toLowerCase();
|
|
5326
|
-
void import('./emit-order-notification-trigger-
|
|
5326
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
5327
5327
|
if (finalCreatedStatus === "pending") {
|
|
5328
5328
|
if (initialPayStatus === "failed") {
|
|
5329
5329
|
fireOrderNotificationTrigger("payment_failed", orderIdForNotify, {
|
|
@@ -6526,7 +6526,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
6526
6526
|
const paymentUpdated = Boolean(rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null);
|
|
6527
6527
|
const assigneeUpdated = Boolean(rawBody && typeof rawBody === "object" && "assignedUserId" in rawBody && rawBody.assignedUserId !== void 0 && Number(rawBody.assignedUserId) > 0 && Number(rawBody.assignedUserId) !== Number(existingOrderRow?.assignedUserId));
|
|
6528
6528
|
if (assigneeUpdated) {
|
|
6529
|
-
void import('./emit-order-notification-trigger-
|
|
6529
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
6530
6530
|
fireOrderNotificationTrigger("order_assigned", updatedOrder.id, {
|
|
6531
6531
|
dataSource,
|
|
6532
6532
|
entityMap
|
|
@@ -6543,7 +6543,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
6543
6543
|
const payments = Array.isArray(updatedOrder.payments) ? updatedOrder.payments : [];
|
|
6544
6544
|
const bodyPayStatus = rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null ? String(rawBody.paymentStatus).toLowerCase() : null;
|
|
6545
6545
|
const curPayStatus = bodyPayStatus || String(payments[0]?.status || "unpaid").toLowerCase();
|
|
6546
|
-
void import('./emit-order-notification-trigger-
|
|
6546
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
6547
6547
|
if (newStatus === "pending") {
|
|
6548
6548
|
if (curPayStatus === "failed") {
|
|
6549
6549
|
fireOrderNotificationTrigger("payment_failed", updatedOrder.id, {
|
|
@@ -7251,7 +7251,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7251
7251
|
});
|
|
7252
7252
|
}
|
|
7253
7253
|
if (ordStatus === "pending" || ordStatus === "confirmed") {
|
|
7254
|
-
void import('./emit-order-notification-trigger-
|
|
7254
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
7255
7255
|
fireOrderNotificationTrigger("order_placed", pOrder, {
|
|
7256
7256
|
dataSource,
|
|
7257
7257
|
entityMap
|
|
@@ -7265,7 +7265,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7265
7265
|
}
|
|
7266
7266
|
}
|
|
7267
7267
|
} else if (newPayStatus === "failed") {
|
|
7268
|
-
void import('./emit-order-notification-trigger-
|
|
7268
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
7269
7269
|
fireOrderNotificationTrigger("payment_failed", pOrder, {
|
|
7270
7270
|
dataSource,
|
|
7271
7271
|
entityMap
|
|
@@ -7273,7 +7273,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7273
7273
|
}).catch(() => {
|
|
7274
7274
|
});
|
|
7275
7275
|
} else if (newPayStatus === "refunded") {
|
|
7276
|
-
void import('./emit-order-notification-trigger-
|
|
7276
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
7277
7277
|
fireOrderNotificationTrigger("payment_refund_initiated", pOrder, {
|
|
7278
7278
|
dataSource,
|
|
7279
7279
|
entityMap
|
|
@@ -7400,7 +7400,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7400
7400
|
const paymentUpdated = Boolean(rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null);
|
|
7401
7401
|
const assigneeUpdated = Boolean(rawBody && typeof rawBody === "object" && "assignedUserId" in rawBody && rawBody.assignedUserId !== void 0 && Number(rawBody.assignedUserId) > 0 && Number(rawBody.assignedUserId) !== Number(existingOrderRow?.assignedUserId));
|
|
7402
7402
|
if (assigneeUpdated) {
|
|
7403
|
-
void import('./emit-order-notification-trigger-
|
|
7403
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
7404
7404
|
fireOrderNotificationTrigger("order_assigned", ord.id, {
|
|
7405
7405
|
dataSource,
|
|
7406
7406
|
entityMap
|
|
@@ -7417,7 +7417,7 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
7417
7417
|
const payments = Array.isArray(ord.payments) ? ord.payments : [];
|
|
7418
7418
|
const bodyPayStatus = rawBody && typeof rawBody === "object" && rawBody.paymentStatus != null ? String(rawBody.paymentStatus).toLowerCase() : null;
|
|
7419
7419
|
const curPayStatus = bodyPayStatus || String(payments[0]?.status || "unpaid").toLowerCase();
|
|
7420
|
-
void import('./emit-order-notification-trigger-
|
|
7420
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
7421
7421
|
if (newStatus === "pending") {
|
|
7422
7422
|
if (curPayStatus === "failed") {
|
|
7423
7423
|
fireOrderNotificationTrigger("payment_failed", ord.id, {
|
|
@@ -10536,7 +10536,7 @@ function createFormSubmissionHandler(config) {
|
|
|
10536
10536
|
label: f.label && String(f.label).trim() || `Field ${f.id}`,
|
|
10537
10537
|
value: formatSubmissionFieldValue(data[String(f.id)])
|
|
10538
10538
|
}));
|
|
10539
|
-
await
|
|
10539
|
+
await chunkUMC7W5G3_cjs.queueEmail(cms, {
|
|
10540
10540
|
to,
|
|
10541
10541
|
templateName: "formSubmission",
|
|
10542
10542
|
ctx: {
|
|
@@ -10590,7 +10590,7 @@ function createUsersApiHandlers(config) {
|
|
|
10590
10590
|
try {
|
|
10591
10591
|
const cms = await getCms();
|
|
10592
10592
|
const companyDetails = getCompanyDetails ? await getCompanyDetails() : {};
|
|
10593
|
-
await
|
|
10593
|
+
await chunkUMC7W5G3_cjs.queueEmail(cms, {
|
|
10594
10594
|
to: toEmail,
|
|
10595
10595
|
templateName: "invite",
|
|
10596
10596
|
ctx: {
|
|
@@ -11863,7 +11863,7 @@ function createChatHandlers(config) {
|
|
|
11863
11863
|
const notifyEmailAgent = await findLlmAgentByScope(dataSource, entityMap, LLM_AGENT_SCOPE_EMAIL_INTENT_CHATBOT, {
|
|
11864
11864
|
enabledOnly: false
|
|
11865
11865
|
});
|
|
11866
|
-
const emailTool =
|
|
11866
|
+
const emailTool = chunkSMHQV3WL_cjs.resolveChatEmailToolSettings(llmSettings, {
|
|
11867
11867
|
chatbotValidationRules: agentRow?.validationRules ?? null,
|
|
11868
11868
|
notifyAgent: notifyEmailAgent ? {
|
|
11869
11869
|
systemInstruction: notifyEmailAgent.systemInstruction,
|
|
@@ -11873,7 +11873,7 @@ function createChatHandlers(config) {
|
|
|
11873
11873
|
const emailPlugin2 = cms.getPlugin("email");
|
|
11874
11874
|
const convLeadSent = conv.leadEmailSentAt;
|
|
11875
11875
|
const chatAgentFn = llm.chatAgent?.bind(llm);
|
|
11876
|
-
console.info(
|
|
11876
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline check", {
|
|
11877
11877
|
conversationId,
|
|
11878
11878
|
enabled: emailTool.enabled,
|
|
11879
11879
|
intentCount: emailTool.intents.length,
|
|
@@ -11887,27 +11887,27 @@ function createChatHandlers(config) {
|
|
|
11887
11887
|
mergedPromptIncludesNotify: Boolean(notifyEmailAgent?.systemInstruction?.trim())
|
|
11888
11888
|
});
|
|
11889
11889
|
if (!emailTool.enabled) {
|
|
11890
|
-
console.info(
|
|
11890
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11891
11891
|
conversationId,
|
|
11892
11892
|
reason: "email_tool_disabled"
|
|
11893
11893
|
});
|
|
11894
11894
|
} else if (emailTool.intents.length === 0) {
|
|
11895
|
-
console.info(
|
|
11895
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11896
11896
|
conversationId,
|
|
11897
11897
|
reason: "no_intents_configured"
|
|
11898
11898
|
});
|
|
11899
11899
|
} else if (!emailPlugin2) {
|
|
11900
|
-
console.info(
|
|
11900
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11901
11901
|
conversationId,
|
|
11902
11902
|
reason: "email_plugin_missing"
|
|
11903
11903
|
});
|
|
11904
11904
|
} else if (!chatAgentFn) {
|
|
11905
|
-
console.info(
|
|
11905
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11906
11906
|
conversationId,
|
|
11907
11907
|
reason: "llm_chat_agent_unavailable"
|
|
11908
11908
|
});
|
|
11909
11909
|
} else if (convLeadSent) {
|
|
11910
|
-
console.info(
|
|
11910
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11911
11911
|
conversationId,
|
|
11912
11912
|
reason: "lead_email_already_sent",
|
|
11913
11913
|
leadEmailSentAt: convLeadSent
|
|
@@ -11920,7 +11920,7 @@ function createChatHandlers(config) {
|
|
|
11920
11920
|
}
|
|
11921
11921
|
});
|
|
11922
11922
|
if (!contactRow) {
|
|
11923
|
-
console.warn(
|
|
11923
|
+
console.warn(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11924
11924
|
conversationId,
|
|
11925
11925
|
reason: "contact_not_found",
|
|
11926
11926
|
contactId
|
|
@@ -11928,7 +11928,7 @@ function createChatHandlers(config) {
|
|
|
11928
11928
|
} else {
|
|
11929
11929
|
const c = contactRow;
|
|
11930
11930
|
try {
|
|
11931
|
-
const intent = await
|
|
11931
|
+
const intent = await chunkSMHQV3WL_cjs.detectChatLeadIntent({
|
|
11932
11932
|
chatAgent: chatAgentFn
|
|
11933
11933
|
}, {
|
|
11934
11934
|
settings: emailTool,
|
|
@@ -11942,15 +11942,15 @@ function createChatHandlers(config) {
|
|
|
11942
11942
|
model: agentRow?.model?.trim() || notifyEmailAgent?.model?.trim() || void 0
|
|
11943
11943
|
});
|
|
11944
11944
|
if (!intent.intent || !intent.emailTo) {
|
|
11945
|
-
console.info(
|
|
11945
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "no email sent", {
|
|
11946
11946
|
conversationId,
|
|
11947
11947
|
reason: intent.intent ? "missing_email_to" : "no_intent_match",
|
|
11948
11948
|
intentLabel: intent.intentLabel,
|
|
11949
11949
|
classifierReason: intent.reason
|
|
11950
11950
|
});
|
|
11951
11951
|
} else {
|
|
11952
|
-
const intentRecipients =
|
|
11953
|
-
console.info(
|
|
11952
|
+
const intentRecipients = chunkSMHQV3WL_cjs.parseIntentRecipientEmails(intent.emailTo);
|
|
11953
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "intent matched \u2014 sending", {
|
|
11954
11954
|
conversationId,
|
|
11955
11955
|
intent: intent.intent,
|
|
11956
11956
|
emailTo: intent.emailTo,
|
|
@@ -11961,7 +11961,7 @@ function createChatHandlers(config) {
|
|
|
11961
11961
|
const brandingSettings = await loadSettingsGroupMap(dataSource, entityMap, "branding");
|
|
11962
11962
|
const storeSettings = await loadSettingsGroupMap(dataSource, entityMap, "store");
|
|
11963
11963
|
const companyDetails = chunkTZEMLHSP_cjs.mergeEmailLayoutCompanyDetails(brandingSettings, emailSettings, storeSettings);
|
|
11964
|
-
const leadResult = await
|
|
11964
|
+
const leadResult = await chunkSMHQV3WL_cjs.sendChatLeadEmail(cms, emailSettings, brandingSettings, {
|
|
11965
11965
|
contactName: String(c.name ?? "").trim() || "Visitor",
|
|
11966
11966
|
contactEmail: String(c.email ?? "").trim(),
|
|
11967
11967
|
contactPhone: c.phone ?? null,
|
|
@@ -11969,7 +11969,7 @@ function createChatHandlers(config) {
|
|
|
11969
11969
|
latestMessage: message,
|
|
11970
11970
|
intentCode: intent.intent,
|
|
11971
11971
|
intentReason: intent.intentLabel || intent.reason,
|
|
11972
|
-
transcript:
|
|
11972
|
+
transcript: chunkSMHQV3WL_cjs.buildTranscriptForLeadEmail(history, message),
|
|
11973
11973
|
companyDetails,
|
|
11974
11974
|
recipients: intentRecipients.length > 0 ? intentRecipients : void 0
|
|
11975
11975
|
});
|
|
@@ -11977,13 +11977,13 @@ function createChatHandlers(config) {
|
|
|
11977
11977
|
await convRepo().update(conversationId, {
|
|
11978
11978
|
leadEmailSentAt: /* @__PURE__ */ new Date()
|
|
11979
11979
|
});
|
|
11980
|
-
console.info(
|
|
11980
|
+
console.info(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "lead email recorded", {
|
|
11981
11981
|
conversationId,
|
|
11982
11982
|
sent: true,
|
|
11983
11983
|
recipients: leadResult.recipients
|
|
11984
11984
|
});
|
|
11985
11985
|
} else {
|
|
11986
|
-
console.warn(
|
|
11986
|
+
console.warn(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "lead email not sent", {
|
|
11987
11987
|
conversationId,
|
|
11988
11988
|
sent: false,
|
|
11989
11989
|
error: leadResult.error ?? "unknown",
|
|
@@ -11992,7 +11992,7 @@ function createChatHandlers(config) {
|
|
|
11992
11992
|
}
|
|
11993
11993
|
}
|
|
11994
11994
|
} catch (intentErr) {
|
|
11995
|
-
console.warn(
|
|
11995
|
+
console.warn(chunkSMHQV3WL_cjs.CHAT_EMAIL_LOG, "pipeline error", {
|
|
11996
11996
|
conversationId,
|
|
11997
11997
|
error: intentErr instanceof Error ? intentErr.message : String(intentErr)
|
|
11998
11998
|
});
|
|
@@ -12009,7 +12009,7 @@ function createChatHandlers(config) {
|
|
|
12009
12009
|
});
|
|
12010
12010
|
if (agentRow && llm.chatAgent) {
|
|
12011
12011
|
const fromAgent = llmAgentToChatAgentOptions(agentRow);
|
|
12012
|
-
const systemPrompt =
|
|
12012
|
+
const systemPrompt = chunkSMHQV3WL_cjs.buildChatbotSystemPromptWithEmailTool(fromAgent.systemPrompt, parsedValidation.guardrailsForPrompt, emailTool);
|
|
12013
12013
|
const res = await llm.chatAgent({
|
|
12014
12014
|
...fromAgent,
|
|
12015
12015
|
systemPrompt: systemPrompt || void 0,
|
|
@@ -12030,7 +12030,7 @@ ${contextParts.join("\n\n")}` : "";
|
|
|
12030
12030
|
agentRow.systemInstruction?.trim(),
|
|
12031
12031
|
ragSystem
|
|
12032
12032
|
].filter(Boolean).join("\n\n");
|
|
12033
|
-
systemContent =
|
|
12033
|
+
systemContent = chunkSMHQV3WL_cjs.buildChatbotSystemPromptWithEmailTool(mergedBase || defaultSystem, parsedValidation.guardrailsForPrompt, emailTool) || defaultSystem;
|
|
12034
12034
|
} else {
|
|
12035
12035
|
systemContent = ragSystem || defaultSystem;
|
|
12036
12036
|
}
|
|
@@ -13285,7 +13285,7 @@ function createDeviceTokensHandlers(config) {
|
|
|
13285
13285
|
const title = body.title?.trim() || "Test Push Notification";
|
|
13286
13286
|
const msgBody = body.body?.trim() || "Firebase Push Notification setup is working!";
|
|
13287
13287
|
if (!token || token === "validate" || token === "validate_only") {
|
|
13288
|
-
const valRes = await
|
|
13288
|
+
const valRes = await chunkSMHQV3WL_cjs.validateFcmCredentials(dataSource, entityMap);
|
|
13289
13289
|
if (!valRes.success) {
|
|
13290
13290
|
return json({
|
|
13291
13291
|
success: false,
|
|
@@ -13302,7 +13302,7 @@ function createDeviceTokensHandlers(config) {
|
|
|
13302
13302
|
clientEmail: valRes.clientEmail
|
|
13303
13303
|
});
|
|
13304
13304
|
}
|
|
13305
|
-
const res = await
|
|
13305
|
+
const res = await chunkSMHQV3WL_cjs.sendFcmPushNotification(dataSource, entityMap, {
|
|
13306
13306
|
token,
|
|
13307
13307
|
title,
|
|
13308
13308
|
body: msgBody,
|
|
@@ -14298,7 +14298,7 @@ async function sendVendorOnboardEmails(input, deps) {
|
|
|
14298
14298
|
getVendorEmails(deps)
|
|
14299
14299
|
]);
|
|
14300
14300
|
const companyDetails = chunkTZEMLHSP_cjs.mergeEmailLayoutCompanyDetails(branding, emailSettings, storeSettings);
|
|
14301
|
-
const configuredNotify =
|
|
14301
|
+
const configuredNotify = chunkSMHQV3WL_cjs.parseEmailRecipientsFromConfig(emailSettings.salesTeamEmails ?? emailSettings.salesTeamEmail);
|
|
14302
14302
|
const ownerEmail = input.ownerEmail?.trim() || "";
|
|
14303
14303
|
const ownerEmailLower = ownerEmail.toLowerCase();
|
|
14304
14304
|
const sendToOwner = input.sendToOwner !== false;
|
|
@@ -14308,7 +14308,7 @@ async function sendVendorOnboardEmails(input, deps) {
|
|
|
14308
14308
|
];
|
|
14309
14309
|
const notifyEmails = Array.from(new Set(combined.map((e) => e.trim().toLowerCase()).filter((e) => e && e !== ownerEmailLower && !vendorEmailSet.has(e))));
|
|
14310
14310
|
const cms = await deps.getCms();
|
|
14311
|
-
await
|
|
14311
|
+
await chunkUMC7W5G3_cjs.queueVendorOnboardEmails(cms, {
|
|
14312
14312
|
vendorName: input.vendorName,
|
|
14313
14313
|
vendorSlug: input.vendorSlug,
|
|
14314
14314
|
ownerName: input.ownerName,
|
|
@@ -15552,6 +15552,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
15552
15552
|
state: vp?.state ?? null,
|
|
15553
15553
|
postalCode: vp?.postalCode ?? null,
|
|
15554
15554
|
blocked: u?.blocked ?? false,
|
|
15555
|
+
inviteStatus: u?.inviteStatus ?? (u?.password ? "active" : "pending"),
|
|
15555
15556
|
groupName: u?.group?.name ?? null
|
|
15556
15557
|
};
|
|
15557
15558
|
});
|
|
@@ -16025,14 +16026,24 @@ function createVendorOnboardHandlers(config) {
|
|
|
16025
16026
|
});
|
|
16026
16027
|
}
|
|
16027
16028
|
}
|
|
16028
|
-
const
|
|
16029
|
-
|
|
16029
|
+
const hasPassword = !!(user.password && String(user.password).trim());
|
|
16030
|
+
const isPending = user.inviteStatus === "pending" || !hasPassword;
|
|
16031
|
+
if (!isPending) {
|
|
16030
16032
|
return json({
|
|
16031
|
-
error: "
|
|
16033
|
+
error: "User has already accepted the invite"
|
|
16032
16034
|
}, {
|
|
16033
16035
|
status: 400
|
|
16034
16036
|
});
|
|
16035
16037
|
}
|
|
16038
|
+
let token = String(user.inviteToken ?? "").trim();
|
|
16039
|
+
if (!token) {
|
|
16040
|
+
token = newUserInviteToken();
|
|
16041
|
+
await dataSource.getRepository(entityMap.users).update(user.id, {
|
|
16042
|
+
inviteToken: token,
|
|
16043
|
+
inviteStatus: "pending",
|
|
16044
|
+
password: null
|
|
16045
|
+
});
|
|
16046
|
+
}
|
|
16036
16047
|
const inviteLink = buildUserInviteLink(baseUrl, token);
|
|
16037
16048
|
const emailSent = await trySendVendorOnboardEmails({
|
|
16038
16049
|
vendorName,
|
|
@@ -29059,11 +29070,11 @@ function whatsappPlugin(config = {}) {
|
|
|
29059
29070
|
db = await settingsLoader?.() ?? {};
|
|
29060
29071
|
} catch {
|
|
29061
29072
|
}
|
|
29062
|
-
if (!
|
|
29073
|
+
if (!chunkSMHQV3WL_cjs.isWhatsAppPluginEnabled(db)) {
|
|
29063
29074
|
context.logger.warn("WhatsApp plugin skipped: disabled in Plugins \u2192 WhatsApp");
|
|
29064
29075
|
return null;
|
|
29065
29076
|
}
|
|
29066
|
-
const svc = new
|
|
29077
|
+
const svc = new chunkSMHQV3WL_cjs.WhatsAppService(env, staticRest, settingsLoader, getMessageTemplateRow);
|
|
29067
29078
|
return {
|
|
29068
29079
|
send: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((opts) => svc.send(opts), "send")
|
|
29069
29080
|
};
|
|
@@ -29136,7 +29147,7 @@ function createMessageTemplateRowLoader(dataSource, entityMap) {
|
|
|
29136
29147
|
}
|
|
29137
29148
|
chunkUSNT2KNT_cjs.__name(createMessageTemplateRowLoader, "createMessageTemplateRowLoader");
|
|
29138
29149
|
function registerMessagingQueueProcessors(cms, entityMap) {
|
|
29139
|
-
|
|
29150
|
+
chunkUMC7W5G3_cjs.registerEmailQueueProcessor(cms, {
|
|
29140
29151
|
getDataSource: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => cms.dataSource, "getDataSource"),
|
|
29141
29152
|
entityMap
|
|
29142
29153
|
});
|
|
@@ -29169,7 +29180,7 @@ async function ensureMessagingPluginsOnCms(base, options) {
|
|
|
29169
29180
|
}
|
|
29170
29181
|
if (!cms.getPlugin("email")) {
|
|
29171
29182
|
try {
|
|
29172
|
-
const instance = await
|
|
29183
|
+
const instance = await chunkSMHQV3WL_cjs.emailPlugin({
|
|
29173
29184
|
type: "SMTP",
|
|
29174
29185
|
from: config.SMTP_FROM ?? "no-reply@localhost",
|
|
29175
29186
|
to: config.SMTP_TO ?? ""
|
|
@@ -29210,7 +29221,7 @@ function messagingPlugins(options) {
|
|
|
29210
29221
|
const config = options.config ?? (typeof process !== "undefined" ? process.env : {});
|
|
29211
29222
|
return [
|
|
29212
29223
|
queuePlugin(),
|
|
29213
|
-
|
|
29224
|
+
chunkSMHQV3WL_cjs.emailPlugin({
|
|
29214
29225
|
type: "SMTP",
|
|
29215
29226
|
from: config.SMTP_FROM ?? "no-reply@localhost",
|
|
29216
29227
|
to: config.SMTP_TO ?? ""
|
|
@@ -29344,7 +29355,7 @@ function createCmsApiHandler(config) {
|
|
|
29344
29355
|
} : void 0;
|
|
29345
29356
|
const entityMap = withLlmKnowledgeEntityFallbacks(rawEntityMap);
|
|
29346
29357
|
if (getCms) {
|
|
29347
|
-
|
|
29358
|
+
chunkSMHQV3WL_cjs.initWhatsappTriggerDispatcher({
|
|
29348
29359
|
dataSource,
|
|
29349
29360
|
entityMap,
|
|
29350
29361
|
getCms
|
|
@@ -29437,7 +29448,7 @@ function createCmsApiHandler(config) {
|
|
|
29437
29448
|
companyDetails
|
|
29438
29449
|
};
|
|
29439
29450
|
if (queue) {
|
|
29440
|
-
const { queueEmail: queueEmail2 } = await import('./email-queue-
|
|
29451
|
+
const { queueEmail: queueEmail2 } = await import('./email-queue-K4E4OFI7.cjs');
|
|
29441
29452
|
await queueEmail2(cms, {
|
|
29442
29453
|
to: opts.to,
|
|
29443
29454
|
templateName: "passwordReset",
|
|
@@ -30447,6 +30458,110 @@ function createCmsApiHandler(config) {
|
|
|
30447
30458
|
return socialMediaHandlers.publishBlogToFacebook(req, id);
|
|
30448
30459
|
}
|
|
30449
30460
|
}
|
|
30461
|
+
if (path2[0] === "settings" && path2.length === 2 && path2[1] === "invoice-preview" && m === "GET") {
|
|
30462
|
+
const a = await config.requireAuth(req);
|
|
30463
|
+
if (a) return a;
|
|
30464
|
+
const pe = await requireEntityPermissionEffective(req, "settings", "read");
|
|
30465
|
+
if (pe) return pe;
|
|
30466
|
+
const url = new URL(req.url);
|
|
30467
|
+
const templateParam = url.searchParams.get("template") || "classic";
|
|
30468
|
+
const qrParam = url.searchParams.get("qr");
|
|
30469
|
+
const configRepo = dataSource.getRepository(entityMap.configs);
|
|
30470
|
+
const rows = await configRepo.find({
|
|
30471
|
+
where: {
|
|
30472
|
+
settings: "store",
|
|
30473
|
+
deleted: false
|
|
30474
|
+
}
|
|
30475
|
+
});
|
|
30476
|
+
const storeMap = {};
|
|
30477
|
+
for (const r of rows) {
|
|
30478
|
+
storeMap[r.key] = r.value;
|
|
30479
|
+
}
|
|
30480
|
+
const { normalizeInvoiceTemplateId } = await import('./invoice-templates-RB462AQN.cjs');
|
|
30481
|
+
const { generateLocalInvoicePdf } = await import('./generate-local-invoice-pdf-BQTCL5MW.cjs');
|
|
30482
|
+
const { resolveInvoiceAssetUrl } = await import('./resolve-invoice-asset-url-JEZRENJW.cjs');
|
|
30483
|
+
const templateId = normalizeInvoiceTemplateId(templateParam);
|
|
30484
|
+
const includeQr = qrParam != null ? qrParam === "1" || qrParam === "true" : storeMap.invoice_include_qr === "true";
|
|
30485
|
+
const sampleInput = {
|
|
30486
|
+
templateId,
|
|
30487
|
+
orderNumber: "SAMPLE-10024",
|
|
30488
|
+
orderDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30489
|
+
currency: storeMap.currency || "INR",
|
|
30490
|
+
company: {
|
|
30491
|
+
name: storeMap.companyName || storeMap.invoiceCompanyName || "ETOE Services",
|
|
30492
|
+
supportEmail: storeMap.companyEmail || storeMap.invoiceEmail || "support@example.com",
|
|
30493
|
+
supportPhone: storeMap.companyPhone || storeMap.invoicePhone || "+91 98765 43210",
|
|
30494
|
+
address: storeMap.companyAddress || storeMap.invoiceAddress || "65 Sanjay Nagar B, Kalwar Road, Jhotwara, Jaipur, Rajasthan, 302012, India",
|
|
30495
|
+
logoUrl: resolveInvoiceAssetUrl(storeMap.invoiceLogoUrl || storeMap.companyLogo || storeMap.logo)
|
|
30496
|
+
},
|
|
30497
|
+
customerName: "Sahil Sharma",
|
|
30498
|
+
customerEmail: "sahil@example.com",
|
|
30499
|
+
customerPhone: "+91 98875 51178",
|
|
30500
|
+
billingAddress: {
|
|
30501
|
+
line1: "65 Sanjay Nagar B, Kalwar Road",
|
|
30502
|
+
city: "Jaipur",
|
|
30503
|
+
state: "Rajasthan",
|
|
30504
|
+
postalCode: "302012",
|
|
30505
|
+
country: "India"
|
|
30506
|
+
},
|
|
30507
|
+
shippingAddress: {
|
|
30508
|
+
line1: "65 Sanjay Nagar B, Kalwar Road",
|
|
30509
|
+
city: "Jaipur",
|
|
30510
|
+
state: "Rajasthan",
|
|
30511
|
+
postalCode: "302012",
|
|
30512
|
+
country: "India"
|
|
30513
|
+
},
|
|
30514
|
+
serviceDate: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30515
|
+
timeSlot: "6:00 PM",
|
|
30516
|
+
assignedTo: "Raaj Sharma",
|
|
30517
|
+
qrToken: "sample-track-token-12345",
|
|
30518
|
+
qrData: "https://etoe.in/track/sample-track-token-12345",
|
|
30519
|
+
includeQrCode: includeQr,
|
|
30520
|
+
lineItems: [
|
|
30521
|
+
{
|
|
30522
|
+
name: "Complete Home Deep Cleaning Service",
|
|
30523
|
+
sku: "ETOE-HDC-001",
|
|
30524
|
+
quantity: 1,
|
|
30525
|
+
unitPrice: 3499,
|
|
30526
|
+
tax: 0,
|
|
30527
|
+
total: 3499
|
|
30528
|
+
},
|
|
30529
|
+
{
|
|
30530
|
+
name: "Kitchen & Bathroom Sanitization Add-on",
|
|
30531
|
+
sku: "ETOE-SAN-002",
|
|
30532
|
+
quantity: 1,
|
|
30533
|
+
unitPrice: 999,
|
|
30534
|
+
tax: 0,
|
|
30535
|
+
total: 999
|
|
30536
|
+
}
|
|
30537
|
+
],
|
|
30538
|
+
subtotal: 4498,
|
|
30539
|
+
discount: 499,
|
|
30540
|
+
tax: 0,
|
|
30541
|
+
total: 3999
|
|
30542
|
+
};
|
|
30543
|
+
try {
|
|
30544
|
+
const bytes = await generateLocalInvoicePdf(sampleInput);
|
|
30545
|
+
return new Response(Buffer.from(bytes), {
|
|
30546
|
+
status: 200,
|
|
30547
|
+
headers: {
|
|
30548
|
+
"Content-Type": "application/pdf",
|
|
30549
|
+
"Content-Disposition": `inline; filename="preview-invoice-${templateId}.pdf"`
|
|
30550
|
+
}
|
|
30551
|
+
});
|
|
30552
|
+
} catch (err) {
|
|
30553
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
30554
|
+
console.error("[invoice-preview] failed", {
|
|
30555
|
+
templateId,
|
|
30556
|
+
error: msg
|
|
30557
|
+
});
|
|
30558
|
+
return config.json({
|
|
30559
|
+
error: `Preview generation failed: ${msg}`
|
|
30560
|
+
}, {
|
|
30561
|
+
status: 500
|
|
30562
|
+
});
|
|
30563
|
+
}
|
|
30564
|
+
}
|
|
30450
30565
|
if (path2[0] === "settings" && path2.length === 2 && settingsHandlers) {
|
|
30451
30566
|
const group = path2[1];
|
|
30452
30567
|
const isPublic = group === "multi_vendor" || group === "turnstile" || group === "auth_providers" || settingsConfig?.publicGetGroups?.includes(group);
|
|
@@ -30751,7 +30866,7 @@ function createCmsApiHandler(config) {
|
|
|
30751
30866
|
const pe = await requireEntityPermissionEffective(req, "orders", "read");
|
|
30752
30867
|
if (pe) return pe;
|
|
30753
30868
|
const cms = await getCms();
|
|
30754
|
-
const { streamOrderInvoicePdf: streamOrderInvoicePdf2 } = await import('./erp-order-invoice-
|
|
30869
|
+
const { streamOrderInvoicePdf: streamOrderInvoicePdf2 } = await import('./erp-order-invoice-AZ5MX2JB.cjs');
|
|
30755
30870
|
const oid = Number(path2[1]);
|
|
30756
30871
|
if (!Number.isFinite(oid)) return config.json({
|
|
30757
30872
|
error: "Invalid id"
|
|
@@ -31133,7 +31248,7 @@ function createCmsApiHandler(config) {
|
|
|
31133
31248
|
status: 400
|
|
31134
31249
|
});
|
|
31135
31250
|
}
|
|
31136
|
-
const { resendOrderNotification } = await import('./order-notification-dispatcher-
|
|
31251
|
+
const { resendOrderNotification } = await import('./order-notification-dispatcher-6HCJ6Q75.cjs');
|
|
31137
31252
|
const result = await resendOrderNotification(triggerKey, orderId, {
|
|
31138
31253
|
dataSource,
|
|
31139
31254
|
entityMap,
|
|
@@ -31232,7 +31347,7 @@ function createCmsApiHandler(config) {
|
|
|
31232
31347
|
status: "cancelled"
|
|
31233
31348
|
});
|
|
31234
31349
|
const fireOrderCancelledNotification = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((refundAmount) => {
|
|
31235
|
-
void import('./emit-order-notification-trigger-
|
|
31350
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
31236
31351
|
fireOrderNotificationTrigger("order_cancelled", orderId, {
|
|
31237
31352
|
dataSource,
|
|
31238
31353
|
entityMap
|
|
@@ -31477,7 +31592,7 @@ function createCmsApiHandler(config) {
|
|
|
31477
31592
|
}, {
|
|
31478
31593
|
status: 400
|
|
31479
31594
|
});
|
|
31480
|
-
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-
|
|
31595
|
+
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-DDQREULW.cjs');
|
|
31481
31596
|
const handlers = createOrderCompletionOtpHandlers(dataSource, entityMap, getCms, getHydratedSessionUser);
|
|
31482
31597
|
return handlers.getChannels(req, orderId);
|
|
31483
31598
|
}
|
|
@@ -31492,7 +31607,7 @@ function createCmsApiHandler(config) {
|
|
|
31492
31607
|
}, {
|
|
31493
31608
|
status: 400
|
|
31494
31609
|
});
|
|
31495
|
-
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-
|
|
31610
|
+
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-DDQREULW.cjs');
|
|
31496
31611
|
const handlers = createOrderCompletionOtpHandlers(dataSource, entityMap, getCms, getHydratedSessionUser);
|
|
31497
31612
|
return handlers.sendOtp(req, orderId);
|
|
31498
31613
|
}
|
|
@@ -31507,7 +31622,7 @@ function createCmsApiHandler(config) {
|
|
|
31507
31622
|
}, {
|
|
31508
31623
|
status: 400
|
|
31509
31624
|
});
|
|
31510
|
-
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-
|
|
31625
|
+
const { createOrderCompletionOtpHandlers } = await import('./order-completion-otp-handlers-DDQREULW.cjs');
|
|
31511
31626
|
const handlers = createOrderCompletionOtpHandlers(dataSource, entityMap, getCms, getHydratedSessionUser);
|
|
31512
31627
|
return handlers.verifyOtp(req, orderId);
|
|
31513
31628
|
}
|
|
@@ -31955,12 +32070,12 @@ async function refreshOrderFromErp(cms, dataSource, entityMap, submission, order
|
|
|
31955
32070
|
const r1 = await submission.postErpReadAction("get-order-status", {
|
|
31956
32071
|
platformOrderId: refId
|
|
31957
32072
|
});
|
|
31958
|
-
const d1 = r1.ok ?
|
|
32073
|
+
const d1 = r1.ok ? chunkSUUD7OUG_cjs.unwrapErpReadData(r1.json) : null;
|
|
31959
32074
|
if (d1) {
|
|
31960
32075
|
const mapped = mapErpSaleStatusToOrderStatus(typeof d1.status === "string" ? d1.status : typeof d1.orderStatus === "string" ? d1.orderStatus : typeof d1.state === "string" ? d1.state : void 0);
|
|
31961
32076
|
if (mapped) newStatus = mapped;
|
|
31962
|
-
fulfillment =
|
|
31963
|
-
const refs =
|
|
32077
|
+
fulfillment = chunkSUUD7OUG_cjs.mapErpPayloadToFulfillment(d1);
|
|
32078
|
+
const refs = chunkSUUD7OUG_cjs.extractChildOrderRefsFromSalePayload(d1);
|
|
31964
32079
|
if (refs.length) {
|
|
31965
32080
|
await ensureChildOrdersFromRefs(orderRepo, order, refs, order.contactId, String(order.currency || "INR"));
|
|
31966
32081
|
}
|
|
@@ -31968,16 +32083,16 @@ async function refreshOrderFromErp(cms, dataSource, entityMap, submission, order
|
|
|
31968
32083
|
const r2 = await submission.postErpReadAction("get-fulfillment-status", {
|
|
31969
32084
|
platformOrderId: refId
|
|
31970
32085
|
});
|
|
31971
|
-
const d2 = r2.ok ?
|
|
32086
|
+
const d2 = r2.ok ? chunkSUUD7OUG_cjs.unwrapErpReadData(r2.json) : null;
|
|
31972
32087
|
if (d2) {
|
|
31973
|
-
fulfillment = deepMergeFulfillment(fulfillment,
|
|
32088
|
+
fulfillment = deepMergeFulfillment(fulfillment, chunkSUUD7OUG_cjs.mapErpPayloadToFulfillment(d2));
|
|
31974
32089
|
}
|
|
31975
32090
|
const r3 = await submission.postErpReadAction("get-invoice", {
|
|
31976
32091
|
platformOrderId: refId
|
|
31977
32092
|
});
|
|
31978
|
-
const d3 = r3.ok ?
|
|
32093
|
+
const d3 = r3.ok ? chunkSUUD7OUG_cjs.unwrapErpReadData(r3.json) : null;
|
|
31979
32094
|
if (d3) {
|
|
31980
|
-
invoiceNumber =
|
|
32095
|
+
invoiceNumber = chunkSUUD7OUG_cjs.mapErpPayloadToInvoiceNumber(d3);
|
|
31981
32096
|
invoiceId = pickInvoiceId(d3);
|
|
31982
32097
|
}
|
|
31983
32098
|
const oid = order.id;
|
|
@@ -32013,10 +32128,10 @@ async function refreshOrderFromErp(cms, dataSource, entityMap, submission, order
|
|
|
32013
32128
|
const r = await submission.postErpReadAction("get-return-status", {
|
|
32014
32129
|
platformReturnId
|
|
32015
32130
|
});
|
|
32016
|
-
const d = r.ok ?
|
|
32131
|
+
const d = r.ok ? chunkSUUD7OUG_cjs.unwrapErpReadData(r.json) : null;
|
|
32017
32132
|
if (!d) return;
|
|
32018
32133
|
const mapped = mapErpSaleStatusToOrderStatus(typeof d.status === "string" ? d.status : typeof d.returnStatus === "string" ? d.returnStatus : void 0);
|
|
32019
|
-
const fulfillment =
|
|
32134
|
+
const fulfillment = chunkSUUD7OUG_cjs.mapErpPayloadToFulfillment(d);
|
|
32020
32135
|
const patch = {};
|
|
32021
32136
|
if (fulfillment !== void 0) patch.fulfillment = fulfillment;
|
|
32022
32137
|
const nextMeta = Object.keys(patch).length ? mergeOrderMetadataPatch(meta, patch) : meta;
|
|
@@ -32139,7 +32254,7 @@ function createStorefrontApiHandler(config) {
|
|
|
32139
32254
|
const otpPepper = config.otpPepper;
|
|
32140
32255
|
const defaultPhoneCc = config.defaultPhoneCountryCode;
|
|
32141
32256
|
function fireStorefrontCheckoutNotifications(orderId) {
|
|
32142
|
-
void import('./emit-order-notification-trigger-
|
|
32257
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
32143
32258
|
fireOrderNotificationTrigger("order_pending", orderId, {
|
|
32144
32259
|
dataSource,
|
|
32145
32260
|
entityMap
|
|
@@ -33823,7 +33938,7 @@ function createStorefrontApiHandler(config) {
|
|
|
33823
33938
|
status: 503
|
|
33824
33939
|
});
|
|
33825
33940
|
const companyDetails = getCompanyDetails ? await getCompanyDetails() : {};
|
|
33826
|
-
await
|
|
33941
|
+
await chunkUMC7W5G3_cjs.queueEmail(cms, {
|
|
33827
33942
|
to: identifier,
|
|
33828
33943
|
templateName: "otp",
|
|
33829
33944
|
ctx: {
|
|
@@ -34048,7 +34163,7 @@ function createStorefrontApiHandler(config) {
|
|
|
34048
34163
|
const companyDetails = getCompanyDetails ? await getCompanyDetails() : {};
|
|
34049
34164
|
const base = (publicSiteUrl || "").replace(/\/$/, "").trim() || "http://localhost:3000";
|
|
34050
34165
|
const verifyEmailUrl = `${base}/verify-email?token=${encodeURIComponent(rawToken)}`;
|
|
34051
|
-
await
|
|
34166
|
+
await chunkUMC7W5G3_cjs.queueEmail(cms, {
|
|
34052
34167
|
to: email,
|
|
34053
34168
|
templateName: "signup",
|
|
34054
34169
|
ctx: {
|
|
@@ -34862,7 +34977,7 @@ function createStorefrontApiHandler(config) {
|
|
|
34862
34977
|
status: 400
|
|
34863
34978
|
});
|
|
34864
34979
|
const cms = await getCms();
|
|
34865
|
-
return
|
|
34980
|
+
return chunkSUUD7OUG_cjs.streamOrderInvoicePdf(cms, dataSource, entityMap, orderId, {
|
|
34866
34981
|
ownerContactId: contact.id
|
|
34867
34982
|
});
|
|
34868
34983
|
}
|
|
@@ -34903,7 +35018,9 @@ function createStorefrontApiHandler(config) {
|
|
|
34903
35018
|
},
|
|
34904
35019
|
relations: [
|
|
34905
35020
|
"items",
|
|
34906
|
-
"items.product"
|
|
35021
|
+
"items.product",
|
|
35022
|
+
"assignedUser",
|
|
35023
|
+
"payments"
|
|
34907
35024
|
]
|
|
34908
35025
|
});
|
|
34909
35026
|
if (!order) return json({
|
|
@@ -34929,7 +35046,9 @@ function createStorefrontApiHandler(config) {
|
|
|
34929
35046
|
},
|
|
34930
35047
|
relations: [
|
|
34931
35048
|
"items",
|
|
34932
|
-
"items.product"
|
|
35049
|
+
"items.product",
|
|
35050
|
+
"assignedUser",
|
|
35051
|
+
"payments"
|
|
34933
35052
|
]
|
|
34934
35053
|
});
|
|
34935
35054
|
}
|
|
@@ -34995,6 +35114,17 @@ function createStorefrontApiHandler(config) {
|
|
|
34995
35114
|
currency: o.currency,
|
|
34996
35115
|
createdAt: o.createdAt,
|
|
34997
35116
|
metadata: o.metadata ?? null,
|
|
35117
|
+
assignedUser: o.assignedUser ? {
|
|
35118
|
+
id: o.assignedUser.id,
|
|
35119
|
+
name: o.assignedUser.name,
|
|
35120
|
+
phone: o.assignedUser.phone
|
|
35121
|
+
} : null,
|
|
35122
|
+
payments: Array.isArray(o.payments) ? o.payments.map((pm) => ({
|
|
35123
|
+
id: pm.id,
|
|
35124
|
+
amount: pm.amount,
|
|
35125
|
+
method: pm.method,
|
|
35126
|
+
status: pm.status
|
|
35127
|
+
})) : [],
|
|
34998
35128
|
items: lines
|
|
34999
35129
|
},
|
|
35000
35130
|
relatedOrders: relatedOrders.map((r) => ({
|
|
@@ -35069,7 +35199,7 @@ function createStorefrontApiHandler(config) {
|
|
|
35069
35199
|
} catch {
|
|
35070
35200
|
}
|
|
35071
35201
|
try {
|
|
35072
|
-
void import('./emit-order-notification-trigger-
|
|
35202
|
+
void import('./emit-order-notification-trigger-ROASTYQP.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
35073
35203
|
fireOrderNotificationTrigger("order_cancelled", orderId, {
|
|
35074
35204
|
dataSource,
|
|
35075
35205
|
entityMap
|