sr-npm 1.7.358 → 1.7.360

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.358",
3
+ "version": "1.7.360",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -88,11 +88,6 @@ async function setPageParamInUrl() {
88
88
 
89
89
  }
90
90
  async function handleUrlParams(_$w) {
91
- console.log("queryKeyWordVar: ", queryKeyWordVar);
92
- console.log("queryPageVar: ", queryPageVar);
93
- console.log("queryDepartmentVar: ", queryDepartmentVar);
94
- console.log("queryLocationVar: ", queryLocationVar);
95
- console.log("queryJobTypeVar: ", queryJobTypeVar);
96
91
  if (queryKeyWordVar) {
97
92
  await handleKeyWordParam(_$w,queryKeyWordVar);
98
93
  }
@@ -114,7 +109,6 @@ async function handleUrlParams(_$w) {
114
109
  async function handleKeyWordParam(_$w,keyWord) {
115
110
  _$w('#searchInput').value = keyWord;
116
111
  // Use applyFilters to maintain consistency instead of directly setting filter
117
- // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
118
112
  }
119
113
 
120
114
  async function handlePageParam(_$w) {
@@ -178,7 +172,7 @@ function init(_$w) {
178
172
  }
179
173
  });
180
174
  _$w('#dropdownDepartment, #dropdownLocation, #dropdownJobType').onChange(()=>{
181
- console.log("onChange triggering on dropdown@@@@@@");
175
+ console.log("dropdown onChange is triggered");
182
176
  applyFilters(_$w);
183
177
  });
184
178
  _$w('#resetFiltersButton, #clearSearch').onClick(()=>resetFilters(_$w));
@@ -194,64 +188,7 @@ function init(_$w) {
194
188
  //URL onChange
195
189
  onChange(async ()=>{
196
190
  await handleBackAndForth(_$w);
197
-
198
-
199
-
200
-
201
-
202
-
203
- //try onready first
204
- //try location to
205
-
206
-
207
-
208
-
209
-
210
- // handleBackAndForth(_$w);
211
- // const newQueryParams=await location.query();
212
- // console.log("location.query(): ", newQueryParams);
213
- // if(newQueryParams.keyWord){
214
- // console.log("setting querykeyparam")
215
- // queryKeyWordVar=newQueryParams.keyWord;
216
- // }
217
- // else
218
- // {
219
- // queryKeyWordVar=undefined;
220
- // _$w('#searchInput').value = '';
221
- // deletedParam=true;
222
- // }
223
- // if(newQueryParams.department){
224
- // console.log("setting queryDepartmentVar")
225
- // queryDepartmentVar=newQueryParams.department;
226
- // }
227
- // else
228
- // {
229
- // queryDepartmentVar=undefined;
230
- // _$w('#dropdownDepartment').value = '';
231
- // deletedParam=true;
232
- // }
233
- // if(newQueryParams.location){
234
- // console.log("setting queryLocationVar")
235
- // queryLocationVar=newQueryParams.location;
236
- // }
237
- // else
238
- // {
239
- // queryLocationVar=undefined;
240
- // _$w('#dropdownLocation').value = '';
241
- // deletedParam=true;
242
- // }
243
-
244
- // await handleUrlParams(_$w);
245
- // if(deletedParam)
246
- // {
247
- // await applyFilters(_$w,true);
248
- // deletedParam=false;
249
- // }
250
191
  });
251
-
252
-
253
-
254
-
255
192
  }
256
193
 
257
194
 
@@ -291,9 +228,6 @@ async function handleBackAndForth(_$w){
291
228
  _$w('#dropdownJobType').value = '';
292
229
  }
293
230
  await handleUrlParams(_$w);
294
- // if(deletedParam){
295
- // await applyFilters(_$w,true);
296
- // }
297
231
 
298
232
  }
299
233
 
