abmp-npm 1.1.38 → 1.1.40
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/package.json +1 -1
- package/pages/Home.js +3 -18
- package/public/Utils/homePage.js +4 -17
package/package.json
CHANGED
package/pages/Home.js
CHANGED
|
@@ -33,8 +33,6 @@ const homePageOnReady = async ({
|
|
|
33
33
|
getCompiledFiltersOptions,
|
|
34
34
|
getNonCompiledFiltersOptions,
|
|
35
35
|
filterProfiles,
|
|
36
|
-
logMessage,
|
|
37
|
-
veloGetCurrentGeolocation,
|
|
38
36
|
}) => {
|
|
39
37
|
const {
|
|
40
38
|
getParamsMapping,
|
|
@@ -54,7 +52,7 @@ const homePageOnReady = async ({
|
|
|
54
52
|
updateUrlParams,
|
|
55
53
|
noSearchCriteria,
|
|
56
54
|
search,
|
|
57
|
-
} = createHomepageUtils(_$w, filterProfiles
|
|
55
|
+
} = createHomepageUtils(_$w, filterProfiles);
|
|
58
56
|
detectMobile();
|
|
59
57
|
initPageUI();
|
|
60
58
|
attachEventListeners();
|
|
@@ -306,7 +304,6 @@ const homePageOnReady = async ({
|
|
|
306
304
|
};
|
|
307
305
|
await setFilterFromParams(true);
|
|
308
306
|
if (isDefaultStateParams) {
|
|
309
|
-
logMessage('[applyFilterToUI] default state set for nearby');
|
|
310
307
|
console.log('default state set for nearby');
|
|
311
308
|
await Promise.all([fetchFilterData(), nearByHandler(true)]);
|
|
312
309
|
return;
|
|
@@ -422,19 +419,11 @@ const homePageOnReady = async ({
|
|
|
422
419
|
const { success, filter: newFilter } = await getAndSetUserLocation(isSearchingNearby, filter);
|
|
423
420
|
filter = newFilter;
|
|
424
421
|
console.log('filter inside nearByHandler', filter);
|
|
425
|
-
console.log('success inside nearByHandler', success);
|
|
426
422
|
const renderingEnv = await rendering.env();
|
|
427
423
|
if (!success) {
|
|
428
|
-
logMessage(`[nearByHandler] Failed to get user location in ${renderingEnv}`);
|
|
429
424
|
if (renderingEnv !== 'backend') {
|
|
430
|
-
logMessage(
|
|
431
|
-
`[nearByHandler] Failed to get user location in ${renderingEnv}, changing to nearByState`
|
|
432
|
-
);
|
|
433
425
|
multiStateBoxSelector.changeState('nearByState');
|
|
434
426
|
}
|
|
435
|
-
logMessage(
|
|
436
|
-
`[nearByHandler] continued, multiStateBoxSelector.currentState: ${multiStateBoxSelector.currentState.id}`
|
|
437
|
-
);
|
|
438
427
|
_$w('#nearBy').checked = false;
|
|
439
428
|
updateFiltersState();
|
|
440
429
|
// 4. Re-enable nearby input
|
|
@@ -446,15 +435,11 @@ const homePageOnReady = async ({
|
|
|
446
435
|
if (!isSearchingNearby) {
|
|
447
436
|
if (await noSearchCriteria()) {
|
|
448
437
|
console.log('no search criteria and no near by');
|
|
449
|
-
logMessage(
|
|
450
|
-
`[nearByHandler] no search criteria and no near by, changing to noSearchCriteria`
|
|
451
|
-
);
|
|
452
438
|
multiStateBoxSelector.changeState('noSearchCriteria');
|
|
453
439
|
// 4. Re-enable nearby input
|
|
454
440
|
_$w('#nearBy').enable();
|
|
455
441
|
return;
|
|
456
442
|
}
|
|
457
|
-
logMessage(`[nearByHandler] search criteria and no near by, changing to resultsState`);
|
|
458
443
|
multiStateBoxSelector.changeState('resultsState');
|
|
459
444
|
}
|
|
460
445
|
|
|
@@ -475,7 +460,7 @@ const homePageOnReady = async ({
|
|
|
475
460
|
await withWarmUpData(
|
|
476
461
|
'getCompiledFiltersOptions',
|
|
477
462
|
() => getCompiledFiltersOptions(),
|
|
478
|
-
|
|
463
|
+
console.log
|
|
479
464
|
);
|
|
480
465
|
completeStateList = COMPILED_STATE_LIST;
|
|
481
466
|
areasOfPracticesList = COMPILED_AREAS_OF_PRACTICES;
|
|
@@ -491,7 +476,7 @@ const homePageOnReady = async ({
|
|
|
491
476
|
} = await withWarmUpData(
|
|
492
477
|
'getNonCompiledFiltersOptions',
|
|
493
478
|
() => getNonCompiledFiltersOptions(),
|
|
494
|
-
|
|
479
|
+
console.log
|
|
495
480
|
);
|
|
496
481
|
completeStateList = _completeStateList;
|
|
497
482
|
areasOfPracticesList = _areasOfPracticesList;
|
package/public/Utils/homePage.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const { location: wixLocation, queryParams: wixQueryParams } = require('@wix/site-location');
|
|
2
|
-
const { window: wixWindow
|
|
2
|
+
const { window: wixWindow } = require('@wix/site-window');
|
|
3
3
|
|
|
4
4
|
const { DEFAULT_FILTER } = require('../consts.js');
|
|
5
5
|
|
|
6
6
|
const { debouncedFunction } = require('./sharedUtils.js');
|
|
7
7
|
|
|
8
|
-
const createHomepageUtils = (_$w, filterProfiles
|
|
8
|
+
const createHomepageUtils = (_$w, filterProfiles) => {
|
|
9
9
|
const getFiltersSelectors = filterName => ({
|
|
10
10
|
checkBoxContainerSelector: _$w(`#${filterName}CheckBoxContainer`),
|
|
11
11
|
searchTextInputSelector: _$w(`#${filterName}TextInput`),
|
|
@@ -366,12 +366,7 @@ const createHomepageUtils = (_$w, filterProfiles, veloGetCurrentGeolocation, log
|
|
|
366
366
|
},
|
|
367
367
|
};
|
|
368
368
|
location = await wixWindow.getCurrentGeolocation();
|
|
369
|
-
const renderingEnv = await rendering.env();
|
|
370
369
|
|
|
371
|
-
logMessage(`SDK location inside getAndSetUserLocation in ${renderingEnv}` + location);
|
|
372
|
-
|
|
373
|
-
const veloLocation = await veloGetCurrentGeolocation();
|
|
374
|
-
logMessage(`veloLocation inside getAndSetUserLocation in ${renderingEnv}` + veloLocation);
|
|
375
370
|
console.log('location inside getAndSetUserLocation', location);
|
|
376
371
|
const userLat = location.coords?.latitude ?? 0;
|
|
377
372
|
const userLong = location.coords?.longitude ?? 0;
|
|
@@ -387,8 +382,6 @@ const createHomepageUtils = (_$w, filterProfiles, veloGetCurrentGeolocation, log
|
|
|
387
382
|
};
|
|
388
383
|
return { success: true, filter };
|
|
389
384
|
} catch (error) {
|
|
390
|
-
const renderingEnv = await rendering.env();
|
|
391
|
-
logMessage(`error inside getAndSetUserLocation in ${renderingEnv}` + error);
|
|
392
385
|
console.warn('Failed to get user location in getAndSetUserLocation', error);
|
|
393
386
|
return { success: false, filter };
|
|
394
387
|
}
|
|
@@ -533,13 +526,8 @@ const createHomepageUtils = (_$w, filterProfiles, veloGetCurrentGeolocation, log
|
|
|
533
526
|
}
|
|
534
527
|
|
|
535
528
|
if (isNoParams) {
|
|
536
|
-
search
|
|
537
|
-
|
|
538
|
-
pagination,
|
|
539
|
-
debounceTimeout: 0,
|
|
540
|
-
timeoutType: 'search',
|
|
541
|
-
isSearchingNearby: false,
|
|
542
|
-
});
|
|
529
|
+
// Don't search yet - let the caller decide what to do
|
|
530
|
+
// The search will be handled in applyFilterToUI
|
|
543
531
|
return { isDefaultStateParams: true, filter: newFilter };
|
|
544
532
|
}
|
|
545
533
|
let autoAdjustFilters = false;
|
|
@@ -682,7 +670,6 @@ const createHomepageUtils = (_$w, filterProfiles, veloGetCurrentGeolocation, log
|
|
|
682
670
|
longitude: 0,
|
|
683
671
|
}) === JSON.stringify(DEFAULT_FILTER)
|
|
684
672
|
) {
|
|
685
|
-
logMessage(`[search] no search criteria, changing to noSearchCriteria`);
|
|
686
673
|
multiStateBoxSelector.changeState('noSearchCriteria');
|
|
687
674
|
|
|
688
675
|
return [];
|