sr-npm 1.7.1282 → 1.7.1284
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,7 +1,7 @@
|
|
|
1
1
|
const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
|
|
2
2
|
const { CAREERS_PAGE_SELECTORS, GLOBAL_SECTIONS_SELECTORS } = require('../public/selectors');
|
|
3
3
|
|
|
4
|
-
const { window } = require('@wix/site-window');
|
|
4
|
+
const { window:wixWindow } = require('@wix/site-window');
|
|
5
5
|
const { queryParams,onChange} = require('wix-location-frontend');
|
|
6
6
|
const { location } = require("@wix/site-location");
|
|
7
7
|
const {
|
|
@@ -42,6 +42,8 @@ let considerAllJobs=false; // whether to consider all jobs or not
|
|
|
42
42
|
let urlOnchangeIsActive=false
|
|
43
43
|
let numbersofParamChanges=0;
|
|
44
44
|
let pageIsRemoved=false
|
|
45
|
+
let selectedParamsList=[]
|
|
46
|
+
let urlParamsIndex=0;
|
|
45
47
|
const pagination = {
|
|
46
48
|
pageSize: 10,
|
|
47
49
|
currentPage: 1,
|
|
@@ -49,7 +51,67 @@ const pagination = {
|
|
|
49
51
|
|
|
50
52
|
async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
51
53
|
//to handle back and forth , url changes
|
|
54
|
+
selectedParamsList.push(urlParams);
|
|
52
55
|
onChange(async ()=>{
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// INSERT_YOUR_CODE
|
|
59
|
+
|
|
60
|
+
// Yes, you can try to identify if it was a browser backward or forward navigation by using the window 'popstate' event and maintaining a stack/history index.
|
|
61
|
+
// Here's a simple approach using a navigation index:
|
|
62
|
+
if (typeof window !== "undefined") {
|
|
63
|
+
if (!window._careersNavIndex) {
|
|
64
|
+
window._careersNavIndex = 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let navDirection = null;
|
|
68
|
+
|
|
69
|
+
window.addEventListener('popstate', function (event) {
|
|
70
|
+
// Get new history state index, fallback to custom counter if unavailable
|
|
71
|
+
let newIndex = (history.state && history.state._careersNavIndex != null)
|
|
72
|
+
? history.state._careersNavIndex
|
|
73
|
+
: (window._careersNavIndex || 0);
|
|
74
|
+
|
|
75
|
+
if (window._careersNavIndex != null) {
|
|
76
|
+
if (newIndex < window._careersNavIndex) {
|
|
77
|
+
navDirection = 'backward';
|
|
78
|
+
} else if (newIndex > window._careersNavIndex) {
|
|
79
|
+
navDirection = 'forward';
|
|
80
|
+
} else {
|
|
81
|
+
navDirection = null;
|
|
82
|
+
}
|
|
83
|
+
window._careersNavIndex = newIndex;
|
|
84
|
+
}
|
|
85
|
+
// You can use navDirection in your logic as needed
|
|
86
|
+
// Example: console.log('Navigation direction:', navDirection);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// On each navigation (including programmatic changes), increment the index, and push the state:
|
|
90
|
+
if (typeof history !== "undefined" && typeof window !== "undefined") {
|
|
91
|
+
window._careersNavIndex = window._careersNavIndex || 0;
|
|
92
|
+
if (!history.state || history.state._careersNavIndex == null) {
|
|
93
|
+
// Only set if not already set by another navigation
|
|
94
|
+
history.replaceState(
|
|
95
|
+
Object.assign({}, history.state, { _careersNavIndex: window._careersNavIndex }),
|
|
96
|
+
''
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
// Whenever you push a new URL (not popstate), increment:
|
|
100
|
+
// window._careersNavIndex++;
|
|
101
|
+
// history.pushState(
|
|
102
|
+
// Object.assign({}, history.state, { _careersNavIndex: window._careersNavIndex }),
|
|
103
|
+
// ''
|
|
104
|
+
// );
|
|
105
|
+
}
|
|
106
|
+
// INSERT_YOUR_CODE
|
|
107
|
+
if (navDirection) {
|
|
108
|
+
console.log('Navigation direction:', navDirection);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
53
115
|
urlOnchangeIsActive=true;
|
|
54
116
|
await handleBackAndForth(_$w);
|
|
55
117
|
urlOnchangeIsActive=false;
|
|
@@ -67,13 +129,21 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
|
|
|
67
129
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
|
|
68
130
|
await clearAll(_$w);
|
|
69
131
|
});
|
|
70
|
-
if (await
|
|
132
|
+
if (await wixWindow.formFactor() === "Mobile") {
|
|
71
133
|
handleFilterInMobile(_$w);
|
|
72
134
|
}
|
|
73
135
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_MULTI_STATE_BOX).changeState("results");
|
|
74
136
|
}
|
|
75
137
|
|
|
76
138
|
async function handleBackAndForth(_$w){
|
|
139
|
+
//check the case when i click on a category then i click on
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
const newQueryParams=await location.query();
|
|
143
|
+
selectedParamsStack.push(newQueryParams);
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
77
147
|
if(ActivateURLOnchange) {
|
|
78
148
|
const newQueryParams=await location.query();
|
|
79
149
|
await clearAll(_$w,true);
|
|
@@ -86,6 +156,8 @@ async function handleBackAndForth(_$w){
|
|
|
86
156
|
ActivateURLOnchange=true;
|
|
87
157
|
}
|
|
88
158
|
}
|
|
159
|
+
|
|
160
|
+
|
|
89
161
|
// if(ActivateURLOnchange) {
|
|
90
162
|
// const newQueryParams=await location.query();
|
|
91
163
|
// console.log("newQueryParams: ", newQueryParams);
|
|
@@ -448,13 +520,16 @@ async function loadJobsRepeater(_$w) {
|
|
|
448
520
|
|
|
449
521
|
_$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices = []; // start empty
|
|
450
522
|
_$w(`#${FiltersIds[field.title]}CheckBox`).onChange(async (ev) => {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
523
|
+
const currentQueryParams=await location.query();
|
|
524
|
+
if(currentQueryParams.page)
|
|
525
|
+
{
|
|
454
526
|
// //try instead of removing to add page = 1
|
|
455
527
|
// //queryParams.remove(["page"]);
|
|
456
528
|
// queryParams.add({ ["page"]: 1 });
|
|
457
|
-
|
|
529
|
+
pageIsRemoved=true
|
|
530
|
+
//save the selected param
|
|
531
|
+
|
|
532
|
+
}
|
|
458
533
|
dontUpdateThisCheckBox=field._id;
|
|
459
534
|
const selected = ev.target.value; // array of selected value IDs
|
|
460
535
|
let fieldTitle=field.title.toLowerCase().replace(' ', '');
|