@global.engg/switcher-lib 0.1.44 → 0.1.45

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.
@@ -197,7 +197,6 @@
197
197
  document.cookie = this.HANDOFF_COOKIE + "=" + value + "; Domain=." + this.HANDOFF_COOKIE_DOMAIN + "; Path=/; Max-Age=" + this.HANDOFF_COOKIE_MAX_AGE + "; Secure; SameSite=Lax";
198
198
  };
199
199
  AppSwitcherService.prototype.executeAppSwitch = function (app, kyc_status, windowRef) {
200
- var _this = this;
201
200
  var _a, _b, _c;
202
201
  if (this.userData.allow_engage && app === 'engage') {
203
202
  var targetUrl = this.SR_CONSTANTS.EngageWebBaseUrl + "gate-keeper";
@@ -210,6 +209,7 @@
210
209
  }
211
210
  var url = "https://fastrr-dashboard.pickrr.com/dashboard?utm_source=sr_dashboard&utm_medium=appswitcher&utm_campaign=appswitcher01&utm_content=appswitcher01&cid=" + this.userData.company_id;
212
211
  url = url + "&token=" + this.userData.token;
212
+ this.setHandoffCookie(url);
213
213
  windowRef.open(url, '_blank');
214
214
  // if ((this.isCheckoutAllowed(this.userData?.company_id) || this.userData.allow_checkout)) {
215
215
  // url = `${url}&token=${this.userData.token}`
@@ -241,8 +241,10 @@
241
241
  }, 500);
242
242
  }
243
243
  else {
244
+ var targetUrl_1 = this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
245
+ this.setHandoffCookie(targetUrl_1);
244
246
  setTimeout(function () {
245
- window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
247
+ window.location.href = targetUrl_1;
246
248
  }, 500);
247
249
  }
248
250
  }
@@ -254,7 +256,9 @@
254
256
  windowRef.open(targetUrl, '_blank');
255
257
  }
256
258
  else if (app === 'sr_genie') {
257
- windowRef.open("https://ai-test.kartrocket.com/login?token=" + this.userData.token, '_blank');
259
+ var targetUrl = "https://ai-test.kartrocket.com/login?token=" + this.userData.token;
260
+ this.setHandoffCookie(targetUrl);
261
+ windowRef.open(targetUrl, '_blank');
258
262
  }
259
263
  else if (app === 'one_impression') {
260
264
  // Calling one-impression and redirecting to new tab
@@ -264,10 +268,14 @@
264
268
  this.fetchOpenInAppLink();
265
269
  }
266
270
  else if (app === 'wigzo') {
267
- windowRef.open("https://app.wigzo.com/auth/shiprocket/login/" + this.userData.token, '_blank');
271
+ var targetUrl = "https://app.wigzo.com/auth/shiprocket/login/" + this.userData.token;
272
+ this.setHandoffCookie(targetUrl);
273
+ windowRef.open(targetUrl, '_blank');
268
274
  }
269
275
  else if (app === 'omuni') {
270
- windowRef.open("https://omuni.com/", '_blank');
276
+ var targetUrl = "https://omuni.com/";
277
+ this.setHandoffCookie(targetUrl);
278
+ windowRef.open(targetUrl, '_blank');
271
279
  // if (this.userData?.is_omuni2_user == 1) {
272
280
  // this.httpService.get('omuni/switch').subscribe(
273
281
  // (res) => {
@@ -286,7 +294,9 @@
286
294
  // }
287
295
  }
288
296
  else if (app === 'trends') {
289
- windowRef.open("https://trends.shiprocket.in/", '_blank');
297
+ var targetUrl = "https://trends.shiprocket.in/";
298
+ this.setHandoffCookie(targetUrl);
299
+ windowRef.open(targetUrl, '_blank');
290
300
  }
291
301
  else if (app === 'creditScore') {
292
302
  if ((_c = this.userData) === null || _c === void 0 ? void 0 : _c.is_crif_enabled) {
@@ -295,7 +305,9 @@
295
305
  windowRef.open(targetUrl, '_blank');
296
306
  }
297
307
  else {
298
- windowRef.open("https://www.shiprocket.in/capital/", '_blank');
308
+ var targetUrl = "https://www.shiprocket.in/capital/";
309
+ this.setHandoffCookie(targetUrl);
310
+ windowRef.open(targetUrl, '_blank');
299
311
  }
300
312
  }
301
313
  else if (app === 'capital') {
@@ -304,9 +316,10 @@
304
316
  windowRef.open(targetUrl, '_blank');
305
317
  }
306
318
  else if (app === 'marketing') {
307
- // Use setTimeout for window.location.href redirects
319
+ var targetUrl_2 = this.DOMAIN + "/seller/home";
320
+ this.setHandoffCookie(targetUrl_2);
308
321
  setTimeout(function () {
309
- window.location.href = _this.DOMAIN + "/seller/home";
322
+ window.location.href = targetUrl_2;
310
323
  }, 500);
311
324
  }
