@frontegg/nextjs 5.11.0-alpha.2959008101 → 6.1.0-alpha.2962640568

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/AppContext.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { FronteggApp } from '@frontegg/admin-portal/FronteggApp';
2
+ import type { FronteggApp } from '@frontegg/js';
3
3
  declare const AppContext: import("react").Context<FronteggApp | null>;
4
4
  export default AppContext;
@@ -19,7 +19,6 @@ declare class FronteggConfig {
19
19
  get password(): string;
20
20
  get clientId(): string;
21
21
  get baseUrlHost(): string;
22
- getEnvAppUrl(): string | undefined;
23
22
  get appUrl(): string;
24
23
  get cookieDomain(): string;
25
24
  getJwtPublicKey(): Promise<KeyLike | Uint8Array>;
package/index.cjs.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var react = require('react');
7
- var adminPortal = require('@frontegg/admin-portal');
7
+ var js = require('@frontegg/js');
8
8
  var reactHooks = require('@frontegg/react-hooks');
9
9
  var restApi = require('@frontegg/rest-api');
10
10
  var router = require('next/router');
@@ -127,9 +127,9 @@ var Connector = function Connector(_props) {
127
127
  var createdApp;
128
128
 
129
129
  try {
130
- createdApp = adminPortal.AppHolder.getInstance(appName !== null && appName !== void 0 ? appName : 'default');
130
+ createdApp = js.AppHolder.getInstance(appName !== null && appName !== void 0 ? appName : 'default');
131
131
  } catch (e) {
132
- createdApp = adminPortal.initialize(Object.assign(Object.assign({}, props), {
132
+ createdApp = js.initialize(Object.assign(Object.assign({}, props), {
133
133
  hostedLoginBox: hostedLoginBox !== null && hostedLoginBox !== void 0 ? hostedLoginBox : false,
134
134
  basename: (_a = props.basename) !== null && _a !== void 0 ? _a : baseName,
135
135
  authOptions: Object.assign(Object.assign({}, props.authOptions), {
@@ -1109,37 +1109,19 @@ var FronteggConfig = /*#__PURE__*/function () {
1109
1109
 
1110
1110
  return new URL((_a = process.env['FRONTEGG_BASE_URL']) !== null && _a !== void 0 ? _a : '').hostname;
1111
1111
  }
1112
- }, {
1113
- key: "getEnvAppUrl",
1114
- value: function getEnvAppUrl() {
1115
- var url = undefined;
1116
-
1117
- if (process.env['VERCEL_URL']) {
1118
- url = process.env['VERCEL_URL'];
1119
- } else if (process.env['FRONTEGG_APP_URL']) {
1120
- url = process.env['FRONTEGG_APP_URL'];
1121
- }
1122
-
1123
- if (url && !url.startsWith('http')) {
1124
- var protocol = url.startsWith('localhost') ? 'http://' : 'https://';
1125
- url = "".concat(protocol).concat(url);
1126
- }
1127
-
1128
- return url;
1129
- }
1130
1112
  }, {
1131
1113
  key: "appUrl",
1132
1114
  get: function get() {
1133
1115
  var _a;
1134
1116
 
1135
- return (_a = this.getEnvAppUrl()) !== null && _a !== void 0 ? _a : 'http://localhost:3000';
1117
+ return (_a = process.env['FRONTEGG_APP_URL']) !== null && _a !== void 0 ? _a : 'http://localhost:3000';
1136
1118
  }
1137
1119
  }, {
1138
1120
  key: "cookieDomain",
1139
1121
  get: function get() {
1140
1122
  var _a;
1141
1123
 
1142
- return new URL((_a = this.getEnvAppUrl()) !== null && _a !== void 0 ? _a : '').hostname.replace(/:(\d)+$/, '');
1124
+ return new URL((_a = process.env['FRONTEGG_APP_URL']) !== null && _a !== void 0 ? _a : '').hostname.replace(/:(\d)+$/, '');
1143
1125
  }
1144
1126
  }, {
1145
1127
  key: "getJwtPublicKey",
@@ -1785,7 +1767,7 @@ var withFronteggApp = function withFronteggApp(app, options) {
1785
1767
 
1786
1768
  app.getInitialProps = function (appContext) {
1787
1769
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
1788
- var _c, _d, ctx, Component, session, envAppUrl;
1770
+ var _c, _d, ctx, Component, session;
1789
1771
 
1790
1772
  return regenerator.wrap(function _callee$(_context) {
1791
1773
  while (1) {
@@ -1794,7 +1776,7 @@ var withFronteggApp = function withFronteggApp(app, options) {
1794
1776
  ctx = appContext.ctx, Component = appContext.Component;
1795
1777
 
1796
1778
  if (!(((_d = (_c = ctx.req) === null || _c === void 0 ? void 0 : _c.url) === null || _d === void 0 ? void 0 : _d.indexOf('/_next/data/')) === -1)) {
1797
- _context.next = 40;
1779
+ _context.next = 39;
1798
1780
  break;
1799
1781
  }
1800
1782
 
@@ -1804,79 +1786,78 @@ var withFronteggApp = function withFronteggApp(app, options) {
1804
1786
  case 4:
1805
1787
  session = _context.sent;
1806
1788
  appContext.session = session;
1807
- envAppUrl = fronteggConfig.getEnvAppUrl();
1808
1789
 
1809
- if (envAppUrl) {
1810
- _context.next = 9;
1790
+ if (process.env['FRONTEGG_APP_URL']) {
1791
+ _context.next = 8;
1811
1792
  break;
1812
1793
  }
1813
1794
 
1814
1795
  throw Error('@frontegg/nextjs: .env.local must contain FRONTEGG_APP_URL');
1815
1796
 
1816
- case 9:
1797
+ case 8:
1817
1798
  if (process.env['FRONTEGG_BASE_URL']) {
1818
- _context.next = 11;
1799
+ _context.next = 10;
1819
1800
  break;
1820
1801
  }
1821
1802
 
1822
1803
  throw Error('@frontegg/nextjs: .env.local must contain FRONTEGG_BASE_URL');
1823
1804
 
1824
- case 11:
1805
+ case 10:
1825
1806
  if (process.env['FRONTEGG_CLIENT_ID']) {
1826
- _context.next = 13;
1807
+ _context.next = 12;
1827
1808
  break;
1828
1809
  }
1829
1810
 
1830
1811
  throw Error('@frontegg/nextjs: .env.local must contain FRONTEGG_CLIENT_ID');
1831
1812
 
1832
- case 13:
1813
+ case 12:
1833
1814
  _context.t0 = Object;
1834
1815
  _context.t1 = Object;
1835
1816
  _context.t2 = Object;
1836
1817
  _context.t3 = {};
1837
1818
 
1838
1819
  if (!originalGetInitialProps) {
1839
- _context.next = 23;
1820
+ _context.next = 22;
1840
1821
  break;
1841
1822
  }
1842
1823
 
1843
- _context.next = 20;
1824
+ _context.next = 19;
1844
1825
  return originalGetInitialProps(appContext);
1845
1826
 
1846
- case 20:
1827
+ case 19:
1847
1828
  _context.t4 = _context.sent;
1848
- _context.next = 24;
1829
+ _context.next = 23;
1849
1830
  break;
1850
1831
 
1851
- case 23:
1832
+ case 22:
1852
1833
  _context.t4 = {};
1853
1834
 
1854
- case 24:
1835
+ case 23:
1855
1836
  _context.t5 = _context.t4;
1856
1837
  _context.t6 = _context.t2.assign.call(_context.t2, _context.t3, _context.t5);
1857
1838
 
1858
1839
  if (!Component.getInitialProps) {
1859
- _context.next = 32;
1840
+ _context.next = 31;
1860
1841
  break;
1861
1842
  }
1862
1843
 
1863
- _context.next = 29;
1844
+ _context.next = 28;
1864
1845
  return Component.getInitialProps(ctx);
1865
1846
 
1866
- case 29:
1847
+ case 28:
1867
1848
  _context.t7 = _context.sent;
1868
- _context.next = 33;
1849
+ _context.next = 32;
1869
1850
  break;
1870
1851
 
1871
- case 32:
1852
+ case 31:
1872
1853
  _context.t7 = {};
1873
1854
 
1874
- case 33:
1855
+ case 32:
1875
1856
  _context.t8 = _context.t7;
1876
1857
  _context.t9 = _context.t1.assign.call(_context.t1, _context.t6, _context.t8);
1877
1858
  _context.t10 = {
1878
1859
  session: session,
1879
- envAppUrl: envAppUrl,
1860
+ envAppUrl: process.env['FRONTEGG_APP_URL'],
1880
1861
  envBaseUrl: process.env['FRONTEGG_BASE_URL'],
1881
1862
  envClientId: process.env['FRONTEGG_CLIENT_ID']
1882
1863
  };
@@ -1885,56 +1866,56 @@ var withFronteggApp = function withFronteggApp(app, options) {
1885
1866
  pageProps: _context.t11
1886
1867
  });
1887
1868
 
1888
- case 40:
1869
+ case 39:
1889
1870
  appContext.session = null;
1890
1871
  _context.t12 = Object;
1891
1872
  _context.t13 = Object;
1892
1873
  _context.t14 = {};
1893
1874
 
1894
1875
  if (!originalGetInitialProps) {
1895
- _context.next = 50;
1876
+ _context.next = 49;
1896
1877
  break;
1897
1878
  }
1898
1879
 
1899
- _context.next = 47;
1880
+ _context.next = 46;
1900
1881
  return originalGetInitialProps(appContext);
1901
1882
 
1902
- case 47:
1883
+ case 46:
1903
1884
  _context.t15 = _context.sent;
1904
- _context.next = 51;
1885
+ _context.next = 50;
1905
1886
  break;
1906
1887
 
1907
- case 50:
1888
+ case 49:
1908
1889
  _context.t15 = {};
1909
1890
 
1910
- case 51:
1891
+ case 50:
1911
1892
  _context.t16 = _context.t15;
1912
1893
  _context.t17 = _context.t13.assign.call(_context.t13, _context.t14, _context.t16);
1913
1894
 
1914
1895
  if (!Component.getInitialProps) {
1915
- _context.next = 59;
1896
+ _context.next = 58;
1916
1897
  break;
1917
1898
  }
1918
1899
 
1919
- _context.next = 56;
1900
+ _context.next = 55;
1920
1901
  return Component.getInitialProps(ctx);
1921
1902
 
1922
- case 56:
1903
+ case 55:
1923
1904
  _context.t18 = _context.sent;
1924
- _context.next = 60;
1905
+ _context.next = 59;
1925
1906
  break;
1926
1907
 
1927
- case 59:
1908
+ case 58:
1928
1909
  _context.t18 = {};
1929
1910
 
1930
- case 60:
1911
+ case 59:
1931
1912
  _context.t19 = _context.t18;
1932
1913
  _context.t20 = _context.t12.assign.call(_context.t12, _context.t17, _context.t19);
1933
1914
  return _context.abrupt("return", {
1934
1915
  pageProps: _context.t20
1935
1916
  });
1936
1917
 
1937
- case 63:
1918
+ case 62:
1938
1919
  case "end":
1939
1920
  return _context.stop();
1940
1921
  }
@@ -2142,7 +2123,7 @@ function fronteggMiddleware(req, res) {
2142
2123
 
2143
2124
  Object.defineProperty(exports, 'AdminPortal', {
2144
2125
  enumerable: true,
2145
- get: function () { return adminPortal.AdminPortal; }
2126
+ get: function () { return js.AdminPortal; }
2146
2127
  });
2147
2128
  exports.AuthorizedContent = AuthorizedContent;
2148
2129
  exports.Connector = Connector;
package/index.d.ts CHANGED
@@ -5,6 +5,6 @@ export * from './FronteggRouter';
5
5
  export * from './withFronteggApp';
6
6
  export * from './session';
7
7
  export * from './FronteggMiddleware';
8
- export { AdminPortal } from '@frontegg/admin-portal';
8
+ export { AdminPortal } from '@frontegg/js';
9
9
  export * from '@frontegg/react-hooks';
10
10
  export * from '@frontegg/types';
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { createContext, useCallback, useMemo, useEffect, useContext } from 'react';
3
- import { AppHolder, initialize } from '@frontegg/admin-portal';
4
- export { AdminPortal } from '@frontegg/admin-portal';
3
+ import { AppHolder, initialize } from '@frontegg/js';
4
+ export { AdminPortal } from '@frontegg/js';
5
5
  import { FronteggStoreProvider, useAuthUserOrNull, useAuthActions, useLoginWithRedirect, useLoginActions } from '@frontegg/react-hooks';
6
6
  export * from '@frontegg/react-hooks';
7
7
  import { fronteggAuthApiRoutes, ContextHolder, fronteggRefreshTokenUrl } from '@frontegg/rest-api';
@@ -1083,37 +1083,19 @@ var FronteggConfig = /*#__PURE__*/function () {
1083
1083
 
1084
1084
  return new URL((_a = process.env['FRONTEGG_BASE_URL']) !== null && _a !== void 0 ? _a : '').hostname;
1085
1085
  }
1086
- }, {
1087
- key: "getEnvAppUrl",
1088
- value: function getEnvAppUrl() {
1089
- var url = undefined;
1090
-
1091
- if (process.env['VERCEL_URL']) {
1092
- url = process.env['VERCEL_URL'];
1093
- } else if (process.env['FRONTEGG_APP_URL']) {
1094
- url = process.env['FRONTEGG_APP_URL'];
1095
- }
1096
-
1097
- if (url && !url.startsWith('http')) {
1098
- var protocol = url.startsWith('localhost') ? 'http://' : 'https://';
1099
- url = "".concat(protocol).concat(url);
1100
- }
1101
-
1102
- return url;
1103
- }
1104
1086
  }, {
1105
1087
  key: "appUrl",
1106
1088
  get: function get() {
1107
1089
  var _a;
1108
1090
 
1109
- return (_a = this.getEnvAppUrl()) !== null && _a !== void 0 ? _a : 'http://localhost:3000';
1091
+ return (_a = process.env['FRONTEGG_APP_URL']) !== null && _a !== void 0 ? _a : 'http://localhost:3000';
1110
1092
  }
1111
1093
  }, {
1112
1094
  key: "cookieDomain",
1113
1095
  get: function get() {
1114
1096
  var _a;
1115
1097
 
1116
- return new URL((_a = this.getEnvAppUrl()) !== null && _a !== void 0 ? _a : '').hostname.replace(/:(\d)+$/, '');
1098
+ return new URL((_a = process.env['FRONTEGG_APP_URL']) !== null && _a !== void 0 ? _a : '').hostname.replace(/:(\d)+$/, '');
1117
1099
  }
1118
1100
  }, {
1119
1101
  key: "getJwtPublicKey",
@@ -1759,7 +1741,7 @@ var withFronteggApp = function withFronteggApp(app, options) {
1759
1741
 
1760
1742
  app.getInitialProps = function (appContext) {
1761
1743
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
1762
- var _c, _d, ctx, Component, session, envAppUrl;
1744
+ var _c, _d, ctx, Component, session;
1763
1745
 
1764
1746
  return regenerator.wrap(function _callee$(_context) {
1765
1747
  while (1) {
@@ -1768,7 +1750,7 @@ var withFronteggApp = function withFronteggApp(app, options) {
1768
1750
  ctx = appContext.ctx, Component = appContext.Component;
1769
1751
 
1770
1752
  if (!(((_d = (_c = ctx.req) === null || _c === void 0 ? void 0 : _c.url) === null || _d === void 0 ? void 0 : _d.indexOf('/_next/data/')) === -1)) {
1771
- _context.next = 40;
1753
+ _context.next = 39;
1772
1754
  break;
1773
1755
  }
1774
1756
 
@@ -1778,79 +1760,78 @@ var withFronteggApp = function withFronteggApp(app, options) {
1778
1760
  case 4:
1779
1761
  session = _context.sent;
1780
1762
  appContext.session = session;
1781
- envAppUrl = fronteggConfig.getEnvAppUrl();
1782
1763
 
1783
- if (envAppUrl) {
1784
- _context.next = 9;
1764
+ if (process.env['FRONTEGG_APP_URL']) {
1765
+ _context.next = 8;
1785
1766
  break;
1786
1767
  }
1787
1768
 
1788
1769
  throw Error('@frontegg/nextjs: .env.local must contain FRONTEGG_APP_URL');
1789
1770
 
1790
- case 9:
1771
+ case 8:
1791
1772
  if (process.env['FRONTEGG_BASE_URL']) {
1792
- _context.next = 11;
1773
+ _context.next = 10;
1793
1774
  break;
1794
1775
  }
1795
1776
 
1796
1777
  throw Error('@frontegg/nextjs: .env.local must contain FRONTEGG_BASE_URL');
1797
1778
 
1798
- case 11:
1779
+ case 10:
1799
1780
  if (process.env['FRONTEGG_CLIENT_ID']) {
1800
- _context.next = 13;
1781
+ _context.next = 12;
1801
1782
  break;
1802
1783
  }
1803
1784
 
1804
1785
  throw Error('@frontegg/nextjs: .env.local must contain FRONTEGG_CLIENT_ID');
1805
1786
 
1806
- case 13:
1787
+ case 12:
1807
1788
  _context.t0 = Object;
1808
1789
  _context.t1 = Object;
1809
1790
  _context.t2 = Object;
1810
1791
  _context.t3 = {};
1811
1792
 
1812
1793
  if (!originalGetInitialProps) {
1813
- _context.next = 23;
1794
+ _context.next = 22;
1814
1795
  break;
1815
1796
  }
1816
1797
 
1817
- _context.next = 20;
1798
+ _context.next = 19;
1818
1799
  return originalGetInitialProps(appContext);
1819
1800
 
1820
- case 20:
1801
+ case 19:
1821
1802
  _context.t4 = _context.sent;
1822
- _context.next = 24;
1803
+ _context.next = 23;
1823
1804
  break;
1824
1805
 
1825
- case 23:
1806
+ case 22:
1826
1807
  _context.t4 = {};
1827
1808
 
1828
- case 24:
1809
+ case 23:
1829
1810
  _context.t5 = _context.t4;
1830
1811
  _context.t6 = _context.t2.assign.call(_context.t2, _context.t3, _context.t5);
1831
1812
 
1832
1813
  if (!Component.getInitialProps) {
1833
- _context.next = 32;
1814
+ _context.next = 31;
1834
1815
  break;
1835
1816
  }
1836
1817
 
1837
- _context.next = 29;
1818
+ _context.next = 28;
1838
1819
  return Component.getInitialProps(ctx);
1839
1820
 
1840
- case 29:
1821
+ case 28:
1841
1822
  _context.t7 = _context.sent;
1842
- _context.next = 33;
1823
+ _context.next = 32;
1843
1824
  break;
1844
1825
 
1845
- case 32:
1826
+ case 31:
1846
1827
  _context.t7 = {};
1847
1828
 
1848
- case 33:
1829
+ case 32:
1849
1830
  _context.t8 = _context.t7;
1850
1831
  _context.t9 = _context.t1.assign.call(_context.t1, _context.t6, _context.t8);
1851
1832
  _context.t10 = {
1852
1833
  session: session,
1853
- envAppUrl: envAppUrl,
1834
+ envAppUrl: process.env['FRONTEGG_APP_URL'],
1854
1835
  envBaseUrl: process.env['FRONTEGG_BASE_URL'],
1855
1836
  envClientId: process.env['FRONTEGG_CLIENT_ID']
1856
1837
  };
@@ -1859,56 +1840,56 @@ var withFronteggApp = function withFronteggApp(app, options) {
1859
1840
  pageProps: _context.t11
1860
1841
  });
1861
1842
 
1862
- case 40:
1843
+ case 39:
1863
1844
  appContext.session = null;
1864
1845
  _context.t12 = Object;
1865
1846
  _context.t13 = Object;
1866
1847
  _context.t14 = {};
1867
1848
 
1868
1849
  if (!originalGetInitialProps) {
1869
- _context.next = 50;
1850
+ _context.next = 49;
1870
1851
  break;
1871
1852
  }
1872
1853
 
1873
- _context.next = 47;
1854
+ _context.next = 46;
1874
1855
  return originalGetInitialProps(appContext);
1875
1856
 
1876
- case 47:
1857
+ case 46:
1877
1858
  _context.t15 = _context.sent;
1878
- _context.next = 51;
1859
+ _context.next = 50;
1879
1860
  break;
1880
1861
 
1881
- case 50:
1862
+ case 49:
1882
1863
  _context.t15 = {};
1883
1864
 
1884
- case 51:
1865
+ case 50:
1885
1866
  _context.t16 = _context.t15;
1886
1867
  _context.t17 = _context.t13.assign.call(_context.t13, _context.t14, _context.t16);
1887
1868
 
1888
1869
  if (!Component.getInitialProps) {
1889
- _context.next = 59;
1870
+ _context.next = 58;
1890
1871
  break;
1891
1872
  }
1892
1873
 
1893
- _context.next = 56;
1874
+ _context.next = 55;
1894
1875
  return Component.getInitialProps(ctx);
1895
1876
 
1896
- case 56:
1877
+ case 55:
1897
1878
  _context.t18 = _context.sent;
1898
- _context.next = 60;
1879
+ _context.next = 59;
1899
1880
  break;
1900
1881
 
1901
- case 59:
1882
+ case 58:
1902
1883
  _context.t18 = {};
1903
1884
 
1904
- case 60:
1885
+ case 59:
1905
1886
  _context.t19 = _context.t18;
1906
1887
  _context.t20 = _context.t12.assign.call(_context.t12, _context.t17, _context.t19);
1907
1888
  return _context.abrupt("return", {
1908
1889
  pageProps: _context.t20
1909
1890
  });
1910
1891
 
1911
- case 63:
1892
+ case 62:
1912
1893
  case "end":
1913
1894
  return _context.stop();
1914
1895
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@frontegg/nextjs",
3
- "version": "5.11.0-alpha.2959008101",
3
+ "version": "6.1.0-alpha.2962640568",
4
4
  "dependencies": {
5
- "@frontegg/admin-portal": "5.80.2",
6
- "@frontegg/react-hooks": "5.80.2",
5
+ "@frontegg/js": "6.0.3-alpha.4",
6
+ "@frontegg/react-hooks": "6.0.3-alpha.4",
7
7
  "jose": "^4.8.0",
8
8
  "iron-session": "^6.1.2",
9
9
  "http-proxy": "^1.18.1",