sr-npm 1.7.874 → 1.7.875

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.7.874",
3
+ "version": "1.7.875",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/pages/homePage.js CHANGED
@@ -19,7 +19,8 @@ async function homePageOnReady(_$w,thisObject=null) {
19
19
  const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
20
20
  await Promise.all([
21
21
  bindPrimarySearch(_$w,allvaluesobjects,allJobs),
22
- loadPrimarySearchRepeater(_$w)
22
+ loadPrimarySearchRepeater(_$w),
23
+ bindTeamRepeater(_$w)
23
24
  ]);
24
25
  }
25
26
  else{
@@ -32,13 +33,9 @@ async function homePageOnReady(_$w,thisObject=null) {
32
33
  }
33
34
 
34
35
  function bind(_$w) {
35
- _$w('#teamRepeater').onItemReady(($item, itemData) => {
36
- $item('#teamButton').label = `View ${itemData.count} Open Positions`;
37
- $item('#teamButton').onClick(()=>{
38
- const department = encodeURIComponent(itemData.title);
39
- location.to(`/positions?department=${department}`);
40
- });
41
- });
36
+
37
+ bindTeamRepeater(_$w);
38
+
42
39
 
43
40
  _$w('#citiesDataset').onReady(async () => {
44
41
  const numOfItems = await _$w('#citiesDataset').getTotalCount();
@@ -64,6 +61,17 @@ async function homePageOnReady(_$w,thisObject=null) {
64
61
  });
65
62
  }
66
63
 
64
+ function bindTeamRepeater(_$w) {
65
+ _$w('#teamRepeater').onItemReady(($item, itemData) => {
66
+ $item('#teamButton').label = `View ${itemData.count} Open Positions`;
67
+ console.log("itemData: ", itemData);
68
+ $item('#teamButton').onClick(()=>{
69
+ const department = encodeURIComponent(itemData.title);
70
+ location.to(`/positions?department=${department}`);
71
+ });
72
+ });
73
+ }
74
+
67
75
  function init(_$w) {
68
76
  const debouncedInput = debounce(()=>handleSearchInput(_$w), 400,thisObjectVar);
69
77
 
@@ -37,10 +37,9 @@ async function getCategoryValueId(customValues) {
37
37
  const item = await _$w('#datasetJobsItem').getCurrentItem();
38
38
  const multiRefField=await getPositionWithMultiRefField(item._id);
39
39
  const categoryValueId=await getCategoryValueId(multiRefField);
40
-
41
40
  handleReferFriendButton(_$w,item);
42
-
43
41
  handleApplyButton(_$w,item);
42
+
44
43
 
45
44
  _$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
46
45
  _$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
@@ -83,15 +82,21 @@ async function getCategoryValueId(customValues) {
83
82
 
84
83
  function handleReferFriendButton(_$w,item) {
85
84
  if(!item.referFriendLink && isElementExistOnPage(_$w('#referFriendButton'))){
86
- console.log("hiding referFriendButton");
87
85
  _$w('#referFriendButton').hide();
88
86
  }
89
87
  }
90
88
 
91
89
  function handleApplyButton(_$w,item) {
90
+ try{
92
91
  _$w('#applyButton').target="_blank";//so it can open in new tab
93
- const url=appendQueryParams(item.applyLink,query);
94
- _$w('#applyButton').link=url; //so it can be clicked
92
+ const url=appendQueryParams(item.applyLink,query);
93
+ _$w('#applyButton').link=url; //so it can be clicked
94
+ }
95
+ catch(error){
96
+ console.warn("error in handleApplyButton: , using applyLink directly", error);
97
+ _$w('#applyButton').target="_blank";
98
+ _$w('#applyButton').link=item.applyLink;
99
+ }
95
100
  }
96
101
 
97
102
  async function getRelatedJobs(categoryValueId,itemId,limit=1000) {
package/public/utils.js CHANGED
@@ -40,15 +40,10 @@ function filterBrokenMarkers(items) {
40
40
 
41
41
 
42
42
  function appendQueryParams(url,query){
43
- console.log("appendQueryParams url: ", url);
44
- console.log("appendQueryParams query: ", query);
45
43
  const urlObj=new URL(url);
46
- console.log("urlObj urlObj: ", urlObj);
47
44
  Object.entries(query).forEach(([key,value])=>{
48
45
  urlObj.searchParams.set(key,value);
49
46
  });
50
- console.log("urlObj urlObj: ", urlObj);
51
- console.log("urlObj urlObj.toString(): ", urlObj.toString());
52
47
  return urlObj.toString();
53
48
  }
54
49