abmp-npm 1.1.84 → 1.1.85
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { getMainAddress } = require('../../public/Utils/sharedUtils');
|
|
2
2
|
const { getMemberBySlug } = require('../members-data-methods');
|
|
3
3
|
const {
|
|
4
|
-
|
|
4
|
+
getMoreAddressesToDisplay,
|
|
5
5
|
formatDateToMonthYear,
|
|
6
6
|
hasStudentMembership,
|
|
7
7
|
isPAC_STAFF,
|
|
@@ -48,7 +48,10 @@ function transformMemberToProfileData(member, siteAssociation) {
|
|
|
48
48
|
?.map(val => val.license)
|
|
49
49
|
.filter(Boolean)
|
|
50
50
|
.join(', ');
|
|
51
|
-
const
|
|
51
|
+
const moreAddressesToDisplay = getMoreAddressesToDisplay(
|
|
52
|
+
member.addresses,
|
|
53
|
+
member.addressDisplayOption
|
|
54
|
+
);
|
|
52
55
|
|
|
53
56
|
const memberships = member.memberships || [];
|
|
54
57
|
const siteAssociationMembership = memberships.find(m => m.association === siteAssociation);
|
|
@@ -67,7 +70,7 @@ function transformMemberToProfileData(member, siteAssociation) {
|
|
|
67
70
|
mainAddress,
|
|
68
71
|
testimonials: member.testimonial || [],
|
|
69
72
|
licenceNo,
|
|
70
|
-
|
|
73
|
+
moreAddressesToDisplay,
|
|
71
74
|
memberSince:
|
|
72
75
|
(member.showABMP &&
|
|
73
76
|
siteAssociationMembership &&
|
package/backend/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ const { site } = require('@wix/urls');
|
|
|
4
4
|
const { encode } = require('ngeohash');
|
|
5
5
|
|
|
6
6
|
const { COLLECTIONS, ADDRESS_STATUS_TYPES } = require('../public/consts');
|
|
7
|
-
const { formatAddress, generateId } = require('../public/Utils/sharedUtils');
|
|
7
|
+
const { formatAddress, generateId, findMainAddress } = require('../public/Utils/sharedUtils');
|
|
8
8
|
|
|
9
9
|
const { CONFIG_KEYS, GEO_HASH_PRECISION, MEMBERSHIPS_TYPES } = require('./consts');
|
|
10
10
|
const { wixData } = require('./elevated-modules');
|
|
@@ -91,18 +91,17 @@ function getAddressDisplayOptions(member) {
|
|
|
91
91
|
}
|
|
92
92
|
return displayOptions;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function getMoreAddressesToDisplay(addresses = [], addressDisplayOption = []) {
|
|
95
95
|
const visible = addresses.filter(addr => addr.addressStatus !== ADDRESS_STATUS_TYPES.DONT_SHOW);
|
|
96
96
|
if (visible.length < 2) {
|
|
97
97
|
return [];
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
const
|
|
99
|
+
const mainAddress = findMainAddress(addressDisplayOption, addresses);
|
|
100
|
+
const remainingAddressesToFormat = mainAddress
|
|
101
|
+
? visible.filter(addr => addr?.key !== mainAddress.key)
|
|
102
|
+
: visible;
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
const addressesToFormat = mainOpt ? visible.filter(addr => addr?.key !== mainOpt.key) : visible;
|
|
104
|
-
|
|
105
|
-
return addressesToFormat
|
|
104
|
+
return remainingAddressesToFormat
|
|
106
105
|
.map(addr => {
|
|
107
106
|
const addressString = formatAddress(addr);
|
|
108
107
|
return addressString ? { _id: generateId(), address: addressString } : null;
|
|
@@ -216,7 +215,7 @@ module.exports = {
|
|
|
216
215
|
getSiteBaseUrl,
|
|
217
216
|
encodeXml,
|
|
218
217
|
formatDateOnly,
|
|
219
|
-
|
|
218
|
+
getMoreAddressesToDisplay,
|
|
220
219
|
isPAC_STAFF,
|
|
221
220
|
searchAllItems,
|
|
222
221
|
};
|
package/package.json
CHANGED
package/pages/Profile.js
CHANGED
|
@@ -59,9 +59,9 @@ async function profileOnReady({ $w: _$w }) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function setupAdditionalAddresses() {
|
|
62
|
-
_$w('#moreAdressesRepeater').data = profileData.
|
|
62
|
+
_$w('#moreAdressesRepeater').data = profileData.moreAddressesToDisplay;
|
|
63
63
|
|
|
64
|
-
if (profileData.
|
|
64
|
+
if (profileData.moreAddressesToDisplay.length > 0) {
|
|
65
65
|
_$w('#moreLocationButton').expand();
|
|
66
66
|
_$w('#addressTitle').collapse();
|
|
67
67
|
}
|