abmp-npm 2.0.46 → 2.0.47
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,7 +410,6 @@ 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)
|
|
414
413
|
.isNotEmpty('url')
|
|
415
414
|
.limit(1000);
|
|
416
415
|
let currentResults = await membersQuery.find();
|
|
@@ -47,12 +47,10 @@ 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;
|
|
52
50
|
const seoData = {
|
|
53
51
|
title: seoTitle,
|
|
54
52
|
description: description,
|
|
55
|
-
noIndex:
|
|
53
|
+
noIndex: isPrivateMember,
|
|
56
54
|
metaTags: [
|
|
57
55
|
{
|
|
58
56
|
name: 'description',
|
|
@@ -71,7 +69,7 @@ const createRoutersHandlers = wixRouterMethods => {
|
|
|
71
69
|
},
|
|
72
70
|
{
|
|
73
71
|
name: 'robots',
|
|
74
|
-
content:
|
|
72
|
+
content: isPrivateMember ? 'noindex, nofollow' : 'index, follow',
|
|
75
73
|
},
|
|
76
74
|
// Open Graph tags
|
|
77
75
|
{
|
package/package.json
CHANGED
package/pages/Home.js
CHANGED
|
@@ -366,7 +366,7 @@ const homePageOnReady = async ({
|
|
|
366
366
|
isSearchingNearby: _$w('#nearBy').checked,
|
|
367
367
|
preservePagination,
|
|
368
368
|
});
|
|
369
|
-
|
|
369
|
+
!preservePagination && (await updateUrlParams(filter, pagination));
|
|
370
370
|
return searchResults;
|
|
371
371
|
}
|
|
372
372
|
|
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();
|
package/public/Utils/homePage.js
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
const { location: wixLocation, queryParams: wixQueryParams } = require('@wix/site-location');
|
|
2
2
|
const { window: wixWindow, rendering } = require('@wix/site-window');
|
|
3
3
|
|
|
4
|
-
const { DEFAULT_FILTER
|
|
4
|
+
const { DEFAULT_FILTER } = require('../consts.js');
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
8
|
-
const r = (Math.random() * 16) | 0;
|
|
9
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
10
|
-
return v.toString(16);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
6
|
+
const { debouncedFunction } = require('./sharedUtils.js');
|
|
13
7
|
|
|
14
8
|
const createHomepageUtils = (_$w, filterProfiles) => {
|
|
15
|
-
let currentSearchId = null;
|
|
16
|
-
let searchDebounceTimer = null;
|
|
17
|
-
let lastSearchFilter = null;
|
|
18
|
-
let lastSearchIsSearchingNearby = false;
|
|
19
|
-
let lastSearchPreservePagination = false;
|
|
20
|
-
let pendingSearchResolve = null;
|
|
21
|
-
|
|
22
9
|
const getFiltersSelectors = filterName => ({
|
|
23
10
|
checkBoxContainerSelector: _$w(`#${filterName}CheckBoxContainer`),
|
|
24
11
|
searchTextInputSelector: _$w(`#${filterName}TextInput`),
|
|
@@ -668,14 +655,13 @@ const createHomepageUtils = (_$w, filterProfiles) => {
|
|
|
668
655
|
async function search({
|
|
669
656
|
filter,
|
|
670
657
|
pagination,
|
|
671
|
-
debounceTimeout
|
|
658
|
+
debounceTimeout,
|
|
672
659
|
timeoutType,
|
|
673
660
|
isSearchingNearby,
|
|
674
661
|
preservePagination = false,
|
|
675
662
|
}) {
|
|
676
663
|
const multiStateBoxSelector = _$w('#resultsStateBox');
|
|
677
664
|
const renderingEnv = await rendering.env();
|
|
678
|
-
|
|
679
665
|
const initSearchResultsUI = () => {
|
|
680
666
|
JSON.stringify(filter) === JSON.stringify(DEFAULT_FILTER)
|
|
681
667
|
? _$w('#resetFilter').hide()
|
|
@@ -686,115 +672,70 @@ const createHomepageUtils = (_$w, filterProfiles) => {
|
|
|
686
672
|
_$w('#profileRepeater').data = [];
|
|
687
673
|
console.log({ filter });
|
|
688
674
|
};
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
filterToUse,
|
|
692
|
-
isSearchingNearbyToUse,
|
|
693
|
-
preservePaginationToUse
|
|
694
|
-
) => {
|
|
695
|
-
if (!isSearchingNearbyToUse) {
|
|
675
|
+
const runSearchAndUpdateUI = async (filter, isSearchingNearby) => {
|
|
676
|
+
if (!isSearchingNearby) {
|
|
696
677
|
if (
|
|
697
678
|
JSON.stringify({
|
|
698
|
-
...
|
|
679
|
+
...filter,
|
|
699
680
|
latitude: 0,
|
|
700
681
|
longitude: 0,
|
|
701
682
|
}) === JSON.stringify(DEFAULT_FILTER)
|
|
702
683
|
) {
|
|
703
684
|
multiStateBoxSelector.changeState('noSearchCriteria');
|
|
704
|
-
await updateUrlParams(filterToUse, pagination);
|
|
705
685
|
return [];
|
|
706
686
|
}
|
|
707
687
|
}
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
688
|
+
const nonDebouncedFilterProfiles = async () => {
|
|
689
|
+
try {
|
|
690
|
+
const result = await filterProfiles({ filter, isSearchingNearby });
|
|
691
|
+
return { success: true, response: result };
|
|
692
|
+
} catch (error) {
|
|
693
|
+
return { success: false, error };
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
//Don't run setTimeout on SSR
|
|
697
|
+
const funcPromise =
|
|
698
|
+
renderingEnv === 'backend'
|
|
699
|
+
? () => nonDebouncedFilterProfiles()
|
|
700
|
+
: () =>
|
|
701
|
+
debouncedFunction({
|
|
702
|
+
func: filterProfiles,
|
|
703
|
+
debounceTimeout,
|
|
704
|
+
timeoutType,
|
|
705
|
+
args: { filter, isSearchingNearby },
|
|
706
|
+
});
|
|
707
|
+
const { success, response, error } = await funcPromise();
|
|
708
|
+
if (!success) {
|
|
719
709
|
_$w('#numberOfResults').text = '';
|
|
720
710
|
console.error('[search] failed with error:', error);
|
|
721
711
|
multiStateBoxSelector.changeState('errorState');
|
|
722
|
-
await updateUrlParams(filterToUse, pagination);
|
|
723
712
|
return [];
|
|
724
713
|
}
|
|
725
|
-
|
|
726
|
-
if (thisSearchId !== currentSearchId) return [];
|
|
727
|
-
|
|
728
|
-
const response = result;
|
|
729
714
|
const totalCount = response.items.length;
|
|
730
715
|
if (!totalCount) {
|
|
731
716
|
_$w('#numberOfResults').text = 'Showing 0 results';
|
|
732
717
|
_$w('#noResultsMessage').text = `${
|
|
733
|
-
|
|
734
|
-
? `'${
|
|
718
|
+
filter.searchText && filter.searchText.length > 0
|
|
719
|
+
? `'${filter.searchText}' did not match any search. Please try again.`
|
|
735
720
|
: 'No results found for the selected filters. Please adjust your filters and try again'
|
|
736
721
|
}`;
|
|
737
722
|
multiStateBoxSelector.changeState('noResultsState');
|
|
738
|
-
await updateUrlParams(filterToUse, pagination);
|
|
739
723
|
return [];
|
|
740
724
|
}
|
|
741
725
|
console.log({ response });
|
|
742
726
|
handleNumberOfResults(pagination, totalCount);
|
|
743
727
|
_$w('#showingResult').show();
|
|
744
728
|
|
|
745
|
-
if (!
|
|
729
|
+
if (!preservePagination || pagination.currentPage >= pagination.totalPages) {
|
|
746
730
|
pagination.currentPage = 0;
|
|
747
731
|
}
|
|
748
732
|
pagination.totalPages = Math.ceil(totalCount / pagination.pageSize);
|
|
749
733
|
paginateSearchResults(response.items, pagination);
|
|
750
734
|
multiStateBoxSelector.changeState('resultsState');
|
|
751
|
-
await updateUrlParams(filterToUse, pagination);
|
|
752
735
|
return response.items;
|
|
753
736
|
};
|
|
754
|
-
|
|
755
|
-
// Always show loading as soon as user changes input
|
|
756
737
|
initSearchResultsUI();
|
|
757
|
-
|
|
758
|
-
// SSR: run immediately, no debounce
|
|
759
|
-
if (renderingEnv === 'backend') {
|
|
760
|
-
return await runSearchAndUpdateUI(filter, isSearchingNearby, preservePagination);
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
// Client: debounce the API call; loading is already shown above.
|
|
764
|
-
// Snapshot the filter so rapid clicks / URL sync can't mutate it before the debounced run.
|
|
765
|
-
lastSearchFilter = JSON.parse(JSON.stringify(filter));
|
|
766
|
-
lastSearchIsSearchingNearby = isSearchingNearby;
|
|
767
|
-
lastSearchPreservePagination = preservePagination;
|
|
768
|
-
|
|
769
|
-
if (pendingSearchResolve) {
|
|
770
|
-
pendingSearchResolve([]);
|
|
771
|
-
pendingSearchResolve = null;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
if (searchDebounceTimer) {
|
|
775
|
-
clearTimeout(searchDebounceTimer);
|
|
776
|
-
searchDebounceTimer = null;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
const delay = DEBOUNCE_DELAY[timeoutType] ?? 300;
|
|
780
|
-
return new Promise(resolve => {
|
|
781
|
-
pendingSearchResolve = resolve;
|
|
782
|
-
searchDebounceTimer = setTimeout(async () => {
|
|
783
|
-
searchDebounceTimer = null;
|
|
784
|
-
const filterToUse = lastSearchFilter;
|
|
785
|
-
const isSearchingNearbyToUse = lastSearchIsSearchingNearby;
|
|
786
|
-
const preservePaginationToUse = lastSearchPreservePagination;
|
|
787
|
-
const items = await runSearchAndUpdateUI(
|
|
788
|
-
filterToUse,
|
|
789
|
-
isSearchingNearbyToUse,
|
|
790
|
-
preservePaginationToUse
|
|
791
|
-
);
|
|
792
|
-
if (pendingSearchResolve) {
|
|
793
|
-
pendingSearchResolve(items);
|
|
794
|
-
pendingSearchResolve = null;
|
|
795
|
-
}
|
|
796
|
-
}, delay);
|
|
797
|
-
});
|
|
738
|
+
return await runSearchAndUpdateUI(filter, isSearchingNearby);
|
|
798
739
|
}
|
|
799
740
|
|
|
800
741
|
return {
|
|
@@ -87,11 +87,9 @@ function findMainAddress(addressDisplayOption = [], addresses = []) {
|
|
|
87
87
|
return '';
|
|
88
88
|
}
|
|
89
89
|
function formatAddress(item) {
|
|
90
|
-
if (!item) return '';
|
|
91
90
|
let addressParts = [];
|
|
92
|
-
const limitedPostalCode =
|
|
93
|
-
|
|
94
|
-
switch (status) {
|
|
91
|
+
const limitedPostalCode = item.postalcode.slice(0, 5); //show only 5 digits to not show full user address
|
|
92
|
+
switch (item.addressStatus) {
|
|
95
93
|
case ADDRESS_STATUS_TYPES.FULL_ADDRESS:
|
|
96
94
|
addressParts = [item.line1, item.line2, item.city, item.state, limitedPostalCode];
|
|
97
95
|
break;
|
|
@@ -99,10 +97,7 @@ function formatAddress(item) {
|
|
|
99
97
|
addressParts = [item.city, item.state, limitedPostalCode];
|
|
100
98
|
break;
|
|
101
99
|
default:
|
|
102
|
-
|
|
103
|
-
// Legacy addresses may have no addressStatus; show city/state/zip by default
|
|
104
|
-
addressParts = [item.city, item.state, limitedPostalCode];
|
|
105
|
-
break;
|
|
100
|
+
return '';
|
|
106
101
|
}
|
|
107
102
|
return addressParts.filter(Boolean).join(', ');
|
|
108
103
|
}
|