@takentrade/takentrade-libs 4.1.6 → 4.1.8
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/common/utils/random.utils.js +2 -1
- package/dist/common/utils/reference.utils.js +2 -1
- package/dist/notification/broadcast-templates.d.ts +97 -0
- package/dist/notification/broadcast-templates.js +78 -0
- package/dist/notification/index.d.ts +1 -0
- package/dist/notification/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/interceptors/response.interceptor.js +2 -1
- package/package.json +5 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateRandomString = generateRandomString;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
4
5
|
const DIGITS = '0123456789';
|
|
5
6
|
const LOWERCASE_CHARS = 'abcdefghijklmnopqrstuvwxyz';
|
|
6
7
|
const UPPERCASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
@@ -21,7 +22,7 @@ function generateRandomString(options = {}) {
|
|
|
21
22
|
let result = '';
|
|
22
23
|
const charactersLength = chars.length;
|
|
23
24
|
for (let i = 0; i < length; i++) {
|
|
24
|
-
result += chars.charAt(
|
|
25
|
+
result += chars.charAt((0, node_crypto_1.randomInt)(0, charactersLength));
|
|
25
26
|
}
|
|
26
27
|
return result;
|
|
27
28
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateReference = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
4
5
|
const generateRandomString = (length) => {
|
|
5
6
|
const characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
6
7
|
const charactersLength = characters.length;
|
|
7
8
|
let result = '';
|
|
8
9
|
for (let i = 0; i < length; i++) {
|
|
9
|
-
const randomIndex =
|
|
10
|
+
const randomIndex = (0, node_crypto_1.randomInt)(0, charactersLength);
|
|
10
11
|
result += characters[randomIndex];
|
|
11
12
|
}
|
|
12
13
|
return result;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export type BroadcastEmailTemplateKey = 'product-announcement' | 'promotion-special-offer' | 'newsletter' | 'event-webinar-invitation' | 'general-company-update';
|
|
2
|
+
export type BroadcastEmailTemplateCategory = 'announcement' | 'promotion' | 'newsletter' | 'event' | 'update';
|
|
3
|
+
export interface BroadcastEmailTemplateDefinition {
|
|
4
|
+
key: BroadcastEmailTemplateKey;
|
|
5
|
+
templateName: BroadcastEmailTemplateKey;
|
|
6
|
+
category: BroadcastEmailTemplateCategory;
|
|
7
|
+
label: string;
|
|
8
|
+
description: string;
|
|
9
|
+
defaultSubject: string;
|
|
10
|
+
defaultTitle: string;
|
|
11
|
+
defaultCtaText: string;
|
|
12
|
+
previewTag: string;
|
|
13
|
+
accentColor: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BroadcastEmailBranding {
|
|
16
|
+
companyName: string;
|
|
17
|
+
logoUrl?: string;
|
|
18
|
+
logoAlt?: string;
|
|
19
|
+
primaryColor?: string;
|
|
20
|
+
supportEmail: string;
|
|
21
|
+
supportPhone?: string;
|
|
22
|
+
websiteUrl?: string;
|
|
23
|
+
unsubscribeUrl?: string;
|
|
24
|
+
currentYear: number;
|
|
25
|
+
}
|
|
26
|
+
export interface BroadcastEmailContent {
|
|
27
|
+
subject: string;
|
|
28
|
+
title: string;
|
|
29
|
+
previewText?: string;
|
|
30
|
+
bodyHtml: string;
|
|
31
|
+
ctaText?: string;
|
|
32
|
+
ctaUrl?: string;
|
|
33
|
+
greetingName?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface BroadcastEmailTemplateContext extends BroadcastEmailBranding, BroadcastEmailContent {
|
|
36
|
+
templateKey: BroadcastEmailTemplateKey;
|
|
37
|
+
audienceLabel?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const BROADCAST_EMAIL_TEMPLATES: readonly [{
|
|
40
|
+
readonly key: "product-announcement";
|
|
41
|
+
readonly templateName: "product-announcement";
|
|
42
|
+
readonly category: "announcement";
|
|
43
|
+
readonly label: "Product Announcement";
|
|
44
|
+
readonly description: "Announce a new feature, release, or platform update with a polished launch-style layout.";
|
|
45
|
+
readonly defaultSubject: "Introducing our latest update";
|
|
46
|
+
readonly defaultTitle: "A new TakeNTrade update is here";
|
|
47
|
+
readonly defaultCtaText: "Learn More";
|
|
48
|
+
readonly previewTag: "Launch";
|
|
49
|
+
readonly accentColor: "#FF914D";
|
|
50
|
+
}, {
|
|
51
|
+
readonly key: "promotion-special-offer";
|
|
52
|
+
readonly templateName: "promotion-special-offer";
|
|
53
|
+
readonly category: "promotion";
|
|
54
|
+
readonly label: "Promotion / Special Offer";
|
|
55
|
+
readonly description: "Highlight limited-time offers, bonuses, or time-sensitive campaigns with stronger visual emphasis.";
|
|
56
|
+
readonly defaultSubject: "Special offer for our customers";
|
|
57
|
+
readonly defaultTitle: "Unlock a limited-time offer";
|
|
58
|
+
readonly defaultCtaText: "Claim Offer";
|
|
59
|
+
readonly previewTag: "Offer";
|
|
60
|
+
readonly accentColor: "#F97316";
|
|
61
|
+
}, {
|
|
62
|
+
readonly key: "newsletter";
|
|
63
|
+
readonly templateName: "newsletter";
|
|
64
|
+
readonly category: "newsletter";
|
|
65
|
+
readonly label: "Newsletter";
|
|
66
|
+
readonly description: "Share a balanced editorial update with multiple content sections and softer promotional styling.";
|
|
67
|
+
readonly defaultSubject: "Your monthly TakeNTrade update";
|
|
68
|
+
readonly defaultTitle: "Catch up on what's new";
|
|
69
|
+
readonly defaultCtaText: "Read More";
|
|
70
|
+
readonly previewTag: "Digest";
|
|
71
|
+
readonly accentColor: "#3B82F6";
|
|
72
|
+
}, {
|
|
73
|
+
readonly key: "event-webinar-invitation";
|
|
74
|
+
readonly templateName: "event-webinar-invitation";
|
|
75
|
+
readonly category: "event";
|
|
76
|
+
readonly label: "Event / Webinar Invitation";
|
|
77
|
+
readonly description: "Invite users to a live event, webinar, or community session with clear schedule and RSVP emphasis.";
|
|
78
|
+
readonly defaultSubject: "You are invited to our next event";
|
|
79
|
+
readonly defaultTitle: "Join our upcoming session";
|
|
80
|
+
readonly defaultCtaText: "Reserve Your Spot";
|
|
81
|
+
readonly previewTag: "Event";
|
|
82
|
+
readonly accentColor: "#14B8A6";
|
|
83
|
+
}, {
|
|
84
|
+
readonly key: "general-company-update";
|
|
85
|
+
readonly templateName: "general-company-update";
|
|
86
|
+
readonly category: "update";
|
|
87
|
+
readonly label: "General Company Update";
|
|
88
|
+
readonly description: "Send a simple operational update, policy notice, or company-wide announcement with a clean structure.";
|
|
89
|
+
readonly defaultSubject: "Important update from TakeNTrade";
|
|
90
|
+
readonly defaultTitle: "A quick company update";
|
|
91
|
+
readonly defaultCtaText: "View Update";
|
|
92
|
+
readonly previewTag: "Update";
|
|
93
|
+
readonly accentColor: "#8B5CF6";
|
|
94
|
+
}];
|
|
95
|
+
export declare const BROADCAST_EMAIL_TEMPLATE_KEYS: readonly BroadcastEmailTemplateKey[];
|
|
96
|
+
export declare function getBroadcastEmailTemplate(key: BroadcastEmailTemplateKey): BroadcastEmailTemplateDefinition;
|
|
97
|
+
export declare function isBroadcastEmailTemplateKey(value: string): value is BroadcastEmailTemplateKey;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BROADCAST_EMAIL_TEMPLATE_KEYS = exports.BROADCAST_EMAIL_TEMPLATES = void 0;
|
|
4
|
+
exports.getBroadcastEmailTemplate = getBroadcastEmailTemplate;
|
|
5
|
+
exports.isBroadcastEmailTemplateKey = isBroadcastEmailTemplateKey;
|
|
6
|
+
exports.BROADCAST_EMAIL_TEMPLATES = [
|
|
7
|
+
{
|
|
8
|
+
key: 'product-announcement',
|
|
9
|
+
templateName: 'product-announcement',
|
|
10
|
+
category: 'announcement',
|
|
11
|
+
label: 'Product Announcement',
|
|
12
|
+
description: 'Announce a new feature, release, or platform update with a polished launch-style layout.',
|
|
13
|
+
defaultSubject: 'Introducing our latest update',
|
|
14
|
+
defaultTitle: 'A new TakeNTrade update is here',
|
|
15
|
+
defaultCtaText: 'Learn More',
|
|
16
|
+
previewTag: 'Launch',
|
|
17
|
+
accentColor: '#FF914D',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: 'promotion-special-offer',
|
|
21
|
+
templateName: 'promotion-special-offer',
|
|
22
|
+
category: 'promotion',
|
|
23
|
+
label: 'Promotion / Special Offer',
|
|
24
|
+
description: 'Highlight limited-time offers, bonuses, or time-sensitive campaigns with stronger visual emphasis.',
|
|
25
|
+
defaultSubject: 'Special offer for our customers',
|
|
26
|
+
defaultTitle: 'Unlock a limited-time offer',
|
|
27
|
+
defaultCtaText: 'Claim Offer',
|
|
28
|
+
previewTag: 'Offer',
|
|
29
|
+
accentColor: '#F97316',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'newsletter',
|
|
33
|
+
templateName: 'newsletter',
|
|
34
|
+
category: 'newsletter',
|
|
35
|
+
label: 'Newsletter',
|
|
36
|
+
description: 'Share a balanced editorial update with multiple content sections and softer promotional styling.',
|
|
37
|
+
defaultSubject: 'Your monthly TakeNTrade update',
|
|
38
|
+
defaultTitle: "Catch up on what's new",
|
|
39
|
+
defaultCtaText: 'Read More',
|
|
40
|
+
previewTag: 'Digest',
|
|
41
|
+
accentColor: '#3B82F6',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: 'event-webinar-invitation',
|
|
45
|
+
templateName: 'event-webinar-invitation',
|
|
46
|
+
category: 'event',
|
|
47
|
+
label: 'Event / Webinar Invitation',
|
|
48
|
+
description: 'Invite users to a live event, webinar, or community session with clear schedule and RSVP emphasis.',
|
|
49
|
+
defaultSubject: 'You are invited to our next event',
|
|
50
|
+
defaultTitle: 'Join our upcoming session',
|
|
51
|
+
defaultCtaText: 'Reserve Your Spot',
|
|
52
|
+
previewTag: 'Event',
|
|
53
|
+
accentColor: '#14B8A6',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'general-company-update',
|
|
57
|
+
templateName: 'general-company-update',
|
|
58
|
+
category: 'update',
|
|
59
|
+
label: 'General Company Update',
|
|
60
|
+
description: 'Send a simple operational update, policy notice, or company-wide announcement with a clean structure.',
|
|
61
|
+
defaultSubject: 'Important update from TakeNTrade',
|
|
62
|
+
defaultTitle: 'A quick company update',
|
|
63
|
+
defaultCtaText: 'View Update',
|
|
64
|
+
previewTag: 'Update',
|
|
65
|
+
accentColor: '#8B5CF6',
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
exports.BROADCAST_EMAIL_TEMPLATE_KEYS = exports.BROADCAST_EMAIL_TEMPLATES.map((template) => template.key);
|
|
69
|
+
function getBroadcastEmailTemplate(key) {
|
|
70
|
+
const template = exports.BROADCAST_EMAIL_TEMPLATES.find((item) => item.key === key);
|
|
71
|
+
if (!template) {
|
|
72
|
+
throw new Error(`Unknown broadcast email template: ${key}`);
|
|
73
|
+
}
|
|
74
|
+
return template;
|
|
75
|
+
}
|
|
76
|
+
function isBroadcastEmailTemplateKey(value) {
|
|
77
|
+
return exports.BROADCAST_EMAIL_TEMPLATE_KEYS.includes(value);
|
|
78
|
+
}
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./notification.client"), exports);
|
|
|
18
18
|
__exportStar(require("./notification.interface"), exports);
|
|
19
19
|
__exportStar(require("./notification.enum"), exports);
|
|
20
20
|
__exportStar(require("./notification.module"), exports);
|
|
21
|
+
__exportStar(require("./broadcast-templates"), exports);
|