sr-npm 1.7.927 → 1.7.929

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/consts.js CHANGED
@@ -91,22 +91,27 @@ const supportTeamsPageIds={
91
91
  MOST_RECENT_JOBS_TITLE: "#mostRecentJobsTitle",
92
92
  valueToValueIdMap: {
93
93
  "Human Resouces":"PeopleSupport",
94
- "Buying":"Merchandise",
95
- "Tech":"InformationServices",
96
- "Planning":"Merchandise",
94
+ "Merchandise - Buying":"Merchandise",
95
+ "Technology, Data and Digital":"InformationServices",
96
+ "Merchandise - Planning":"Merchandise",
97
97
  "Digital":"ecommerceandDigital",// this field doesnt exists in the database
98
- "Marketing":"Marketing",
99
- "Finance":"Finance",// this field doesnt exists in the database
98
+ "Marketing and Market Media":"Marketing",
99
+ "Finance, Property and Legal":"Finance",// this field doesnt exists in the database
100
100
  "Services":"ServicesInstallation",
101
- "Design":"Merchandise",
102
- "Retail Operations":"Operations",// this field doesnt exists in the database
101
+ "Merchandise - Design and Sourcing":"Merchandise",
102
+ "Store Operations":"Operations",// this field doesnt exists in the database
103
103
  "Data":"InsightsandDataScience",// this field doesnt exists in the database
104
104
  "Property":"Property",// this field doesnt exists in the database,
105
105
  "Legal":"Legal",// this field doesnt exists in the database,
106
- "Supply Chain":"Logistics",
107
- "Contact Centre":"CustomerEngagementCentres",// this field doesnt exists in the database
106
+ "Supply Chain and Logistics":"Logistics",
107
+ "Contact Centres":"CustomerEngagementCentres",// this field doesnt exists in the database
108
108
  "Commercial":"CommercialSales",// this field doesnt exists in the database
109
- }
109
+ },
110
+ excludeValues: new Set([
111
+ "Noel Leeming Commercial",
112
+ "Noel Leeming Services",
113
+ "Sustainability"
114
+ ])
110
115
  }
111
116
  const LINKS={
112
117
  myApplication:'https://www.smartrecruiters.com/app/employee-portal/68246e5512d84f4c00a19e62/job-applications',
package/backend/data.js CHANGED
@@ -111,7 +111,9 @@ async function saveJobsDataToCMS() {
111
111
  const customFieldsValues = {}
112
112
 
113
113
  const {companyId,templateType} = await getApiKeys();
114
-
114
+ if(siteconfig===undefined) {
115
+ await getSiteConfig();
116
+ }
115
117
  // bulk insert to jobs collection without descriptions first
116
118
  const jobsData = sourcePositions.map(position => {
117
119
 
@@ -135,7 +137,7 @@ async function saveJobsDataToCMS() {
135
137
  country: position.location?.country || '',
136
138
  remote: position.location?.remote || false,
137
139
  language: position.language?.label || '',
138
- brand: getBrand(position.customField),
140
+ brand: siteconfig.disableMultiBrand==="false" ? getBrand(position.customField) : '',
139
141
  jobDescription: null, // Will be filled later
140
142
  employmentType: position.typeOfEmployment.label,
141
143
  releasedDate: position.releasedDate
@@ -149,9 +151,7 @@ async function saveJobsDataToCMS() {
149
151
  }
150
152
  return basicJob;
151
153
  });
152
- if(siteconfig===undefined) {
153
- await getSiteConfig();
154
- }
154
+
155
155
  if (siteconfig.customFields==="true") {
156
156
  await populateCustomFieldsCollection(customFieldsLabels,templateType);
157
157
  await populateCustomValuesCollection(customFieldsValues);
@@ -468,9 +468,15 @@ async function aggregateJobs() {
468
468
 
469
469
  async function referenceJobs() {
470
470
  console.log("Reference jobs");
471
+ if(siteconfig===undefined) {
472
+ await getSiteConfig();
473
+ }
471
474
  await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT });
472
475
  await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT });
473
- await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.BRAND_REF, sourceCollection: COLLECTIONS.BRANDS, jobField: JOBS_COLLECTION_FIELDS.BRAND });
476
+ if(siteconfig.disableMultiBrand==="false"){
477
+ await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.BRAND_REF, sourceCollection: COLLECTIONS.BRANDS, jobField: JOBS_COLLECTION_FIELDS.BRAND });
478
+ }
479
+
474
480
  console.log("finished referencing jobs");
