abmp-npm 10.0.52 → 10.0.54

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.
@@ -410,6 +410,7 @@ 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
+ .ne('memberships.membertype', MEMBERSHIPS_TYPES.STUDENT)
413
414
  .isNotEmpty('url')
414
415
  .limit(1000);
415
416
  let currentResults = await membersQuery.find();
@@ -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: isPrivateMember,
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: isPrivateMember ? 'noindex, nofollow' : 'index, follow',
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 <= 1) {
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 multiple addresses and no primary: ${memberIds.length}`);
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 skippedNoMultiAddress = [];
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 <= 1) {
123
+ if (addresses.length === 0) {
124
124
  result.skipped++;
125
125
  result.skippedIds.push(member.memberId);
126
- if (skippedNoMultiAddress.length < 20) {
127
- skippedNoMultiAddress.push(member.memberId);
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 (skippedNoMultiAddress.length > 0) {
195
- console.log(`Skipped (<=1 address) sample: ${skippedNoMultiAddress.join(', ')}`);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "10.0.52",
3
+ "version": "10.0.54",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "check-cycles": "madge --circular .",
package/pages/Home.js CHANGED
@@ -366,7 +366,7 @@ const homePageOnReady = async ({
366
366
  isSearchingNearby: _$w('#nearBy').checked,
367
367
  preservePagination,
368
368
  });
369
- !preservePagination && (await updateUrlParams(filter, pagination));
369
+ // URL is updated inside search() with the filter actually used (avoids rapid select/deselect overwriting with live filter)
370
370
  return searchResults;
371
371
  }
372
372
 
@@ -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();
@@ -668,7 +668,7 @@ const createHomepageUtils = (_$w, filterProfiles) => {
668
668
  async function search({
669
669
  filter,
670
670
  pagination,
671
- debounceTimeout,
671
+ debounceTimeout: _debounceTimeout,
672
672
  timeoutType,
673
673
  isSearchingNearby,
674
674
  preservePagination = false,
@@ -687,7 +687,11 @@ const createHomepageUtils = (_$w, filterProfiles) => {
687
687
  console.log({ filter });
688
688
  };
689
689
 
690
- const runSearchAndUpdateUI = async (filterToUse, isSearchingNearbyToUse, preservePaginationToUse) => {
690
+ const runSearchAndUpdateUI = async (
691
+ filterToUse,
692
+ isSearchingNearbyToUse,
693
+ preservePaginationToUse
694
+ ) => {
691
695
  if (!isSearchingNearbyToUse) {
692
696
  if (
693
697
  JSON.stringify({
@@ -697,6 +701,7 @@ const createHomepageUtils = (_$w, filterProfiles) => {
697
701
  }) === JSON.stringify(DEFAULT_FILTER)
698
702
  ) {
699
703
  multiStateBoxSelector.changeState('noSearchCriteria');
704
+ await updateUrlParams(filterToUse, pagination);
700
705
  return [];
701
706
  }
702
707
  }
@@ -705,12 +710,16 @@ const createHomepageUtils = (_$w, filterProfiles) => {
705
710
 
706
711
  let result;
707
712
  try {
708
- result = await filterProfiles({ filter: filterToUse, isSearchingNearby: isSearchingNearbyToUse });
713
+ result = await filterProfiles({
714
+ filter: filterToUse,
715
+ isSearchingNearby: isSearchingNearbyToUse,
716
+ });
709
717
  } catch (error) {
710
718
  if (thisSearchId !== currentSearchId) return [];
711
719
  _$w('#numberOfResults').text = '';
712
720
  console.error('[search] failed with error:', error);
713
721
  multiStateBoxSelector.changeState('errorState');
722
+ await updateUrlParams(filterToUse, pagination);
714
723
  return [];
715
724
  }
716
725
 
@@ -726,6 +735,7 @@ const createHomepageUtils = (_$w, filterProfiles) => {
726
735
  : 'No results found for the selected filters. Please adjust your filters and try again'
727
736
  }`;
728
737
  multiStateBoxSelector.changeState('noResultsState');
738
+ await updateUrlParams(filterToUse, pagination);
729
739
  return [];
730
740
  }
731
741
  console.log({ response });
@@ -738,6 +748,7 @@ const createHomepageUtils = (_$w, filterProfiles) => {
738
748
  pagination.totalPages = Math.ceil(totalCount / pagination.pageSize);
739
749
  paginateSearchResults(response.items, pagination);
740
750
  multiStateBoxSelector.changeState('resultsState');
751
+ await updateUrlParams(filterToUse, pagination);
741
752
  return response.items;
742
753
  };
743
754
 
@@ -773,7 +784,11 @@ const createHomepageUtils = (_$w, filterProfiles) => {
773
784
  const filterToUse = lastSearchFilter;
774
785
  const isSearchingNearbyToUse = lastSearchIsSearchingNearby;
775
786
  const preservePaginationToUse = lastSearchPreservePagination;
776
- const items = await runSearchAndUpdateUI(filterToUse, isSearchingNearbyToUse, preservePaginationToUse);
787
+ const items = await runSearchAndUpdateUI(
788
+ filterToUse,
789
+ isSearchingNearbyToUse,
790
+ preservePaginationToUse
791
+ );
777
792
  if (pendingSearchResolve) {
778
793
  pendingSearchResolve(items);
779
794
  pendingSearchResolve = null;
@@ -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
- switch (item.addressStatus) {
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
  }