sr-npm 1.7.94 → 1.7.95
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/backend/collectionConsts.js +7 -3
- package/backend/consts.js +89 -117
- package/backend/data.js +22 -19
- package/backend/fetchPositionsFromSRAPI.js +4 -4
- package/backend/queries.js +4 -2
- package/package.json +2 -4
- package/pages/index.js +0 -2
- package/pages/positionPage.js +7 -7
- package/public/index.js +0 -2
- package/pages/careersPage.js +0 -250
- package/pages/homePage.js +0 -109
- package/public/filterUtils.js +0 -40
- package/public/mapUtils.js +0 -16
|
@@ -17,6 +17,8 @@ const JOBS_COLLECTION_FIELDS = {
|
|
|
17
17
|
DEPARTMENT_REF: 'departmentRef',
|
|
18
18
|
CITY: 'city',
|
|
19
19
|
CITY_TEXT: 'cityText',
|
|
20
|
+
IMAGE: 'image',
|
|
21
|
+
APPLY_LINK: 'applyLink',
|
|
20
22
|
}
|
|
21
23
|
const AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION_FIELDS = {
|
|
22
24
|
TITLE: 'title',
|
|
@@ -53,9 +55,11 @@ const COLLECTIONS_FIELDS = {
|
|
|
53
55
|
{key:'language', type: 'TEXT'},
|
|
54
56
|
{key:'remote', type: 'BOOLEAN'},
|
|
55
57
|
{key:'jobDescription', type: 'OBJECT'},
|
|
56
|
-
{key:'cityText', type: 'TEXT'},
|
|
57
|
-
{key:'
|
|
58
|
-
{key:'
|
|
58
|
+
{key:'cityText', type: 'TEXT'},
|
|
59
|
+
{key:'applyLink', type: 'URL'},
|
|
60
|
+
{key:'departmentref', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT } } },
|
|
61
|
+
{key:'city', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: COLLECTIONS.CITIES } } },
|
|
62
|
+
{ key: 'image', type: 'IMAGE' },
|
|
59
63
|
],
|
|
60
64
|
API_KEY: [
|
|
61
65
|
{key:'token', type: 'TEXT'},
|
package/backend/consts.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
const {
|
|
2
|
-
saveJobsDataToCMS,
|
|
3
|
-
saveJobsDescriptionsAndLocationToCMS,
|
|
4
|
-
aggregateJobsByFieldToCMS,
|
|
5
|
-
referenceJobsToField,
|
|
6
|
-
createApiKeyCollectionAndFillIt,
|
|
7
|
-
} = require('./data');
|
|
1
|
+
const {saveJobsDataToCMS,saveJobsDescriptionsAndLocationApplyUrlToCMS,aggregateJobsByFieldToCMS,referenceJobsToField,createApiKeyCollectionAndFillIt} = require('./data');
|
|
8
2
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
9
3
|
const { COLLECTIONS, COLLECTIONS_FIELDS, JOBS_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
10
4
|
|
|
@@ -13,7 +7,7 @@ const QUERY_MAX_LIMIT = 1000;
|
|
|
13
7
|
const TASKS_NAMES = {
|
|
14
8
|
SYNC_JOBS: 'syncJobsFromSRAPIToCMS',
|
|
15
9
|
INSERT_JOBS_TO_CMS: 'insertJobsToCMS',
|
|
16
|
-
|
|
10
|
+
INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS: 'insertJobsDescriptionsLocationApplyUrlToCMS',
|
|
17
11
|
FILL_JOBS_PER_CITY_COLLECTION: 'fillJobsPerCityCollection',
|
|
18
12
|
FILL_JOBS_PER_DEPARTMENT_COLLECTION: 'fillJobsPerDepartmentCollection',
|
|
19
13
|
REFERENCE_JOBS_TO_LOCATIONS: 'referenceJobsToLocations',
|
|
@@ -26,115 +20,93 @@ const TASKS_NAMES = {
|
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
const TASKS = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
collection: COLLECTIONS.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
estimatedDurationSec: 3,
|
|
117
|
-
},
|
|
118
|
-
[TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT]: {
|
|
119
|
-
name: TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT,
|
|
120
|
-
getIdentifier: () => 'SHOULD_NEVER_SKIP',
|
|
121
|
-
process: () =>
|
|
122
|
-
referenceJobsToField({
|
|
123
|
-
referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF,
|
|
124
|
-
sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT,
|
|
125
|
-
jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT,
|
|
126
|
-
}),
|
|
127
|
-
shouldSkipCheck: () => false,
|
|
128
|
-
estimatedDurationSec: 3,
|
|
129
|
-
},
|
|
130
|
-
[TASKS_NAMES.CREATE_API_KEY_COLLECTION_AND_FILL_IT]: {
|
|
131
|
-
name: TASKS_NAMES.CREATE_API_KEY_COLLECTION_AND_FILL_IT,
|
|
132
|
-
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
133
|
-
process:()=>createApiKeyCollectionAndFillIt(),
|
|
134
|
-
shouldSkipCheck:()=>false,
|
|
135
|
-
estimatedDurationSec:3
|
|
136
|
-
}
|
|
137
|
-
};
|
|
23
|
+
[TASKS_NAMES.SYNC_JOBS]: {
|
|
24
|
+
name: TASKS_NAMES.SYNC_JOBS,
|
|
25
|
+
childTasks: [
|
|
26
|
+
{ name: TASKS_NAMES.CREATE_JOBS_COLLECTION },
|
|
27
|
+
{ name: TASKS_NAMES.CREATE_CITIES_COLLECTION },
|
|
28
|
+
{name: TASKS_NAMES.CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION},
|
|
29
|
+
{ name: TASKS_NAMES.INSERT_JOBS_TO_CMS },
|
|
30
|
+
{ name: TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS },
|
|
31
|
+
{ name: TASKS_NAMES.FILL_JOBS_PER_CITY_COLLECTION },
|
|
32
|
+
{ name: TASKS_NAMES.FILL_JOBS_PER_DEPARTMENT_COLLECTION },
|
|
33
|
+
{ name: TASKS_NAMES.REFERENCE_JOBS_TO_LOCATIONS },
|
|
34
|
+
{ name: TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT },
|
|
35
|
+
],
|
|
36
|
+
scheduleChildrenSequentially: true,
|
|
37
|
+
estimatedDurationSec: 30,
|
|
38
|
+
},
|
|
39
|
+
[TASKS_NAMES.CREATE_JOBS_COLLECTION]: {
|
|
40
|
+
name: TASKS_NAMES.CREATE_JOBS_COLLECTION,
|
|
41
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
42
|
+
process:()=>createCollectionIfMissing(COLLECTIONS.JOBS, COLLECTIONS_FIELDS.JOBS,{ insert: 'ADMIN', update: 'ADMIN', remove: 'ADMIN', read: 'ANYONE' }),
|
|
43
|
+
shouldSkipCheck:()=>false,
|
|
44
|
+
estimatedDurationSec:3
|
|
45
|
+
},
|
|
46
|
+
[TASKS_NAMES.CREATE_CITIES_COLLECTION]: {
|
|
47
|
+
name: TASKS_NAMES.CREATE_CITIES_COLLECTION,
|
|
48
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
49
|
+
process:()=>createCollectionIfMissing(COLLECTIONS.CITIES, COLLECTIONS_FIELDS.CITIES),
|
|
50
|
+
shouldSkipCheck:()=>false,
|
|
51
|
+
estimatedDurationSec:3
|
|
52
|
+
},
|
|
53
|
+
[TASKS_NAMES.CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION]: {
|
|
54
|
+
name: TASKS_NAMES.CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION,
|
|
55
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
56
|
+
process:()=>createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
57
|
+
shouldSkipCheck:()=>false,
|
|
58
|
+
estimatedDurationSec:3
|
|
59
|
+
},
|
|
60
|
+
[TASKS_NAMES.INSERT_JOBS_TO_CMS]: {
|
|
61
|
+
name: TASKS_NAMES.INSERT_JOBS_TO_CMS,
|
|
62
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
63
|
+
process:saveJobsDataToCMS,
|
|
64
|
+
shouldSkipCheck:()=>false,
|
|
65
|
+
estimatedDurationSec:20
|
|
66
|
+
},
|
|
67
|
+
[TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS]: {
|
|
68
|
+
name: TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS,
|
|
69
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
70
|
+
process:saveJobsDescriptionsAndLocationApplyUrlToCMS,
|
|
71
|
+
shouldSkipCheck:()=>false,
|
|
72
|
+
estimatedDurationSec:20
|
|
73
|
+
},
|
|
74
|
+
[TASKS_NAMES.FILL_JOBS_PER_CITY_COLLECTION]: {
|
|
75
|
+
name: TASKS_NAMES.FILL_JOBS_PER_CITY_COLLECTION,
|
|
76
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
77
|
+
process:()=>aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
|
|
78
|
+
shouldSkipCheck:()=>false,
|
|
79
|
+
estimatedDurationSec:3
|
|
80
|
+
},
|
|
81
|
+
[TASKS_NAMES.FILL_JOBS_PER_DEPARTMENT_COLLECTION]: {
|
|
82
|
+
name: TASKS_NAMES.FILL_JOBS_PER_DEPARTMENT_COLLECTION,
|
|
83
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
84
|
+
process:()=>aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT }),
|
|
85
|
+
shouldSkipCheck:()=>false,
|
|
86
|
+
estimatedDurationSec:3
|
|
87
|
+
},
|
|
88
|
+
[TASKS_NAMES.REFERENCE_JOBS_TO_LOCATIONS]: {
|
|
89
|
+
name: TASKS_NAMES.REFERENCE_JOBS_TO_LOCATIONS,
|
|
90
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
91
|
+
process:()=>referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT }),
|
|
92
|
+
shouldSkipCheck:()=>false,
|
|
93
|
+
estimatedDurationSec:3
|
|
94
|
+
},
|
|
95
|
+
[TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT]: {
|
|
96
|
+
name: TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT,
|
|
97
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
98
|
+
process:()=>referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT }),
|
|
99
|
+
shouldSkipCheck:()=>false,
|
|
100
|
+
estimatedDurationSec:3
|
|
101
|
+
},
|
|
102
|
+
[TASKS_NAMES.CREATE_API_KEY_COLLECTION_AND_FILL_IT]: {
|
|
103
|
+
name: TASKS_NAMES.CREATE_API_KEY_COLLECTION_AND_FILL_IT,
|
|
104
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
105
|
+
process:()=>createApiKeyCollectionAndFillIt(),
|
|
106
|
+
shouldSkipCheck:()=>false,
|
|
107
|
+
estimatedDurationSec:3
|
|
108
|
+
}
|
|
109
|
+
}
|
|
138
110
|
|
|
139
111
|
|
|
140
112
|
|
package/backend/data.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const { items: wixData } = require('@wix/data');
|
|
1
|
+
const { items: wixData, collections } = require('@wix/data');
|
|
2
2
|
const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositionsFromSRAPI');
|
|
3
3
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
4
|
-
const { COLLECTIONS, COLLECTIONS_FIELDS } = require('./collectionConsts');
|
|
4
|
+
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
5
5
|
const { secrets } = require("@wix/secrets");
|
|
6
6
|
const { auth } = require('@wix/essentials');
|
|
7
7
|
const { chunkedBulkOperation, delay, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeCityName} = require('./utils');
|
|
@@ -58,7 +58,7 @@ async function saveJobsDataToCMS() {
|
|
|
58
58
|
processChunk: async (chunk, chunkNumber) => {
|
|
59
59
|
console.log(`Saving chunk ${chunkNumber}/${totalChunks}: ${chunk.length} jobs`);
|
|
60
60
|
try {
|
|
61
|
-
const result = await wixData.bulkSave(
|
|
61
|
+
const result = await wixData.bulkSave(COLLECTIONS.JOBS, chunk);
|
|
62
62
|
const saved = result.inserted + result.updated || chunk.length;
|
|
63
63
|
totalSaved += saved;
|
|
64
64
|
console.log(
|
|
@@ -74,7 +74,7 @@ async function saveJobsDataToCMS() {
|
|
|
74
74
|
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${jobsData.length}`);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
async function
|
|
77
|
+
async function saveJobsDescriptionsAndLocationApplyUrlToCMS() {
|
|
78
78
|
console.log('🚀 Starting job descriptions update process for ALL jobs');
|
|
79
79
|
|
|
80
80
|
try {
|
|
@@ -105,13 +105,16 @@ async function saveJobsDescriptionsAndLocationToCMS() {
|
|
|
105
105
|
try {
|
|
106
106
|
const jobDetails = await fetchJobDescription(job._id);
|
|
107
107
|
const jobLocation = fetchJobLocation(jobDetails);
|
|
108
|
+
const applyLink = fetchApplyLink(jobDetails);
|
|
109
|
+
|
|
108
110
|
|
|
109
111
|
const updatedJob = {
|
|
110
112
|
...job,
|
|
111
113
|
locationAddress: jobLocation,
|
|
112
114
|
jobDescription: jobDetails.jobAd.sections,
|
|
115
|
+
applyLink: applyLink,
|
|
113
116
|
};
|
|
114
|
-
await wixData.update(
|
|
117
|
+
await wixData.update(COLLECTIONS.JOBS, updatedJob);
|
|
115
118
|
return { success: true, jobId: job._id, title: job.title };
|
|
116
119
|
} catch (error) {
|
|
117
120
|
console.error(` ❌ Failed to update ${job.title} (${job._id}):`, error);
|
|
@@ -188,7 +191,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
188
191
|
|
|
189
192
|
async function getJobsWithNoDescriptions() {
|
|
190
193
|
let jobswithoutdescriptionsQuery = await wixData
|
|
191
|
-
.query(
|
|
194
|
+
.query(COLLECTIONS.JOBS)
|
|
192
195
|
.limit(1000)
|
|
193
196
|
.isEmpty('jobDescription')
|
|
194
197
|
.find();
|
|
@@ -197,9 +200,9 @@ async function getJobsWithNoDescriptions() {
|
|
|
197
200
|
|
|
198
201
|
/**
|
|
199
202
|
* @param {Object} params
|
|
200
|
-
* @param {
|
|
201
|
-
* @param {
|
|
202
|
-
* @param {
|
|
203
|
+
* @param {JOBS_COLLECTION_FIELDS.CITY|JOBS_COLLECTION_FIELDS.DEPARTMENT_REF} params.referenceField
|
|
204
|
+
* @param {COLLECTIONS.CITIES|COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT} params.sourceCollection
|
|
205
|
+
* @param {JOBS_COLLECTION_FIELDS.CITY_TEXT|JOBS_COLLECTION_FIELDS.DEPARTMENT} params.jobField
|
|
203
206
|
*/
|
|
204
207
|
async function referenceJobsToField({ referenceField, sourceCollection, jobField }) {
|
|
205
208
|
// Fetch all source items (cities or departments)
|
|
@@ -235,22 +238,22 @@ async function referenceJobsToField({ referenceField, sourceCollection, jobField
|
|
|
235
238
|
items: jobsToUpdate,
|
|
236
239
|
chunkSize,
|
|
237
240
|
processChunk: async chunk => {
|
|
238
|
-
await wixData.bulkUpdate(
|
|
241
|
+
await wixData.bulkUpdate(COLLECTIONS.JOBS, chunk);
|
|
239
242
|
},
|
|
240
243
|
});
|
|
241
244
|
|
|
242
245
|
return { success: true, updated: jobsToUpdate.length };
|
|
243
246
|
}
|
|
244
247
|
|
|
248
|
+
function fetchApplyLink(jobDetails) {
|
|
249
|
+
return jobDetails.actions.applyOnWeb.url;
|
|
250
|
+
}
|
|
251
|
+
|
|
245
252
|
function fetchJobLocation(jobDetails) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
? {}
|
|
251
|
-
: {
|
|
252
|
-
latitude: parseFloat(jobDetails.location.latitude),
|
|
253
|
-
longitude: parseFloat(jobDetails.location.longitude),
|
|
253
|
+
const jobLocation = {
|
|
254
|
+
location: {
|
|
255
|
+
latitude: parseFloat(jobDetails.location.latitude),
|
|
256
|
+
longitude: parseFloat(jobDetails.location.longitude)
|
|
254
257
|
},
|
|
255
258
|
city: jobDetails.location.city,
|
|
256
259
|
country: jobDetails.location.country,
|
|
@@ -300,7 +303,7 @@ async function createApiKeyCollectionAndFillIt() {
|
|
|
300
303
|
|
|
301
304
|
module.exports = {
|
|
302
305
|
saveJobsDataToCMS,
|
|
303
|
-
|
|
306
|
+
saveJobsDescriptionsAndLocationApplyUrlToCMS,
|
|
304
307
|
aggregateJobsByFieldToCMS,
|
|
305
308
|
referenceJobsToField,
|
|
306
309
|
createApiKeyCollectionAndFillIt,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
2
|
const { items: wixData } = require('@wix/data');
|
|
3
3
|
const { COLLECTIONS } = require('./collectionConsts');
|
|
4
|
-
|
|
5
4
|
async function makeSmartRecruitersRequest(path,token) {
|
|
6
5
|
// const baseUrl = 'https://api.smartrecruiters.com'; // PROD
|
|
7
|
-
const baseUrl = 'https://aoxley54.wixstudio.com/
|
|
8
|
-
|
|
6
|
+
const baseUrl = 'https://aoxley54.wixstudio.com/test-site/_functions'; // TEST
|
|
7
|
+
const fullUrl = `${baseUrl}${path}`;
|
|
9
8
|
|
|
10
9
|
//console.log(`Making request to: ${fullUrl}`);
|
|
11
10
|
try {
|
|
@@ -108,7 +107,8 @@ async function fetchPositionsFromSRAPI() {
|
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
async function fetchJobDescription(jobId) {
|
|
111
|
-
|
|
110
|
+
const token = await getSmartTokenFromCMS();
|
|
111
|
+
return await makeSmartRecruitersRequest(`/jobs/${jobId}`,token);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async function getSmartTokenFromCMS() {
|
package/backend/queries.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
const { COLLECTIONS } = require('./collectionConsts');
|
|
1
2
|
const { items: wixData } = require('@wix/data');
|
|
2
3
|
|
|
4
|
+
|
|
3
5
|
async function getAllPositions() {
|
|
4
6
|
return wixData
|
|
5
|
-
.query(
|
|
7
|
+
.query(COLLECTIONS.JOBS)
|
|
6
8
|
.limit(1000)
|
|
7
9
|
.find()
|
|
8
10
|
.then(result => result.items);
|
|
@@ -10,7 +12,7 @@ async function getAllPositions() {
|
|
|
10
12
|
|
|
11
13
|
async function getPositionsByField(field, value) {
|
|
12
14
|
return wixData
|
|
13
|
-
.query(
|
|
15
|
+
.query(COLLECTIONS.JOBS)
|
|
14
16
|
.eq(field, value)
|
|
15
17
|
.find()
|
|
16
18
|
.then(result => result.items);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sr-npm",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.95",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,9 +20,7 @@
|
|
|
20
20
|
"@hisense-staging/velo-npm": "3.0.19",
|
|
21
21
|
"@wix/data": "^1.0.211",
|
|
22
22
|
"@wix/essentials": "^0.1.24",
|
|
23
|
-
"@wix/secrets": "^1.0.53"
|
|
24
|
-
"@wix/site-location": "^1.0.0",
|
|
25
|
-
"@wix/site-window": "^1.0.0"
|
|
23
|
+
"@wix/secrets": "^1.0.53"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
26
|
"prettier": "^3.6.2"
|
package/pages/index.js
CHANGED
package/pages/positionPage.js
CHANGED
|
@@ -3,14 +3,14 @@ const {
|
|
|
3
3
|
} = require('../public/utils');
|
|
4
4
|
|
|
5
5
|
async function positionPageOnReady(_$w) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
bind(_$w);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
_$w('#datasetJobsItem').onReady(
|
|
10
|
+
function bind(_$w) {
|
|
11
|
+
_$w('#datasetJobsItem').onReady(() => {
|
|
12
12
|
|
|
13
|
-
const item =
|
|
13
|
+
const item = _$w('#datasetJobsItem').getCurrentItem();
|
|
14
14
|
|
|
15
15
|
_$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
|
|
16
16
|
_$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
|
|
@@ -18,8 +18,8 @@ const {
|
|
|
18
18
|
_$w('#relatedJobsTitleText').text = `More ${item.department} Positions`;
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
_$w('#relatedJobsDataset').onReady(
|
|
22
|
-
const count =
|
|
21
|
+
_$w('#relatedJobsDataset').onReady(() => {
|
|
22
|
+
const count = _$w('#relatedJobsDataset').getTotalCount();
|
|
23
23
|
if(!count){
|
|
24
24
|
_$w('#relatedJobsSection').collapse();
|
|
25
25
|
}
|
package/public/index.js
CHANGED
package/pages/careersPage.js
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
const { getAllPositions } = require('../backend/queries');
|
|
2
|
-
//const { items: wixData } = require('@wix/data');
|
|
3
|
-
const {wixData} = require('wix-data');
|
|
4
|
-
const { window } = require('@wix/site-window');
|
|
5
|
-
//const { location,queryParams } = require('@wix/site-location');
|
|
6
|
-
const { query,queryParams,to } = require("wix-location-frontend");
|
|
7
|
-
const {
|
|
8
|
-
debounce,
|
|
9
|
-
getFilter,
|
|
10
|
-
} = require('../public/filterUtils');
|
|
11
|
-
|
|
12
|
-
let currentLoadedItems =100;
|
|
13
|
-
const itemsPerPage = 100;
|
|
14
|
-
let allJobs=[]
|
|
15
|
-
const RESET_ALL = 'RESET_ALL';
|
|
16
|
-
let pageParamSet=0;
|
|
17
|
-
let thisObjectVar;
|
|
18
|
-
let queryPageVar;
|
|
19
|
-
let queryKeyWordVar;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
async function careersPageOnReady(_$w,thisObject,queryPage,queryKeyWord) {
|
|
23
|
-
queryPageVar=queryPage;
|
|
24
|
-
queryKeyWordVar=queryKeyWord;
|
|
25
|
-
thisObjectVar=thisObject;
|
|
26
|
-
allJobs=await getAllPositions();
|
|
27
|
-
await handleUrlParams(_$w);
|
|
28
|
-
await activateAutoLoad(_$w);
|
|
29
|
-
await bind(_$w);
|
|
30
|
-
await init(_$w);
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function activateAutoLoad(_$w)
|
|
36
|
-
{
|
|
37
|
-
_$w("#jobsDataset").onReady(() => {
|
|
38
|
-
updateCount(_$w);
|
|
39
|
-
_$w("#section2").onViewportEnter(() => {
|
|
40
|
-
if (currentLoadedItems<_$w("#jobsDataset").getTotalCount()) {
|
|
41
|
-
loadMoreJobs(_$w);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
console.log("no more jobs")
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function loadMoreJobs(_$w) {
|
|
51
|
-
//const query = await location.query();
|
|
52
|
-
let shouldLoad = false;
|
|
53
|
-
if (pageParamSet == 0) {
|
|
54
|
-
shouldLoad = true;
|
|
55
|
-
} else if (query.page % 2 == pageParamSet % 2) {
|
|
56
|
-
shouldLoad = true;
|
|
57
|
-
} else {
|
|
58
|
-
pageParamSet = Number(pageParamSet) + 1;
|
|
59
|
-
}
|
|
60
|
-
if (shouldLoad) {
|
|
61
|
-
_$w("#jobsDataset").loadMore();
|
|
62
|
-
console.log("loading more jobs");
|
|
63
|
-
currentLoadedItems = currentLoadedItems + itemsPerPage;
|
|
64
|
-
const data = _$w("#positionsRepeater").data;
|
|
65
|
-
console.log("data length is : ", data.length);
|
|
66
|
-
setPageParamInUrl();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
async function setPageParamInUrl() {
|
|
72
|
-
console.log("query is: ", query);
|
|
73
|
-
console.log("query.page is: ", query.page);
|
|
74
|
-
console.log(" is: ", Number(query.page) + 1);
|
|
75
|
-
console.log("queryPageVar is: ", queryPageVar);
|
|
76
|
-
if(queryPageVar){
|
|
77
|
-
queryParams.add({ page: Number(queryPageVar) + 1 })
|
|
78
|
-
queryPageVar=Number(queryPageVar) + 1
|
|
79
|
-
}
|
|
80
|
-
else{
|
|
81
|
-
queryParams.add({ page: 2 })
|
|
82
|
-
queryPageVar=2
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
async function handleUrlParams(_$w) {
|
|
88
|
-
// const query = await location.query();
|
|
89
|
-
if (queryKeyWordVar) {
|
|
90
|
-
await handleKeyWordParam(_$w,queryKeyWordVar);
|
|
91
|
-
}
|
|
92
|
-
if (queryPageVar) {
|
|
93
|
-
await handlePageParam(_$w);
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async function handleKeyWordParam(_$w,keyWord) {
|
|
99
|
-
_$w('#searchInput').value = keyWord;
|
|
100
|
-
//const filter = await wixData.query("Jobs").contains("title", keyWord);
|
|
101
|
-
await $w("#jobsDataset").setFilter(wixData.filter().contains("title", keyWord));
|
|
102
|
-
await _$w("#jobsDataset").refresh();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async function handlePageParam(_$w) {
|
|
106
|
-
|
|
107
|
-
if(allJobs.length/itemsPerPage<queryPageVar){
|
|
108
|
-
console.log(`max page is: ${allJobs.length/itemsPerPage}`)
|
|
109
|
-
queryParams.add({ page: allJobs.length/itemsPerPage })
|
|
110
|
-
}
|
|
111
|
-
if(queryPageVar<=1){
|
|
112
|
-
console.log("min page is : 2")
|
|
113
|
-
pageParamSet=2;
|
|
114
|
-
queryParams.add({ page: 2 })
|
|
115
|
-
}
|
|
116
|
-
if (queryPageVar) {
|
|
117
|
-
pageParamSet=queryPageVar;
|
|
118
|
-
//scrolls a bit to load the dataset data
|
|
119
|
-
await window.scrollTo(0, 200,{scrollAnimation:false});
|
|
120
|
-
for (let i = 2; i <= queryPageVar; i++) {
|
|
121
|
-
await _$w("#jobsDataset").loadMore();
|
|
122
|
-
currentLoadedItems=currentLoadedItems+itemsPerPage
|
|
123
|
-
}
|
|
124
|
-
// the timeout is to wait for the repeater to render, then scroll to the last item.
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
const data = _$w("#positionsRepeater").data;
|
|
127
|
-
if (data && data.length > 0) {
|
|
128
|
-
//the dataset each time it loads 100 items
|
|
129
|
-
const lastIndex = data.length - itemsPerPage;
|
|
130
|
-
_$w("#positionsRepeater").forEachItem(async ($item, itemData, index) => {
|
|
131
|
-
if (index === lastIndex) {
|
|
132
|
-
await $item("#positionItem").scrollTo();
|
|
133
|
-
console.log("finishied scrolling inside handlePageParam")
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}, 200);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async function bind(_$w) {
|
|
143
|
-
await _$w('#jobsDataset').onReady(async () => {
|
|
144
|
-
await updateCount(_$w);
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
if (await window.formFactor === "Mobile") {
|
|
149
|
-
_$w('#dropdownsContainer').collapse();
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
_$w('#positionsRepeater').onItemReady(async ($item, itemData) => {
|
|
153
|
-
$item('#positionItem').onClick(() => {
|
|
154
|
-
to(`${itemData['link-jobs-title']}`);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function init(_$w) {
|
|
160
|
-
const debouncedSearch = debounce(()=>applyFilters(_$w), 400,thisObjectVar);
|
|
161
|
-
|
|
162
|
-
_$w('#searchInput').onInput(debouncedSearch);
|
|
163
|
-
_$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>applyFilters(_$w));
|
|
164
|
-
_$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
|
|
165
|
-
|
|
166
|
-
_$w('#openFiltersButton').onClick(()=>{
|
|
167
|
-
_$w('#dropdownsContainer, #closeFiltersButton').expand();
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
_$w('#closeFiltersButton').onClick(()=>{
|
|
171
|
-
_$w('#dropdownsContainer, #closeFiltersButton').collapse();
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async function applyFilters(_$w) {
|
|
176
|
-
|
|
177
|
-
const dropdownFiltersMapping = [
|
|
178
|
-
{ elementId: '#dropdownDepartment', field: 'department', value: _$w('#dropdownDepartment').value },
|
|
179
|
-
{ elementId: '#dropdownLocation', field: 'cityText', value: _$w('#dropdownLocation').value },
|
|
180
|
-
{ elementId: '#dropdownJobType', field: 'remote', value: _$w('#dropdownJobType').value},
|
|
181
|
-
{ elementId: '#searchInput', field: 'title', value: _$w('#searchInput').value }
|
|
182
|
-
];
|
|
183
|
-
|
|
184
|
-
let filters = [];
|
|
185
|
-
let value;
|
|
186
|
-
|
|
187
|
-
dropdownFiltersMapping.forEach(filter => {
|
|
188
|
-
// Handle RESET_ALL values
|
|
189
|
-
if (filter.value === RESET_ALL) {
|
|
190
|
-
_$w(filter.elementId).value = '';
|
|
191
|
-
filter.value = '';
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// build filters
|
|
195
|
-
if (filter.value && filter.value.trim() !== '') {
|
|
196
|
-
if(filter.field === 'title'){
|
|
197
|
-
queryParams.add({ keyWord: filter.value });
|
|
198
|
-
}
|
|
199
|
-
if(filter.field === 'remote') {
|
|
200
|
-
value = filter.value === 'true';
|
|
201
|
-
} else {
|
|
202
|
-
value = filter.value;
|
|
203
|
-
}
|
|
204
|
-
filters.push({ field: filter.field, searchTerm: value });
|
|
205
|
-
}
|
|
206
|
-
else{
|
|
207
|
-
queryParams.remove(["keyWord" ]);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const filter = await getFilter(filters, 'and');
|
|
212
|
-
|
|
213
|
-
await _$w('#jobsDataset').setFilter(filter);
|
|
214
|
-
await _$w('#jobsDataset').refresh();
|
|
215
|
-
|
|
216
|
-
const count = await updateCount(_$w);
|
|
217
|
-
|
|
218
|
-
count ? _$w('#resultsMultiState').changeState('results') : _$w('#resultsMultiState').changeState('noResults');
|
|
219
|
-
|
|
220
|
-
// Update reset button state
|
|
221
|
-
const hasActiveFilters = filters.length > 0;
|
|
222
|
-
hasActiveFilters? _$w('#resetFiltersButton').enable() : _$w('#resetFiltersButton').disable();
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
async function resetFilters(_$w) {
|
|
226
|
-
_$w('#searchInput, #dropdownDepartment, #dropdownLocation, #dropdownJobType').value = '';
|
|
227
|
-
|
|
228
|
-
await _$w('#jobsDataset').setFilter(wixData.filter());
|
|
229
|
-
await _$w('#jobsDataset').refresh();
|
|
230
|
-
|
|
231
|
-
_$w('#resultsMultiState').changeState('results');
|
|
232
|
-
|
|
233
|
-
_$w('#resetFiltersButton').disable();
|
|
234
|
-
|
|
235
|
-
await updateCount(_$w);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
async function updateCount(_$w) {
|
|
239
|
-
const count = await _$w('#jobsDataset').getTotalCount();
|
|
240
|
-
_$w('#numOfPositionText').text = `Showing ${count} Open Positions`;
|
|
241
|
-
|
|
242
|
-
return count;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
module.exports = {
|
|
249
|
-
careersPageOnReady,
|
|
250
|
-
};
|
package/pages/homePage.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
debounce,
|
|
3
|
-
getFilter,
|
|
4
|
-
} = require('../public/filterUtils');
|
|
5
|
-
const { handleOnLocationClick } = require('../public/mapUtils');
|
|
6
|
-
const { location } = require('@wix/site-location');
|
|
7
|
-
let thisObjectVar;
|
|
8
|
-
async function homePageOnReady(_$w,thisObject) {
|
|
9
|
-
thisObjectVar=thisObject;
|
|
10
|
-
await bind(_$w);
|
|
11
|
-
await init(_$w);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function bind(_$w) {
|
|
15
|
-
_$w('#teamRepeater').onItemReady(($item, itemData) => {
|
|
16
|
-
$item('#teamButton').label = `View ${itemData.count} Open Positions`;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
_$w('#citiesDataset').onReady(async () => {
|
|
20
|
-
const numOfItems = await _$w('#citiesDataset').getTotalCount();
|
|
21
|
-
const items = await _$w('#citiesDataset').getItems(0, numOfItems);
|
|
22
|
-
let baseUrl = await location.baseUrl();
|
|
23
|
-
const linkUrl = `${baseUrl}/positions`;
|
|
24
|
-
|
|
25
|
-
const markers = items.items.map(item => {
|
|
26
|
-
const location = item.locationAddress.location;
|
|
27
|
-
return {
|
|
28
|
-
location: {
|
|
29
|
-
latitude: location.latitude,
|
|
30
|
-
longitude: location.longitude
|
|
31
|
-
},
|
|
32
|
-
address: item.locationAddress.formatted,
|
|
33
|
-
description: `<a href=${linkUrl} target="_parent" rel="noopener noreferrer" style="color:#000000;text-decoration:underline;font-weight:bold;">View ${item.count} Open Positions</a>`
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
//@ts-ignore
|
|
37
|
-
_$w('#googleMaps').setMarkers(markers);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function init(_$w) {
|
|
42
|
-
const debouncedInput = debounce(()=>handleSearchInput(_$w), 400,thisObjectVar);
|
|
43
|
-
|
|
44
|
-
_$w('#searchInput').onInput(debouncedInput);
|
|
45
|
-
_$w('#searchInput').maxLength = 40;
|
|
46
|
-
|
|
47
|
-
_$w('#searchInput').onKeyPress((event) => {
|
|
48
|
-
if (event.key === 'Enter') {
|
|
49
|
-
handleEnterPress(_$w('#searchInput').value);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
_$w('#searchInput').onFocus(() => {
|
|
54
|
-
if (_$w(`#resultsContainer`).collapsed) {
|
|
55
|
-
_$w(`#resultsContainer`).expand();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
_$w('#searchInput').onBlur(() => {
|
|
60
|
-
setTimeout(() => {
|
|
61
|
-
if (!_$w(`#resultsContainer`).collapsed) {
|
|
62
|
-
_$w(`#resultsContainer`).collapse();
|
|
63
|
-
}
|
|
64
|
-
}, 250);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
_$w('#locationItem').onClick((event)=>{
|
|
68
|
-
handleOnLocationClick(event, '#locationsRepeater', '#googleMaps', _$w);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async function handleSearchInput(_$w) {
|
|
73
|
-
let searchInput;
|
|
74
|
-
let count;
|
|
75
|
-
|
|
76
|
-
searchInput = _$w('#searchInput').value;
|
|
77
|
-
const trimmedInput = searchInput.trim();
|
|
78
|
-
|
|
79
|
-
const fieldsToSearch = [
|
|
80
|
-
{ field: 'title', searchTerm: trimmedInput },
|
|
81
|
-
{ field: 'cityText', searchTerm: trimmedInput }
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
const filter = await getFilter(fieldsToSearch, 'or');
|
|
85
|
-
|
|
86
|
-
await _$w('#jobsDataset').setFilter(filter);
|
|
87
|
-
await _$w('#jobsDataset').refresh();
|
|
88
|
-
|
|
89
|
-
count = _$w('#jobsDataset').getTotalCount();
|
|
90
|
-
|
|
91
|
-
if (count > 0) {
|
|
92
|
-
_$w('#resultsContainer').expand();
|
|
93
|
-
_$w('#searchMultiStateBox').changeState('results');
|
|
94
|
-
} else {
|
|
95
|
-
_$w('#searchMultiStateBox').changeState('noResults');
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function handleEnterPress(searchInput) {
|
|
100
|
-
const trimmedInput = searchInput.trim();
|
|
101
|
-
|
|
102
|
-
if (trimmedInput) {
|
|
103
|
-
location.to(`/positions?keyWord=${trimmedInput}`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
module.exports = {
|
|
108
|
-
homePageOnReady,
|
|
109
|
-
};
|
package/public/filterUtils.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//const { items:wixData } = require('@wix/data');
|
|
2
|
-
const {wixData} = require('wix-data');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function getFilter(fieldsToSearch = [], mode = 'or') {
|
|
6
|
-
const baseFilter = wixData.filter();
|
|
7
|
-
// if no fields to search, return empty filter
|
|
8
|
-
if (fieldsToSearch.length === 0) {
|
|
9
|
-
return baseFilter;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// build filters
|
|
13
|
-
let filter;
|
|
14
|
-
fieldsToSearch.forEach(({ field, searchTerm }) => {
|
|
15
|
-
const condition = typeof searchTerm === 'boolean'
|
|
16
|
-
? baseFilter.eq(field, searchTerm)
|
|
17
|
-
: baseFilter.contains(field, searchTerm);
|
|
18
|
-
|
|
19
|
-
filter = filter
|
|
20
|
-
? (mode === 'or' ? filter.or(condition) : filter.and(condition))
|
|
21
|
-
: condition;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return filter;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function debounce(fn, delay = 400,thisObject) {
|
|
28
|
-
let timeout;
|
|
29
|
-
return function (...args) {
|
|
30
|
-
clearTimeout(timeout);
|
|
31
|
-
console.log("thisObject is: ", thisObject);
|
|
32
|
-
console.log("args is: ", args);
|
|
33
|
-
timeout = setTimeout(() => fn.apply(thisObject, args), delay);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
module.exports = {
|
|
38
|
-
getFilter,
|
|
39
|
-
debounce
|
|
40
|
-
};
|
package/public/mapUtils.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
function handleOnLocationClick(event, repeaterId, mapId, _$w) {
|
|
2
|
-
const FOCUS_ZOOM = 13;
|
|
3
|
-
const { itemId } = event.context;
|
|
4
|
-
const itemData = _$w(repeaterId).data.find(item => item._id === itemId);
|
|
5
|
-
|
|
6
|
-
const location = itemData.locationAddress.location;
|
|
7
|
-
|
|
8
|
-
//@ts-ignore
|
|
9
|
-
_$w(mapId).setCenter(location);
|
|
10
|
-
//@ts-ignore
|
|
11
|
-
_$w(mapId).setZoom(FOCUS_ZOOM);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
handleOnLocationClick
|
|
16
|
-
};
|