sr-npm 1.7.518 → 1.7.520
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/data.js
CHANGED
|
@@ -28,7 +28,6 @@ function validatePosition(position) {
|
|
|
28
28
|
|
|
29
29
|
async function filterBasedOnBrand(positions) {
|
|
30
30
|
try{
|
|
31
|
-
|
|
32
31
|
const desiredBrand = await getTokenFromCMS(TOKEN_NAME.DESIRED_BRAND);
|
|
33
32
|
validateSingleDesiredBrand(desiredBrand);
|
|
34
33
|
console.log("filtering positions based on brand: ", desiredBrand);
|
|
@@ -53,10 +52,21 @@ function validateSingleDesiredBrand(desiredBrand) {
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
function addCustomFields(basicJob, position) {
|
|
56
|
+
const customFieldsArray = Array.isArray(position?.customField) ? position.customField : [];
|
|
57
|
+
const customFields = {};
|
|
58
|
+
for (const field of customFieldsArray) {
|
|
59
|
+
const label = field.fieldLabel;
|
|
60
|
+
const key = normalizeString(label);
|
|
61
|
+
const value = field.valueLabel
|
|
62
|
+
customFields[key] = value;
|
|
63
|
+
}
|
|
64
|
+
return { ...basicJob, customFields };
|
|
65
|
+
}
|
|
66
|
+
|
|
56
67
|
async function saveJobsDataToCMS() {
|
|
57
68
|
const positions = await fetchPositionsFromSRAPI();
|
|
58
69
|
const sourcePositions = await filterBasedOnBrand(positions);
|
|
59
|
-
|
|
60
70
|
// bulk insert to jobs collection without descriptions first
|
|
61
71
|
const jobsData = sourcePositions.map(position => {
|
|
62
72
|
const basicJob = {
|
|
@@ -79,9 +89,10 @@ async function saveJobsDataToCMS() {
|
|
|
79
89
|
country: position.location?.country || '',
|
|
80
90
|
remote: position.location?.remote || false,
|
|
81
91
|
language: position.language?.label || '',
|
|
82
|
-
|
|
92
|
+
// brand: getBrand(position.customField),
|
|
83
93
|
jobDescription: null, // Will be filled later
|
|
84
94
|
};
|
|
95
|
+
basicJob=addCustomFields(basicJob,position)
|
|
85
96
|
return basicJob;
|
|
86
97
|
});
|
|
87
98
|
|
|
@@ -354,18 +365,18 @@ async function referenceJobs() {
|
|
|
354
365
|
|
|
355
366
|
async function syncJobsFast() {
|
|
356
367
|
console.log("Syncing jobs fast");
|
|
357
|
-
await createCollections();
|
|
358
|
-
await clearCollections();
|
|
359
|
-
await fillSecretManagerMirror();
|
|
368
|
+
// await createCollections();
|
|
369
|
+
// await clearCollections();
|
|
370
|
+
// await fillSecretManagerMirror();
|
|
360
371
|
console.log("saving jobs data to CMS");
|
|
361
372
|
await saveJobsDataToCMS();
|
|
362
373
|
console.log("saved jobs data to CMS successfully");
|
|
363
|
-
console.log("saving jobs descriptions and location apply url to CMS");
|
|
364
|
-
await saveJobsDescriptionsAndLocationApplyUrlToCMS();
|
|
365
|
-
console.log("saved jobs descriptions and location apply url to CMS successfully");
|
|
366
|
-
await aggregateJobs();
|
|
367
|
-
await referenceJobs();
|
|
368
|
-
console.log("syncing jobs fast finished successfully");
|
|
374
|
+
// console.log("saving jobs descriptions and location apply url to CMS");
|
|
375
|
+
// await saveJobsDescriptionsAndLocationApplyUrlToCMS();
|
|
376
|
+
// console.log("saved jobs descriptions and location apply url to CMS successfully");
|
|
377
|
+
// await aggregateJobs();
|
|
378
|
+
// await referenceJobs();
|
|
379
|
+
// console.log("syncing jobs fast finished successfully");
|
|
369
380
|
}
|
|
370
381
|
|
|
371
382
|
async function clearCollections() {
|
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -3,8 +3,7 @@ const {wixData} = require('wix-data');
|
|
|
3
3
|
const { window } = require('@wix/site-window');
|
|
4
4
|
const { query,queryParams,onChange} = require("wix-location-frontend");
|
|
5
5
|
const { location } = require("@wix/site-location");
|
|
6
|
-
const { COLLECTIONS
|
|
7
|
-
const { getTokenFromCMS } = require('../backend/secretsData');
|
|
6
|
+
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
8
7
|
|
|
9
8
|
const {
|
|
10
9
|
debounce,
|
|
@@ -496,23 +495,13 @@ async function updateMapMarkers(_$w){
|
|
|
496
495
|
|
|
497
496
|
}
|
|
498
497
|
|
|
499
|
-
async function handleBrandDropdown(_$w)
|
|
500
|
-
const brands
|
|
501
|
-
|
|
502
|
-
try {
|
|
503
|
-
disableMultiBrand = await getTokenFromCMS(TOKEN_NAME.DISABLE_MULTI_BRAND);
|
|
504
|
-
} catch (e) {
|
|
505
|
-
if (e.message !== "[getTokenFromCMS], No disableMultiBrand found") throw e;
|
|
506
|
-
console.log("disableMultiBrand token wasn't found");
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
console.log("disableMultiBrand: ", disableMultiBrand);
|
|
510
|
-
if (brands.items.length > 1 && disableMultiBrand !== 'true') {
|
|
498
|
+
async function handleBrandDropdown(_$w){
|
|
499
|
+
const brands=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
500
|
+
if(brands.items.length>1){
|
|
511
501
|
console.log("showing brand dropdown");
|
|
512
502
|
_$w('#dropdownBrand').show();
|
|
513
503
|
}
|
|
514
504
|
}
|
|
515
|
-
|
|
516
505
|
module.exports = {
|
|
517
506
|
careersPageOnReady,
|
|
518
507
|
};
|