authscape 1.0.670 → 1.0.672

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": "authscape",
3
- "version": "1.0.670",
3
+ "version": "1.0.672",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,27 +15,39 @@ export async function PrivateLabelPageModule(apiUri, host) {
15
15
  const response = await fetch(apiUri + "/api/PrivateLabel/GetCompanyIdFromDomain?domain=" + host);
16
16
  if (response.status == 200)
17
17
  {
18
- var data = await response.json();
19
- if (data != null)
18
+ var dataResponse = await response.json();
19
+ if (dataResponse != null)
20
20
  {
21
- if (data.companyId != null)
21
+ if (dataResponse.companyId != null)
22
22
  {
23
- data.oemCompanyId = data.companyId;
23
+ data.oemCompanyId = dataResponse.companyId;
24
24
  }
25
25
 
26
- if (data.demoCompanyId != null)
26
+ if (dataResponse.demoCompanyId != null)
27
27
  {
28
- data.demoId = data.demoCompanyId;
28
+ data.demoId = dataResponse.demoCompanyId;
29
29
  }
30
30
 
31
- if (data.favIcon != null)
31
+ if (dataResponse.favIcon != null)
32
32
  {
33
- data.favIcon = data.favIcon;
33
+ data.favIcon = dataResponse.favIcon;
34
34
  }
35
35
 
36
- if (data.companyName != null)
36
+ if (dataResponse.companyName != null)
37
37
  {
38
- data.companyName = data.companyName;
38
+ data.companyName = dataResponse.companyName;
39
+ }
40
+
41
+ // check for redirect
42
+ if (dataResponse.redirectTrafficToCanonical)
43
+ {
44
+ const hasWWW = host.startsWith('www.');
45
+ if (hasWWW) {
46
+ data.redirect = {
47
+ destination: dataResponse.canonicalBaseUrl, // Replace with your target URL
48
+ permanent: false, // Set to true for a permanent redirect (HTTP 308)
49
+ }
50
+ }
39
51
  }
40
52
  }
41
53
  }