@managesome/eposmatic-toolkit 0.4.67 → 0.4.69
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/esm/constants/enums/communications.js +1 -0
- package/esm/helpers/utils/email-helpers.js +5 -0
- package/esm/schemas/models/customers.js +10 -0
- package/lib/constants/enums/communications.d.ts +2 -1
- package/lib/constants/enums/communications.js +1 -0
- package/lib/helpers/types/email-templates.d.ts +13 -1
- package/lib/helpers/utils/email-helpers.js +5 -0
- package/lib/schemas/models/customers.d.ts +10 -0
- package/lib/schemas/models/customers.js +10 -0
- package/package.json +1 -1
|
@@ -320,6 +320,7 @@ export var EMAIL_TEMPLATES_TYPE_ENUM;
|
|
|
320
320
|
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_RFQ"] = "EMAIL_TEMPLATE_FOR_RFQ";
|
|
321
321
|
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_PURCHASE_ORDER"] = "EMAIL_TEMPLATE_FOR_PURCHASE_ORDER";
|
|
322
322
|
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_SALE_ORDER"] = "EMAIL_TEMPLATE_FOR_SALE_ORDER";
|
|
323
|
+
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_OTP"] = "EMAIL_TEMPLATE_FOR_OTP";
|
|
323
324
|
})(EMAIL_TEMPLATES_TYPE_ENUM || (EMAIL_TEMPLATES_TYPE_ENUM = {}));
|
|
324
325
|
// ======================>> <<====================== //
|
|
325
326
|
export var NOTIFICATION_PROVIDER_ENUM;
|
|
@@ -96,6 +96,11 @@ const templates = {
|
|
|
96
96
|
alias: 'email-template-for-sale-order',
|
|
97
97
|
stream: STREAMS.transactional,
|
|
98
98
|
},
|
|
99
|
+
[EMAIL_TEMPLATES_TYPE_ENUM.EMAIL_TEMPLATE_FOR_OTP]: {
|
|
100
|
+
id: 48566213,
|
|
101
|
+
alias: 'otp-verification',
|
|
102
|
+
stream: STREAMS.transactional,
|
|
103
|
+
},
|
|
99
104
|
};
|
|
100
105
|
export function getEmailTemplateBody(templateType, to, templateModel) {
|
|
101
106
|
const { id, alias, stream } = templates[templateType];
|
|
@@ -219,6 +219,8 @@ export const CUSTOMER_COLLECTION_NAME = 'customers';
|
|
|
219
219
|
* be passed straight to `.hint()`.
|
|
220
220
|
* - `_id`: unique primary key.
|
|
221
221
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
222
|
+
* - `brand_id__email`: per-brand customer lookups by email (email/Google login).
|
|
223
|
+
* - `brand_id__uid`: per-brand customer lookups by Firebase uid.
|
|
222
224
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
223
225
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
224
226
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -234,6 +236,14 @@ export const CUSTOMER_COLLECTION_INDEXES = {
|
|
|
234
236
|
brand_id: 1,
|
|
235
237
|
phone_number: 1,
|
|
236
238
|
}, // per-brand customer lookups by phone number
|
|
239
|
+
brand_id__email: {
|
|
240
|
+
brand_id: 1,
|
|
241
|
+
email: 1,
|
|
242
|
+
}, // per-brand customer lookups by email (email login / account resolution)
|
|
243
|
+
brand_id__uid: {
|
|
244
|
+
brand_id: 1,
|
|
245
|
+
uid: 1,
|
|
246
|
+
}, // per-brand customer lookups by Firebase uid
|
|
237
247
|
brand_id__createdAt: {
|
|
238
248
|
brand_id: 1,
|
|
239
249
|
createdAt: -1,
|
|
@@ -71,7 +71,8 @@ export declare enum EMAIL_TEMPLATES_TYPE_ENUM {
|
|
|
71
71
|
MARKETING_FORM_SUBMISSION = "MARKETING_FORM_SUBMISSION",
|
|
72
72
|
EMAIL_TEMPLATE_FOR_RFQ = "EMAIL_TEMPLATE_FOR_RFQ",
|
|
73
73
|
EMAIL_TEMPLATE_FOR_PURCHASE_ORDER = "EMAIL_TEMPLATE_FOR_PURCHASE_ORDER",
|
|
74
|
-
EMAIL_TEMPLATE_FOR_SALE_ORDER = "EMAIL_TEMPLATE_FOR_SALE_ORDER"
|
|
74
|
+
EMAIL_TEMPLATE_FOR_SALE_ORDER = "EMAIL_TEMPLATE_FOR_SALE_ORDER",
|
|
75
|
+
EMAIL_TEMPLATE_FOR_OTP = "EMAIL_TEMPLATE_FOR_OTP"
|
|
75
76
|
}
|
|
76
77
|
export declare enum NOTIFICATION_PROVIDER_ENUM {
|
|
77
78
|
FIREBASE = "FIREBASE",
|
|
@@ -323,6 +323,7 @@ var EMAIL_TEMPLATES_TYPE_ENUM;
|
|
|
323
323
|
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_RFQ"] = "EMAIL_TEMPLATE_FOR_RFQ";
|
|
324
324
|
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_PURCHASE_ORDER"] = "EMAIL_TEMPLATE_FOR_PURCHASE_ORDER";
|
|
325
325
|
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_SALE_ORDER"] = "EMAIL_TEMPLATE_FOR_SALE_ORDER";
|
|
326
|
+
EMAIL_TEMPLATES_TYPE_ENUM["EMAIL_TEMPLATE_FOR_OTP"] = "EMAIL_TEMPLATE_FOR_OTP";
|
|
326
327
|
})(EMAIL_TEMPLATES_TYPE_ENUM || (exports.EMAIL_TEMPLATES_TYPE_ENUM = EMAIL_TEMPLATES_TYPE_ENUM = {}));
|
|
327
328
|
// ======================>> <<====================== //
|
|
328
329
|
var NOTIFICATION_PROVIDER_ENUM;
|
|
@@ -242,5 +242,17 @@ export interface IEmailTemplateForSaleOrder {
|
|
|
242
242
|
description: string;
|
|
243
243
|
theme_color?: string | null;
|
|
244
244
|
}
|
|
245
|
-
export
|
|
245
|
+
export interface IEmailTemplateForOTP {
|
|
246
|
+
brand_name: string;
|
|
247
|
+
brand_logo_url: string;
|
|
248
|
+
header_color: string;
|
|
249
|
+
footer_color: string;
|
|
250
|
+
user_name: string;
|
|
251
|
+
user_email: string;
|
|
252
|
+
otp_code: string;
|
|
253
|
+
expiry_minutes: number;
|
|
254
|
+
anti_phishing_code?: string | null;
|
|
255
|
+
support_email: string;
|
|
256
|
+
}
|
|
257
|
+
export type ITemplateModel = IEmailAccountActivated | IEmailAccountDeactivated | IEmailLateDeliveryAlert | IEmailLowInventoryAlert | IEmailOrderReceipt | IEmailOrderStatusUpdate | IEmailRateOrder | IEmailReceivedOrderReview | IEmailSubscriptionDueSoon | IEmailSubscriptionPending | IEmailSubscriptionExpired | IEmailSubscriptionRenewed | IEmailUnconfirmOrderAlert | IEmailWelcome | IEmailMarketingFormSubmission | IEmailTemplateForRFQ | IEmailTemplateForPurchaseOrder | IEmailTemplateForSaleOrder | IEmailTemplateForOTP;
|
|
246
258
|
export {};
|
|
@@ -99,6 +99,11 @@ const templates = {
|
|
|
99
99
|
alias: 'email-template-for-sale-order',
|
|
100
100
|
stream: STREAMS.transactional,
|
|
101
101
|
},
|
|
102
|
+
[constants_1.EMAIL_TEMPLATES_TYPE_ENUM.EMAIL_TEMPLATE_FOR_OTP]: {
|
|
103
|
+
id: 48566213,
|
|
104
|
+
alias: 'otp-verification',
|
|
105
|
+
stream: STREAMS.transactional,
|
|
106
|
+
},
|
|
102
107
|
};
|
|
103
108
|
function getEmailTemplateBody(templateType, to, templateModel) {
|
|
104
109
|
const { id, alias, stream } = templates[templateType];
|
|
@@ -572,6 +572,8 @@ export declare const CUSTOMER_COLLECTION_NAME = "customers";
|
|
|
572
572
|
* be passed straight to `.hint()`.
|
|
573
573
|
* - `_id`: unique primary key.
|
|
574
574
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
575
|
+
* - `brand_id__email`: per-brand customer lookups by email (email/Google login).
|
|
576
|
+
* - `brand_id__uid`: per-brand customer lookups by Firebase uid.
|
|
575
577
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
576
578
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
577
579
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -589,6 +591,14 @@ export declare const CUSTOMER_COLLECTION_INDEXES: {
|
|
|
589
591
|
brand_id: number;
|
|
590
592
|
phone_number: number;
|
|
591
593
|
};
|
|
594
|
+
brand_id__email: {
|
|
595
|
+
brand_id: number;
|
|
596
|
+
email: number;
|
|
597
|
+
};
|
|
598
|
+
brand_id__uid: {
|
|
599
|
+
brand_id: number;
|
|
600
|
+
uid: number;
|
|
601
|
+
};
|
|
592
602
|
brand_id__createdAt: {
|
|
593
603
|
brand_id: number;
|
|
594
604
|
createdAt: number;
|
|
@@ -222,6 +222,8 @@ exports.CUSTOMER_COLLECTION_NAME = 'customers';
|
|
|
222
222
|
* be passed straight to `.hint()`.
|
|
223
223
|
* - `_id`: unique primary key.
|
|
224
224
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
225
|
+
* - `brand_id__email`: per-brand customer lookups by email (email/Google login).
|
|
226
|
+
* - `brand_id__uid`: per-brand customer lookups by Firebase uid.
|
|
225
227
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
226
228
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
227
229
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -237,6 +239,14 @@ exports.CUSTOMER_COLLECTION_INDEXES = {
|
|
|
237
239
|
brand_id: 1,
|
|
238
240
|
phone_number: 1,
|
|
239
241
|
}, // per-brand customer lookups by phone number
|
|
242
|
+
brand_id__email: {
|
|
243
|
+
brand_id: 1,
|
|
244
|
+
email: 1,
|
|
245
|
+
}, // per-brand customer lookups by email (email login / account resolution)
|
|
246
|
+
brand_id__uid: {
|
|
247
|
+
brand_id: 1,
|
|
248
|
+
uid: 1,
|
|
249
|
+
}, // per-brand customer lookups by Firebase uid
|
|
240
250
|
brand_id__createdAt: {
|
|
241
251
|
brand_id: 1,
|
|
242
252
|
createdAt: -1,
|