authscape 1.0.668 → 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/index.js CHANGED
@@ -261,10 +261,19 @@ function AuthScapeApp(_ref) {
261
261
  };
262
262
  (0, _react.useEffect)(function () {
263
263
  if (frontEndLoadedState) {
264
- if (process.env.googleAnalytics4 != "") {
264
+ if (pageProps.googleAnalytics4Code != null) {
265
+ initGA(pageProps.googleAnalytics4Code);
266
+ } else if (process.env.googleAnalytics4 != "") {
265
267
  initGA(process.env.googleAnalytics4);
266
268
  }
267
- if (process.env.microsoftClarityTrackingCode != "") {
269
+ if (pageProps.microsoftClarityCode != null) {
270
+ _reactMicrosoftClarity.clarity.init(pageProps.microsoftClarityCode);
271
+ if (signedInUser.current != null && _reactMicrosoftClarity.clarity.hasStarted()) {
272
+ _reactMicrosoftClarity.clarity.identify('USER_ID', {
273
+ userProperty: signedInUser.current.id.toString()
274
+ });
275
+ }
276
+ } else if (process.env.microsoftClarityTrackingCode != "") {
268
277
  _reactMicrosoftClarity.clarity.init(process.env.microsoftClarityTrackingCode);
269
278
  if (signedInUser.current != null && _reactMicrosoftClarity.clarity.hasStarted()) {
270
279
  _reactMicrosoftClarity.clarity.identify('USER_ID', {
@@ -9183,7 +9192,7 @@ function PrivateLabelPageModule(_x, _x2) {
9183
9192
  }
9184
9193
  function _PrivateLabelPageModule() {
9185
9194
  _PrivateLabelPageModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(apiUri, host) {
9186
- var data, response;
9195
+ var data, response, dataResponse, hasWWW;
9187
9196
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9188
9197
  while (1) switch (_context.prev = _context.next) {
9189
9198
  case 0:
@@ -9204,19 +9213,31 @@ function _PrivateLabelPageModule() {
9204
9213
  _context.next = 8;
9205
9214
  return response.json();
9206
9215
  case 8:
9207
- data = _context.sent;
9208
- if (data != null) {
9209
- if (data.companyId != null) {
9210
- data.oemCompanyId = data.companyId;
9216
+ dataResponse = _context.sent;
9217
+ if (dataResponse != null) {
9218
+ if (dataResponse.companyId != null) {
9219
+ data.oemCompanyId = dataResponse.companyId;
9220
+ }
9221
+ if (dataResponse.demoCompanyId != null) {
9222
+ data.demoId = dataResponse.demoCompanyId;
9211
9223
  }
9212
- if (data.demoCompanyId != null) {
9213
- data.demoId = data.demoCompanyId;
9224
+ if (dataResponse.favIcon != null) {
9225
+ data.favIcon = dataResponse.favIcon;
9214
9226
  }
9215
- if (data.favIcon != null) {
9216
- data.favIcon = data.favIcon;
9227
+ if (dataResponse.companyName != null) {
9228
+ data.companyName = dataResponse.companyName;
9217
9229
  }
9218
- if (data.companyName != null) {
9219
- data.companyName = data.companyName;
9230
+
9231
+ // check for redirect
9232
+ if (dataResponse.redirectTrafficToCanonical) {
9233
+ hasWWW = host.startsWith('www.');
9234
+ if (hasWWW) {
9235
+ data.redirect = {
9236
+ destination: dataResponse.canonicalBaseUrl,
9237
+ // Replace with your target URL
9238
+ permanent: false // Set to true for a permanent redirect (HTTP 308)
9239
+ };
9240
+ }
9220
9241
  }
9221
9242
  }
9222
9243
  case 10:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.668",
3
+ "version": "1.0.672",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,11 +15,11 @@
15
15
  "react-dom": "^18.2.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@babel/cli": "^7.21.5",
19
- "@babel/core": "^7.22.1",
20
- "@babel/preset-env": "^7.22.2",
21
- "@babel/preset-react": "^7.0.0",
22
- "react-dom": "^18.2.0"
18
+ "@babel/cli": "^7.27.0",
19
+ "@babel/core": "^7.26.10",
20
+ "@babel/preset-env": "^7.26.9",
21
+ "@babel/preset-react": "^7.26.3",
22
+ "react-dom": "^18.3.1"
23
23
  },
24
24
  "dependencies": {
25
25
  "@microsoft/signalr": "^8.0.0",
@@ -219,12 +219,25 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
219
219
 
220
220
  if (frontEndLoadedState)
221
221
  {
222
- if (process.env.googleAnalytics4 != "")
222
+ if (pageProps.googleAnalytics4Code != null)
223
+ {
224
+ initGA(pageProps.googleAnalytics4Code);
225
+ }
226
+ else if (process.env.googleAnalytics4 != "")
223
227
  {
224
228
  initGA(process.env.googleAnalytics4);
225
229
  }
226
230
 
227
- if (process.env.microsoftClarityTrackingCode != "")
231
+ if (pageProps.microsoftClarityCode != null)
232
+ {
233
+ clarity.init(pageProps.microsoftClarityCode);
234
+
235
+ if (signedInUser.current != null && clarity.hasStarted())
236
+ {
237
+ clarity.identify('USER_ID', { userProperty: signedInUser.current.id.toString() });
238
+ }
239
+ }
240
+ else if (process.env.microsoftClarityTrackingCode != "")
228
241
  {
229
242
  clarity.init(process.env.microsoftClarityTrackingCode);
230
243
 
@@ -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
  }