sr-npm 1.2.57 → 1.2.59

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.2.57",
3
+ "version": "1.2.59",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,7 +20,7 @@ const { groupValuesByField,
20
20
  getOptionIndexFromCheckBox,
21
21
  getAllDatasetItems
22
22
  } = require('./pagesUtils');
23
- const { loadPrimarySearchRepeater, bindPrimarySearch, primarySearch } = require('../public/primarySearchUtil');
23
+ const { handlePrimarySearch, queryPrimarySearchResults } = require('../public/primarySearchUtils');
24
24
 
25
25
 
26
26
  let dontUpdateThisCheckBox;
@@ -50,7 +50,7 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
50
50
 
51
51
  await loadData(_$w);
52
52
  await loadJobsRepeater(_$w); // if we remove the await here the job list will be flaky , it doesn't fill it properly
53
- loadPrimarySearchRepeater(_$w);
53
+ handlePrimarySearch(_$w, allvaluesobjects);
54
54
  await loadFilters(_$w);
55
55
  loadSelectedValuesRepeater(_$w);
56
56
  bindSearchInput(_$w);
@@ -147,7 +147,7 @@ async function handleUrlParams(_$w,urlParams,handleBackAndForth=false) {
147
147
  let currentApplyFilterFlag=false;
148
148
  //apply this first to determine all jobs
149
149
  if(urlParams.keyword) {
150
- applyFiltering = await primarySearch(_$w, decodeURIComponent(urlParams.keyword));
150
+ applyFiltering = await queryPrimarySearchResults(_$w, decodeURIComponent(urlParams.keyword));
151
151
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value = decodeURIComponent(urlParams.keyword);
152
152
 
153
153
  const items = await getAllDatasetItems(_$w, CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_DATASET);
@@ -641,8 +641,6 @@ async function secondarySearch(_$w,query) {
641
641
  }
642
642
  function bindSearchInput(_$w) {
643
643
  try {
644
- bindPrimarySearch(_$w, allvaluesobjects);
645
-
646
644
  const secondarySearchDebounced = debounce(async () => {
647
645
  const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || '').toLowerCase().trim();
648
646
  await secondarySearch(_$w, query);
package/pages/homePage.js CHANGED
@@ -5,7 +5,7 @@ const { location } = require('@wix/site-location');
5
5
  const {wixData} = require('wix-data');
6
6
  const { COLLECTIONS } = require('../backend/collectionConsts');
7
7
  const { getAllRecords } = require('./pagesUtils');
8
- const { bindPrimarySearch, loadPrimarySearchRepeater } = require('../public/primarySearchUtil');
8
+ const { handlePrimarySearch } = require('../public/primarySearchUtils');
9
9
 
10
10
  let thisObjectVar;
11
11
  let searchByCityFlag=false;
@@ -18,8 +18,7 @@ async function homePageOnReady(_$w,thisObject = null) {
18
18
 
19
19
  if(siteconfig.twg) {
20
20
  const allvaluesobjects = await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
21
- bindPrimarySearch(_$w, allvaluesobjects);
22
- loadPrimarySearchRepeater(_$w)
21
+ handlePrimarySearch(_$w, allvaluesobjects);
23
22
  console.log("siteconfig.twg: ",siteconfig.twg);
24
23
 
25
24
  if(siteconfig.twg === "external") {
@@ -1,7 +1,13 @@
1
- const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS, TWG_JOBS_COLLECTION_FIELDS } = require('../backend/careersMultiBoxesPageIds');
2
1
  const { location } = require("@wix/site-location");
2
+
3
+ const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS, TWG_JOBS_COLLECTION_FIELDS } = require('../backend/careersMultiBoxesPageIds');
3
4
  const { getFilter } = require('../public/filterUtils');
4
- const { debounce } = require('./utils');
5
+ const { debounce } = require('../pages/pagesUtils');
6
+
7
+ async function handlePrimarySearch(_$w, allvaluesobjects) {
8
+ loadPrimarySearchRepeater(_$w);
9
+ bindPrimarySearch(_$w, allvaluesobjects);
10
+ }
5
11
 
6
12
  function loadPrimarySearchRepeater(_$w) {
7
13
 
@@ -43,7 +49,7 @@ function bindPrimarySearch(_$w, allvaluesobjects) {
43
49
 
44
50
  const handleSearchInput = async () => {
45
51
  const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
46
- await primarySearch(_$w, query);
52
+ await queryPrimarySearchResults(_$w, query);
47
53
  }
48
54
 
49
55
  const primarySearchDebounced = debounce(() => handleSearchInput(), 400);
@@ -57,7 +63,7 @@ function bindPrimarySearch(_$w, allvaluesobjects) {
57
63
 
58
64
  if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()!=='') {
59
65
  const query = _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
60
- await primarySearch(_$w, query);
66
+ await queryPrimarySearchResults(_$w, query);
61
67
  }
62
68
  else {
63
69
  await loadCategoriesListPrimarySearch(_$w,allvaluesobjects);
@@ -109,7 +115,7 @@ async function loadCategoriesListPrimarySearch(_$w, allvaluesobjects) {
109
115
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).data = categoryValues;
110
116
  }
111
117
 
112
- async function primarySearch(_$w, query) {
118
+ async function queryPrimarySearchResults(_$w, query) {
113
119
  if(query === undefined || query === '') {
114
120
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
115
121
  return false;
@@ -150,5 +156,6 @@ return count > 0;
150
156
  module.exports = {
151
157
  loadPrimarySearchRepeater,
152
158
  bindPrimarySearch,
153
- primarySearch,
159
+ queryPrimarySearchResults,
160
+ handlePrimarySearch,
154
161
  }