@infuro/cms-core 1.0.59 → 1.0.60
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 +442 -37
- package/dist/admin.js +443 -38
- package/dist/api.cjs +38 -38
- package/dist/api.js +5 -5
- package/dist/auth.cjs +51 -51
- package/dist/auth.js +3 -3
- package/dist/{chunk-3EOM4V2M.cjs → chunk-4U6DATGZ.cjs} +7 -7
- package/dist/{chunk-BNKZNLEX.js → chunk-6DBDJ4VD.js} +2 -2
- package/dist/{chunk-UQWZUZ5X.cjs → chunk-73WVHINE.cjs} +30 -6
- package/dist/{chunk-UCKN4BBY.cjs → chunk-77I3KS7V.cjs} +4 -1
- package/dist/{chunk-MCCA7WLQ.cjs → chunk-BSLNXKV2.cjs} +282 -128
- package/dist/{chunk-77NUXO6A.cjs → chunk-J7FMZK66.cjs} +10 -2
- package/dist/{chunk-BTUEUA5H.js → chunk-JAEUYYGA.js} +202 -48
- package/dist/{chunk-BC22I7C7.cjs → chunk-KM2I6AFP.cjs} +9 -9
- package/dist/{chunk-JIWUVQ6B.js → chunk-MVHDC3XF.js} +10 -2
- package/dist/{chunk-RK5ETF2I.js → chunk-NR44CK5E.js} +1 -1
- package/dist/{chunk-MXIWUFBP.js → chunk-O2642WVS.js} +28 -4
- package/dist/{chunk-HCIRL37O.js → chunk-T3HPSF7K.js} +4 -1
- package/dist/{chunk-HYW3MUXT.js → chunk-URN7GS23.js} +30 -16
- package/dist/{chunk-HXLC56ZK.cjs → chunk-YSYX4GUD.cjs} +32 -18
- package/dist/{emit-order-notification-trigger-HZQPPSFB.js → emit-order-notification-trigger-CZU3V2WE.js} +2 -2
- package/dist/{emit-order-notification-trigger-NR3VN6C6.cjs → emit-order-notification-trigger-TNEZOYEE.cjs} +4 -4
- package/dist/index.cjs +339 -301
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +54 -16
- package/dist/migrations/1782800000000-AddPaymentSuccessFailedRefundTriggers.ts +32 -0
- package/dist/migrations/1782900000000-AddEnableTurnstileToForms.ts +29 -0
- package/dist/{order-notification-dispatcher-2FCZFZUD.cjs → order-notification-dispatcher-KJVGLK5E.cjs} +5 -5
- package/dist/{order-notification-dispatcher-64WDCHHG.js → order-notification-dispatcher-ZSFKEYMP.js} +2 -2
- package/dist/{rbac-debug-db-6EMIVMGF.js → rbac-debug-db-5R6XFPSV.js} +1 -1
- package/dist/{rbac-debug-db-6PWTLBEL.cjs → rbac-debug-db-JKK2MCWF.cjs} +2 -2
- package/package.json +1 -1
|
@@ -3,7 +3,10 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
|
|
4
4
|
var KNOWN_NOTIFICATION_TRIGGERS = {
|
|
5
5
|
ORDER_PLACED: "order_placed",
|
|
6
|
-
ORDER_CANCELLED: "order_cancelled"
|
|
6
|
+
ORDER_CANCELLED: "order_cancelled",
|
|
7
|
+
PAYMENT_SUCCESS: "payment_success",
|
|
8
|
+
PAYMENT_FAILED: "payment_failed",
|
|
9
|
+
PAYMENT_REFUND_INITIATED: "payment_refund_initiated"
|
|
7
10
|
};
|
|
8
11
|
var NotificationTriggerEmitter = class NotificationTriggerEmitter2 extends EventEmitter {
|
|
9
12
|
static {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { notificationTriggerEmitter } from './chunk-
|
|
1
|
+
import { notificationTriggerEmitter } from './chunk-T3HPSF7K.js';
|
|
2
2
|
import { queueEmail } from './chunk-L3525VXI.js';
|
|
3
3
|
import { mergeEmailLayoutCompanyDetails } from './chunk-2KUCQVAQ.js';
|
|
4
4
|
import { applyTemplateVars } from './chunk-CRFV5WJK.js';
|
|
@@ -2345,16 +2345,21 @@ __name(loadBoundTemplate, "loadBoundTemplate");
|
|
|
2345
2345
|
function mergeTriggerVariables(payload, rich) {
|
|
2346
2346
|
const basic = {
|
|
2347
2347
|
orderId: String(payload.orderId ?? ""),
|
|
2348
|
-
orderNumber: payload.orderNumber,
|
|
2349
|
-
customerName: payload.customerName,
|
|
2350
|
-
customerPhone: payload.customerPhone ?? "",
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
} :
|
|
2348
|
+
orderNumber: String(payload.orderNumber ?? rich?.orderNumber ?? ""),
|
|
2349
|
+
customerName: String(payload.customerName ?? rich?.customerName ?? ""),
|
|
2350
|
+
customerPhone: String(payload.customerPhone ?? rich?.customerPhone ?? ""),
|
|
2351
|
+
customerEmail: String(rich?.customerEmail ?? rich?.email ?? ""),
|
|
2352
|
+
total: String(payload.total ?? rich?.total ?? rich?.orderTotal ?? "0"),
|
|
2353
|
+
orderTotal: String(payload.total ?? rich?.total ?? rich?.orderTotal ?? "0"),
|
|
2354
|
+
currency: String(payload.currency ?? rich?.currency ?? "INR"),
|
|
2355
|
+
vendorId: String(payload.vendorId ?? rich?.vendorId ?? ""),
|
|
2356
|
+
refundAmount: String(payload.refundAmount ?? rich?.refundAmount ?? "0"),
|
|
2357
|
+
invoiceNumber: String(rich?.invoiceNumber ?? (payload.orderNumber ? `INV-${payload.orderNumber}` : "")),
|
|
2358
|
+
vendorName: String(rich?.vendorName ?? ""),
|
|
2359
|
+
eventName: String(rich?.eventName ?? rich?.name ?? ""),
|
|
2360
|
+
orderDetails: String(rich?.orderDetails ?? rich?.itemsSummary ?? ""),
|
|
2361
|
+
invoiceAttachment: "",
|
|
2362
|
+
invoicePdf: ""
|
|
2358
2363
|
};
|
|
2359
2364
|
const extraVars = payload.extraVariables ?? {};
|
|
2360
2365
|
return {
|
|
@@ -2592,21 +2597,30 @@ async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables,
|
|
|
2592
2597
|
getSettingsGroup(dataSource, entityMap, "email")
|
|
2593
2598
|
]);
|
|
2594
2599
|
const companyDetails = mergeEmailLayoutCompanyDetails(branding, emailSettings);
|
|
2595
|
-
const
|
|
2596
|
-
const
|
|
2600
|
+
const templateContent = (template.body ?? "") + (template.subject ?? "");
|
|
2601
|
+
const shouldAttachInvoice = /\{\{\s*(invoiceAttachment|invoicePdf|invoice|attachInvoice)\s*\}\}/i.test(templateContent);
|
|
2602
|
+
const cleanVariables = {
|
|
2603
|
+
...variables,
|
|
2604
|
+
invoiceAttachment: "",
|
|
2605
|
+
invoicePdf: "",
|
|
2606
|
+
invoice: "",
|
|
2607
|
+
attachInvoice: "",
|
|
2608
|
+
invoiceUrl: ""
|
|
2609
|
+
};
|
|
2610
|
+
const subject = applyTemplateVars(template.subject ?? "Order update", cleanVariables);
|
|
2611
|
+
const rawBody = applyTemplateVars(template.body, cleanVariables);
|
|
2597
2612
|
const bodyHtml = formatBodyForEmailHtml(rawBody);
|
|
2598
2613
|
const html = renderLayout({
|
|
2599
2614
|
bodyHtml,
|
|
2600
2615
|
companyDetails
|
|
2601
2616
|
});
|
|
2602
2617
|
const cms = await getCms();
|
|
2603
|
-
const isCustomer = audienceType === "customers";
|
|
2604
2618
|
await queueEmail(cms, {
|
|
2605
2619
|
to: contactEmail,
|
|
2606
2620
|
subject,
|
|
2607
2621
|
html,
|
|
2608
2622
|
text: rawBody.replace(/<[^>]+>/g, "").trim(),
|
|
2609
|
-
...
|
|
2623
|
+
...shouldAttachInvoice ? {
|
|
2610
2624
|
orderId,
|
|
2611
2625
|
attachInvoice: true
|
|
2612
2626
|
} : {}
|
|
@@ -2616,7 +2630,7 @@ async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables,
|
|
|
2616
2630
|
audienceType,
|
|
2617
2631
|
orderId,
|
|
2618
2632
|
to: contactEmail,
|
|
2619
|
-
attachInvoice:
|
|
2633
|
+
attachInvoice: shouldAttachInvoice
|
|
2620
2634
|
});
|
|
2621
2635
|
}
|
|
2622
2636
|
__name(sendEmailForTrigger, "sendEmailForTrigger");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk77I3KS7V_cjs = require('./chunk-77I3KS7V.cjs');
|
|
4
4
|
var chunkV25RDUOU_cjs = require('./chunk-V25RDUOU.cjs');
|
|
5
5
|
var chunkBXYZDMTZ_cjs = require('./chunk-BXYZDMTZ.cjs');
|
|
6
6
|
var chunkOOTLNH63_cjs = require('./chunk-OOTLNH63.cjs');
|
|
@@ -1331,7 +1331,7 @@ function renderEmail(templateName, ctx, options) {
|
|
|
1331
1331
|
chunkUSNT2KNT_cjs.__name(renderEmail, "renderEmail");
|
|
1332
1332
|
|
|
1333
1333
|
// src/plugins/email/email-service.ts
|
|
1334
|
-
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1334
|
+
var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-YSYX4GUD.cjs', document.baseURI).href)));
|
|
1335
1335
|
var MailComposer = require2("nodemailer/lib/mail-composer");
|
|
1336
1336
|
var SES_REGIONS_WITHOUT_SMTP = /* @__PURE__ */ new Set([
|
|
1337
1337
|
"af-south-1",
|
|
@@ -2371,16 +2371,21 @@ chunkUSNT2KNT_cjs.__name(loadBoundTemplate, "loadBoundTemplate");
|
|
|
2371
2371
|
function mergeTriggerVariables(payload, rich) {
|
|
2372
2372
|
const basic = {
|
|
2373
2373
|
orderId: String(payload.orderId ?? ""),
|
|
2374
|
-
orderNumber: payload.orderNumber,
|
|
2375
|
-
customerName: payload.customerName,
|
|
2376
|
-
customerPhone: payload.customerPhone ?? "",
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
} :
|
|
2374
|
+
orderNumber: String(payload.orderNumber ?? rich?.orderNumber ?? ""),
|
|
2375
|
+
customerName: String(payload.customerName ?? rich?.customerName ?? ""),
|
|
2376
|
+
customerPhone: String(payload.customerPhone ?? rich?.customerPhone ?? ""),
|
|
2377
|
+
customerEmail: String(rich?.customerEmail ?? rich?.email ?? ""),
|
|
2378
|
+
total: String(payload.total ?? rich?.total ?? rich?.orderTotal ?? "0"),
|
|
2379
|
+
orderTotal: String(payload.total ?? rich?.total ?? rich?.orderTotal ?? "0"),
|
|
2380
|
+
currency: String(payload.currency ?? rich?.currency ?? "INR"),
|
|
2381
|
+
vendorId: String(payload.vendorId ?? rich?.vendorId ?? ""),
|
|
2382
|
+
refundAmount: String(payload.refundAmount ?? rich?.refundAmount ?? "0"),
|
|
2383
|
+
invoiceNumber: String(rich?.invoiceNumber ?? (payload.orderNumber ? `INV-${payload.orderNumber}` : "")),
|
|
2384
|
+
vendorName: String(rich?.vendorName ?? ""),
|
|
2385
|
+
eventName: String(rich?.eventName ?? rich?.name ?? ""),
|
|
2386
|
+
orderDetails: String(rich?.orderDetails ?? rich?.itemsSummary ?? ""),
|
|
2387
|
+
invoiceAttachment: "",
|
|
2388
|
+
invoicePdf: ""
|
|
2384
2389
|
};
|
|
2385
2390
|
const extraVars = payload.extraVariables ?? {};
|
|
2386
2391
|
return {
|
|
@@ -2618,21 +2623,30 @@ async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables,
|
|
|
2618
2623
|
getSettingsGroup(dataSource, entityMap, "email")
|
|
2619
2624
|
]);
|
|
2620
2625
|
const companyDetails = chunkBXYZDMTZ_cjs.mergeEmailLayoutCompanyDetails(branding, emailSettings);
|
|
2621
|
-
const
|
|
2622
|
-
const
|
|
2626
|
+
const templateContent = (template.body ?? "") + (template.subject ?? "");
|
|
2627
|
+
const shouldAttachInvoice = /\{\{\s*(invoiceAttachment|invoicePdf|invoice|attachInvoice)\s*\}\}/i.test(templateContent);
|
|
2628
|
+
const cleanVariables = {
|
|
2629
|
+
...variables,
|
|
2630
|
+
invoiceAttachment: "",
|
|
2631
|
+
invoicePdf: "",
|
|
2632
|
+
invoice: "",
|
|
2633
|
+
attachInvoice: "",
|
|
2634
|
+
invoiceUrl: ""
|
|
2635
|
+
};
|
|
2636
|
+
const subject = chunkOOTLNH63_cjs.applyTemplateVars(template.subject ?? "Order update", cleanVariables);
|
|
2637
|
+
const rawBody = chunkOOTLNH63_cjs.applyTemplateVars(template.body, cleanVariables);
|
|
2623
2638
|
const bodyHtml = formatBodyForEmailHtml(rawBody);
|
|
2624
2639
|
const html = renderLayout({
|
|
2625
2640
|
bodyHtml,
|
|
2626
2641
|
companyDetails
|
|
2627
2642
|
});
|
|
2628
2643
|
const cms = await getCms();
|
|
2629
|
-
const isCustomer = audienceType === "customers";
|
|
2630
2644
|
await chunkV25RDUOU_cjs.queueEmail(cms, {
|
|
2631
2645
|
to: contactEmail,
|
|
2632
2646
|
subject,
|
|
2633
2647
|
html,
|
|
2634
2648
|
text: rawBody.replace(/<[^>]+>/g, "").trim(),
|
|
2635
|
-
...
|
|
2649
|
+
...shouldAttachInvoice ? {
|
|
2636
2650
|
orderId,
|
|
2637
2651
|
attachInvoice: true
|
|
2638
2652
|
} : {}
|
|
@@ -2642,7 +2656,7 @@ async function sendEmailForTrigger(triggerKey, orderId, audienceType, variables,
|
|
|
2642
2656
|
audienceType,
|
|
2643
2657
|
orderId,
|
|
2644
2658
|
to: contactEmail,
|
|
2645
|
-
attachInvoice:
|
|
2659
|
+
attachInvoice: shouldAttachInvoice
|
|
2646
2660
|
});
|
|
2647
2661
|
}
|
|
2648
2662
|
chunkUSNT2KNT_cjs.__name(sendEmailForTrigger, "sendEmailForTrigger");
|
|
@@ -2834,7 +2848,7 @@ function initWhatsappTriggerDispatcher(deps) {
|
|
|
2834
2848
|
const { dataSource, entityMap, getCms } = deps;
|
|
2835
2849
|
void dataSource.query(`ALTER TYPE "order_notification_bindings_channel_enum" ADD VALUE IF NOT EXISTS 'mobile'`).catch(() => {
|
|
2836
2850
|
});
|
|
2837
|
-
|
|
2851
|
+
chunk77I3KS7V_cjs.notificationTriggerEmitter.onAnyTrigger((triggerKey, payload) => {
|
|
2838
2852
|
void handleTrigger(triggerKey, payload, dataSource, entityMap, getCms).catch((err) => {
|
|
2839
2853
|
console.error("[order-notifications]", triggerKey, err);
|
|
2840
2854
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { emitOrderNotificationTrigger, fireOrderNotificationTrigger } from './chunk-O2642WVS.js';
|
|
2
|
+
import './chunk-T3HPSF7K.js';
|
|
3
3
|
import './chunk-SHUYVCID.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk73WVHINE_cjs = require('./chunk-73WVHINE.cjs');
|
|
4
|
+
require('./chunk-77I3KS7V.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 chunk73WVHINE_cjs.emitOrderNotificationTrigger; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "fireOrderNotificationTrigger", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk73WVHINE_cjs.fireOrderNotificationTrigger; }
|
|
16
16
|
});
|