propro-utils 1.3.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.
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+
3
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+ var templateData = function templateData(_ref) {
6
+ var args = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
7
+ return {
8
+ "new-account": {
9
+ subject: "Welcome to ProPro",
10
+ body: "Thank you for signing up to ProPro. Please click the link below to verify your email address.",
11
+ button: {
12
+ label: "Verify Your Email",
13
+ url: "{{domain}}?token={{content.verification_token}}"
14
+ }
15
+ },
16
+ "duplicate-user": {
17
+ subject: "Important! Your ProPro Account",
18
+ body: "We noticed you already have a registered account with ProPro. To prevent confusion, your original password remains unchanged.",
19
+ button: {
20
+ label: "Sign In",
21
+ url: "{{domain}}/signin"
22
+ }
23
+ },
24
+ new_plan: {
25
+ subject: "Your ProPro Plan",
26
+ body: "Thank you for choosing the {{content.plan}} plan. Your card has been successfully charged {{content.price}}.",
27
+ button: {
28
+ label: "Your Dashboard",
29
+ url: "{{domain}}/dashboard"
30
+ }
31
+ },
32
+ "new-user": {
33
+ subject: "Welcome to ProPro",
34
+ body: "Thank you for signing up to ProPro. Please click the link below to verify your email address.",
35
+ button: {
36
+ label: "Verify Your Email",
37
+ url: "{{domain}}?token={{content.verification_token}}"
38
+ }
39
+ },
40
+ "plan-updated": {
41
+ subject: "Your Billing Plan Updated",
42
+ body: "Confirmation: Your billing plan has been updated to the {{content.plan}} plan.",
43
+ button: {
44
+ label: "Manage Your Plan",
45
+ url: "{{domain}}/account/billing"
46
+ }
47
+ },
48
+ "card-updated": {
49
+ subject: "Credit Card Information Updated",
50
+ body: "Confirmation: Your credit card information has been updated. Contact us immediately if you did not authorize this change.",
51
+ button: {
52
+ label: "Contact Support",
53
+ url: "mailto:support@yourdomain.com"
54
+ }
55
+ },
56
+ "account-closed": {
57
+ subject: "Account Closure Confirmation",
58
+ body: "Your account has been closed and all associated data has been removed from our servers. You're welcome to rejoin ProPro anytime.",
59
+ button: {
60
+ label: "Sign Up",
61
+ url: "{{domain}}/signup"
62
+ }
63
+ },
64
+ "invite-accepted": {
65
+ subject: "Team Invitation Accepted",
66
+ body: "Great news! {{content.friend}} has accepted your invitation to join your ProPro team.",
67
+ button: {
68
+ label: "Invite More Friends",
69
+ url: "{{domain}}/account/users"
70
+ }
71
+ },
72
+ "password-updated": {
73
+ subject: "Password Change Confirmation",
74
+ body: "Your ProPro password has been changed. If you did not initiate this change, please contact our support team immediately.",
75
+ button: {
76
+ label: "Contact Support",
77
+ url: "mailto:support@yourdomain.com"
78
+ }
79
+ },
80
+ "password-reset": {
81
+ subject: "Password Reset Request",
82
+ title: "Forgot Your ProPro Password?",
83
+ body: "To reset your password, click the link below.",
84
+ button: {
85
+ label: "Reset Password",
86
+ url: "{{domain}}?token={{content.token}}"
87
+ }
88
+ },
89
+ invite: {
90
+ subject: "Team Invitation from a Friend",
91
+ body: "You've been invited by {{content.friend}} to join their ProPro team. Sign up now to collaborate.",
92
+ button: {
93
+ label: "Sign Up Now",
94
+ url: "{{domain}}?id={{content.id}}&email={{content.email}}"
95
+ }
96
+ },
97
+ contact: {
98
+ subject: "New Contact Form Submission",
99
+ body: "You've received a new message from {{content.name}}: <br><br> {{content.message}}",
100
+ button: {
101
+ label: "Respond Now",
102
+ url: "mailto:{{content.email}}"
103
+ }
104
+ },
105
+ feedback: {
106
+ subject: "New App Feedback Received",
107
+ body: "New feedback for your ProPro app: <br><br> Rating: {{content.rating}} <br><br>{{content.comment}}",
108
+ button: {
109
+ label: "View Now",
110
+ url: "{{content.url}}"
111
+ }
112
+ },
113
+ magic_signin: {
114
+ subject: "Your ProPro Magic Sign-In Link",
115
+ body: "You requested a magic sign-in link for ProPro. Click below to sign in without a password.",
116
+ button: {
117
+ label: "Sign In",
118
+ url: "{{domain}}?token={{content.token}}"
119
+ }
120
+ },
121
+ new_signin: {
122
+ subject: "New Sign-In Alert for ProPro",
123
+ body: "A new sign-in to your ProPro account was detected: \n\n{{content.browser}} on {{content.device}}\n\nIP: {{content.ip}}\n\nTime: {{content.time}}\n\nIf this was you, no action is needed. If not, please secure your account.",
124
+ button: {
125
+ label: "Secure My Account",
126
+ url: "{{domain}}/account/security"
127
+ }
128
+ },
129
+ blocked_signin: {
130
+ subject: "Blocked Suspicious Sign-In Attempt",
131
+ body: "A suspicious sign-in attempt to your ProPro account was blocked. If this was you, use the link below to sign in securely.",
132
+ button: {
133
+ label: "Sign In Securely",
134
+ url: "{{domain}}?token={{content.token}}"
135
+ }
136
+ },
137
+ help: {
138
+ subject: "New Support Request Received",
139
+ body: "A new support request has been submitted by {{content.name}}: <br><br> {{content.message}}",
140
+ button: {
141
+ label: "Respond Now",
142
+ url: "mailto:{{content.email}}"
143
+ }
144
+ },
145
+ "new-log": {
146
+ subject: "New Log Recorded in ProPro",
147
+ body: "A new log has been recorded in your ProPro application. Check Mission Control for details.",
148
+ button: {
149
+ label: "View Log",
150
+ url: "{{domain}}/missioncontrol/logs/{{content.id}}"
151
+ }
152
+ },
153
+ email_verification: {
154
+ subject: "Verify Your ProPro Email",
155
+ body: "Thanks for signing up to ProPro. Click the link below to verify your email address.",
156
+ button: {
157
+ label: "Verify Your Email",
158
+ url: "{{domain}}?token={{content.verification_token}}"
159
+ }
160
+ },
161
+ email_verification_complete: {
162
+ subject: "Email Verified - Welcome to ProPro",
163
+ body: "Your email address has been verified. Your ProPro account is now active.",
164
+ button: {
165
+ label: "Open Dashboard",
166
+ url: "{{domain}}/dashboard"
167
+ }
168
+ },
169
+ "new-email": {
170
+ subject: "Email Address Change Confirmation",
171
+ body: "You have changed your email address for your ProPro account. If you did not authorize this change, please contact us immediately.",
172
+ button: {
173
+ label: "Contact Support",
174
+ url: "mailto:support@yourdomain.com"
175
+ }
176
+ },
177
+ otp_request: {
178
+ subject: "Your ProPro One-Time Password",
179
+ body: "Your ProPro one-time password (OTP) is: {{content.otp}}",
180
+ additionalInfo: "This password will expire in 10 minutes."
181
+ },
182
+ subscription_expiry: {
183
+ subject: "Your ProPro Subscription is Expiring",
184
+ body: "Your ProPro subscription will expire in {{content.days}} days. Renew now to continue enjoying our services.",
185
+ button: {
186
+ label: "Renew Subscription",
187
+ url: "{{domain}}/account/billing"
188
+ }
189
+ },
190
+ payment_failure: {
191
+ subject: "Your ProPro Payment Failed",
192
+ body: "We were unable to process your payment. Please update your billing information to avoid interruption of your ProPro services.",
193
+ button: {
194
+ label: "Update Billing Information",
195
+ url: "{{domain}}/account/billing"
196
+ }
197
+ },
198
+ account_recovery: {
199
+ subject: "ProPro Account Recovery",
200
+ body: "To recover your ProPro account, please click the link below.",
201
+ button: {
202
+ label: "Recover Account",
203
+ url: "{{domain}}?token={{content.token}}"
204
+ }
205
+ },
206
+ account_verified: {
207
+ subject: "Your ProPro Account is Verified",
208
+ body: "Your ProPro account is now verified. You can now use all the features available.",
209
+ button: {
210
+ label: "Get Started",
211
+ url: "{{domain}}/dashboard"
212
+ }
213
+ },
214
+ account_verification_failed: {
215
+ subject: "ProPro Account Verification Failed",
216
+ body: "Your attempt to verify your ProPro account failed. Please try again or contact support if you continue to have issues.",
217
+ button: {
218
+ label: "Contact Support",
219
+ url: "mailto:support@yourdomain.com"
220
+ }
221
+ },
222
+ report_ready: {
223
+ subject: "Your ProPro Report is Ready",
224
+ body: "Your requested report from ProPro is now ready for download.",
225
+ button: {
226
+ label: "Download Report",
227
+ url: "{{domain}}/report/{{content.id}}"
228
+ }
229
+ },
230
+ welcome_message: {
231
+ subject: "Welcome to ProPro!",
232
+ body: "We're excited to have you on board. Discover the possibilities and features available with ProPro.",
233
+ button: {
234
+ label: "Get Started",
235
+ url: "{{domain}}/dashboard"
236
+ }
237
+ },
238
+ congratulations: {
239
+ subject: "Congratulations from ProPro",
240
+ body: "Congratulations on reaching a new milestone with ProPro!",
241
+ button: {
242
+ label: "Celebrate Now",
243
+ url: "{{domain}}/rewards"
244
+ }
245
+ },
246
+ newsletter: {
247
+ subject: "ProPro Newsletter - {{content.month}}",
248
+ body: "Catch up on the latest news and updates from ProPro in our monthly newsletter.",
249
+ button: {
250
+ label: "Read Now",
251
+ url: "{{domain}}/newsletter/{{content.id}}"
252
+ }
253
+ },
254
+ security_alert: {
255
+ subject: "Security Alert: New Device Signed in to ProPro",
256
+ body: "A new device has just signed into your ProPro account. If this was you, you can safely ignore this email. If it wasn't you, please secure your account.",
257
+ button: {
258
+ label: "Secure My Account",
259
+ url: "{{domain}}/account/security"
260
+ }
261
+ },
262
+ promotion: {
263
+ subject: "Special Promotion Just for You from ProPro",
264
+ body: "We have a special promotion just for you. Unlock your exclusive deal from ProPro now.",
265
+ button: {
266
+ label: "Unlock Now",
267
+ url: "{{domain}}/promotions"
268
+ }
269
+ },
270
+ thank_you: {
271
+ subject: "Thank You for Choosing ProPro",
272
+ body: "Thank you for being a valued member of the ProPro community. We're glad to have you with us.",
273
+ button: {
274
+ label: "Explore More",
275
+ url: "{{domain}}/dashboard"
276
+ }
277
+ },
278
+ goodbye: {
279
+ subject: "Goodbye from ProPro",
280
+ body: "We're sad to see you go. If you ever decide to come back, ProPro will be here waiting for you.",
281
+ button: {
282
+ label: "Come Back",
283
+ url: "{{domain}}/signup"
284
+ }
285
+ },
286
+ confirmation: {
287
+ subject: "Action Required: Confirm Your Action",
288
+ body: "Please confirm your action by clicking the button below.",
289
+ button: {
290
+ label: "Confirm",
291
+ url: "{{domain}}?token={{content.token}}"
292
+ }
293
+ }
294
+ };
295
+ };
296
+ module.exports = {
297
+ templateData: templateData
298
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ var _require = require("./emailStrategy"),
4
+ EmailNotificationStrategy = _require.EmailNotificationStrategy;
5
+ var _require2 = require("./notificationService"),
6
+ NotificationService = _require2.NotificationService;
7
+ var notificationService = new NotificationService(new EmailNotificationStrategy());
8
+ notificationService.sendNotification("chidosiky2015@gmail.com", "new-account").then(function () {
9
+ console.log("Email sent");
10
+ })["catch"](function (error) {
11
+ console.log("Error sending email", error);
12
+ });
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
15
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
18
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
19
+ var twilio = require("twilio");
20
+
21
+ /**
22
+ * Twilio SMS Notification Strategy class.
23
+ * @class
24
+ * @extends NotificationStrategy
25
+ */
26
+ var TwilioSMSNotificationStrategy = /*#__PURE__*/function (_NotificationStrategy) {
27
+ _inherits(TwilioSMSNotificationStrategy, _NotificationStrategy);
28
+ var _super = _createSuper(TwilioSMSNotificationStrategy);
29
+ function TwilioSMSNotificationStrategy() {
30
+ var _this;
31
+ _classCallCheck(this, TwilioSMSNotificationStrategy);
32
+ _this = _super.call(this);
33
+ _this.twilioClient = twilio(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);
34
+ return _this;
35
+ }
36
+ _createClass(TwilioSMSNotificationStrategy, [{
37
+ key: "sendNotification",
38
+ value: function () {
39
+ var _sendNotification = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(to, message) {
40
+ var response;
41
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
42
+ while (1) switch (_context.prev = _context.next) {
43
+ case 0:
44
+ _context.next = 2;
45
+ return this.twilioClient.messages.create({
46
+ to: to,
47
+ from: process.env.TWILIO_PHONE_NUMBER,
48
+ body: message
49
+ });
50
+ case 2:
51
+ response = _context.sent;
52
+ return _context.abrupt("return", response.sid);
53
+ case 4:
54
+ case "end":
55
+ return _context.stop();
56
+ }
57
+ }, _callee, this);
58
+ }));
59
+ function sendNotification(_x, _x2) {
60
+ return _sendNotification.apply(this, arguments);
61
+ }
62
+ return sendNotification;
63
+ }()
64
+ }]);
65
+ return TwilioSMSNotificationStrategy;
66
+ }(NotificationStrategy);
67
+ module.exports = {
68
+ TwilioSMSNotificationStrategy: TwilioSMSNotificationStrategy
69
+ };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var React = require("react");
8
+ var _require = require("@react-email/components"),
9
+ Button = _require.Button,
10
+ Container = _require.Container,
11
+ Head = _require.Head,
12
+ Html = _require.Html,
13
+ Img = _require.Img,
14
+ Section = _require.Section,
15
+ Text = _require.Text;
16
+ var NotifLocal = function NotifLocal(_ref) {
17
+ var body = _ref.body,
18
+ app = _ref.app,
19
+ label = _ref.label,
20
+ url = _ref.url;
21
+ var getLogoUrl = function getLogoUrl(app) {
22
+ switch (app) {
23
+ case "hubhub":
24
+ return "/assets/logos/hubhub.svg";
25
+ case "propro":
26
+ return "/assets/logos/propro.svg";
27
+ default:
28
+ return "/assets/logos/hubhub.svg";
29
+ }
30
+ };
31
+ return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null), /*#__PURE__*/React.createElement(Section, {
32
+ style: main
33
+ }, /*#__PURE__*/React.createElement(Container, {
34
+ style: container
35
+ }, /*#__PURE__*/React.createElement(Img, {
36
+ src: getLogoUrl(app)
37
+ }), /*#__PURE__*/React.createElement(Section, null, /*#__PURE__*/React.createElement(Text, {
38
+ style: text
39
+ }, body || "Default body text here."), label && /*#__PURE__*/React.createElement(Button, {
40
+ href: url,
41
+ style: btn
42
+ }, label)))));
43
+ };
44
+ var main = {
45
+ backgroundColor: "#ffffff",
46
+ margin: "0 auto"
47
+ };
48
+ var container = {
49
+ border: "1px solid #eaeaea",
50
+ borderRadius: "5px",
51
+ margin: "40px auto",
52
+ padding: "20px",
53
+ width: "465px"
54
+ };
55
+ var h1 = {
56
+ color: "#000",
57
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
58
+ fontSize: "24px",
59
+ fontWeight: "normal",
60
+ textAlign: "center",
61
+ margin: "30px 0",
62
+ padding: "0"
63
+ };
64
+ var text = {
65
+ color: "#000",
66
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
67
+ fontSize: "14px",
68
+ lineHeight: "24px"
69
+ };
70
+ var btn = {
71
+ backgroundColor: "#000",
72
+ borderRadius: "5px",
73
+ color: "#fff",
74
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
75
+ fontSize: "12px",
76
+ fontWeight: 500,
77
+ lineHeight: "50px",
78
+ textDecoration: "none",
79
+ textAlign: "center"
80
+ };
81
+ var _default = exports["default"] = NotifLocal;
@@ -0,0 +1,89 @@
1
+ const React = require("react");
2
+ const {
3
+ Button,
4
+ Container,
5
+ Head,
6
+ Html,
7
+ Img,
8
+ Section,
9
+ Text,
10
+ } = require("@react-email/components");
11
+
12
+ const NotifLocal = ({ body, app, label, url }) => {
13
+ const getLogoUrl = (app) => {
14
+ switch (app) {
15
+ case "hubhub":
16
+ return "/assets/logos/hubhub.svg";
17
+ case "propro":
18
+ return "/assets/logos/propro.svg";
19
+ default:
20
+ return "/assets/logos/hubhub.svg";
21
+ }
22
+ };
23
+
24
+ return (
25
+ <Html>
26
+ <Head />
27
+ <Section style={main}>
28
+ <Container style={container}>
29
+ <Img src={getLogoUrl(app)} />
30
+ <Section>
31
+ <Text style={text}>{body || "Default body text here."}</Text>
32
+ {label && (
33
+ <Button href={url} style={btn}>
34
+ {label}
35
+ </Button>
36
+ )}
37
+ </Section>
38
+ </Container>
39
+ </Section>
40
+ </Html>
41
+ );
42
+ };
43
+
44
+ const main = {
45
+ backgroundColor: "#ffffff",
46
+ margin: "0 auto",
47
+ };
48
+
49
+ const container = {
50
+ border: "1px solid #eaeaea",
51
+ borderRadius: "5px",
52
+ margin: "40px auto",
53
+ padding: "20px",
54
+ width: "465px",
55
+ };
56
+
57
+ const h1 = {
58
+ color: "#000",
59
+ fontFamily:
60
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
61
+ fontSize: "24px",
62
+ fontWeight: "normal",
63
+ textAlign: "center",
64
+ margin: "30px 0",
65
+ padding: "0",
66
+ };
67
+
68
+ const text = {
69
+ color: "#000",
70
+ fontFamily:
71
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
72
+ fontSize: "14px",
73
+ lineHeight: "24px",
74
+ };
75
+
76
+ const btn = {
77
+ backgroundColor: "#000",
78
+ borderRadius: "5px",
79
+ color: "#fff",
80
+ fontFamily:
81
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
82
+ fontSize: "12px",
83
+ fontWeight: 500,
84
+ lineHeight: "50px",
85
+ textDecoration: "none",
86
+ textAlign: "center",
87
+ };
88
+
89
+ export default NotifLocal;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Represents a notification service.
3
+ * @class
4
+ */
5
+ class NotificationService {
6
+ constructor(strategy) {
7
+ this.strategy = strategy;
8
+ }
9
+
10
+ setStrategy(strategy) {
11
+ this.strategy = strategy;
12
+ }
13
+
14
+ /**
15
+ * Sends a notification to the specified recipient.
16
+ * @param {string} to - The recipient of the notification.
17
+ * @param {string} message - The message to be sent.
18
+ * @returns {Promise} A promise that resolves when the notification is sent.
19
+ * @throws {Error} If the strategy is not set.
20
+ */
21
+ async sendNotification(to, message) {
22
+ if (!this.strategy) {
23
+ throw new Error("Strategy is not set");
24
+ }
25
+ return this.strategy.sendNotification(to, message);
26
+ }
27
+ }
28
+
29
+ module.exports = {
30
+ NotificationService,
31
+ };