abmp-npm 2.0.43 → 2.0.44
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/routers/utils.js +6 -1
- package/package.json +1 -1
- package/pages/personalDetails.js +14 -5
package/backend/routers/utils.js
CHANGED
|
@@ -66,6 +66,11 @@ function transformMemberToProfileData(member, siteAssociation) {
|
|
|
66
66
|
numeric: true,
|
|
67
67
|
})
|
|
68
68
|
) || [];
|
|
69
|
+
|
|
70
|
+
const phones = Array.isArray(member.phones) ? member.phones : [];
|
|
71
|
+
const toShowPhone = member.toShowPhone || '';
|
|
72
|
+
const phone = toShowPhone && phones.includes(toShowPhone) ? toShowPhone : '';
|
|
73
|
+
|
|
69
74
|
return {
|
|
70
75
|
mainAddress,
|
|
71
76
|
testimonials: member.testimonial || [],
|
|
@@ -84,7 +89,7 @@ function transformMemberToProfileData(member, siteAssociation) {
|
|
|
84
89
|
bookingUrl: member.bookingUrl,
|
|
85
90
|
aboutService: member.aboutService,
|
|
86
91
|
businessName: (member.showBusinessName && member.businessName) || '',
|
|
87
|
-
phone
|
|
92
|
+
phone,
|
|
88
93
|
areasOfPractices,
|
|
89
94
|
gallery: member.gallery,
|
|
90
95
|
bannerImages: member.bannerImages,
|
package/package.json
CHANGED
package/pages/personalDetails.js
CHANGED
|
@@ -2122,16 +2122,19 @@ async function personalDetailsOnReady({
|
|
|
2122
2122
|
const phoneToRemove = currentData.find(item => item._id === phoneId);
|
|
2123
2123
|
|
|
2124
2124
|
if (phoneToRemove) {
|
|
2125
|
-
if (itemMemberObj.toShowPhone === phoneToRemove.phoneNumber) {
|
|
2126
|
-
itemMemberObj.toShowPhone = null;
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
2125
|
if (itemMemberObj.phones) {
|
|
2130
2126
|
itemMemberObj.phones = itemMemberObj.phones.filter(
|
|
2131
2127
|
phone => phone !== phoneToRemove.phoneNumber
|
|
2132
2128
|
);
|
|
2133
2129
|
}
|
|
2134
2130
|
|
|
2131
|
+
// Clear toShowPhone if it was the removed phone or if it's no longer in the list
|
|
2132
|
+
// (handles format mismatch e.g. "(406)655-4940" vs "(406) 655-4940")
|
|
2133
|
+
const remainingPhones = Array.isArray(itemMemberObj.phones) ? itemMemberObj.phones : [];
|
|
2134
|
+
if (itemMemberObj.toShowPhone && !remainingPhones.includes(itemMemberObj.toShowPhone)) {
|
|
2135
|
+
itemMemberObj.toShowPhone = null;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2135
2138
|
const updatedData = currentData.filter(item => item._id !== phoneId);
|
|
2136
2139
|
renderPhonesList(updatedData);
|
|
2137
2140
|
checkFormChanges(FORM_SECTION_HANDLER_MAP.CONTACT_BOOKING);
|
|
@@ -2152,7 +2155,13 @@ async function personalDetailsOnReady({
|
|
|
2152
2155
|
}
|
|
2153
2156
|
|
|
2154
2157
|
function getToShowPhone() {
|
|
2155
|
-
|
|
2158
|
+
const phones = Array.isArray(itemMemberObj.phones) ? itemMemberObj.phones : [];
|
|
2159
|
+
const toShow = itemMemberObj.toShowPhone || null;
|
|
2160
|
+
// Never expose toShowPhone when phones is empty, so save payload clears it in CMS
|
|
2161
|
+
if (phones.length === 0) return null;
|
|
2162
|
+
// If toShowPhone is not in the list (e.g. format mismatch), treat as none selected
|
|
2163
|
+
if (toShow && !phones.includes(toShow)) return null;
|
|
2164
|
+
return toShow;
|
|
2156
2165
|
}
|
|
2157
2166
|
|
|
2158
2167
|
function getContactAndBookingData() {
|