@frontegg/js 7.106.0 → 7.107.0-alpha.1

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
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.106.0
1
+ /** @license Frontegg v7.107.0-alpha.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.106.0
1
+ /** @license Frontegg v7.107.0-alpha.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/node/version.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
- cdnVersion: '7.106.0'
8
+ cdnVersion: '7.107.0-alpha.1'
9
9
  };
10
10
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/js",
3
- "version": "7.106.0",
3
+ "version": "7.107.0-alpha.1",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/types": "7.106.0"
9
+ "@frontegg/types": "7.107.0-alpha.1"
10
10
  },
11
11
  "browserslist": {
12
12
  "production": [
@@ -1924,7 +1924,7 @@ __webpack_require__.r(__webpack_exports__);
1924
1924
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1925
1925
  /* harmony export */ });
1926
1926
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1927
- cdnVersion: '7.106.0'
1927
+ cdnVersion: '7.107.0-alpha.1'
1928
1928
  });
1929
1929
 
1930
1930
  /***/ }),
@@ -13091,6 +13091,62 @@ const _excluded = ["callback"],
13091
13091
  callback == null ? void 0 : callback(null, e);
13092
13092
  }
13093
13093
  };
13094
+ const addCurrentUserCountryAndActivate = async payload => {
13095
+ var _ref2, _store$auth$userIpDat2, _countryRestrictionsS3, _countryRestrictionsS4, _countryRestrictionsS5, _countryRestrictionsS6;
13096
+ const {
13097
+ callback,
13098
+ countryCode: payloadCountryCode
13099
+ } = payload;
13100
+ const currentCountryCode = ((_ref2 = payloadCountryCode != null ? payloadCountryCode : (_store$auth$userIpDat2 = store.auth.userIpData) == null ? void 0 : _store$auth$userIpDat2.countryCode) != null ? _ref2 : '').trim();
13101
+ setCountryRestrictionsState({
13102
+ saving: true,
13103
+ error: null
13104
+ });
13105
+ if (!currentCountryCode) {
13106
+ const error = new Error('Current country could not be detected');
13107
+ setCountryRestrictionsState({
13108
+ saving: false,
13109
+ error
13110
+ });
13111
+ callback == null ? void 0 : callback(false, error);
13112
+ return;
13113
+ }
13114
+ const countryRestrictionsState = store.auth.restrictionsState.countryRestrictions;
13115
+ const currentConfig = (_countryRestrictionsS3 = (_countryRestrictionsS4 = countryRestrictionsState.data) == null ? void 0 : _countryRestrictionsS4.config) != null ? _countryRestrictionsS3 : {
13116
+ enabled: false,
13117
+ action: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.RestrictionType.ALLOW,
13118
+ failStrategy: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.RestrictionType.ALLOW,
13119
+ shouldSendRestrictionEmail: false
13120
+ };
13121
+ const countryCodes = (_countryRestrictionsS5 = (_countryRestrictionsS6 = countryRestrictionsState.data) == null ? void 0 : _countryRestrictionsS6.restrictions.map(({
13122
+ countryCode
13123
+ }) => countryCode)) != null ? _countryRestrictionsS5 : [];
13124
+ const uniqueUpper = Array.from(new Set([...countryCodes, currentCountryCode].map(code => code.toUpperCase())));
13125
+ try {
13126
+ await Promise.all([api.auth.updateCountryRestrictions({
13127
+ countries: uniqueUpper.map(countryCode => ({
13128
+ countryCode
13129
+ }))
13130
+ }), api.auth.updateCountryRestrictionsConfig((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, currentConfig, {
13131
+ enabled: true
13132
+ }))]);
13133
+ const [config, restrictions] = await Promise.all([api.auth.getCountryRestrictionsConfig(), api.auth.getCountryRestrictions()]);
13134
+ setCountryRestrictionsState({
13135
+ data: {
13136
+ config,
13137
+ restrictions
13138
+ },
13139
+ saving: false
13140
+ });
13141
+ callback == null ? void 0 : callback(true);
13142
+ } catch (e) {
13143
+ setCountryRestrictionsState({
13144
+ saving: false,
13145
+ error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e)
13146
+ });
13147
+ callback == null ? void 0 : callback(false, e);
13148
+ }
13149
+ };
13094
13150
  const wrappedLoadIpRestrictions = __securityCenterSagaWrapper(loadIpRestrictions);