475
481
  }
476
482
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.927",
3
+ "version": "1.7.929",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,15 +23,13 @@ const pagination = {
23
23
  };
24
24
  async function careersMultiBoxesPageOnReady(_$w,urlParams) {
25
25
  await loadData(_$w);
26
-
27
- await Promise.all([
28
- loadJobsRepeater(_$w),
29
- loadPrimarySearchRepeater(_$w),
30
- loadFilters(_$w),
31
- loadSelectedValuesRepeater(_$w),
32
- bindSearchInput(_$w),
33
- loadPaginationButtons(_$w)
34
- ]);
26
+ loadJobsRepeater(_$w);
27
+ loadPrimarySearchRepeater(_$w);
28
+ await loadFilters(_$w);
29
+ loadSelectedValuesRepeater(_$w);
30
+ bindSearchInput(_$w);
31
+ loadPaginationButtons(_$w);
32
+
35
33
  await handleUrlParams(_$w, urlParams);
36
34
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CLEAR_ALL_BUTTON_ID).onClick(async () => {
37
35
  await clearAll(_$w);
@@ -121,7 +119,7 @@ async function handleParams(_$w,param,value) {
121
119
  return applyFiltering;
122
120
  }
123
121
 
124
- async function loadPaginationButtons(_$w) {
122
+ function loadPaginationButtons(_$w) {
125
123
  try {
126
124
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PAGE_BUTTON_NEXT).onClick(async () => {
127
125
  let nextPageJobs=currentJobs.slice(pagination.pageSize*pagination.currentPage,pagination.pageSize*(pagination.currentPage+1));
@@ -143,7 +141,7 @@ async function loadPaginationButtons(_$w) {
143
141
  }
144
142
  }
145
143
 
146
- async function loadSelectedValuesRepeater(_$w) {
144
+ function loadSelectedValuesRepeater(_$w) {
147
145
  try {
148
146
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).onItemReady(($item, itemData) => {
149
147
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
@@ -170,7 +168,7 @@ async function loadSelectedValuesRepeater(_$w) {
170
168
  await updateJobsAndNumbersAndFilters(_$w);
171
169
  });
172
170
  });
173
- await updateSelectedValuesRepeater(_$w);
171
+ updateSelectedValuesRepeater(_$w);
174
172
  } catch (error) {
175
173
  console.error('Failed to load selected values repeater:', error);
176
174
  }
@@ -494,9 +492,9 @@ async function secondarySearch(_$w,query) {
494
492
  await refreshFacetCounts(_$w);
495
493
  return allsecondarySearchJobs;
496
494
  }
497
- async function bindSearchInput(_$w) {
495
+ function bindSearchInput(_$w) {
498
496
  try {
499
- await bindPrimarySearch(_$w,allvaluesobjects,alljobs);
497
+ bindPrimarySearch(_$w,allvaluesobjects,alljobs);
500
498
 
501
499
  const secondarySearchDebounced = debounce(async () => {
502
500
  const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || '').toLowerCase().trim();
@@ -507,11 +507,16 @@ async function updateMapMarkers(_$w){
507
507
  }
508
508
 
509
509
  async function handleBrandDropdown(_$w){
510
+ if(siteconfig.disableMultiBrand==="false"){
510
511
  const brands=await wixData.query(COLLECTIONS.BRANDS).find();
511
512
  if(brands.items.length>1){
512
513
  console.log("showing brand dropdown");
513
514
  _$w('#dropdownBrand').show();
514
515
  }
516
+ }
517
+ else{
518
+ _$w('#dropdownBrand').hide();
519
+ }
515
520
  }
516
521
  module.exports = {
517
522
  careersPageOnReady,
package/pages/homePage.js CHANGED
@@ -18,13 +18,10 @@ async function homePageOnReady(_$w,thisObject=null) {
18
18
  if(siteconfig.categorySearch==="true") {
19
19
  const allJobs=await getAllRecords(COLLECTIONS.JOBS);
20
20
  const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
21
- await Promise.all([
22
- bindPrimarySearch(_$w,allvaluesobjects,allJobs),
23
- loadPrimarySearchRepeater(_$w),
24
- bindTeamRepeater(_$w),
25
- bindViewAllButton(_$w),
26
-
27
- ]);
21
+ bindPrimarySearch(_$w,allvaluesobjects,allJobs);
22
+ loadPrimarySearchRepeater(_$w)
23
+ bindTeamRepeater(_$w)
24
+ bindViewAllButton(_$w)
28
25
  }
29
26
  else{
30
27
 
@@ -60,8 +60,8 @@ function groupValuesByField(values, refKey) {
60
60
  }
61
61
  }
62
62
 
63
- async function loadPrimarySearchRepeater(_$w) {
64
- try {
63
+ function loadPrimarySearchRepeater(_$w) {
64
+
65
65
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOB_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
66
66
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_POSITION_BUTTON).label = itemData.title || '';
67
67
  });
@@ -87,12 +87,9 @@ async function loadPrimarySearchRepeater(_$w) {
87
87
  location.to(`${baseUrl}/search?category=${encodedCategory}`);
88
88
  });
89
89
 
90
- } catch (error) {
91
- console.error('Failed to load primary search repeater:', error);
92
- }
93
90
  }
94
91
 
95
- async function bindPrimarySearch(_$w,allvaluesobjects,alljobs) {
92
+ function bindPrimarySearch(_$w,allvaluesobjects,alljobs) {
96
93
 
97
94
  const primarySearchDebounced = debounce(async () => {
98
95
  const query = (_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value || '').toLowerCase().trim();
@@ -89,7 +89,8 @@ async function getCategoryValueId(customValues) {
89
89
  function handleApplyButton(_$w,item) {
90
90
  try{
91
91
  _$w('#applyButton').target="_blank";//so it can open in new tab
92
- const url=appendQueryParams(item.applyLink,query);
92
+
93
+ const url=buildApplyLinkWithQueryParams(item.applyLink,query);
93
94
  _$w('#applyButton').link=url; //so it can be clicked
94
95
  }
95
96
  catch(error){
@@ -99,6 +100,20 @@ async function getCategoryValueId(customValues) {
99
100
  }
100
101
  }
101
102
 
103
+ function buildApplyLinkWithQueryParams(url, query) {
104
+ if (!url || typeof url !== 'string' || !url.startsWith('http')) {
105
+ console.warn(`Invalid URL ${url}, button link will not be set`);
106
+ return null;
107
+ }
108
+
109
+ if (!query || typeof query !== 'object') {
110
+ console.warn(`Invalid query params ${query}, button link will not be set`);
111
+ return null;
112
+ }
113
+
114
+ return appendQueryParams(url, query);
115
+ }
116
+
102
117
  async function getRelatedJobs({ categoryValueId, itemId, limit = 1000 }) {
103
118
 
104
119
 
@@ -14,7 +14,12 @@ async function supportTeasmPageOnReady(_$w) {
14
14
  async function handleRecentJobsSection(_$w) {
15
15
 
16
16
  const currentItem= _$w(supportTeamsPageIds.TEAM_SUPPORT_DYNAMIC_DATASET).getCurrentItem();
17
- console.log("currentItem: ",currentItem);
17
+ console.log("currentItem 2 3 4: ",currentItem);
18
+ if(supportTeamsPageIds.excludeValues.has(currentItem.title_fld)) {
19
+ console.log("Value is excluded , collapsing recently Jobs Section ");
20
+ await collapseSection(_$w);
21
+ return;
22
+ }
18
23
  const valueId=supportTeamsPageIds.valueToValueIdMap[currentItem.title_fld]
19
24
  console.log("valueId: ",valueId);
20
25
  const Value=await getValueFromValueId(valueId);