sr-npm 1.7.958 → 1.7.959

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.958",
3
+ "version": "1.7.959",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,7 +12,6 @@ async function bindBoardPeopleRepeaters(_$w) {
12
12
  _$w('#directorsRepeaterItem').onClick((event) => {
13
13
  const $item = _$w.at(event.context);
14
14
  const clickedItemData = $item('#dynamicDataset').getCurrentItem();
15
- console.log("clickedItemData: ",clickedItemData);
16
15
  location.to(`/${clickedItemData['link-board-people-title_fld']}`);
17
16
 
18
17
  });
@@ -20,7 +19,6 @@ async function bindBoardPeopleRepeaters(_$w) {
20
19
  _$w('#executivesRepeaterItem').onClick((event) => {
21
20
  const $item = _$w.at(event.context);
22
21
  const clickedItemData = $item('#dataset1').getCurrentItem();
23
- console.log("clickedItemData: ",clickedItemData);
24
22
  location.to(`/${clickedItemData['link-board-people-title_fld']}`);
25
23
 
26
24
  });
@@ -20,11 +20,11 @@ const {
20
20
 
21
21
  }
22
22
 
23
- async function getCategoryValue(customValues) {
23
+ async function getCategoryValueId(customValues) {
24
24
  const categoryCustomField=await wixData.query(COLLECTIONS.CUSTOM_FIELDS).eq(CUSTOM_FIELDS_COLLECTION_FIELDS.TITLE,"Category").find().then(result => result.items[0]);
25
25
  for(const value of customValues) {
26
26
  if(value.customField===categoryCustomField._id) {
27
- return value;
27
+ return value._id;
28
28
 
29
29
  }
30
30
  }
@@ -35,14 +35,11 @@ async function getCategoryValue(customValues) {
35
35
  _$w('#datasetJobsItem').onReady(async () => {
36
36
 
37
37
  const item = await _$w('#datasetJobsItem').getCurrentItem();
38
- console.log("item: ",item);
39
-
38
+
40
39
  handleReferFriendButton(_$w,item);
41
40
  handleApplyButton(_$w,item);
42
41
 
43
42
 
44
-
45
-
46
43
  _$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
47
44
  _$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
48
45
  _$w('#qualificationsText').text = htmlToText(item.jobDescription.qualifications.text);
@@ -55,13 +52,9 @@ async function getCategoryValue(customValues) {
55
52
  {
56
53
 
57
54
  const multiRefField=await getPositionWithMultiRefField(item._id);
58
- const categoryValue=await getCategoryValue(multiRefField);
59
-
60
- if(isElementExistOnPage(_$w('#jobCategory'))) {
61
- _$w('#jobCategory').text = categoryValue.title;
62
- }
63
-
64
- const relatedJobs = await getRelatedJobs({ categoryValueId:categoryValue._id, itemId: item._id ,limit:5});
55
+ const categoryValueId=await getCategoryValueId(multiRefField);
56
+
57
+ const relatedJobs = await getRelatedJobs({ categoryValueId, itemId: item._id ,limit:5});
65
58
  _$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
66
59
  $item('#relatedJobTitle').text = itemData.title;
67
60
  $item('#relatedJobLocation').text = itemData.location.fullLocation;
@@ -91,7 +84,7 @@ async function getCategoryValue(customValues) {
91
84
  }
92
85
 
93
86
  }
94
-
87
+
95
88
  function handleReferFriendButton(_$w,item) {
96
89
  if(!item.referFriendLink && isElementExistOnPage(_$w('#referFriendButton'))){
97
90
  _$w('#referFriendButton').hide();
@@ -6,16 +6,10 @@ const { getAllRecordsWithoutMultiRef } = require('./pagesUtils');
6
6
  let currentItem;
7
7
  async function supportTeasmPageOnReady(_$w) {
8
8
  currentItem= _$w(supportTeamsPageIds.TEAM_SUPPORT_DYNAMIC_DATASET).getCurrentItem();
9
- console.log("currentItem: ",currentItem);
10
- await handleRecentJobsSection(_$w);
11
- await handlePeopleSection(_$w);
12
- await handleVideoSection(_$w);
13
-
9
+ Promise.all([handleRecentJobsSection(_$w),handlePeopleSection(_$w),handleVideoSection(_$w)]);
14
10
  }
15
11
 
16
12
  async function handleVideoSection(_$w) {
17
- console.log("inside video section");
18
- console.log("currentItem: ",currentItem);
19
13
  if(!currentItem.videoExists) {
20
14
  console.log("Video does not exist , collapsing video section ");
21
15
  await collapseSection(_$w,"video");
@@ -25,15 +19,8 @@ async function handleVideoSection(_$w) {
25
19
  }
26
20
 
27
21
  async function handlePeopleSection(_$w) {
28
- const currentPeopleRepeaterData= _$w(supportTeamsPageIds.PEOPLE_REPEATER).data;
29
- console.log("currentPeopleRepeaterData: ",currentPeopleRepeaterData);
30
22
  const allpeoplesrecord=await getAllRecordsWithoutMultiRef("OurPeople");
31
- console.log("allpeoplesrecord: ",allpeoplesrecord);
32
- console.log("currentItem inisde peolpe serion: ",currentItem);
33
23
  const peopleToDisplay=allpeoplesrecord.filter(person=>person.supportTeamName===currentItem._id);
34
- console.log("peopleToDisplay: ",peopleToDisplay);
35
- let itemObj = _$w("#peopleDataset").getCurrentItem();
36
- console.log("itemObj: ",itemObj);
37
24
 
38
25
  if(peopleToDisplay.length === 0) {
39
26
  console.log("No people found , collapsing people section ");
@@ -47,26 +34,21 @@ async function handlePeopleSection(_$w) {
47
34
  async function handleRecentJobsSection(_$w) {
48
35
 
49
36
 
50
- console.log("currentItem 2 3 4 5: ",currentItem);
51
37
  if(supportTeamsPageIds.excludeValues.has(currentItem.title_fld)) {
52
38
  console.log("Value is excluded , collapsing recently Jobs Section ");
53
39
  await collapseSection(_$w,"recentJobs");
54
40
  return;
55
41
  }
56
42
  const valueId=supportTeamsPageIds.valueToValueIdMap[currentItem.title_fld]
57
- console.log("valueId: ",valueId);
58
43
  const Value=await getValueFromValueId(valueId);
59
- console.log("Value: ",Value);
60
44
  if(Value===undefined) {
61
45
  console.log("Value is undefined , collapsing recently Jobs Section ");
62
46
  await collapseSection(_$w,"recentJobs");
63
47
  return;
64
48
  }
65
49
  const latestsJobs=await getLatestJobsByValue(Value);
66
- console.log("latestsJobs: ",latestsJobs);
67
50
 
68
51
  _$w(supportTeamsPageIds.RECENT_JOBS_REPEATER).onItemReady(($item, itemData) => {
69
- console.log("itemData: ",itemData);
70
52
  $item(supportTeamsPageIds.JOB_TITLE).text = itemData.title;
71
53
  $item(supportTeamsPageIds.JOB_LOCATION).text = itemData.location.fullLocation;
72
54
 
package/public/utils.js CHANGED
@@ -14,8 +14,7 @@ function htmlToText(html) {
14
14
  .replace(/>/g, '>')
15
15
  .replace(/"/g, '"')
16
16
  .replace(/'/g, "'")
17
- .replace(/ /g, ' ')
18
- .replace(/ /gi, ' ');
17
+ .replace(/ /g, ' ');
19
18
 
20
19
  // Clean up whitespace
21
20
  return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();