ws-process 0.3.56 → 0.3.58

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.
Files changed (2) hide show
  1. package/index.js +20 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -603,6 +603,8 @@ function asyncSend(msg) {
603
603
 
604
604
  if (!msg.action) {
605
605
  let url;
606
+ const user = getState().user.currentUser;
607
+
606
608
  if (/^https{0,1}:\/\//.test(msg.url)) {
607
609
  url = msg.url;
608
610
  } else {
@@ -624,10 +626,26 @@ function asyncSend(msg) {
624
626
  if (altDomain) {
625
627
  url = [altDomain, msg.url.replace(/^\/{0,}/, '')].join('/');
626
628
  } else {
627
- url = ['https://api2.bsg.support', msg.url.replace(/^\/{0,}/, '')].join('/');
629
+ const defaultDomain = [
630
+ 'https://',
631
+ [
632
+ 'api',
633
+ ['dev', 'staging'].find(
634
+ (each) => each === local.stage,
635
+ )
636
+ ? 'dev'
637
+ : null,
638
+ ]
639
+ .filter(Boolean)
640
+ .join('-'),
641
+ '.bsg.support',
642
+ ].join('');
643
+ url = [
644
+ user.system?.useApi2 === true ? 'https://api2.bsg.support' : defaultDomain,
645
+ msg.url.replace(/^\/{0,}/, ''),
646
+ ].join('/');
628
647
  }
629
648
  }
630
- const user = getState().user.currentUser;
631
649
  const headers = {};
632
650
  headers['bsg-support-process-id'] = msg.processID;
633
651
  headers['bsg-support-api-key'] = user.apiKey || undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws-process",
3
- "version": "0.3.56",
3
+ "version": "0.3.58",
4
4
  "description": "Process Management for Web Socket Client",
5
5
  "main": "index.js",
6
6
  "type": "module",