abmp-npm 1.1.102 → 1.1.103
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.
|
@@ -84,11 +84,10 @@ async function updateContactEmail(contactId, newEmail) {
|
|
|
84
84
|
* Updates contact names in Wix CRM for both contact and member
|
|
85
85
|
* @param {Object} params - Parameters object
|
|
86
86
|
* @param {string} params.wixContactId - The contact ID in Wix CRM
|
|
87
|
-
* @param {string} params.wixMemberId - The member ID in Wix CRM
|
|
88
87
|
* @param {string} params.firstName - The new first name
|
|
89
88
|
* @param {string} params.lastName - The new last name
|
|
90
89
|
*/
|
|
91
|
-
async function updateMemberAndContactNames({ wixContactId,
|
|
90
|
+
async function updateMemberAndContactNames({ wixContactId, firstName, lastName }) {
|
|
92
91
|
//TODO: rethink if we should keep all info just in contact, meaning no need to update the member
|
|
93
92
|
if (!firstName && !lastName) {
|
|
94
93
|
throw new Error('At least one name field is required');
|
|
@@ -104,7 +103,7 @@ async function updateMemberAndContactNames({ wixContactId, wixMemberId, firstNam
|
|
|
104
103
|
|
|
105
104
|
const updatePromises = [
|
|
106
105
|
wixContactId && updateContactInfo(wixContactId, createNameUpdate, 'update contact names'),
|
|
107
|
-
wixMemberId && updateContactInfo(wixMemberId, createNameUpdate, 'update member names'),
|
|
106
|
+
// wixMemberId && updateContactInfo(wixMemberId, createNameUpdate, 'update member names'),
|
|
108
107
|
].filter(Boolean);
|
|
109
108
|
|
|
110
109
|
return await Promise.all(updatePromises);
|
|
@@ -129,7 +128,7 @@ const updateIfChanged = (existingValues, newValues, updater, argsBuilder) => {
|
|
|
129
128
|
* @param {Object} existingMemberData - Existing member data
|
|
130
129
|
*/
|
|
131
130
|
const updateMemberContactInfo = async (data, existingMemberData) => {
|
|
132
|
-
const { wixContactId
|
|
131
|
+
const { wixContactId } = existingMemberData;
|
|
133
132
|
|
|
134
133
|
const updateConfig = [
|
|
135
134
|
{
|
|
@@ -140,7 +139,7 @@ const updateMemberContactInfo = async (data, existingMemberData) => {
|
|
|
140
139
|
{
|
|
141
140
|
fields: ['firstName', 'lastName'],
|
|
142
141
|
updater: updateMemberAndContactNames,
|
|
143
|
-
args: ([firstName, lastName]) => [{ firstName, lastName, wixContactId
|
|
142
|
+
args: ([firstName, lastName]) => [{ firstName, lastName, wixContactId }],
|
|
144
143
|
},
|
|
145
144
|
];
|
|
146
145
|
|
|
@@ -3,15 +3,15 @@ const { members, authentication } = require('@wix/members');
|
|
|
3
3
|
const elevatedCreateMember = auth.elevate(members.createMember);
|
|
4
4
|
|
|
5
5
|
function prepareMemberData(partner) {
|
|
6
|
-
const phones = Array.isArray(partner.phones) ? partner.phones : []; //some users don't have phones
|
|
6
|
+
// const phones = Array.isArray(partner.phones) ? partner.phones : []; //some users don't have phones
|
|
7
7
|
const options = {
|
|
8
8
|
member: {
|
|
9
|
-
//Keeping contact creation in member data for future purposes, in case we need to use it later
|
|
10
|
-
contact: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
9
|
+
// //Keeping contact creation in member data for future purposes, in case we need to use it later
|
|
10
|
+
// contact: {
|
|
11
|
+
// ...partner,
|
|
12
|
+
// phones,
|
|
13
|
+
// emails: [partner.contactFormEmail || partner.email],
|
|
14
|
+
// },
|
|
15
15
|
loginEmail: partner.email,
|
|
16
16
|
},
|
|
17
17
|
};
|