312
325
  else if (app === 'whatsapp_solutions') {
@@ -316,38 +329,46 @@
316
329
  windowRef.open(targetUrl, '_blank');
317
330
  }
318
331
  else {
319
- windowRef.open("https://app-engage.shiprocket.in/auth/register", '_blank');
332
+ var targetUrl = "https://app-engage.shiprocket.in/auth/register";
333
+ this.setHandoffCookie(targetUrl);
334
+ windowRef.open(targetUrl, '_blank');
320
335
  }
321
336
  }
322
337
  else if (app === 'internationalParcels') {
323
338
  if (kyc_status == 0 || kyc_status == 1 || kyc_status == 2 || kyc_status == 4) {
324
- // Use setTimeout for window.location.href redirects
339
+ var targetUrl_3 = this.DOMAIN + "/seller/internationalDashboard/overview";
340
+ this.setHandoffCookie(targetUrl_3);
325
341
  setTimeout(function () {
326
- window.location.href = _this.DOMAIN + "/seller/internationalDashboard/overview";
342
+ window.location.href = targetUrl_3;
327
343
  }, 500);
328
344
  }
329
345
  else {
346
+ var targetUrl_4 = this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
347
+ this.setHandoffCookie(targetUrl_4);
330
348
  setTimeout(function () {
331
- window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
349
+ window.location.href = targetUrl_4;
332
350
  }, 500);
333
351
  }
334
352
  }
335
353
  else if (app === 'i_rocketbox') {
336
- // Use setTimeout for window.location.href redirects
354
+ var targetUrl_5 = this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
355
+ this.setHandoffCookie(targetUrl_5);
337
356
  setTimeout(function () {
338
- window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
357
+ window.location.href = targetUrl_5;
339
358
  }, 500);
340
359
  }
341
360
  else if (app === 'brand_launch') {
342
- // Use setTimeout for window.location.href redirects
361
+ var targetUrl_6 = this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
362
+ this.setHandoffCookie(targetUrl_6);
343
363
  setTimeout(function () {
344
- window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
364
+ window.location.href = targetUrl_6;
345
365
  }, 500);
346
366
  }
347
367
  else if (app === 'express_parcel') {
348
- // Use setTimeout for window.location.href redirects
368
+ var targetUrl_7 = this.DOMAIN + "/seller/home";
369
+ this.setHandoffCookie(targetUrl_7);
349
370
  setTimeout(function () {
350
- window.location.href = _this.DOMAIN + "/seller/home";
371
+ window.location.href = targetUrl_7;
351
372
  }, 500);
352
373
  }
353
374
  else if (app === 'instant_deliveries') {
@@ -357,18 +378,22 @@
357
378
  return;
358
379
  }
359
380
  else if (app === 'warehousing') {
360
- windowRef.open("https://fulfillment.shiprocket.in/", '_blank');
381
+ var targetUrl = "https://fulfillment.shiprocket.in/";
382
+ this.setHandoffCookie(targetUrl);
383
+ windowRef.open(targetUrl, '_blank');
361
384
  }
362
385
  else if (app == 'srocketbox') {
363
- // Use setTimeout for window.location.href redirects
386
+ var targetUrl_8 = this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
387
+ this.setHandoffCookie(targetUrl_8);
364
388
  setTimeout(function () {
365
- window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
389
+ window.location.href = targetUrl_8;
366
390
  }, 500);
367
391
  }
368
392
  else if (app == 'somuni') {
369
- // Use setTimeout for window.location.href redirects
393
+ var targetUrl_9 = this.DOMAIN + "/seller/home";
394
+ this.setHandoffCookie(targetUrl_9);
370
395
  setTimeout(function () {
371
- window.location.href = _this.DOMAIN + "/seller/home";
396
+ window.location.href = targetUrl_9;
372
397
  }, 500);
373
398
  }
374
399
  };
@@ -484,16 +509,20 @@
484
509
  }
485
510
  };
486
511
  AppSwitcherService.prototype.fetchOpenInAppLink = function () {
512
+ var _this = this;
487
513
  this._http.get('oneimpression/open-app-redirection_url')
488
514
  .subscribe(function (res) {
489
515
  if (res && (res === null || res === void 0 ? void 0 : res.url)) {
516
+ _this.setHandoffCookie(res.url);
490
517
  window.open(res === null || res === void 0 ? void 0 : res.url, '_blank');
491
518
  }
492
519
  });
493
520
  };
494
521
  AppSwitcherService.prototype.fetchOneImpressionLoginLink = function () {
522
+ var _this = this;
495
523
  this._http.get(this._getURL() + 'oneimpression/get-login-link').subscribe(function (res) {
496
524
  if (res && (res === null || res === void 0 ? void 0 : res.url)) {
525
+ _this.setHandoffCookie(res.url);
497
526
  window.open(res === null || res === void 0 ? void 0 : res.url, '_blank');
498
527
  }
499
528
  else if ((res === null || res === void 0 ? void 0 : res.status) == 'fail') {