abmp-npm 1.8.33 → 1.8.35
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.
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
const { contacts } = require('@wix/crm');
|
|
2
2
|
const { auth } = require('@wix/essentials');
|
|
3
|
+
|
|
3
4
|
const elevatedGetContact = auth.elevate(contacts.getContact);
|
|
4
5
|
const elevatedUpdateContact = auth.elevate(contacts.updateContact);
|
|
5
6
|
|
|
6
|
-
const { findMemberByWixDataId } = require('./members-data-methods');
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Generic contact update helper function
|
|
10
9
|
* @param {string} contactId - The contact ID in Wix CRM
|
|
@@ -94,12 +93,11 @@ const updateIfChanged = (existingValues, newValues, updater, argsBuilder) => {
|
|
|
94
93
|
|
|
95
94
|
/**
|
|
96
95
|
* Updates member contact information in CRM if fields have changed
|
|
97
|
-
* @param {string} id - Member ID
|
|
98
96
|
* @param {Object} data - New member data
|
|
97
|
+
* @param {Object} existingMemberData - Existing member data
|
|
99
98
|
*/
|
|
100
|
-
const updateMemberContactInfo = async (
|
|
101
|
-
const
|
|
102
|
-
const { contactId } = existing;
|
|
99
|
+
const updateMemberContactInfo = async (data, existingMemberData) => {
|
|
100
|
+
const { contactId } = existingMemberData;
|
|
103
101
|
|
|
104
102
|
const updateConfig = [
|
|
105
103
|
{
|
|
@@ -116,7 +114,7 @@ const updateMemberContactInfo = async (id, data) => {
|
|
|
116
114
|
|
|
117
115
|
const updatePromises = updateConfig
|
|
118
116
|
.map(({ fields, updater, args }) => {
|
|
119
|
-
const existingValues = fields.map(field =>
|
|
117
|
+
const existingValues = fields.map(field => existingMemberData[field]);
|
|
120
118
|
const newValues = fields.map(field => data[field]);
|
|
121
119
|
return updateIfChanged(existingValues, newValues, updater, args);
|
|
122
120
|
})
|
|
@@ -267,7 +267,9 @@ async function saveRegistrationData(data, id) {
|
|
|
267
267
|
data.locHash = generateGeoHash(data.addresses);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
await
|
|
270
|
+
const existingMemberData = await findMemberByWixDataId(id);
|
|
271
|
+
|
|
272
|
+
await updateMemberContactInfo(data, existingMemberData);
|
|
271
273
|
|
|
272
274
|
const saveData = await wixData.update(COLLECTIONS.MEMBERS_DATA, data);
|
|
273
275
|
return {
|
package/package.json
CHANGED
package/pages/personalDetails.js
CHANGED
|
@@ -85,6 +85,8 @@ async function personalDetailsOnReady({
|
|
|
85
85
|
ERROR: 'There was an error. Please try again.',
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
_$w('#mainMultiStateBox').changeState(MAIN_STATE_BOX_STATES.LOADING_STATE);
|
|
89
|
+
|
|
88
90
|
// Set up handler functions with access to closures
|
|
89
91
|
FORM_SECTION_HANDLER_MAP.PERSONAL.handler = () => checkPersonalDataChanged();
|
|
90
92
|
FORM_SECTION_HANDLER_MAP.BUSINESS_SERVICES.handler = () => checkBusinessDataChanged();
|