13095
13151
  const wrappedSaveIpRestriction = __securityCenterSagaWrapper(saveIpRestriction);
13096
13152
  const wrappedSaveIpRestrictionsConfig = __securityCenterSagaWrapper(saveIpRestrictionsConfig);
@@ -13104,6 +13160,7 @@ const _excluded = ["callback"],
13104
13160
  const wrappedLoadCountryRestrictions = __securityCenterSagaWrapper(loadCountryRestrictions);
13105
13161
  const wrappedSaveCountryRestrictionsConfig = __securityCenterSagaWrapper(saveCountryRestrictionsConfig);
13106
13162
  const wrappedSaveCountryRestrictions = __securityCenterSagaWrapper(saveCountryRestrictions);
13163
+ const wrappedAddCurrentUserCountryAndActivate = __securityCenterSagaWrapper(addCurrentUserCountryAndActivate);
13107
13164
  return {
13108
13165
  // reducers
13109
13166
  setRestrictionsState,
@@ -13124,7 +13181,8 @@ const _excluded = ["callback"],
13124
13181
  deleteEmailDomainRestriction: wrappedDeleteEmailDomainRestriction,
13125
13182
  loadCountryRestrictions: wrappedLoadCountryRestrictions,
13126
13183
  saveCountryRestrictionsConfig: wrappedSaveCountryRestrictionsConfig,
13127
- saveCountryRestrictions: wrappedSaveCountryRestrictions
13184
+ saveCountryRestrictions: wrappedSaveCountryRestrictions,
13185
+ addCurrentUserCountryAndActivate: wrappedAddCurrentUserCountryAndActivate
13128
13186
  };
13129
13187
  });
13130
13188
 
