backend-manager 5.0.93 → 5.0.94
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/package.json +1 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/one-time/purchase-completed.js +0 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/send-email.js +4 -5
- package/src/manager/events/firestore/payments-webhooks/transitions/subscription/cancellation-requested.js +0 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/subscription/new-subscription.js +0 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/subscription/payment-failed.js +0 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/subscription/payment-recovered.js +0 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/subscription/plan-changed.js +0 -1
- package/src/manager/events/firestore/payments-webhooks/transitions/subscription/subscription-cancelled.js +0 -1
- package/src/manager/libraries/email.js +2 -1
package/package.json
CHANGED
|
@@ -12,16 +12,15 @@ const moment = require('moment');
|
|
|
12
12
|
* @param {string} options.subject - Email subject line
|
|
13
13
|
* @param {string[]} options.categories - SendGrid categories for filtering
|
|
14
14
|
* @param {object} options.data - Template data (passed as-is to the email)
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {object} options.userDoc - User document data (used to get email directly, avoids race conditions)
|
|
15
|
+
* @param {object} options.userDoc - User document data (already fetched by on-write.js)
|
|
17
16
|
* @param {object} options.assistant - Assistant instance
|
|
18
17
|
*/
|
|
19
|
-
function sendOrderEmail({ template, subject, categories, data,
|
|
18
|
+
function sendOrderEmail({ template, subject, categories, data, userDoc, assistant }) {
|
|
20
19
|
const email = assistant.Manager.Email(assistant);
|
|
21
20
|
|
|
22
|
-
// Use email directly from userDoc (already fetched by on-write.js, avoids redundant Firestore lookup)
|
|
23
21
|
const userEmail = userDoc?.auth?.email;
|
|
24
22
|
const userName = userDoc?.personal?.name?.first;
|
|
23
|
+
const uid = userDoc?.auth?.uid;
|
|
25
24
|
|
|
26
25
|
if (!userEmail) {
|
|
27
26
|
assistant.error(`sendOrderEmail(): No email found for uid=${uid}, skipping`);
|
|
@@ -33,7 +32,7 @@ function sendOrderEmail({ template, subject, categories, data, uid, userDoc, ass
|
|
|
33
32
|
subject,
|
|
34
33
|
template,
|
|
35
34
|
categories,
|
|
36
|
-
copy:
|
|
35
|
+
copy: true,
|
|
37
36
|
data,
|
|
38
37
|
};
|
|
39
38
|
|
|
@@ -11,7 +11,6 @@ module.exports = async function ({ before, after, order, uid, userDoc, assistant
|
|
|
11
11
|
template: 'main/order/cancellation-requested',
|
|
12
12
|
subject: 'Your subscription cancellation is confirmed',
|
|
13
13
|
categories: ['order/cancellation-requested'],
|
|
14
|
-
uid,
|
|
15
14
|
userDoc,
|
|
16
15
|
assistant,
|
|
17
16
|
data: {
|
package/src/manager/events/firestore/payments-webhooks/transitions/subscription/new-subscription.js
CHANGED
|
@@ -14,7 +14,6 @@ module.exports = async function ({ before, after, order, uid, userDoc, assistant
|
|
|
14
14
|
template: 'main/order/confirmation',
|
|
15
15
|
subject: isTrial ? 'Your free trial has started!' : 'Your subscription is confirmed!',
|
|
16
16
|
categories: ['order/confirmation'],
|
|
17
|
-
uid,
|
|
18
17
|
userDoc,
|
|
19
18
|
assistant,
|
|
20
19
|
data: {
|
|
@@ -103,6 +103,8 @@ Email.prototype.build = async function (settings) {
|
|
|
103
103
|
throw errorWithCode('Missing brand.contact.email in backend-manager-config.json', 400);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
const copy = settings.copy ?? true;
|
|
107
|
+
|
|
106
108
|
// Add carbon copy recipients
|
|
107
109
|
if (copy) {
|
|
108
110
|
cc.push({
|
|
@@ -146,7 +148,6 @@ Email.prototype.build = async function (settings) {
|
|
|
146
148
|
|
|
147
149
|
const templateId = TEMPLATES[settings.template] || settings.template || TEMPLATES['default'];
|
|
148
150
|
const groupId = GROUPS[settings.group] || settings.group || GROUPS['default'];
|
|
149
|
-
const copy = settings.copy ?? true;
|
|
150
151
|
|
|
151
152
|
// Build categories
|
|
152
153
|
const categories = _.uniq([
|