@@ -324,15 +258,12 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
324
258
  if (!skipUrlUpdate) {
325
259
  if(filter.field === 'title'){
326
260
  queryParams.add({ keyWord: filter.value });
327
- // queryKeyWordVar=filter.value;
328
261
  }
329
262
  if(filter.field === 'department'){
330
263
  queryParams.add({ department: encodeURIComponent(filter.value) });
331
- //queryDepartmentVar=filter.value;
332
264
  }
333
265
  if(filter.field === 'cityText'){
334
266
  queryParams.add({ location: encodeURIComponent(filter.value) });
335
- //queryLocationVar=filter.value;
336
267
  }
337
268
  if(filter.field === 'remote'){
338
269
  if(filter.value === 'true'){
@@ -341,7 +272,6 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
341
272
  else{
342
273
  queryParams.add({ jobType: encodeURIComponent("onsite") });
343
274
  }
344
- //queryJobTypeVar=filter.value;
345
275
  }
346
276
  }
347
277
  if(filter.field === 'remote') {
@@ -355,22 +285,18 @@ async function applyFilters(_$w, skipUrlUpdate = false) {
355
285
  if (!skipUrlUpdate) {
356
286
  if(filter.field === 'title'){
357
287
  queryParams.remove(["keyWord" ]);
358
- // queryKeyWordVar=undefined;
359
288
  }
360
289
  if(filter.field === 'department'){
361
290
  console.log("removing department from url")
362
291
  queryParams.remove(["department" ]);
363
- // queryDepartmentVar=undefined;
364
292
  }
365
293
  if(filter.field === 'cityText'){
366
294
  console.log("removing location from url")
367
295
  queryParams.remove(["location" ]);
368
- // queryLocationVar=undefined;
369
296
  }
370
297
  if(filter.field === 'remote'){
371
298
  console.log("removing jobType from url")
372
299
  queryParams.remove(["jobType" ]);
373
- // queryJobTypeVar=undefined;
374
300
  }
375
301
  }
376
302
  }
@@ -438,7 +364,6 @@ async function handleDepartmentParam(_$w,department) {
438
364
  {
439
365
  console.log("department value found in dropdown options ",departmentValue);
440
366
  _$w('#dropdownDepartment').value = departmentValue;
441
- // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
442
367
  }
443
368
  else{
444
369
  console.warn("department value not found in dropdown options");
@@ -479,7 +404,6 @@ async function handleLocationParam(_$w,location) {
479
404
 
480
405
  if(option){
481
406
  _$w('#dropdownLocation').value = option.value;
482
- // await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
483
407
  }
484
408
  else{
485
409
  console.warn("location value not found in dropdown options");
@@ -499,9 +423,7 @@ async function handleJobTypeParam(_$w,jobType) {
499
423
  if(jobTypeValue.toLowerCase()==="onsite"){
500
424
  option="false";
501
425
  }
502
- //const option=_$w('#dropdownJobType').options.find(option => option.value.toLowerCase() === jobTypeValue.toLowerCase())
503
426
  if(option){
504
-
505
427
  _$w('#dropdownJobType').value = option;
506
428
  }
507
429
  else{
@@ -1,6 +1,5 @@
1
1
  const {
2
- htmlToText,
3
- htmlToRichContent
2
+ htmlToText
4
3
  } = require('../public/utils');
5
4
 
6
5
  async function positionPageOnReady(_$w) {
@@ -16,7 +15,6 @@ const {
16
15
  _$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
17
16
  _$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
18
17
  _$w('#qualificationsText').text = htmlToText(item.jobDescription.qualifications.text);
19
- _$w('#richContent').content = await htmlToRichContent(item.jobDescription.jobDescription.text);
20
18
  _$w('#relatedJobsTitleText').text = `More ${item.department} Positions`;
21
19
  });
22
20
 
package/public/utils.js CHANGED
@@ -1,4 +1,3 @@
1
- const { fetch } = require('wix-fetch');
2
1
 
3
2
  function htmlToText(html) {
4
3
  if (!html) return '';
@@ -21,41 +20,8 @@ function htmlToText(html) {
21
20
  return text.replace(/\n\s*\n+/g, '\n\n').replace(/[ \t]+\n/g, '\n').trim();
22
21
  }
23
22
 
24
- async function htmlToRichContent(htmlString) {
25
-
26
- const raw = JSON.stringify({
27
- "content": htmlString
28
- });
29
23
 
30
24
 
31
- const requestOptions = {
32
- method: "post",
33
- headers: {
34
- "Content-Type": "application/json",
35
- "Cookie": "XSRF-TOKEN=1753949844|p--a7HsuVjR4",
36
- "Authorization": "Bearer 2e19efe5f44d29d74480f5b744a5a90f19ba6ca7012ced19e7b14edb1ad6a641"
37
-
38
- },
39
- body: raw
40
- };
41
- try{
42
- const response = await fetch("https://www.wixapis.com/data-sync/v1/abmp-content-converter", requestOptions);
43
- if (response.ok) {
44
- const data = await response.json();
45
- return data.richContent;
46
- }
47
-
48
- else
49
- {
50
- console.error(`error in fetching data, response: ${response}`);
51
-
52
- }
53
- }
54
- catch(error){
55
- console.error("error in fetching data",error);
56
- }
57
- }
58
-
59
25
  function filterBrokenMarkers(items) {
60
26
  return items
61
27
  .filter(item => {
@@ -75,6 +41,5 @@ function filterBrokenMarkers(items) {
75
41
 
76
42
  module.exports = {
77
43
  htmlToText,
78
- filterBrokenMarkers,
79
- htmlToRichContent
44
+ filterBrokenMarkers
80
45
  };