@@ -20183,7 +20241,7 @@ __webpack_require__.r(__webpack_exports__);
20183
20241
  /* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
20184
20242
  /* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
20185
20243
  /* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
20186
- /** @license Frontegg v7.106.0
20244
+ /** @license Frontegg v7.107.0-alpha.1
20187
20245
  *
20188
20246
  * This source code is licensed under the MIT license found in the
20189
20247
  * LICENSE file in the root directory of this source tree.
@@ -22380,6 +22438,50 @@ const _excluded = ["callback"],
22380
22438
  saving: false
22381
22439
  });
22382
22440
  };
22441
+ mockedActions.addCurrentUserCountryAndActivate = async payload => {
22442
+ var _ref5, _store$auth$userIpDat, _countryRestrictionsS8, _countryRestrictionsS9, _countryRestrictionsS10, _countryRestrictionsS11;
22443
+ const {
22444
+ callback,
22445
+ countryCode: payloadCountryCode
22446
+ } = payload;
22447
+ const countryRestrictionsState = store.auth.restrictionsState.countryRestrictions;
22448
+ const currentCountryCode = ((_ref5 = payloadCountryCode != null ? payloadCountryCode : (_store$auth$userIpDat = store.auth.userIpData) == null ? void 0 : _store$auth$userIpDat.countryCode) != null ? _ref5 : '').trim();
22449
+ mockedActions.setCountryRestrictionsState({
22450
+ saving: true,
22451
+ error: null
22452
+ });
22453
+ await (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.delay)();
22454
+ if (!currentCountryCode) {
22455
+ const error = new Error('Current country could not be detected');
22456
+ mockedActions.setCountryRestrictionsState({
22457
+ saving: false,
22458
+ error
22459
+ });
22460
+ callback == null ? void 0 : callback(false, error);
22461
+ return;
22462
+ }
22463
+ const countryCodes = [...((_countryRestrictionsS8 = (_countryRestrictionsS9 = countryRestrictionsState.data) == null ? void 0 : _countryRestrictionsS9.restrictions.map(({
22464
+ countryCode
22465
+ }) => countryCode)) != null ? _countryRestrictionsS8 : []), currentCountryCode];
22466
+ const restrictions = Array.from(new Set(countryCodes.map(code => code.toUpperCase()))).map((countryCode, index) => ({
22467
+ id: `mock-${countryCode}-${index}`,
22468
+ countryCode
22469
+ }));
22470
+ callback == null ? void 0 : callback(true);
22471
+ mockedActions.setCountryRestrictionsState({
22472
+ data: {
22473
+ config: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, (_countryRestrictionsS10 = (_countryRestrictionsS11 = countryRestrictionsState.data) == null ? void 0 : _countryRestrictionsS11.config) != null ? _countryRestrictionsS10 : {
22474
+ action: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.RestrictionType.ALLOW,
22475
+ failStrategy: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.RestrictionType.ALLOW,
22476
+ shouldSendRestrictionEmail: false
22477
+ }, {
22478
+ enabled: true
22479
+ }),
22480
+ restrictions
22481
+ },
22482
+ saving: false
22483
+ });
22484
+ };
22383
22485
  mockedActions.deleteEmailDomainRestriction = async payload => {
22384
22486
  var _emailDomainRestricti4, _emailDomainRestricti5;
22385
22487
  const {
@@ -30660,7 +30762,7 @@ __webpack_require__.r(__webpack_exports__);
30660
30762
  /* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
30661
30763
  /* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
30662
30764
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
30663
- /** @license Frontegg v7.106.0
30765
+ /** @license Frontegg v7.107.0-alpha.1
30664
30766
  *
30665
30767
  * This source code is licensed under the MIT license found in the
30666
30768
  * LICENSE file in the root directory of this source tree.
@@ -31412,6 +31514,7 @@ let RecommendationCode;
31412
31514
  RecommendationCode["CHANGE_IP_TO_ALLOWLIST"] = "CHANGE_IP_TO_ALLOWLIST";
31413
31515
  RecommendationCode["ENABLE_DOMAIN_RESTRICTIONS"] = "ENABLE_DOMAIN_RESTRICTIONS";
31414
31516
  RecommendationCode["CHANGE_DOMAIN_TO_ALLOWLIST"] = "CHANGE_DOMAIN_TO_ALLOWLIST";
31517
+ RecommendationCode["ENABLE_COUNTRY_RESTRICTIONS"] = "ENABLE_COUNTRY_RESTRICTIONS";
31415
31518
  RecommendationCode["CONFIGURE_SSO"] = "CONFIGURE_SSO";
31416
31519
  })(RecommendationCode || (RecommendationCode = {}));
31417
31520
  let InsightCode;
@@ -31455,6 +31558,7 @@ let SecurityCategory;
31455
31558
  SecurityCategory["INACTIVITY"] = "INACTIVITY";
31456
31559
  SecurityCategory["IP"] = "IP";
31457
31560
  SecurityCategory["DOMAIN"] = "DOMAIN";
31561
+ SecurityCategory["COUNTRY"] = "COUNTRY";
31458
31562
  SecurityCategory["SSO"] = "SSO";
31459
31563
  })(SecurityCategory || (SecurityCategory = {}));
31460
31564
 
@@ -33455,7 +33559,7 @@ __webpack_require__.r(__webpack_exports__);
33455
33559
  /* harmony export */ });
33456
33560
  /* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
33457
33561
  /* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
33458
- /** @license Frontegg v7.106.0
33562
+ /** @license Frontegg v7.107.0-alpha.1
33459
33563
  *
33460
33564
  * This source code is licensed under the MIT license found in the
33461
33565
  * LICENSE file in the root directory of this source tree.