abmp-npm 10.0.53 → 10.0.55
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 +5 -2
- package/backend/routers/methods.js +4 -2
- package/backend/tasks/address-primary-methods.js +53 -8
- package/backend/tasks/tasks-helpers-methods.js +1 -1
- package/package.json +1 -1
- package/pages/personalDetails.js +1 -1
- package/public/Utils/sharedUtils.js +8 -3
|
@@ -410,7 +410,8 @@ async function getMembersWithWixUrl() {
|
|
|
410
410
|
.eq('showWixUrl', true)
|
|
411
411
|
.ne('action', MEMBER_ACTIONS.DROP)
|
|
412
412
|
.ne('memberships.membertype', MEMBERSHIPS_TYPES.PAC_STAFF)
|
|
413
|
-
.
|
|
413
|
+
.ne('memberships.membertype', MEMBERSHIPS_TYPES.STUDENT)
|
|
414
|
+
//.isNotEmpty('url') - not used because it's not working as expected
|
|
414
415
|
.limit(1000);
|
|
415
416
|
let currentResults = await membersQuery.find();
|
|
416
417
|
let i = 0;
|
|
@@ -422,7 +423,9 @@ async function getMembersWithWixUrl() {
|
|
|
422
423
|
i++;
|
|
423
424
|
}
|
|
424
425
|
console.log('i is ', i);
|
|
425
|
-
const filtered = allItems.filter(
|
|
426
|
+
const filtered = allItems.filter(
|
|
427
|
+
item => typeof item.url === 'string' && !item.url.includes('/') && item.url !== ''
|
|
428
|
+
);
|
|
426
429
|
console.log('filtered is ', filtered.length);
|
|
427
430
|
return filtered;
|
|
428
431
|
}
|
|
@@ -47,10 +47,12 @@ const createRoutersHandlers = wixRouterMethods => {
|
|
|
47
47
|
}
|
|
48
48
|
const profileUrl = `${request.baseUrl}/${PAGES_PATHS.PROFILE}/${profileData.url}`;
|
|
49
49
|
const isPrivateMember = profileData.isPrivateMember;
|
|
50
|
+
const isStudent = profileData.shouldHaveStudentBadge;
|
|
51
|
+
const shouldNoIndex = isPrivateMember || isStudent;
|
|
50
52
|
const seoData = {
|
|
51
53
|
title: seoTitle,
|
|
52
54
|
description: description,
|
|
53
|
-
noIndex:
|
|
55
|
+
noIndex: shouldNoIndex,
|
|
54
56
|
metaTags: [
|
|
55
57
|
{
|
|
56
58
|
name: 'description',
|
|
@@ -69,7 +71,7 @@ const createRoutersHandlers = wixRouterMethods => {
|
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
73
|
name: 'robots',
|
|
72
|
-
content:
|
|
74
|
+
content: shouldNoIndex ? 'noindex, nofollow' : 'index, follow',
|
|
73
75
|
},
|
|
74
76
|
// Open Graph tags
|
|
75
77
|
{
|
|
@@ -32,7 +32,7 @@ async function scheduleFixPrimaryAddressForMembers() {
|
|
|
32
32
|
|
|
33
33
|
const membersToFix = members.filter(member => {
|
|
34
34
|
const addresses = Array.isArray(member.addresses) ? member.addresses : [];
|
|
35
|
-
if (addresses.length
|
|
35
|
+
if (addresses.length === 0) {
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
return !hasPrimaryAddress(member.addressDisplayOption);
|
|
@@ -45,7 +45,7 @@ async function scheduleFixPrimaryAddressForMembers() {
|
|
|
45
45
|
.filter(memberId => Number.isFinite(memberId) && memberId > 0)
|
|
46
46
|
),
|
|
47
47
|
];
|
|
48
|
-
console.log(`Members with
|
|
48
|
+
console.log(`Members with addresses and no primary: ${memberIds.length}`);
|
|
49
49
|
|
|
50
50
|
if (memberIds.length === 0) {
|
|
51
51
|
console.log('No members need primary address fixes');
|
|
@@ -109,7 +109,7 @@ async function fixPrimaryAddressChunk(data) {
|
|
|
109
109
|
skippedIds: [],
|
|
110
110
|
failedIds: [],
|
|
111
111
|
};
|
|
112
|
-
const
|
|
112
|
+
const skippedNoAddress = [];
|
|
113
113
|
const skippedHasPrimary = [];
|
|
114
114
|
const updatedIds = [];
|
|
115
115
|
|
|
@@ -120,11 +120,11 @@ async function fixPrimaryAddressChunk(data) {
|
|
|
120
120
|
|
|
121
121
|
members.forEach(member => {
|
|
122
122
|
const addresses = Array.isArray(member.addresses) ? member.addresses : [];
|
|
123
|
-
if (addresses.length
|
|
123
|
+
if (addresses.length === 0) {
|
|
124
124
|
result.skipped++;
|
|
125
125
|
result.skippedIds.push(member.memberId);
|
|
126
|
-
if (
|
|
127
|
-
|
|
126
|
+
if (skippedNoAddress.length < 20) {
|
|
127
|
+
skippedNoAddress.push(member.memberId);
|
|
128
128
|
}
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
@@ -191,8 +191,8 @@ async function fixPrimaryAddressChunk(data) {
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
if (
|
|
195
|
-
console.log(`Skipped (
|
|
194
|
+
if (skippedNoAddress.length > 0) {
|
|
195
|
+
console.log(`Skipped (no addresses) sample: ${skippedNoAddress.join(', ')}`);
|
|
196
196
|
}
|
|
197
197
|
if (skippedHasPrimary.length > 0) {
|
|
198
198
|
console.log(`Skipped (already has primary) sample: ${skippedHasPrimary.join(', ')}`);
|
|
@@ -205,7 +205,52 @@ async function fixPrimaryAddressChunk(data) {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Returns count of members with addresses but no primary address.
|
|
210
|
+
*/
|
|
211
|
+
async function countMembersMissingPrimaryAddress() {
|
|
212
|
+
console.log('=== Counting Members Missing Primary Address ===');
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
const membersQuery = await wixData
|
|
216
|
+
.query(COLLECTIONS.MEMBERS_DATA)
|
|
217
|
+
.isNotEmpty('addresses')
|
|
218
|
+
.limit(1000);
|
|
219
|
+
const members = await queryAllItems(membersQuery);
|
|
220
|
+
console.log(`Fetched ${members.length} members with addresses`);
|
|
221
|
+
|
|
222
|
+
const membersToFix = members.filter(member => {
|
|
223
|
+
const addresses = Array.isArray(member.addresses) ? member.addresses : [];
|
|
224
|
+
if (addresses.length === 0) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
return !hasPrimaryAddress(member.addressDisplayOption);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const memberIds = [
|
|
231
|
+
...new Set(
|
|
232
|
+
membersToFix
|
|
233
|
+
.map(member => Number(member.memberId))
|
|
234
|
+
.filter(memberId => Number.isFinite(memberId) && memberId > 0)
|
|
235
|
+
),
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
const result = {
|
|
239
|
+
success: true,
|
|
240
|
+
totalMembers: memberIds.length,
|
|
241
|
+
sampleMemberIds: memberIds.slice(0, 20),
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
console.log(JSON.stringify(result, null, 2));
|
|
245
|
+
return result;
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.error('Error counting members missing primary address:', error);
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
208
252
|
module.exports = {
|
|
209
253
|
scheduleFixPrimaryAddressForMembers,
|
|
210
254
|
fixPrimaryAddressChunk,
|
|
255
|
+
countMembersMissingPrimaryAddress,
|
|
211
256
|
};
|
|
@@ -295,7 +295,7 @@ async function getAWSTokens() {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
async function generateSitemapXml(members) {
|
|
298
|
-
const baseUrl = await getSiteBaseUrl();
|
|
298
|
+
const baseUrl = (await getSiteBaseUrl()).replace(/\/+$/, '');
|
|
299
299
|
const profilePageUrl = `${baseUrl}/${PAGES_PATHS.PROFILE}`;
|
|
300
300
|
const urls = members
|
|
301
301
|
.map(m => {
|
package/package.json
CHANGED
package/pages/personalDetails.js
CHANGED
|
@@ -358,8 +358,8 @@ async function personalDetailsOnReady({
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
function handleOptWebsiteCheckboxEnable(showExistingWebsite) {
|
|
361
|
-
_$w('#optWebsiteCheckbox').checked = !showExistingWebsite;
|
|
362
361
|
if (showExistingWebsite) {
|
|
362
|
+
_$w('#optWebsiteCheckbox').checked = false;
|
|
363
363
|
_$w('#optWebsiteCheckbox').customClassList.add('disabled-text');
|
|
364
364
|
_$w('#optWebsiteCheckbox').customClassList.add('disabled-checkbox');
|
|
365
365
|
_$w('#optWebsiteCheckbox').disable();
|
|
@@ -87,9 +87,11 @@ function findMainAddress(addressDisplayOption = [], addresses = []) {
|
|
|
87
87
|
return '';
|
|
88
88
|
}
|
|
89
89
|
function formatAddress(item) {
|
|
90
|
+
if (!item) return '';
|
|
90
91
|
let addressParts = [];
|
|
91
|
-
const limitedPostalCode = item.postalcode.slice(0, 5); //show only 5 digits to not show full user address
|
|
92
|
-
|
|
92
|
+
const limitedPostalCode = (item.postalcode && String(item.postalcode).slice(0, 5)) || ''; //show only 5 digits to not show full user address
|
|
93
|
+
const status = item.addressStatus;
|
|
94
|
+
switch (status) {
|
|
93
95
|
case ADDRESS_STATUS_TYPES.FULL_ADDRESS:
|
|
94
96
|
addressParts = [item.line1, item.line2, item.city, item.state, limitedPostalCode];
|
|
95
97
|
break;
|
|
@@ -97,7 +99,10 @@ function formatAddress(item) {
|
|
|
97
99
|
addressParts = [item.city, item.state, limitedPostalCode];
|
|
98
100
|
break;
|
|
99
101
|
default:
|
|
100
|
-
return '';
|
|
102
|
+
if (status === ADDRESS_STATUS_TYPES.DONT_SHOW) return '';
|
|
103
|
+
// Legacy addresses may have no addressStatus; show city/state/zip by default
|
|
104
|
+
addressParts = [item.city, item.state, limitedPostalCode];
|
|
105
|
+
break;
|
|
101
106
|
}
|
|
102
107
|
return addressParts.filter(Boolean).join(', ');
|
|
103
108
|
}
|