authscape 1.0.298 → 1.0.300
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 +11 -8
- package/package.json +1 -1
- package/src/components/AuthScapeApp.js +0 -2
- package/src/services/setupOEMProps.js +21 -18
package/index.js
CHANGED
|
@@ -23,8 +23,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
23
23
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
24
24
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
-
// import { apiService, setupOEMProps, OEMStyleSheet, AuthorizationComponent, authService, logEvent, init, signInValidator } from 'authscape';
|
|
27
|
-
|
|
28
26
|
function AuthScapeApp(_ref) {
|
|
29
27
|
var Component = _ref.Component,
|
|
30
28
|
pageProps = _ref.pageProps,
|
|
@@ -4277,11 +4275,11 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
4277
4275
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4278
4276
|
var setupOEMProps = /*#__PURE__*/function () {
|
|
4279
4277
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
4280
|
-
var
|
|
4278
|
+
var Component, ctx, pageProps, host, response;
|
|
4281
4279
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4282
4280
|
while (1) switch (_context.prev = _context.next) {
|
|
4283
4281
|
case 0:
|
|
4284
|
-
|
|
4282
|
+
Component = _ref.Component, ctx = _ref.ctx;
|
|
4285
4283
|
pageProps = {};
|
|
4286
4284
|
if (!Component.getInitialProps) {
|
|
4287
4285
|
_context.next = 6;
|
|
@@ -4292,6 +4290,10 @@ var setupOEMProps = /*#__PURE__*/function () {
|
|
|
4292
4290
|
case 5:
|
|
4293
4291
|
pageProps = _context.sent;
|
|
4294
4292
|
case 6:
|
|
4293
|
+
if (!(ctx.req != null)) {
|
|
4294
|
+
_context.next = 13;
|
|
4295
|
+
break;
|
|
4296
|
+
}
|
|
4295
4297
|
host = ctx.req.headers.host;
|
|
4296
4298
|
if (host.includes("localhost")) {
|
|
4297
4299
|
pageProps.host = "http://" + ctx.req.headers.host;
|
|
@@ -4300,15 +4302,16 @@ var setupOEMProps = /*#__PURE__*/function () {
|
|
|
4300
4302
|
}
|
|
4301
4303
|
|
|
4302
4304
|
// get the companyId
|
|
4303
|
-
_context.next =
|
|
4304
|
-
return apiService().get(apiUri + "/api/WhiteLabel/GetCompanyIdFromDomain?domain=" + pageProps.host);
|
|
4305
|
-
case
|
|
4305
|
+
_context.next = 11;
|
|
4306
|
+
return apiService().get(process.env.apiUri + "/api/WhiteLabel/GetCompanyIdFromDomain?domain=" + pageProps.host);
|
|
4307
|
+
case 11:
|
|
4306
4308
|
response = _context.sent;
|
|
4307
4309
|
if (response != null && response.status == 200) {
|
|
4308
4310
|
pageProps.oemCompanyId = response.data;
|
|
4309
4311
|
}
|
|
4310
|
-
return _context.abrupt("return", pageProps);
|
|
4311
4312
|
case 13:
|
|
4313
|
+
return _context.abrupt("return", pageProps);
|
|
4314
|
+
case 14:
|
|
4312
4315
|
case "end":
|
|
4313
4316
|
return _context.stop();
|
|
4314
4317
|
}
|
package/package.json
CHANGED
|
@@ -6,8 +6,6 @@ import { useRouter } from 'next/router';
|
|
|
6
6
|
import { ThemeProvider } from '@mui/material/styles';
|
|
7
7
|
import { Box } from '@mui/material';
|
|
8
8
|
import Head from "next/head";
|
|
9
|
-
// import { apiService, setupOEMProps, OEMStyleSheet, AuthorizationComponent, authService, logEvent, init, signInValidator } from 'authscape';
|
|
10
|
-
|
|
11
9
|
|
|
12
10
|
export function AuthScapeApp({Component, pageProps, muiTheme = {}, enforceLoggedIn = false, enableAuth = true, onAuthenticationLoaded = null, children = null}) {
|
|
13
11
|
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
export const setupOEMProps = async ({
|
|
3
|
+
export const setupOEMProps = async ({Component, ctx}) => {
|
|
4
4
|
|
|
5
5
|
let pageProps = {};
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
if (Component.getInitialProps) {
|
|
8
8
|
pageProps = await Component.getInitialProps(ctx);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (host.includes("localhost"))
|
|
13
|
-
{
|
|
14
|
-
pageProps.host = "http://" + ctx.req.headers.host;
|
|
15
|
-
}
|
|
16
|
-
else
|
|
10
|
+
|
|
11
|
+
if (ctx.req != null)
|
|
17
12
|
{
|
|
18
|
-
|
|
13
|
+
let host = ctx.req.headers.host;
|
|
14
|
+
if (host.includes("localhost"))
|
|
15
|
+
{
|
|
16
|
+
pageProps.host = "http://" + ctx.req.headers.host;
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
{
|
|
20
|
+
pageProps.host = "https://" + ctx.req.headers.host;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// get the companyId
|
|
24
|
+
let response = await apiService().get(process.env.apiUri + "/api/WhiteLabel/GetCompanyIdFromDomain?domain=" + pageProps.host);
|
|
25
|
+
if (response != null && response.status == 200)
|
|
26
|
+
{
|
|
27
|
+
pageProps.oemCompanyId = response.data;
|
|
28
|
+
}
|
|
19
29
|
}
|
|
20
|
-
|
|
21
|
-
// get the companyId
|
|
22
|
-
let response = await apiService().get(apiUri + "/api/WhiteLabel/GetCompanyIdFromDomain?domain=" + pageProps.host);
|
|
23
|
-
if (response != null && response.status == 200)
|
|
24
|
-
{
|
|
25
|
-
pageProps.oemCompanyId = response.data;
|
|
26
|
-
}
|
|
27
|
-
|
|
30
|
+
|
|
28
31
|
return pageProps;
|
|
29
32
|
}
|
|
30
33
|
|