abmp-npm 2.0.20 → 2.0.21
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/backend/members-data-methods.js +7 -21
- package/package.json +1 -1
- package/pages/Home.js +9 -2
- package/pages/personalDetails.js +7 -15
|
@@ -218,8 +218,8 @@ async function updateMember(memberToUpdate) {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
|
-
* Saves member registration data
|
|
222
|
-
* @param {Object} data - Member data to save
|
|
221
|
+
* Saves member registration data
|
|
222
|
+
* @param {Object} data - Member data to save
|
|
223
223
|
* @param {string} id - Member ID
|
|
224
224
|
* @returns {Promise<Object>} Result object with type and data/error
|
|
225
225
|
*/
|
|
@@ -240,29 +240,15 @@ async function saveRegistrationData(data, id) {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
// Fetch existing data to merge with partial update
|
|
244
|
-
const existingMemberData = await findMemberByWixDataId(id);
|
|
245
|
-
|
|
246
|
-
if (!existingMemberData) {
|
|
247
|
-
return {
|
|
248
|
-
type: 'error',
|
|
249
|
-
error: 'Member not found',
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Merge partial data with existing data (incoming data takes precedence)
|
|
254
|
-
const mergedData = {
|
|
255
|
-
...existingMemberData,
|
|
256
|
-
...data,
|
|
257
|
-
};
|
|
258
|
-
|
|
259
243
|
if (data.addresses && Array.isArray(data.addresses)) {
|
|
260
|
-
|
|
244
|
+
data.locHash = generateGeoHash(data.addresses);
|
|
261
245
|
}
|
|
262
246
|
|
|
263
|
-
await
|
|
247
|
+
const existingMemberData = await findMemberByWixDataId(id);
|
|
248
|
+
|
|
249
|
+
await updateMemberContactInfo(data, existingMemberData);
|
|
264
250
|
|
|
265
|
-
const saveData = await updateMember(
|
|
251
|
+
const saveData = await updateMember(data);
|
|
266
252
|
return {
|
|
267
253
|
type: 'success',
|
|
268
254
|
saveData,
|
package/package.json
CHANGED
package/pages/Home.js
CHANGED
|
@@ -211,9 +211,16 @@ const homePageOnReady = async ({
|
|
|
211
211
|
// 5) Location text
|
|
212
212
|
const mainAddress = getMainAddress(itemData.addressDisplayOption, addresses);
|
|
213
213
|
$item('#location').text = mainAddress || '';
|
|
214
|
+
|
|
215
|
+
// 6) Miles away
|
|
216
|
+
const isNearbyEnabled = _$w('#nearBy').checked;
|
|
214
217
|
const miles = itemData.distance ?? 0;
|
|
215
|
-
|
|
216
|
-
if (
|
|
218
|
+
|
|
219
|
+
if (isNearbyEnabled && miles) {
|
|
220
|
+
$item('#differenceInMiles').text = miles.toFixed(1);
|
|
221
|
+
$item('#milesAwayText').text = 'miles away';
|
|
222
|
+
} else {
|
|
223
|
+
$item('#differenceInMiles').text = '';
|
|
217
224
|
$item('#milesAwayText').text = '';
|
|
218
225
|
}
|
|
219
226
|
|
package/pages/personalDetails.js
CHANGED
|
@@ -1087,10 +1087,8 @@ async function personalDetailsOnReady({
|
|
|
1087
1087
|
const personalChanges = getPersonalData();
|
|
1088
1088
|
const originalUrl = beforeData.url;
|
|
1089
1089
|
|
|
1090
|
-
// Only send personal fields + required identifiers (partial update)
|
|
1091
1090
|
const formData = {
|
|
1092
|
-
|
|
1093
|
-
memberId: itemMemberObj.memberId,
|
|
1091
|
+
...itemMemberObj,
|
|
1094
1092
|
...personalChanges,
|
|
1095
1093
|
};
|
|
1096
1094
|
|
|
@@ -1098,7 +1096,7 @@ async function personalDetailsOnReady({
|
|
|
1098
1096
|
console.group('Personal Details Save Attempt');
|
|
1099
1097
|
console.log('Current Data:', beforeData);
|
|
1100
1098
|
console.log('Changes Being Applied:', personalChanges);
|
|
1101
|
-
console.log('Final Form Data
|
|
1099
|
+
console.log('Final Form Data:', formData);
|
|
1102
1100
|
console.groupEnd();
|
|
1103
1101
|
|
|
1104
1102
|
const result = await saveData(formData);
|
|
@@ -1130,10 +1128,8 @@ async function personalDetailsOnReady({
|
|
|
1130
1128
|
const beforeData = JSON.parse(JSON.stringify(itemMemberObj));
|
|
1131
1129
|
const businessChanges = getBusinessAndServicesData();
|
|
1132
1130
|
|
|
1133
|
-
// Only send business fields + required identifiers (partial update)
|
|
1134
1131
|
const formData = {
|
|
1135
|
-
|
|
1136
|
-
memberId: itemMemberObj.memberId,
|
|
1132
|
+
...itemMemberObj,
|
|
1137
1133
|
...businessChanges,
|
|
1138
1134
|
};
|
|
1139
1135
|
|
|
@@ -1141,7 +1137,7 @@ async function personalDetailsOnReady({
|
|
|
1141
1137
|
console.group('Business Services Save Attempt');
|
|
1142
1138
|
console.log('Current Data:', beforeData);
|
|
1143
1139
|
console.log('Changes Being Applied:', businessChanges);
|
|
1144
|
-
console.log('Final Form Data
|
|
1140
|
+
console.log('Final Form Data:', formData);
|
|
1145
1141
|
console.log('Image Changes:', {
|
|
1146
1142
|
profileImage: uploadedImages.profileImage,
|
|
1147
1143
|
logoImage: uploadedImages.logoImage,
|
|
@@ -1963,10 +1959,8 @@ async function personalDetailsOnReady({
|
|
|
1963
1959
|
const beforeData = JSON.parse(JSON.stringify(itemMemberObj));
|
|
1964
1960
|
const contactChanges = getContactAndBookingData();
|
|
1965
1961
|
|
|
1966
|
-
// Only send contact fields + required identifiers (partial update)
|
|
1967
1962
|
const formData = {
|
|
1968
|
-
|
|
1969
|
-
memberId: itemMemberObj.memberId,
|
|
1963
|
+
...itemMemberObj,
|
|
1970
1964
|
...contactChanges,
|
|
1971
1965
|
};
|
|
1972
1966
|
|
|
@@ -1974,7 +1968,7 @@ async function personalDetailsOnReady({
|
|
|
1974
1968
|
console.group('Contact & Booking Save Attempt');
|
|
1975
1969
|
console.log('Current Data:', beforeData);
|
|
1976
1970
|
console.log('Changes Being Applied:', contactChanges);
|
|
1977
|
-
console.log('Final Form Data
|
|
1971
|
+
console.log('Final Form Data:', formData);
|
|
1978
1972
|
console.log('Address Changes:', {
|
|
1979
1973
|
addressCount: contactChanges.addresses?.length || 0,
|
|
1980
1974
|
addressDisplayOptions: contactChanges.addressDisplayOption,
|
|
@@ -2038,10 +2032,8 @@ async function personalDetailsOnReady({
|
|
|
2038
2032
|
}
|
|
2039
2033
|
|
|
2040
2034
|
async function saveGalleryToCMS() {
|
|
2041
|
-
// Only send gallery field + required identifiers (partial update)
|
|
2042
2035
|
const formData = {
|
|
2043
|
-
|
|
2044
|
-
memberId: itemMemberObj.memberId,
|
|
2036
|
+
...itemMemberObj,
|
|
2045
2037
|
gallery: itemMemberObj.gallery,
|
|
2046
2038
|
};
|
|
2047
2039
|
|