@frontegg/js 7.3.0-alpha.0 → 7.4.0-alpha.0
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/FronteggApp/FronteggApp.js +1 -3
- package/FronteggApp/utils.js +4 -2
- package/index.js +1 -1
- package/node/FronteggApp/FronteggApp.js +1 -3
- package/node/FronteggApp/utils.js +4 -2
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +876 -830
- package/umd/frontegg.production.min.js +1 -1
- package/version.js +1 -1
|
@@ -322,8 +322,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
322
322
|
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4__);
|
|
323
323
|
/* harmony import */ var _frontegg_redux_store__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @frontegg/redux-store */ "../../dist/@frontegg/redux-store/index.js");
|
|
324
324
|
/* harmony import */ var _frontegg_redux_store__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @frontegg/redux-store */ "../../dist/@frontegg/redux-store/toolkit/store.js");
|
|
325
|
-
/* harmony import */ var
|
|
326
|
-
/* harmony import */ var
|
|
325
|
+
/* harmony import */ var _frontegg_redux_store__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @frontegg/redux-store */ "../../dist/@frontegg/redux-store/auth/Entitlements/helpers.js");
|
|
326
|
+
/* harmony import */ var _frontegg_redux_store__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @frontegg/redux-store */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
|
|
327
327
|
/* harmony import */ var _frontegg_types__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @frontegg/types */ "../../dist/@frontegg/types/index.js");
|
|
328
328
|
/* harmony import */ var _frontegg_types__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @frontegg/types */ "../../dist/@frontegg/types/Metadata/index.js");
|
|
329
329
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ "../../dist/@frontegg/js/utils/index.js");
|
|
@@ -332,12 +332,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
332
332
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/index.js");
|
|
333
333
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/FetchClient.js");
|
|
334
334
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/ContextHolder/index.js");
|
|
335
|
-
/* harmony import */ var
|
|
335
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/interfaces.js");
|
|
336
336
|
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../version */ "../../dist/@frontegg/js/version.js");
|
|
337
337
|
/* harmony import */ var _utils_mockFlagsList__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/mockFlagsList */ "../../dist/@frontegg/js/utils/mockFlagsList.js");
|
|
338
338
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "../../dist/@frontegg/js/FronteggApp/utils.js");
|
|
339
|
-
/* harmony import */ var valtio_vanilla__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! valtio/vanilla */ "../../node_modules/valtio/esm/vanilla.mjs");
|
|
340
|
-
|
|
341
339
|
|
|
342
340
|
|
|
343
341
|
|
|
@@ -711,8 +709,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
711
709
|
resolve(scriptHolder["".concat(component, "Init")]({
|
|
712
710
|
FronteggRestApi: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_13__,
|
|
713
711
|
FronteggTypes: _frontegg_types__WEBPACK_IMPORTED_MODULE_16__,
|
|
714
|
-
FronteggReduxStore: _frontegg_redux_store__WEBPACK_IMPORTED_MODULE_17__
|
|
715
|
-
ValtioVanilla: valtio_vanilla__WEBPACK_IMPORTED_MODULE_18__
|
|
712
|
+
FronteggReduxStore: _frontegg_redux_store__WEBPACK_IMPORTED_MODULE_17__
|
|
716
713
|
}));
|
|
717
714
|
} else {
|
|
718
715
|
resolve(scriptHolder[component]);
|
|
@@ -774,7 +771,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
774
771
|
isMultiApp: false
|
|
775
772
|
}, isMultiApp = _ref4.isMultiApp;
|
|
776
773
|
_this$queryFeatureFla = this.queryFeatureFlags(['multi-apps-admin-portal']), _this$queryFeatureFla2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_this$queryFeatureFla, 1), multiAppsFlag = _this$queryFeatureFla2[0];
|
|
777
|
-
_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.ContextHolder["for"](this.name).setRequestSource(
|
|
774
|
+
_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.ContextHolder["for"](this.name).setRequestSource(_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.RequestSource.AdminPortal);
|
|
778
775
|
_context6.next = 5;
|
|
779
776
|
return this.loadScript('FronteggAdminPortal');
|
|
780
777
|
case 5:
|
|
@@ -882,7 +879,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
882
879
|
var _this$getEntitlements = this.getEntitlementsQueryData(customAttributes),
|
|
883
880
|
entitlements = _this$getEntitlements.entitlements,
|
|
884
881
|
attributes = _this$getEntitlements.attributes;
|
|
885
|
-
return (0,
|
|
882
|
+
return (0,_frontegg_redux_store__WEBPACK_IMPORTED_MODULE_19__.getFeatureEntitlements)(entitlements, key, attributes);
|
|
886
883
|
}
|
|
887
884
|
|
|
888
885
|
/**
|
|
@@ -897,7 +894,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
897
894
|
var _this$getEntitlements2 = this.getEntitlementsQueryData(customAttributes),
|
|
898
895
|
entitlements = _this$getEntitlements2.entitlements,
|
|
899
896
|
attributes = _this$getEntitlements2.attributes;
|
|
900
|
-
return (0,
|
|
897
|
+
return (0,_frontegg_redux_store__WEBPACK_IMPORTED_MODULE_19__.getPermissionEntitlements)(entitlements, key, attributes);
|
|
901
898
|
}
|
|
902
899
|
|
|
903
900
|
/**
|
|
@@ -949,7 +946,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
949
946
|
});
|
|
950
947
|
return;
|
|
951
948
|
}
|
|
952
|
-
(0,
|
|
949
|
+
(0,_frontegg_redux_store__WEBPACK_IMPORTED_MODULE_20__.redirectByStepUpUrl)(stepUpUrl, state.auth.onRedirectTo, options == null ? void 0 : options.maxAge);
|
|
953
950
|
}
|
|
954
951
|
|
|
955
952
|
/**
|
|
@@ -963,7 +960,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
963
960
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
964
961
|
var _ref6 = ((_this$store$getState = this.store.getState()) == null ? void 0 : _this$store$getState.auth) || {},
|
|
965
962
|
user = _ref6.user;
|
|
966
|
-
return (0,
|
|
963
|
+
return (0,_frontegg_redux_store__WEBPACK_IMPORTED_MODULE_20__.isSteppedUp)(user, options);
|
|
967
964
|
}
|
|
968
965
|
|
|
969
966
|
/**
|
|
@@ -1086,8 +1083,10 @@ var getOverriddenMetadata = /*#__PURE__*/function () {
|
|
|
1086
1083
|
case 3:
|
|
1087
1084
|
_context.prev = 3;
|
|
1088
1085
|
_context.next = 6;
|
|
1089
|
-
return fetchClient.
|
|
1090
|
-
|
|
1086
|
+
return fetchClient.sendRequest({
|
|
1087
|
+
url: overrideUrl,
|
|
1088
|
+
method: 'GET',
|
|
1089
|
+
credentials: 'omit'
|
|
1091
1090
|
});
|
|
1092
1091
|
case 6:
|
|
1093
1092
|
overrideData = _context.sent;
|
|
@@ -1587,7 +1586,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1587
1586
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1588
1587
|
/* harmony export */ });
|
|
1589
1588
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
1590
|
-
cdnVersion: '7.
|
|
1589
|
+
cdnVersion: '7.4.0-alpha.0'
|
|
1591
1590
|
});
|
|
1592
1591
|
|
|
1593
1592
|
/***/ }),
|
|
@@ -2169,12 +2168,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2169
2168
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2170
2169
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
2171
2170
|
/* harmony export */ });
|
|
2172
|
-
/* harmony import */ var
|
|
2173
|
-
/* harmony import */ var
|
|
2174
|
-
/* harmony import */ var
|
|
2175
|
-
/* harmony import */ var
|
|
2176
|
-
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
2177
|
-
|
|
2171
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/AcceptInvitationState/interfaces.js");
|
|
2172
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/AcceptInvitationState/state.js");
|
|
2173
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
2174
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
2178
2175
|
|
|
2179
2176
|
|
|
2180
2177
|
|
|
@@ -2182,32 +2179,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2182
2179
|
const actions = sharedActions;
|
|
2183
2180
|
const setAcceptInvitationState = state => {
|
|
2184
2181
|
Object.assign(store.auth.acceptInvitationState, state);
|
|
2185
|
-
return (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__.snapshot)(store.auth.acceptInvitationState);
|
|
2186
2182
|
};
|
|
2187
2183
|
const resetAcceptInvitationState = () => {
|
|
2188
|
-
store.auth.acceptInvitationState = (0,
|
|
2184
|
+
store.auth.acceptInvitationState = (0,_helpers__WEBPACK_IMPORTED_MODULE_0__.deepClone)(_state__WEBPACK_IMPORTED_MODULE_1__.initialState);
|
|
2189
2185
|
};
|
|
2190
2186
|
const acceptInvitation = async payload => {
|
|
2191
2187
|
if (!payload.token || !payload.userId) {
|
|
2192
2188
|
setAcceptInvitationState({
|
|
2193
2189
|
error: undefined,
|
|
2194
|
-
step:
|
|
2190
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_2__.AcceptInvitationStep.invalid
|
|
2195
2191
|
});
|
|
2196
2192
|
return;
|
|
2197
2193
|
}
|
|
2198
2194
|
try {
|
|
2199
2195
|
setAcceptInvitationState({
|
|
2200
2196
|
error: undefined,
|
|
2201
|
-
step:
|
|
2197
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_2__.AcceptInvitationStep.pending
|
|
2202
2198
|
});
|
|
2203
2199
|
await api.auth.acceptInvitation(payload);
|
|
2204
2200
|
setAcceptInvitationState({
|
|
2205
|
-
step:
|
|
2201
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_2__.AcceptInvitationStep.success
|
|
2206
2202
|
});
|
|
2207
2203
|
} catch (e) {
|
|
2208
2204
|
setAcceptInvitationState({
|
|
2209
|
-
step:
|
|
2210
|
-
error: (0,
|
|
2205
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_2__.AcceptInvitationStep.failed,
|
|
2206
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e)
|
|
2211
2207
|
});
|
|
2212
2208
|
}
|
|
2213
2209
|
};
|
|
@@ -2278,24 +2274,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2278
2274
|
/* harmony export */ });
|
|
2279
2275
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
2280
2276
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
|
|
2281
|
-
/* harmony import */ var
|
|
2282
|
-
/* harmony import */ var
|
|
2283
|
-
/* harmony import */ var
|
|
2284
|
-
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
2277
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/AccountSettingsState/state.js");
|
|
2278
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
2279
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
2285
2280
|
|
|
2286
2281
|
|
|
2287
2282
|
const _excluded = ["activeTenant", "tenants"];
|
|
2288
2283
|
|
|
2289
2284
|
|
|
2290
|
-
|
|
2291
2285
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
|
|
2292
2286
|
const actions = sharedActions;
|
|
2293
2287
|
const setAccountSettingsState = state => {
|
|
2294
2288
|
Object.assign(store.auth.accountSettingsState, state);
|
|
2295
|
-
return (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_2__.snapshot)(store.auth.accountSettingsState);
|
|
2296
2289
|
};
|
|
2297
2290
|
const resetAccountSettingsState = () => {
|
|
2298
|
-
store.auth.accountSettingsState = (0,
|
|
2291
|
+
store.auth.accountSettingsState = (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.deepClone)(_state__WEBPACK_IMPORTED_MODULE_3__.initialState);
|
|
2299
2292
|
};
|
|
2300
2293
|
const updateTenantState = ({
|
|
2301
2294
|
newSettingValues
|
|
@@ -2346,7 +2339,7 @@ const _excluded = ["activeTenant", "tenants"];
|
|
|
2346
2339
|
var _payload$callback2;
|
|
2347
2340
|
setAccountSettingsState({
|
|
2348
2341
|
loading: false,
|
|
2349
|
-
error: (0,
|
|
2342
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e)
|
|
2350
2343
|
});
|
|
2351
2344
|
(_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, null, e);
|
|
2352
2345
|
}
|
|
@@ -2364,7 +2357,7 @@ const _excluded = ["activeTenant", "tenants"];
|
|
|
2364
2357
|
} catch (e) {
|
|
2365
2358
|
setAccountSettingsState({
|
|
2366
2359
|
loading: false,
|
|
2367
|
-
error: (0,
|
|
2360
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e)
|
|
2368
2361
|
});
|
|
2369
2362
|
}
|
|
2370
2363
|
};
|
|
@@ -2412,16 +2405,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2412
2405
|
/* harmony export */ });
|
|
2413
2406
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
2414
2407
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
|
|
2415
|
-
/* harmony import */ var
|
|
2416
|
-
/* harmony import */ var
|
|
2417
|
-
/* harmony import */ var
|
|
2418
|
-
/* harmony import */ var
|
|
2419
|
-
/* harmony import */ var
|
|
2420
|
-
/* harmony import */ var
|
|
2421
|
-
/* harmony import */ var
|
|
2422
|
-
/* harmony import */ var
|
|
2423
|
-
/* harmony import */ var
|
|
2424
|
-
/* harmony import */ var _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../TeamState/interfaces */ "../../dist/@frontegg/redux-store/auth/TeamState/interfaces.js");
|
|
2408
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/ActivateAccountState/state.js");
|
|
2409
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/ContextHolder/index.js");
|
|
2410
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
2411
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
2412
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/redux-store/auth/ActivateAccountState/interfaces.js");
|
|
2413
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
|
|
2414
|
+
/* harmony import */ var _helpers_gtm__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../helpers/gtm */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
|
|
2415
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
|
|
2416
|
+
/* harmony import */ var _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../TeamState/interfaces */ "../../dist/@frontegg/redux-store/auth/TeamState/interfaces.js");
|
|
2425
2417
|
|
|
2426
2418
|
|
|
2427
2419
|
const _excluded = ["callback", "events"],
|
|
@@ -2436,15 +2428,13 @@ const _excluded = ["callback", "events"],
|
|
|
2436
2428
|
|
|
2437
2429
|
|
|
2438
2430
|
|
|
2439
|
-
|
|
2440
2431
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
|
|
2441
2432
|
const actions = sharedActions;
|
|
2442
2433
|
const setActivateState = state => {
|
|
2443
2434
|
Object.assign(store.auth.activateAccountState, state);
|
|
2444
|
-
return (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_2__.snapshot)(store.auth.activateAccountState);
|
|
2445
2435
|
};
|
|
2446
2436
|
const resetActivateState = () => {
|
|
2447
|
-
store.auth.activateAccountState = (0,
|
|
2437
|
+
store.auth.activateAccountState = (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.deepClone)(_state__WEBPACK_IMPORTED_MODULE_3__.initialState);
|
|
2448
2438
|
};
|
|
2449
2439
|
const setActivateStrategyState = state => {
|
|
2450
2440
|
Object.assign(store.auth.activateAccountState.activationStrategy, state);
|
|
@@ -2456,7 +2446,7 @@ const _excluded = ["callback", "events"],
|
|
|
2456
2446
|
} = payload;
|
|
2457
2447
|
setActivateState({
|
|
2458
2448
|
loading: true,
|
|
2459
|
-
step:
|
|
2449
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.activating
|
|
2460
2450
|
});
|
|
2461
2451
|
try {
|
|
2462
2452
|
const isAuthenticated = store.auth.isAuthenticated;
|
|
@@ -2475,13 +2465,13 @@ const _excluded = ["callback", "events"],
|
|
|
2475
2465
|
if (strategy.shouldSetPassword) {
|
|
2476
2466
|
setActivateState({
|
|
2477
2467
|
loading: false,
|
|
2478
|
-
step:
|
|
2468
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.activatingForm
|
|
2479
2469
|
});
|
|
2480
2470
|
}
|
|
2481
2471
|
} catch (e) {
|
|
2482
2472
|
setActivateState({
|
|
2483
2473
|
loading: false,
|
|
2484
|
-
error: (0,
|
|
2474
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
|
|
2485
2475
|
});
|
|
2486
2476
|
}
|
|
2487
2477
|
};
|
|
@@ -2495,7 +2485,7 @@ const _excluded = ["callback", "events"],
|
|
|
2495
2485
|
loading: true
|
|
2496
2486
|
});
|
|
2497
2487
|
try {
|
|
2498
|
-
const onRedirectTo =
|
|
2488
|
+
const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_6__.ContextHolder.for(store.root.appName).onRedirectTo;
|
|
2499
2489
|
const routes = store.auth.routes;
|
|
2500
2490
|
const _await$api$auth$activ = await api.auth.activateAccountV2(payload),
|
|
2501
2491
|
{
|
|
@@ -2506,37 +2496,37 @@ const _excluded = ["callback", "events"],
|
|
|
2506
2496
|
window.location.href = user.redirectLocation;
|
|
2507
2497
|
return;
|
|
2508
2498
|
}
|
|
2509
|
-
if ((0,
|
|
2499
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_7__.isMfaRequired)(user, store.root.appName)) {
|
|
2510
2500
|
setActivateState({
|
|
2511
|
-
step:
|
|
2501
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.success
|
|
2512
2502
|
});
|
|
2513
2503
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
2514
2504
|
actions.setAuthState(mfaRequiredState);
|
|
2515
|
-
await (0,
|
|
2505
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.delay)(1000);
|
|
2516
2506
|
onRedirectTo(routes.loginUrl, {
|
|
2517
2507
|
preserveQueryParams: true
|
|
2518
2508
|
});
|
|
2519
2509
|
} else {
|
|
2520
2510
|
var _events$userVerified;
|
|
2521
2511
|
setActivateState({
|
|
2522
|
-
step:
|
|
2512
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.ActivateAccountStep.success
|
|
2523
2513
|
});
|
|
2524
2514
|
const userVerifiedPayload = {
|
|
2525
2515
|
email: user.email,
|
|
2526
|
-
origin:
|
|
2516
|
+
origin: _interfaces__WEBPACK_IMPORTED_MODULE_8__.UserVeirifedOriginTypes.ACTIVATION_LINK,
|
|
2527
2517
|
id: user.id,
|
|
2528
2518
|
tenantId: user.tenantId,
|
|
2529
2519
|
name: user.name,
|
|
2530
2520
|
createdAt: new Date()
|
|
2531
2521
|
};
|
|
2532
2522
|
events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
|
|
2533
|
-
(0,
|
|
2523
|
+
(0,_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.reportGTMEvent)(_helpers_gtm__WEBPACK_IMPORTED_MODULE_9__.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
|
|
2534
2524
|
await actions.afterAuthenticationStateUpdate((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
|
2535
2525
|
user
|
|
2536
2526
|
}, rest), {
|
|
2537
2527
|
isAuthenticated: true
|
|
2538
2528
|
});
|
|
2539
|
-
await (0,
|
|
2529
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.delay)(1000);
|
|
2540
2530
|
await actions.afterAuthNavigation();
|
|
2541
2531
|
resetActivateState();
|
|
2542
2532
|
}
|
|
@@ -2544,7 +2534,7 @@ const _excluded = ["callback", "events"],
|
|
|
2544
2534
|
} catch (e) {
|
|
2545
2535
|
setActivateState({
|
|
2546
2536
|
loading: false,
|
|
2547
|
-
error: (0,
|
|
2537
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
|
|
2548
2538
|
});
|
|
2549
2539
|
}
|
|
2550
2540
|
};
|
|
@@ -2567,7 +2557,7 @@ const _excluded = ["callback", "events"],
|
|
|
2567
2557
|
} catch (e) {
|
|
2568
2558
|
setActivateStrategyState({
|
|
2569
2559
|
loading: false,
|
|
2570
|
-
error: (0,
|
|
2560
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
|
|
2571
2561
|
});
|
|
2572
2562
|
}
|
|
2573
2563
|
};
|
|
@@ -2577,7 +2567,7 @@ const _excluded = ["callback", "events"],
|
|
|
2577
2567
|
} = payload,
|
|
2578
2568
|
body = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(payload, _excluded4);
|
|
2579
2569
|
actions.setTeamLoader({
|
|
2580
|
-
key:
|
|
2570
|
+
key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_10__.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
2581
2571
|
value: body.email
|
|
2582
2572
|
});
|
|
2583
2573
|
setActivateState({
|
|
@@ -2594,12 +2584,12 @@ const _excluded = ["callback", "events"],
|
|
|
2594
2584
|
} catch (e) {
|
|
2595
2585
|
setActivateState({
|
|
2596
2586
|
loading: false,
|
|
2597
|
-
error: (0,
|
|
2587
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
|
|
2598
2588
|
});
|
|
2599
2589
|
callback == null ? void 0 : callback(null, e);
|
|
2600
2590
|
} finally {
|
|
2601
2591
|
actions.setTeamLoader({
|
|
2602
|
-
key:
|
|
2592
|
+
key: _TeamState_interfaces__WEBPACK_IMPORTED_MODULE_10__.TeamStateKeys.RESEND_ACTIVATE_LINK,
|
|
2603
2593
|
value: false
|
|
2604
2594
|
});
|
|
2605
2595
|
}
|
|
@@ -15407,28 +15397,25 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15407
15397
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
15408
15398
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
15409
15399
|
/* harmony export */ });
|
|
15410
|
-
/* harmony import */ var
|
|
15411
|
-
/* harmony import */ var
|
|
15412
|
-
/* harmony import */ var
|
|
15413
|
-
/* harmony import */ var
|
|
15414
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/ContextHolder/index.js");
|
|
15415
|
-
|
|
15400
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/UnlockAccountState/state.js");
|
|
15401
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
15402
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
15403
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/ContextHolder/index.js");
|
|
15416
15404
|
|
|
15417
15405
|
|
|
15418
15406
|
|
|
15419
15407
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((store, api, sharedActions) => {
|
|
15420
15408
|
const setUnlockAccountState = state => {
|
|
15421
15409
|
Object.assign(store.auth.unlockAccountState, state);
|
|
15422
|
-
return (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__.snapshot)(store.auth.unlockAccountState);
|
|
15423
15410
|
};
|
|
15424
15411
|
const resetUnlockAccountState = () => {
|
|
15425
|
-
store.auth.activateAccountState = (0,
|
|
15412
|
+
store.auth.activateAccountState = (0,_helpers__WEBPACK_IMPORTED_MODULE_0__.deepClone)(_state__WEBPACK_IMPORTED_MODULE_1__.initialState);
|
|
15426
15413
|
};
|
|
15427
15414
|
const unlockAccount = async _payload => {
|
|
15428
15415
|
const {
|
|
15429
15416
|
token
|
|
15430
15417
|
} = _payload;
|
|
15431
|
-
const onRedirectTo =
|
|
15418
|
+
const onRedirectTo = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(store.root.appName).onRedirectTo;
|
|
15432
15419
|
const routes = store.auth.routes;
|
|
15433
15420
|
setUnlockAccountState({
|
|
15434
15421
|
loading: true
|
|
@@ -15442,12 +15429,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15442
15429
|
error: undefined,
|
|
15443
15430
|
unlockAccountSuccess: true
|
|
15444
15431
|
});
|
|
15445
|
-
await (0,
|
|
15432
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_0__.delay)(1000);
|
|
15446
15433
|
onRedirectTo(routes.loginUrl);
|
|
15447
15434
|
} catch (e) {
|
|
15448
15435
|
setUnlockAccountState({
|
|
15449
15436
|
loading: false,
|
|
15450
|
-
error: (0,
|
|
15437
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e)
|
|
15451
15438
|
});
|
|
15452
15439
|
}
|
|
15453
15440
|
};
|
|
@@ -17561,6 +17548,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17561
17548
|
/* harmony export */ createAuthState: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.createAuthState),
|
|
17562
17549
|
/* harmony export */ createConnectivityState: () => (/* reexport safe */ _connectivity__WEBPACK_IMPORTED_MODULE_4__.createConnectivityState),
|
|
17563
17550
|
/* harmony export */ createFronteggStore: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.createFronteggStore),
|
|
17551
|
+
/* harmony export */ createProxy: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.createProxy),
|
|
17564
17552
|
/* harmony export */ createRandomString: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.createRandomString),
|
|
17565
17553
|
/* harmony export */ createStore: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.createStore),
|
|
17566
17554
|
/* harmony export */ createSubscriptionsState: () => (/* reexport safe */ _subscriptions__WEBPACK_IMPORTED_MODULE_5__.createSubscriptionsState),
|
|
@@ -17614,7 +17602,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17614
17602
|
/* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
|
|
17615
17603
|
/* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
|
|
17616
17604
|
/* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
|
|
17617
|
-
/** @license Frontegg v7.
|
|
17605
|
+
/** @license Frontegg v7.4.0-alpha.0
|
|
17618
17606
|
*
|
|
17619
17607
|
* This source code is licensed under the MIT license found in the
|
|
17620
17608
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -23868,17 +23856,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23868
23856
|
/* harmony export */ buildAuthActions: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.buildAuthActions),
|
|
23869
23857
|
/* harmony export */ createAuthState: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.createAuthState),
|
|
23870
23858
|
/* harmony export */ createFronteggStore: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.createFronteggStore),
|
|
23859
|
+
/* harmony export */ createProxy: () => (/* reexport safe */ _proxy__WEBPACK_IMPORTED_MODULE_3__.createProxy),
|
|
23871
23860
|
/* harmony export */ createStore: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.createStore),
|
|
23872
23861
|
/* harmony export */ getEntitlements: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.getEntitlements),
|
|
23873
23862
|
/* harmony export */ getFeatureEntitlements: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.getFeatureEntitlements),
|
|
23874
23863
|
/* harmony export */ getPermissionEntitlements: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.getPermissionEntitlements),
|
|
23875
23864
|
/* harmony export */ isEntitlementsDeeplyEqual: () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_1__.isEntitlementsDeeplyEqual),
|
|
23876
|
-
/* harmony export */ snapshot: () => (/* reexport safe */
|
|
23877
|
-
/* harmony export */ subscribe: () => (/* reexport safe */
|
|
23865
|
+
/* harmony export */ snapshot: () => (/* reexport safe */ _valtio__WEBPACK_IMPORTED_MODULE_2__.snapshot),
|
|
23866
|
+
/* harmony export */ subscribe: () => (/* reexport safe */ _valtio__WEBPACK_IMPORTED_MODULE_2__.subscribe)
|
|
23878
23867
|
/* harmony export */ });
|
|
23879
23868
|
/* harmony import */ var _FronteggNativeModule__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FronteggNativeModule */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
|
|
23880
23869
|
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store */ "../../dist/@frontegg/redux-store/toolkit/store.js");
|
|
23881
|
-
/* harmony import */ var
|
|
23870
|
+
/* harmony import */ var _valtio__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../valtio */ "../../dist/@frontegg/redux-store/valtio/valtio.js");
|
|
23871
|
+
/* harmony import */ var _proxy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proxy */ "../../dist/@frontegg/redux-store/toolkit/proxy.js");
|
|
23872
|
+
|
|
23882
23873
|
|
|
23883
23874
|
|
|
23884
23875
|
|
|
@@ -23897,7 +23888,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23897
23888
|
/* harmony export */ createProxy: () => (/* binding */ createProxy)
|
|
23898
23889
|
/* harmony export */ });
|
|
23899
23890
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
23900
|
-
/* harmony import */ var
|
|
23891
|
+
/* harmony import */ var _valtio__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../valtio */ "../../dist/@frontegg/redux-store/valtio/valtio.js");
|
|
23901
23892
|
/* harmony import */ var deepmerge__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! deepmerge */ "../../node_modules/deepmerge/dist/cjs.js");
|
|
23902
23893
|
/* harmony import */ var deepmerge__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(deepmerge__WEBPACK_IMPORTED_MODULE_1__);
|
|
23903
23894
|
|
|
@@ -23905,7 +23896,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23905
23896
|
|
|
23906
23897
|
const createProxy = (initialState, overrideState) => {
|
|
23907
23898
|
const deepMergedState = deepmerge__WEBPACK_IMPORTED_MODULE_1___default()(initialState, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, overrideState));
|
|
23908
|
-
return (0,
|
|
23899
|
+
return (0,_valtio__WEBPACK_IMPORTED_MODULE_2__.proxy)((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
|
23909
23900
|
__isProxy: true
|
|
23910
23901
|
}, deepMergedState));
|
|
23911
23902
|
};
|
|
@@ -23957,7 +23948,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23957
23948
|
/* harmony export */ isEntitlementsDeeplyEqual: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_2__.isEntitlementsDeeplyEqual)
|
|
23958
23949
|
/* harmony export */ });
|
|
23959
23950
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
23960
|
-
/* harmony import */ var
|
|
23951
|
+
/* harmony import */ var _valtio__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../valtio */ "../../dist/@frontegg/redux-store/valtio/utils/devtools.js");
|
|
23952
|
+
/* harmony import */ var _valtio__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../valtio */ "../../dist/@frontegg/redux-store/valtio/valtio.js");
|
|
23961
23953
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/ContextHolder/index.js");
|
|
23962
23954
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/index.js");
|
|
23963
23955
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @frontegg/rest-api */ "../../node_modules/@frontegg/rest-api/FetchClient.js");
|
|
@@ -23971,7 +23963,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23971
23963
|
/* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../audits */ "../../dist/@frontegg/redux-store/audits/index.js");
|
|
23972
23964
|
/* harmony import */ var set_value__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! set-value */ "../../node_modules/set-value/index.js");
|
|
23973
23965
|
/* harmony import */ var set_value__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(set_value__WEBPACK_IMPORTED_MODULE_1__);
|
|
23974
|
-
/* harmony import */ var valtio_vanilla__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! valtio/vanilla */ "../../node_modules/valtio/esm/vanilla.mjs");
|
|
23975
23966
|
/* harmony import */ var _audits_backward_compatibility__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../audits-backward-compatibility */ "../../dist/@frontegg/redux-store/audits-backward-compatibility/state.js");
|
|
23976
23967
|
/* harmony import */ var _audits_backward_compatibility__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../audits-backward-compatibility */ "../../dist/@frontegg/redux-store/audits-backward-compatibility/actions.js");
|
|
23977
23968
|
/* harmony import */ var _mocks__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../mocks */ "../../dist/@frontegg/redux-store/mocks/index.js");
|
|
@@ -23992,7 +23983,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23992
23983
|
|
|
23993
23984
|
|
|
23994
23985
|
|
|
23995
|
-
|
|
23996
23986
|
/**
|
|
23997
23987
|
* @deprecated use createStore instead
|
|
23998
23988
|
*/
|
|
@@ -24075,7 +24065,7 @@ const createStore = options => {
|
|
|
24075
24065
|
audits: oldAuditsState
|
|
24076
24066
|
});
|
|
24077
24067
|
if (typeof window !== 'undefined' && (localStorage['DEBUG_FRONTEGG_STORE'] === 'true' || "development" === 'development')) {
|
|
24078
|
-
(0,
|
|
24068
|
+
(0,_valtio__WEBPACK_IMPORTED_MODULE_11__.devtools)(store, {
|
|
24079
24069
|
name: `${appName} Store`,
|
|
24080
24070
|
enabled: true
|
|
24081
24071
|
});
|
|
@@ -24123,7 +24113,7 @@ const createStore = options => {
|
|
|
24123
24113
|
});
|
|
24124
24114
|
},
|
|
24125
24115
|
getState: () => store,
|
|
24126
|
-
subscribe: callback => (0,
|
|
24116
|
+
subscribe: callback => (0,_valtio__WEBPACK_IMPORTED_MODULE_15__.subscribe)(store, callback),
|
|
24127
24117
|
store,
|
|
24128
24118
|
actions,
|
|
24129
24119
|
stateActions
|
|
@@ -24167,7 +24157,7 @@ const createStore = options => {
|
|
|
24167
24157
|
}
|
|
24168
24158
|
},
|
|
24169
24159
|
getState: () => store,
|
|
24170
|
-
subscribe: callback => (0,
|
|
24160
|
+
subscribe: callback => (0,_valtio__WEBPACK_IMPORTED_MODULE_15__.subscribe)(store, callback),
|
|
24171
24161
|
store,
|
|
24172
24162
|
actions,
|
|
24173
24163
|
stateActions
|
|
@@ -24177,6 +24167,408 @@ const createStore = options => {
|
|
|
24177
24167
|
|
|
24178
24168
|
/***/ }),
|
|
24179
24169
|
|
|
24170
|
+
/***/ "../../dist/@frontegg/redux-store/valtio/utils/devtools.js":
|
|
24171
|
+
/*!*****************************************************************!*\
|
|
24172
|
+
!*** ../../dist/@frontegg/redux-store/valtio/utils/devtools.js ***!
|
|
24173
|
+
\*****************************************************************/
|
|
24174
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
24175
|
+
|
|
24176
|
+
"use strict";
|
|
24177
|
+
__webpack_require__.r(__webpack_exports__);
|
|
24178
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24179
|
+
/* harmony export */ devtools: () => (/* binding */ devtools)
|
|
24180
|
+
/* harmony export */ });
|
|
24181
|
+
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
24182
|
+
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
|
|
24183
|
+
/* harmony import */ var _valtio__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../valtio */ "../../dist/@frontegg/redux-store/valtio/valtio.js");
|
|
24184
|
+
|
|
24185
|
+
|
|
24186
|
+
const _excluded = ["enabled", "name"];
|
|
24187
|
+
|
|
24188
|
+
const DEVTOOLS = Symbol();
|
|
24189
|
+
/**
|
|
24190
|
+
* devtools
|
|
24191
|
+
*
|
|
24192
|
+
* This is to connect with [Redux DevTools Extension](https://github.com/reduxjs/redux-devtools).
|
|
24193
|
+
* Limitation: Only plain objects/values are supported.
|
|
24194
|
+
*
|
|
24195
|
+
* @example
|
|
24196
|
+
* import { devtools } from 'valtio/utils'
|
|
24197
|
+
* const state = proxy({ count: 0, text: 'hello' })
|
|
24198
|
+
* const unsub = devtools(state, { name: 'state name', enabled: true })
|
|
24199
|
+
*/
|
|
24200
|
+
function devtools(proxyObject, options) {
|
|
24201
|
+
if (typeof options === 'string') {
|
|
24202
|
+
// console.warn('string name option is deprecated, use { name }. https://github.com/pmndrs/valtio/pull/400');
|
|
24203
|
+
options = {
|
|
24204
|
+
name: options
|
|
24205
|
+
};
|
|
24206
|
+
}
|
|
24207
|
+
const _ref = options || {},
|
|
24208
|
+
{
|
|
24209
|
+
enabled,
|
|
24210
|
+
name = ''
|
|
24211
|
+
} = _ref,
|
|
24212
|
+
rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref, _excluded);
|
|
24213
|
+
|
|
24214
|
+
// @ts-ignore
|
|
24215
|
+
let extension;
|
|
24216
|
+
try {
|
|
24217
|
+
// @ts-ignore
|
|
24218
|
+
extension = enabled && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
24219
|
+
} catch {
|
|
24220
|
+
// ignored
|
|
24221
|
+
}
|
|
24222
|
+
if (!extension) {
|
|
24223
|
+
// @ts-ignore
|
|
24224
|
+
// TODO: console.warn('[Warning] Please install/enable Redux devtools extension');
|
|
24225
|
+
return;
|
|
24226
|
+
}
|
|
24227
|
+
let isTimeTraveling = false;
|
|
24228
|
+
const devtools = extension.connect((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({
|
|
24229
|
+
name
|
|
24230
|
+
}, rest));
|
|
24231
|
+
const unsub1 = (0,_valtio__WEBPACK_IMPORTED_MODULE_2__.subscribe)(proxyObject, ops => {
|
|
24232
|
+
const action = ops.filter(([_, path]) => path[0] !== DEVTOOLS).map(([op, path]) => `${op}:${path.map(String).join('.')}`).join(', ');
|
|
24233
|
+
if (!action) {
|
|
24234
|
+
return;
|
|
24235
|
+
}
|
|
24236
|
+
if (isTimeTraveling) {
|
|
24237
|
+
isTimeTraveling = false;
|
|
24238
|
+
} else {
|
|
24239
|
+
const snapWithoutDevtools = Object.assign({}, (0,_valtio__WEBPACK_IMPORTED_MODULE_2__.snapshot)(proxyObject));
|
|
24240
|
+
delete snapWithoutDevtools[DEVTOOLS];
|
|
24241
|
+
devtools.send({
|
|
24242
|
+
type: action,
|
|
24243
|
+
updatedAt: new Date().toLocaleString()
|
|
24244
|
+
}, snapWithoutDevtools);
|
|
24245
|
+
}
|
|
24246
|
+
});
|
|
24247
|
+
const unsub2 = devtools.subscribe(message => {
|
|
24248
|
+
var _message$payload3, _message$payload4;
|
|
24249
|
+
if (message.type === 'ACTION' && message.payload) {
|
|
24250
|
+
try {
|
|
24251
|
+
Object.assign(proxyObject, JSON.parse(message.payload));
|
|
24252
|
+
} catch (e) {
|
|
24253
|
+
console.error('please dispatch a serializable value that JSON.parse() and proxy() support\n', e);
|
|
24254
|
+
}
|
|
24255
|
+
}
|
|
24256
|
+
if (message.type === 'DISPATCH' && message.state) {
|
|
24257
|
+
var _message$payload, _message$payload2;
|
|
24258
|
+
if (((_message$payload = message.payload) == null ? void 0 : _message$payload.type) === 'JUMP_TO_ACTION' || ((_message$payload2 = message.payload) == null ? void 0 : _message$payload2.type) === 'JUMP_TO_STATE') {
|
|
24259
|
+
isTimeTraveling = true;
|
|
24260
|
+
const state = JSON.parse(message.state);
|
|
24261
|
+
Object.assign(proxyObject, state);
|
|
24262
|
+
}
|
|
24263
|
+
proxyObject[DEVTOOLS] = message;
|
|
24264
|
+
} else if (message.type === 'DISPATCH' && ((_message$payload3 = message.payload) == null ? void 0 : _message$payload3.type) === 'COMMIT') {
|
|
24265
|
+
devtools.init((0,_valtio__WEBPACK_IMPORTED_MODULE_2__.snapshot)(proxyObject));
|
|
24266
|
+
} else if (message.type === 'DISPATCH' && ((_message$payload4 = message.payload) == null ? void 0 : _message$payload4.type) === 'IMPORT_STATE') {
|
|
24267
|
+
var _message$payload$next, _message$payload$next2;
|
|
24268
|
+
const actions = (_message$payload$next = message.payload.nextLiftedState) == null ? void 0 : _message$payload$next.actionsById;
|
|
24269
|
+
const computedStates = ((_message$payload$next2 = message.payload.nextLiftedState) == null ? void 0 : _message$payload$next2.computedStates) || [];
|
|
24270
|
+
isTimeTraveling = true;
|
|
24271
|
+
computedStates.forEach(({
|
|
24272
|
+
state
|
|
24273
|
+
}, index) => {
|
|
24274
|
+
const action = actions[index] || 'No action found';
|
|
24275
|
+
Object.assign(proxyObject, state);
|
|
24276
|
+
if (index === 0) {
|
|
24277
|
+
devtools.init((0,_valtio__WEBPACK_IMPORTED_MODULE_2__.snapshot)(proxyObject));
|
|
24278
|
+
} else {
|
|
24279
|
+
devtools.send(action, (0,_valtio__WEBPACK_IMPORTED_MODULE_2__.snapshot)(proxyObject));
|
|
24280
|
+
}
|
|
24281
|
+
});
|
|
24282
|
+
}
|
|
24283
|
+
});
|
|
24284
|
+
devtools.init((0,_valtio__WEBPACK_IMPORTED_MODULE_2__.snapshot)(proxyObject));
|
|
24285
|
+
return () => {
|
|
24286
|
+
unsub1();
|
|
24287
|
+
unsub2 == null ? void 0 : unsub2();
|
|
24288
|
+
};
|
|
24289
|
+
}
|
|
24290
|
+
|
|
24291
|
+
/***/ }),
|
|
24292
|
+
|
|
24293
|
+
/***/ "../../dist/@frontegg/redux-store/valtio/valtio.js":
|
|
24294
|
+
/*!*********************************************************!*\
|
|
24295
|
+
!*** ../../dist/@frontegg/redux-store/valtio/valtio.js ***!
|
|
24296
|
+
\*********************************************************/
|
|
24297
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
24298
|
+
|
|
24299
|
+
"use strict";
|
|
24300
|
+
__webpack_require__.r(__webpack_exports__);
|
|
24301
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
24302
|
+
/* harmony export */ getVersion: () => (/* binding */ getVersion),
|
|
24303
|
+
/* harmony export */ proxy: () => (/* binding */ proxy),
|
|
24304
|
+
/* harmony export */ ref: () => (/* binding */ ref),
|
|
24305
|
+
/* harmony export */ snapshot: () => (/* binding */ snapshot),
|
|
24306
|
+
/* harmony export */ subscribe: () => (/* binding */ subscribe),
|
|
24307
|
+
/* harmony export */ unstable_buildProxyFunction: () => (/* binding */ unstable_buildProxyFunction)
|
|
24308
|
+
/* harmony export */ });
|
|
24309
|
+
/* harmony import */ var proxy_compare__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! proxy-compare */ "../../node_modules/proxy-compare/dist/index.js");
|
|
24310
|
+
|
|
24311
|
+
const isObject = x => typeof x === 'object' && x !== null;
|
|
24312
|
+
// shared state
|
|
24313
|
+
const proxyStateMap = new WeakMap();
|
|
24314
|
+
const refSet = new WeakSet();
|
|
24315
|
+
function buildProxyFunction(objectIs = Object.is, newProxy = (target, handler) => new Proxy(target, handler), canProxy = x => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), defaultHandlePromise = promise => {
|
|
24316
|
+
switch (promise.status) {
|
|
24317
|
+
case 'fulfilled':
|
|
24318
|
+
return promise.value;
|
|
24319
|
+
case 'rejected':
|
|
24320
|
+
throw promise.reason;
|
|
24321
|
+
default:
|
|
24322
|
+
throw promise;
|
|
24323
|
+
}
|
|
24324
|
+
}, snapCache = new WeakMap(), createSnapshot = (target, version, handlePromise = defaultHandlePromise) => {
|
|
24325
|
+
const cache = snapCache.get(target);
|
|
24326
|
+
if ((cache == null ? void 0 : cache[0]) === version) {
|
|
24327
|
+
return cache[1];
|
|
24328
|
+
}
|
|
24329
|
+
const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
|
|
24330
|
+
(0,proxy_compare__WEBPACK_IMPORTED_MODULE_0__.markToTrack)(snap, true); // mark to track
|
|
24331
|
+
snapCache.set(target, [version, snap]);
|
|
24332
|
+
Reflect.ownKeys(target).forEach(key => {
|
|
24333
|
+
if (Object.getOwnPropertyDescriptor(snap, key)) {
|
|
24334
|
+
// Only the known case is Array.length so far.
|
|
24335
|
+
return;
|
|
24336
|
+
}
|
|
24337
|
+
const value = Reflect.get(target, key);
|
|
24338
|
+
const {
|
|
24339
|
+
enumerable
|
|
24340
|
+
} = Reflect.getOwnPropertyDescriptor(target, key);
|
|
24341
|
+
const desc = {
|
|
24342
|
+
value,
|
|
24343
|
+
enumerable: enumerable,
|
|
24344
|
+
// This is intentional to avoid copying with proxy-compare.
|
|
24345
|
+
// It's still non-writable, so it avoids assigning a value.
|
|
24346
|
+
configurable: true
|
|
24347
|
+
};
|
|
24348
|
+
if (refSet.has(value)) {
|
|
24349
|
+
(0,proxy_compare__WEBPACK_IMPORTED_MODULE_0__.markToTrack)(value, false); // mark not to track
|
|
24350
|
+
} else if (value instanceof Promise) {
|
|
24351
|
+
delete desc.value;
|
|
24352
|
+
desc.get = () => handlePromise(value);
|
|
24353
|
+
} else if (proxyStateMap.has(value)) {
|
|
24354
|
+
const [target, ensureVersion] = proxyStateMap.get(value);
|
|
24355
|
+
desc.value = createSnapshot(target, ensureVersion(), handlePromise);
|
|
24356
|
+
}
|
|
24357
|
+
Object.defineProperty(snap, key, desc);
|
|
24358
|
+
});
|
|
24359
|
+
return Object.preventExtensions(snap);
|
|
24360
|
+
}, proxyCache = new WeakMap(), versionHolder = [1, 1], proxyFunction = initialObject => {
|
|
24361
|
+
if (!isObject(initialObject)) {
|
|
24362
|
+
throw new Error('object required');
|
|
24363
|
+
}
|
|
24364
|
+
const found = proxyCache.get(initialObject);
|
|
24365
|
+
if (found) {
|
|
24366
|
+
return found;
|
|
24367
|
+
}
|
|
24368
|
+
let version = versionHolder[0];
|
|
24369
|
+
const listeners = new Set();
|
|
24370
|
+
const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
|
|
24371
|
+
if (version !== nextVersion) {
|
|
24372
|
+
version = nextVersion;
|
|
24373
|
+
listeners.forEach(listener => listener(op, nextVersion));
|
|
24374
|
+
}
|
|
24375
|
+
};
|
|
24376
|
+
let checkVersion = versionHolder[1];
|
|
24377
|
+
const ensureVersion = (nextCheckVersion = ++versionHolder[1]) => {
|
|
24378
|
+
if (checkVersion !== nextCheckVersion && !listeners.size) {
|
|
24379
|
+
checkVersion = nextCheckVersion;
|
|
24380
|
+
propProxyStates.forEach(([propProxyState]) => {
|
|
24381
|
+
const propVersion = propProxyState[1](nextCheckVersion);
|
|
24382
|
+
if (propVersion > version) {
|
|
24383
|
+
version = propVersion;
|
|
24384
|
+
}
|
|
24385
|
+
});
|
|
24386
|
+
}
|
|
24387
|
+
return version;
|
|
24388
|
+
};
|
|
24389
|
+
const createPropListener = prop => (op, nextVersion) => {
|
|
24390
|
+
const newOp = [...op];
|
|
24391
|
+
newOp[1] = [prop, ...newOp[1]];
|
|
24392
|
+
notifyUpdate(newOp, nextVersion);
|
|
24393
|
+
};
|
|
24394
|
+
const propProxyStates = new Map();
|
|
24395
|
+
const addPropListener = (prop, propProxyState) => {
|
|
24396
|
+
// @ts-ignore
|
|
24397
|
+
// if (import.meta.env?.MODE !== 'production' && propProxyStates.has(prop)) {
|
|
24398
|
+
// throw new Error('prop listener already exists');
|
|
24399
|
+
// }
|
|
24400
|
+
if (listeners.size) {
|
|
24401
|
+
const remove = propProxyState[3](createPropListener(prop));
|
|
24402
|
+
propProxyStates.set(prop, [propProxyState, remove]);
|
|
24403
|
+
} else {
|
|
24404
|
+
propProxyStates.set(prop, [propProxyState]);
|
|
24405
|
+
}
|
|
24406
|
+
};
|
|
24407
|
+
const removePropListener = prop => {
|
|
24408
|
+
const entry = propProxyStates.get(prop);
|
|
24409
|
+
if (entry) {
|
|
24410
|
+
var _entry$;
|
|
24411
|
+
propProxyStates.delete(prop);
|
|
24412
|
+
(_entry$ = entry[1]) == null ? void 0 : _entry$.call(entry);
|
|
24413
|
+
}
|
|
24414
|
+
};
|
|
24415
|
+
const addListener = listener => {
|
|
24416
|
+
listeners.add(listener);
|
|
24417
|
+
if (listeners.size === 1) {
|
|
24418
|
+
propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
|
|
24419
|
+
// @ts-ignore
|
|
24420
|
+
// if (import.meta.env?.MODE !== 'production' && prevRemove) {
|
|
24421
|
+
// throw new Error('remove already exists');
|
|
24422
|
+
// }
|
|
24423
|
+
const remove = propProxyState[3](createPropListener(prop));
|
|
24424
|
+
propProxyStates.set(prop, [propProxyState, remove]);
|
|
24425
|
+
});
|
|
24426
|
+
}
|
|
24427
|
+
const removeListener = () => {
|
|
24428
|
+
listeners.delete(listener);
|
|
24429
|
+
if (listeners.size === 0) {
|
|
24430
|
+
propProxyStates.forEach(([propProxyState, remove], prop) => {
|
|
24431
|
+
if (remove) {
|
|
24432
|
+
remove();
|
|
24433
|
+
propProxyStates.set(prop, [propProxyState]);
|
|
24434
|
+
}
|
|
24435
|
+
});
|
|
24436
|
+
}
|
|
24437
|
+
};
|
|
24438
|
+
return removeListener;
|
|
24439
|
+
};
|
|
24440
|
+
const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
|
|
24441
|
+
const handler = {
|
|
24442
|
+
deleteProperty(target, prop) {
|
|
24443
|
+
const prevValue = Reflect.get(target, prop);
|
|
24444
|
+
removePropListener(prop);
|
|
24445
|
+
const deleted = Reflect.deleteProperty(target, prop);
|
|
24446
|
+
if (deleted) {
|
|
24447
|
+
notifyUpdate(['delete', [prop], prevValue]);
|
|
24448
|
+
}
|
|
24449
|
+
return deleted;
|
|
24450
|
+
},
|
|
24451
|
+
set(target, prop, value, receiver) {
|
|
24452
|
+
const hasPrevValue = Reflect.has(target, prop);
|
|
24453
|
+
const prevValue = Reflect.get(target, prop, receiver);
|
|
24454
|
+
if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
|
|
24455
|
+
return true;
|
|
24456
|
+
}
|
|
24457
|
+
removePropListener(prop);
|
|
24458
|
+
if (isObject(value)) {
|
|
24459
|
+
value = (0,proxy_compare__WEBPACK_IMPORTED_MODULE_0__.getUntracked)(value) || value;
|
|
24460
|
+
}
|
|
24461
|
+
let nextValue = value;
|
|
24462
|
+
if (value instanceof Promise) {
|
|
24463
|
+
value.then(v => {
|
|
24464
|
+
// @ts-ignore
|
|
24465
|
+
value.status = 'fulfilled';
|
|
24466
|
+
// @ts-ignore
|
|
24467
|
+
value.value = v;
|
|
24468
|
+
notifyUpdate(['resolve', [prop], v]);
|
|
24469
|
+
}).catch(e => {
|
|
24470
|
+
// @ts-ignore
|
|
24471
|
+
value.status = 'rejected';
|
|
24472
|
+
// @ts-ignore
|
|
24473
|
+
value.reason = e;
|
|
24474
|
+
notifyUpdate(['reject', [prop], e]);
|
|
24475
|
+
});
|
|
24476
|
+
} else {
|
|
24477
|
+
if (!proxyStateMap.has(value) && canProxy(value)) {
|
|
24478
|
+
nextValue = proxyFunction(value);
|
|
24479
|
+
}
|
|
24480
|
+
const childProxyState = !refSet.has(nextValue) && proxyStateMap.get(nextValue);
|
|
24481
|
+
if (childProxyState) {
|
|
24482
|
+
addPropListener(prop, childProxyState);
|
|
24483
|
+
}
|
|
24484
|
+
}
|
|
24485
|
+
Reflect.set(target, prop, nextValue, receiver);
|
|
24486
|
+
notifyUpdate(['set', [prop], value, prevValue]);
|
|
24487
|
+
return true;
|
|
24488
|
+
}
|
|
24489
|
+
};
|
|
24490
|
+
const proxyObject = newProxy(baseObject, handler);
|
|
24491
|
+
proxyCache.set(initialObject, proxyObject);
|
|
24492
|
+
const proxyState = [baseObject, ensureVersion, createSnapshot, addListener];
|
|
24493
|
+
proxyStateMap.set(proxyObject, proxyState);
|
|
24494
|
+
Reflect.ownKeys(initialObject).forEach(key => {
|
|
24495
|
+
const desc = Object.getOwnPropertyDescriptor(initialObject, key);
|
|
24496
|
+
if ('value' in desc) {
|
|
24497
|
+
proxyObject[key] = initialObject[key];
|
|
24498
|
+
// We need to delete desc.value because we already set it,
|
|
24499
|
+
// and delete desc.writable because we want to write it again.
|
|
24500
|
+
delete desc.value;
|
|
24501
|
+
delete desc.writable;
|
|
24502
|
+
}
|
|
24503
|
+
Object.defineProperty(baseObject, key, desc);
|
|
24504
|
+
});
|
|
24505
|
+
return proxyObject;
|
|
24506
|
+
}) {
|
|
24507
|
+
return [
|
|
24508
|
+
// public functions
|
|
24509
|
+
proxyFunction,
|
|
24510
|
+
// shared state
|
|
24511
|
+
proxyStateMap, refSet,
|
|
24512
|
+
// internal things
|
|
24513
|
+
objectIs, newProxy, canProxy, defaultHandlePromise, snapCache, createSnapshot, proxyCache, versionHolder];
|
|
24514
|
+
}
|
|
24515
|
+
const [defaultProxyFunction] = buildProxyFunction();
|
|
24516
|
+
function proxy(initialObject = {}) {
|
|
24517
|
+
return defaultProxyFunction(initialObject);
|
|
24518
|
+
}
|
|
24519
|
+
function getVersion(proxyObject) {
|
|
24520
|
+
const proxyState = proxyStateMap.get(proxyObject);
|
|
24521
|
+
return proxyState == null ? void 0 : proxyState[1]();
|
|
24522
|
+
}
|
|
24523
|
+
function subscribe(proxyObject, callback, notifyInSync) {
|
|
24524
|
+
const proxyState = proxyStateMap.get(proxyObject);
|
|
24525
|
+
// @ts-ignore
|
|
24526
|
+
// if (import.meta.env?.MODE !== 'production' && !proxyState) {
|
|
24527
|
+
// console.warn('Please use proxy object');
|
|
24528
|
+
// }
|
|
24529
|
+
let promise;
|
|
24530
|
+
const ops = [];
|
|
24531
|
+
const addListener = proxyState[3];
|
|
24532
|
+
let isListenerActive = false;
|
|
24533
|
+
const listener = op => {
|
|
24534
|
+
ops.push(op);
|
|
24535
|
+
if (notifyInSync) {
|
|
24536
|
+
callback(ops.splice(0));
|
|
24537
|
+
return;
|
|
24538
|
+
}
|
|
24539
|
+
if (!promise) {
|
|
24540
|
+
promise = Promise.resolve().then(() => {
|
|
24541
|
+
promise = undefined;
|
|
24542
|
+
if (isListenerActive) {
|
|
24543
|
+
callback(ops.splice(0));
|
|
24544
|
+
}
|
|
24545
|
+
});
|
|
24546
|
+
}
|
|
24547
|
+
};
|
|
24548
|
+
const removeListener = addListener(listener);
|
|
24549
|
+
isListenerActive = true;
|
|
24550
|
+
return () => {
|
|
24551
|
+
isListenerActive = false;
|
|
24552
|
+
removeListener();
|
|
24553
|
+
};
|
|
24554
|
+
}
|
|
24555
|
+
function snapshot(proxyObject, handlePromise) {
|
|
24556
|
+
const proxyState = proxyStateMap.get(proxyObject);
|
|
24557
|
+
// @ts-ignore
|
|
24558
|
+
// if (import.meta.env?.MODE !== 'production' && !proxyState) {
|
|
24559
|
+
// console.warn('Please use proxy object');
|
|
24560
|
+
// }
|
|
24561
|
+
const [target, ensureVersion, createSnapshot] = proxyState;
|
|
24562
|
+
return createSnapshot(target, ensureVersion(), handlePromise);
|
|
24563
|
+
}
|
|
24564
|
+
function ref(obj) {
|
|
24565
|
+
refSet.add(obj);
|
|
24566
|
+
return obj;
|
|
24567
|
+
}
|
|
24568
|
+
const unstable_buildProxyFunction = buildProxyFunction;
|
|
24569
|
+
|
|
24570
|
+
/***/ }),
|
|
24571
|
+
|
|
24180
24572
|
/***/ "../../dist/@frontegg/redux-store/vendor/actions.js":
|
|
24181
24573
|
/*!**********************************************************!*\
|
|
24182
24574
|
!*** ../../dist/@frontegg/redux-store/vendor/actions.js ***!
|
|
@@ -24983,7 +25375,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24983
25375
|
/* harmony export */ });
|
|
24984
25376
|
/* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
|
|
24985
25377
|
/* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
|
|
24986
|
-
/** @license Frontegg v7.
|
|
25378
|
+
/** @license Frontegg v7.4.0-alpha.0
|
|
24987
25379
|
*
|
|
24988
25380
|
* This source code is licensed under the MIT license found in the
|
|
24989
25381
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -31566,26 +31958,6 @@ var deepmerge_1 = deepmerge;
|
|
|
31566
31958
|
module.exports = deepmerge_1;
|
|
31567
31959
|
|
|
31568
31960
|
|
|
31569
|
-
/***/ }),
|
|
31570
|
-
|
|
31571
|
-
/***/ "../../node_modules/derive-valtio/dist/index.modern.js":
|
|
31572
|
-
/*!*************************************************************!*\
|
|
31573
|
-
!*** ../../node_modules/derive-valtio/dist/index.modern.js ***!
|
|
31574
|
-
\*************************************************************/
|
|
31575
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
31576
|
-
|
|
31577
|
-
"use strict";
|
|
31578
|
-
__webpack_require__.r(__webpack_exports__);
|
|
31579
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31580
|
-
/* harmony export */ derive: () => (/* binding */ f),
|
|
31581
|
-
/* harmony export */ underive: () => (/* binding */ u),
|
|
31582
|
-
/* harmony export */ unstable_deriveSubscriptions: () => (/* binding */ i)
|
|
31583
|
-
/* harmony export */ });
|
|
31584
|
-
/* harmony import */ var valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! valtio/vanilla */ "../../node_modules/valtio/esm/vanilla.mjs");
|
|
31585
|
-
const o=new WeakMap,r=new WeakMap,s=(e,t)=>{const n=o.get(e);n&&(n[0].forEach(t=>{const{d:n}=t;e!==n&&s(n)}),++n[2],t&&n[3].add(t))},l=e=>{const t=o.get(e);t&&(--t[2],t[2]||(t[3].forEach(e=>e()),t[3].clear()),t[0].forEach(t=>{const{d:n}=t;e!==n&&l(n)}))},c=e=>{const{s:n,d:c}=e;let a=r.get(c);a||(a=[new Set],r.set(e.d,a)),a[0].add(e);let d=o.get(n);if(!d){const e=new Set,r=(0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__.subscribe)(n,t=>{e.forEach(e=>{const{d:o,c:r,n:c,i:a}=e;n===o&&t.every(e=>1===e[1].length&&a.includes(e[1][0]))||e.p||(s(n,r),c?l(n):e.p=Promise.resolve().then(()=>{delete e.p,l(n)}))})},!0);d=[e,r,0,new Set],o.set(n,d)}d[0].add(e)},a=e=>{const{s:t,d:n}=e,s=r.get(n);null==s||s[0].delete(e),0===(null==s?void 0:s[0].size)&&r.delete(n);const l=o.get(t);if(l){const[n,r]=l;n.delete(e),n.size||(r(),o.delete(t))}},d=e=>{const t=r.get(e);return t?Array.from(t[0]):[]},i={add:c,remove:a,list:d};function f(t,r){const s=(null==r?void 0:r.proxy)||(0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__.proxy)({}),l=!(null==r||!r.sync),d=Object.keys(t);return d.forEach(e=>{if(Object.getOwnPropertyDescriptor(s,e))throw new Error("object property already defined");const r=t[e];let i=null;const f=()=>{if(i){if(Array.from(i).map(([e])=>((e,t)=>{const n=o.get(e);return!(null==n||!n[2]||(n[3].add(t),0))})(e,f)).some(e=>e))return;if(Array.from(i).every(([e,t])=>(0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__.getVersion)(e)===t.v))return}const t=new Map,u=r(e=>(t.set(e,{v:(0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_0__.getVersion)(e)}),e)),p=()=>{var n;t.forEach((t,n)=>{var o;const r=null==(o=i)||null==(o=o.get(n))?void 0:o.s;if(r)t.s=r;else{const o={s:n,d:s,k:e,c:f,n:l,i:d};c(o),t.s=o}}),null==(n=i)||n.forEach((e,n)=>{!t.has(n)&&e.s&&a(e.s)}),i=t};u instanceof Promise?u.finally(p):p(),s[e]=u};f()}),s}function u(e,t){const n=null!=t&&t.delete?new Set:null;d(e).forEach(e=>{const{k:o}=e;null!=t&&t.keys&&!t.keys.includes(o)||(a(e),n&&n.add(o))}),n&&n.forEach(t=>{delete e[t]})}
|
|
31586
|
-
//# sourceMappingURL=index.modern.mjs.map
|
|
31587
|
-
|
|
31588
|
-
|
|
31589
31961
|
/***/ }),
|
|
31590
31962
|
|
|
31591
31963
|
/***/ "../../node_modules/fast-deep-equal/index.js":
|
|
@@ -31740,29 +32112,6 @@ module.exports = function isObject(val) {
|
|
|
31740
32112
|
};
|
|
31741
32113
|
|
|
31742
32114
|
|
|
31743
|
-
/***/ }),
|
|
31744
|
-
|
|
31745
|
-
/***/ "../../node_modules/proxy-compare/dist/index.modern.js":
|
|
31746
|
-
/*!*************************************************************!*\
|
|
31747
|
-
!*** ../../node_modules/proxy-compare/dist/index.modern.js ***!
|
|
31748
|
-
\*************************************************************/
|
|
31749
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
31750
|
-
|
|
31751
|
-
"use strict";
|
|
31752
|
-
__webpack_require__.r(__webpack_exports__);
|
|
31753
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31754
|
-
/* harmony export */ affectedToPathList: () => (/* binding */ w),
|
|
31755
|
-
/* harmony export */ createProxy: () => (/* binding */ a),
|
|
31756
|
-
/* harmony export */ getUntracked: () => (/* binding */ y),
|
|
31757
|
-
/* harmony export */ isChanged: () => (/* binding */ p),
|
|
31758
|
-
/* harmony export */ markToTrack: () => (/* binding */ h),
|
|
31759
|
-
/* harmony export */ replaceNewProxy: () => (/* binding */ O),
|
|
31760
|
-
/* harmony export */ trackMemo: () => (/* binding */ g)
|
|
31761
|
-
/* harmony export */ });
|
|
31762
|
-
const e=Symbol(),t=Symbol(),r="a",n="w";let o=(e,t)=>new Proxy(e,t);const s=Object.getPrototypeOf,c=new WeakMap,l=e=>e&&(c.has(e)?c.get(e):s(e)===Object.prototype||s(e)===Array.prototype),f=e=>"object"==typeof e&&null!==e,i=e=>{if(Array.isArray(e))return Array.from(e);const t=Object.getOwnPropertyDescriptors(e);return Object.values(t).forEach(e=>{e.configurable=!0}),Object.create(s(e),t)},u=e=>e[t]||e,a=(s,c,f,p)=>{if(!l(s))return s;let g=p&&p.get(s);if(!g){const e=u(s);g=(e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(e=>!e.configurable&&!e.writable))(e)?[e,i(e)]:[e],null==p||p.set(s,g)}const[y,h]=g;let w=f&&f.get(y);return w&&w[1].f===!!h||(w=((o,s)=>{const c={f:s};let l=!1;const f=(e,t)=>{if(!l){let s=c[r].get(o);if(s||(s={},c[r].set(o,s)),e===n)s[n]=!0;else{let r=s[e];r||(r=new Set,s[e]=r),r.add(t)}}},i={get:(e,n)=>n===t?o:(f("k",n),a(Reflect.get(e,n),c[r],c.c,c.t)),has:(t,n)=>n===e?(l=!0,c[r].delete(o),!0):(f("h",n),Reflect.has(t,n)),getOwnPropertyDescriptor:(e,t)=>(f("o",t),Reflect.getOwnPropertyDescriptor(e,t)),ownKeys:e=>(f(n),Reflect.ownKeys(e))};return s&&(i.set=i.deleteProperty=()=>!1),[i,c]})(y,!!h),w[1].p=o(h||y,w[0]),f&&f.set(y,w)),w[1][r]=c,w[1].c=f,w[1].t=p,w[1].p},p=(e,t,r,o,s=Object.is)=>{if(s(e,t))return!1;if(!f(e)||!f(t))return!0;const c=r.get(u(e));if(!c)return!0;if(o){const r=o.get(e);if(r&&r.n===t)return r.g;o.set(e,{n:t,g:!1})}let l=null;try{for(const r of c.h||[])if(l=Reflect.has(e,r)!==Reflect.has(t,r),l)return l;if(!0===c[n]){if(l=((e,t)=>{const r=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return r.length!==n.length||r.some((e,t)=>e!==n[t])})(e,t),l)return l}else for(const r of c.o||[])if(l=!!Reflect.getOwnPropertyDescriptor(e,r)!=!!Reflect.getOwnPropertyDescriptor(t,r),l)return l;for(const n of c.k||[])if(l=p(e[n],t[n],r,o,s),l)return l;return null===l&&(l=!0),l}finally{o&&o.set(e,{n:t,g:l})}},g=t=>!!l(t)&&e in t,y=e=>l(e)&&e[t]||null,h=(e,t=!0)=>{c.set(e,t)},w=(e,t,r)=>{const o=[],s=new WeakSet,c=(e,l)=>{if(s.has(e))return;f(e)&&s.add(e);const i=f(e)&&t.get(u(e));if(i){var a,p;if(null==(a=i.h)||a.forEach(e=>{const t=`:has(${String(e)})`;o.push(l?[...l,t]:[t])}),!0===i[n]){const e=":ownKeys";o.push(l?[...l,e]:[e])}else{var g;null==(g=i.o)||g.forEach(e=>{const t=`:hasOwn(${String(e)})`;o.push(l?[...l,t]:[t])})}null==(p=i.k)||p.forEach(t=>{r&&!("value"in(Object.getOwnPropertyDescriptor(e,t)||{}))||c(e[t],l?[...l,t]:[t])})}else l&&o.push(l)};return c(e),o},O=e=>{o=e};
|
|
31763
|
-
//# sourceMappingURL=index.modern.mjs.map
|
|
31764
|
-
|
|
31765
|
-
|
|
31766
32115
|
/***/ }),
|
|
31767
32116
|
|
|
31768
32117
|
/***/ "../../node_modules/set-value/index.js":
|
|
@@ -33063,725 +33412,422 @@ function _wrapNativeSuper(Class) {
|
|
|
33063
33412
|
|
|
33064
33413
|
/***/ }),
|
|
33065
33414
|
|
|
33066
|
-
/***/ "../../node_modules/
|
|
33067
|
-
|
|
33068
|
-
!*** ../../node_modules/
|
|
33069
|
-
|
|
33415
|
+
/***/ "../../node_modules/proxy-compare/dist/index.js":
|
|
33416
|
+
/*!******************************************************!*\
|
|
33417
|
+
!*** ../../node_modules/proxy-compare/dist/index.js ***!
|
|
33418
|
+
\******************************************************/
|
|
33070
33419
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
33071
33420
|
|
|
33072
33421
|
"use strict";
|
|
33073
33422
|
__webpack_require__.r(__webpack_exports__);
|
|
33074
33423
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33075
|
-
/* harmony export */
|
|
33076
|
-
/* harmony export */
|
|
33077
|
-
/* harmony export */
|
|
33078
|
-
/* harmony export */
|
|
33079
|
-
/* harmony export */
|
|
33080
|
-
/* harmony export */
|
|
33081
|
-
/* harmony export */
|
|
33082
|
-
/* harmony
|
|
33083
|
-
|
|
33084
|
-
|
|
33085
|
-
const
|
|
33086
|
-
const
|
|
33087
|
-
|
|
33088
|
-
const
|
|
33089
|
-
|
|
33090
|
-
|
|
33091
|
-
|
|
33092
|
-
|
|
33093
|
-
|
|
33094
|
-
|
|
33095
|
-
|
|
33096
|
-
|
|
33097
|
-
|
|
33098
|
-
|
|
33099
|
-
|
|
33100
|
-
|
|
33101
|
-
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
|
|
33106
|
-
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33117
|
-
|
|
33118
|
-
|
|
33119
|
-
|
|
33424
|
+
/* harmony export */ affectedToPathList: () => (/* binding */ affectedToPathList),
|
|
33425
|
+
/* harmony export */ createProxy: () => (/* binding */ createProxy),
|
|
33426
|
+
/* harmony export */ getUntracked: () => (/* binding */ getUntracked),
|
|
33427
|
+
/* harmony export */ isChanged: () => (/* binding */ isChanged),
|
|
33428
|
+
/* harmony export */ markToTrack: () => (/* binding */ markToTrack),
|
|
33429
|
+
/* harmony export */ replaceNewProxy: () => (/* binding */ replaceNewProxy),
|
|
33430
|
+
/* harmony export */ trackMemo: () => (/* binding */ trackMemo)
|
|
33431
|
+
/* harmony export */ });
|
|
33432
|
+
/* eslint @typescript-eslint/no-explicit-any: off */
|
|
33433
|
+
// symbols
|
|
33434
|
+
const TRACK_MEMO_SYMBOL = Symbol();
|
|
33435
|
+
const GET_ORIGINAL_SYMBOL = Symbol();
|
|
33436
|
+
// properties
|
|
33437
|
+
const AFFECTED_PROPERTY = 'a';
|
|
33438
|
+
const IS_TARGET_COPIED_PROPERTY = 'f';
|
|
33439
|
+
const PROXY_PROPERTY = 'p';
|
|
33440
|
+
const PROXY_CACHE_PROPERTY = 'c';
|
|
33441
|
+
const TARGET_CACHE_PROPERTY = 't';
|
|
33442
|
+
const NEXT_OBJECT_PROPERTY = 'n';
|
|
33443
|
+
const CHANGED_PROPERTY = 'g';
|
|
33444
|
+
const HAS_KEY_PROPERTY = 'h';
|
|
33445
|
+
const ALL_OWN_KEYS_PROPERTY = 'w';
|
|
33446
|
+
const HAS_OWN_KEY_PROPERTY = 'o';
|
|
33447
|
+
const KEYS_PROPERTY = 'k';
|
|
33448
|
+
// function to create a new bare proxy
|
|
33449
|
+
let newProxy = (target, handler) => new Proxy(target, handler);
|
|
33450
|
+
// get object prototype
|
|
33451
|
+
const getProto = Object.getPrototypeOf;
|
|
33452
|
+
const objectsToTrack = new WeakMap();
|
|
33453
|
+
// check if obj is a plain object or an array
|
|
33454
|
+
const isObjectToTrack = (obj) => obj &&
|
|
33455
|
+
(objectsToTrack.has(obj)
|
|
33456
|
+
? objectsToTrack.get(obj)
|
|
33457
|
+
: getProto(obj) === Object.prototype || getProto(obj) === Array.prototype);
|
|
33458
|
+
// check if it is object
|
|
33459
|
+
const isObject = (x) => typeof x === 'object' && x !== null;
|
|
33460
|
+
// Properties that are both non-configurable and non-writable will break
|
|
33461
|
+
// the proxy get trap when we try to return a recursive/child compare proxy
|
|
33462
|
+
// from them. We can avoid this by making a copy of the target object with
|
|
33463
|
+
// all descriptors marked as configurable, see `copyTargetObject`.
|
|
33464
|
+
// See: https://github.com/dai-shi/proxy-compare/pull/8
|
|
33465
|
+
const needsToCopyTargetObject = (obj) => Object.values(Object.getOwnPropertyDescriptors(obj)).some((descriptor) => !descriptor.configurable && !descriptor.writable);
|
|
33466
|
+
// Make a copy with all descriptors marked as configurable.
|
|
33467
|
+
const copyTargetObject = (obj) => {
|
|
33468
|
+
if (Array.isArray(obj)) {
|
|
33469
|
+
// Arrays need a special way to copy
|
|
33470
|
+
return Array.from(obj);
|
|
33471
|
+
}
|
|
33472
|
+
// For non-array objects, we create a new object keeping the prototype
|
|
33473
|
+
// with changing all configurable options (otherwise, proxies will complain)
|
|
33474
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
33475
|
+
Object.values(descriptors).forEach((desc) => {
|
|
33476
|
+
desc.configurable = true;
|
|
33477
|
+
});
|
|
33478
|
+
return Object.create(getProto(obj), descriptors);
|
|
33479
|
+
};
|
|
33480
|
+
const createProxyHandler = (origObj, isTargetCopied) => {
|
|
33481
|
+
const state = {
|
|
33482
|
+
[IS_TARGET_COPIED_PROPERTY]: isTargetCopied,
|
|
33483
|
+
};
|
|
33484
|
+
let trackObject = false; // for trackMemo
|
|
33485
|
+
const recordUsage = (type, key) => {
|
|
33486
|
+
if (!trackObject) {
|
|
33487
|
+
let used = state[AFFECTED_PROPERTY].get(origObj);
|
|
33488
|
+
if (!used) {
|
|
33489
|
+
used = {};
|
|
33490
|
+
state[AFFECTED_PROPERTY].set(origObj, used);
|
|
33491
|
+
}
|
|
33492
|
+
if (type === ALL_OWN_KEYS_PROPERTY) {
|
|
33493
|
+
used[ALL_OWN_KEYS_PROPERTY] = true;
|
|
33494
|
+
}
|
|
33495
|
+
else {
|
|
33496
|
+
let set = used[type];
|
|
33497
|
+
if (!set) {
|
|
33498
|
+
set = new Set();
|
|
33499
|
+
used[type] = set;
|
|
33500
|
+
}
|
|
33501
|
+
set.add(key);
|
|
33502
|
+
}
|
|
33503
|
+
}
|
|
33120
33504
|
};
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
|
|
33124
|
-
|
|
33125
|
-
|
|
33126
|
-
|
|
33127
|
-
|
|
33128
|
-
|
|
33129
|
-
|
|
33130
|
-
|
|
33131
|
-
|
|
33132
|
-
|
|
33133
|
-
|
|
33134
|
-
|
|
33135
|
-
|
|
33136
|
-
|
|
33137
|
-
|
|
33138
|
-
|
|
33139
|
-
|
|
33140
|
-
|
|
33141
|
-
|
|
33142
|
-
|
|
33143
|
-
|
|
33144
|
-
|
|
33145
|
-
|
|
33146
|
-
|
|
33147
|
-
|
|
33148
|
-
|
|
33149
|
-
|
|
33150
|
-
if (
|
|
33151
|
-
|
|
33152
|
-
listeners.forEach((listener) => listener(op, nextVersion));
|
|
33505
|
+
const recordObjectAsUsed = () => {
|
|
33506
|
+
trackObject = true;
|
|
33507
|
+
state[AFFECTED_PROPERTY].delete(origObj);
|
|
33508
|
+
};
|
|
33509
|
+
const handler = {
|
|
33510
|
+
get(target, key) {
|
|
33511
|
+
if (key === GET_ORIGINAL_SYMBOL) {
|
|
33512
|
+
return origObj;
|
|
33513
|
+
}
|
|
33514
|
+
recordUsage(KEYS_PROPERTY, key);
|
|
33515
|
+
return createProxy(Reflect.get(target, key), state[AFFECTED_PROPERTY], state[PROXY_CACHE_PROPERTY], state[TARGET_CACHE_PROPERTY]);
|
|
33516
|
+
},
|
|
33517
|
+
has(target, key) {
|
|
33518
|
+
if (key === TRACK_MEMO_SYMBOL) {
|
|
33519
|
+
recordObjectAsUsed();
|
|
33520
|
+
return true;
|
|
33521
|
+
}
|
|
33522
|
+
recordUsage(HAS_KEY_PROPERTY, key);
|
|
33523
|
+
return Reflect.has(target, key);
|
|
33524
|
+
},
|
|
33525
|
+
getOwnPropertyDescriptor(target, key) {
|
|
33526
|
+
recordUsage(HAS_OWN_KEY_PROPERTY, key);
|
|
33527
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
33528
|
+
},
|
|
33529
|
+
ownKeys(target) {
|
|
33530
|
+
recordUsage(ALL_OWN_KEYS_PROPERTY);
|
|
33531
|
+
return Reflect.ownKeys(target);
|
|
33532
|
+
},
|
|
33533
|
+
};
|
|
33534
|
+
if (isTargetCopied) {
|
|
33535
|
+
handler.set = handler.deleteProperty = () => false;
|
|
33153
33536
|
}
|
|
33154
|
-
|
|
33155
|
-
|
|
33156
|
-
|
|
33157
|
-
|
|
33158
|
-
|
|
33159
|
-
|
|
33160
|
-
|
|
33161
|
-
|
|
33162
|
-
|
|
33537
|
+
return [handler, state];
|
|
33538
|
+
};
|
|
33539
|
+
const getOriginalObject = (obj) =>
|
|
33540
|
+
// unwrap proxy
|
|
33541
|
+
obj[GET_ORIGINAL_SYMBOL] ||
|
|
33542
|
+
// otherwise
|
|
33543
|
+
obj;
|
|
33544
|
+
/**
|
|
33545
|
+
* Create a proxy.
|
|
33546
|
+
*
|
|
33547
|
+
* This function will create a proxy at top level and proxy nested objects as you access them,
|
|
33548
|
+
* in order to keep track of which properties were accessed via get/has proxy handlers:
|
|
33549
|
+
*
|
|
33550
|
+
* NOTE: Printing of WeakMap is hard to inspect and not very readable
|
|
33551
|
+
* for this purpose you can use the `affectedToPathList` helper.
|
|
33552
|
+
*
|
|
33553
|
+
* @param {object} obj - Object that will be wrapped on the proxy.
|
|
33554
|
+
* @param {WeakMap<object, unknown>} affected -
|
|
33555
|
+
* WeakMap that will hold the tracking of which properties in the proxied object were accessed.
|
|
33556
|
+
* @param {WeakMap<object, unknown>} [proxyCache] -
|
|
33557
|
+
* WeakMap that will help keep referential identity for proxies.
|
|
33558
|
+
* @returns {Proxy<object>} - Object wrapped in a proxy.
|
|
33559
|
+
*
|
|
33560
|
+
* @example
|
|
33561
|
+
* import { createProxy } from 'proxy-compare';
|
|
33562
|
+
*
|
|
33563
|
+
* const original = { a: "1", c: "2", d: { e: "3" } };
|
|
33564
|
+
* const affected = new WeakMap();
|
|
33565
|
+
* const proxy = createProxy(original, affected);
|
|
33566
|
+
*
|
|
33567
|
+
* proxy.a // Will mark as used and track its value.
|
|
33568
|
+
* // This will update the affected WeakMap with original as key
|
|
33569
|
+
* // and a Set with "a"
|
|
33570
|
+
*
|
|
33571
|
+
* proxy.d // Will mark "d" as accessed to track and proxy itself ({ e: "3" }).
|
|
33572
|
+
* // This will update the affected WeakMap with original as key
|
|
33573
|
+
* // and a Set with "d"
|
|
33574
|
+
*/
|
|
33575
|
+
const createProxy = (obj, affected, proxyCache, targetCache) => {
|
|
33576
|
+
if (!isObjectToTrack(obj))
|
|
33577
|
+
return obj;
|
|
33578
|
+
let targetAndCopied = targetCache && targetCache.get(obj);
|
|
33579
|
+
if (!targetAndCopied) {
|
|
33580
|
+
const target = getOriginalObject(obj);
|
|
33581
|
+
if (needsToCopyTargetObject(target)) {
|
|
33582
|
+
targetAndCopied = [target, copyTargetObject(target)];
|
|
33163
33583
|
}
|
|
33164
|
-
|
|
33165
|
-
|
|
33166
|
-
|
|
33167
|
-
|
|
33168
|
-
|
|
33169
|
-
const
|
|
33170
|
-
|
|
33171
|
-
|
|
33172
|
-
|
|
33173
|
-
|
|
33174
|
-
|
|
33175
|
-
|
|
33176
|
-
|
|
33177
|
-
}
|
|
33178
|
-
if (listeners.size) {
|
|
33179
|
-
const remove = propProxyState[3](createPropListener(prop));
|
|
33180
|
-
propProxyStates.set(prop, [propProxyState, remove]);
|
|
33181
|
-
} else {
|
|
33182
|
-
propProxyStates.set(prop, [propProxyState]);
|
|
33183
|
-
}
|
|
33184
|
-
};
|
|
33185
|
-
const removePropListener = (prop) => {
|
|
33186
|
-
var _a;
|
|
33187
|
-
const entry = propProxyStates.get(prop);
|
|
33188
|
-
if (entry) {
|
|
33189
|
-
propProxyStates.delete(prop);
|
|
33190
|
-
(_a = entry[1]) == null ? void 0 : _a.call(entry);
|
|
33191
|
-
}
|
|
33192
|
-
};
|
|
33193
|
-
const addListener = (listener) => {
|
|
33194
|
-
listeners.add(listener);
|
|
33195
|
-
if (listeners.size === 1) {
|
|
33196
|
-
propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
|
|
33197
|
-
if (( false ? 0 : void 0) !== "production" && prevRemove) {
|
|
33198
|
-
throw new Error("remove already exists");
|
|
33584
|
+
else {
|
|
33585
|
+
targetAndCopied = [target];
|
|
33586
|
+
}
|
|
33587
|
+
targetCache === null || targetCache === void 0 ? void 0 : targetCache.set(obj, targetAndCopied);
|
|
33588
|
+
}
|
|
33589
|
+
const [target, copiedTarget] = targetAndCopied;
|
|
33590
|
+
let handlerAndState = proxyCache && proxyCache.get(target);
|
|
33591
|
+
if (!handlerAndState ||
|
|
33592
|
+
handlerAndState[1][IS_TARGET_COPIED_PROPERTY] !== !!copiedTarget) {
|
|
33593
|
+
handlerAndState = createProxyHandler(target, !!copiedTarget);
|
|
33594
|
+
handlerAndState[1][PROXY_PROPERTY] = newProxy(copiedTarget || target, handlerAndState[0]);
|
|
33595
|
+
if (proxyCache) {
|
|
33596
|
+
proxyCache.set(target, handlerAndState);
|
|
33199
33597
|
}
|
|
33200
|
-
const remove = propProxyState[3](createPropListener(prop));
|
|
33201
|
-
propProxyStates.set(prop, [propProxyState, remove]);
|
|
33202
|
-
});
|
|
33203
33598
|
}
|
|
33204
|
-
|
|
33205
|
-
|
|
33206
|
-
|
|
33207
|
-
|
|
33208
|
-
|
|
33209
|
-
|
|
33210
|
-
|
|
33211
|
-
|
|
33212
|
-
|
|
33213
|
-
|
|
33214
|
-
|
|
33215
|
-
|
|
33216
|
-
|
|
33217
|
-
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33221
|
-
|
|
33222
|
-
|
|
33223
|
-
|
|
33224
|
-
|
|
33225
|
-
|
|
33226
|
-
|
|
33227
|
-
|
|
33228
|
-
|
|
33229
|
-
|
|
33230
|
-
|
|
33231
|
-
|
|
33599
|
+
handlerAndState[1][AFFECTED_PROPERTY] = affected;
|
|
33600
|
+
handlerAndState[1][PROXY_CACHE_PROPERTY] = proxyCache;
|
|
33601
|
+
handlerAndState[1][TARGET_CACHE_PROPERTY] = targetCache;
|
|
33602
|
+
return handlerAndState[1][PROXY_PROPERTY];
|
|
33603
|
+
};
|
|
33604
|
+
const isAllOwnKeysChanged = (prevObj, nextObj) => {
|
|
33605
|
+
const prevKeys = Reflect.ownKeys(prevObj);
|
|
33606
|
+
const nextKeys = Reflect.ownKeys(nextObj);
|
|
33607
|
+
return (prevKeys.length !== nextKeys.length ||
|
|
33608
|
+
prevKeys.some((k, i) => k !== nextKeys[i]));
|
|
33609
|
+
};
|
|
33610
|
+
/**
|
|
33611
|
+
* Compare changes on objects.
|
|
33612
|
+
*
|
|
33613
|
+
* This will compare the affected properties on tracked objects inside the proxy
|
|
33614
|
+
* to check if there were any changes made to it,
|
|
33615
|
+
* by default if no property was accessed on the proxy it will attempt to do a
|
|
33616
|
+
* reference equality check for the objects provided (Object.is(a, b)). If you access a property
|
|
33617
|
+
* on the proxy, then isChanged will only compare the affected properties.
|
|
33618
|
+
*
|
|
33619
|
+
* @param {object} prevObj - The previous object to compare.
|
|
33620
|
+
* @param {object} nextObj - Object to compare with the previous one.
|
|
33621
|
+
* @param {WeakMap<object, unknown>} affected -
|
|
33622
|
+
* WeakMap that holds the tracking of which properties in the proxied object were accessed.
|
|
33623
|
+
* @param {WeakMap<object, unknown>} [cache] -
|
|
33624
|
+
* WeakMap that holds a cache of the comparisons for better performance with repetitive comparisons,
|
|
33625
|
+
* and to avoid infinite loop with circular structures.
|
|
33626
|
+
* @returns {boolean} - Boolean indicating if the affected property on the object has changed.
|
|
33627
|
+
*
|
|
33628
|
+
* @example
|
|
33629
|
+
* import { createProxy, isChanged } from 'proxy-compare';
|
|
33630
|
+
*
|
|
33631
|
+
* const obj = { a: "1", c: "2", d: { e: "3" } };
|
|
33632
|
+
* const affected = new WeakMap();
|
|
33633
|
+
*
|
|
33634
|
+
* const proxy = createProxy(obj, affected);
|
|
33635
|
+
*
|
|
33636
|
+
* proxy.a
|
|
33637
|
+
*
|
|
33638
|
+
* isChanged(obj, { a: "1" }, affected) // false
|
|
33639
|
+
*
|
|
33640
|
+
* proxy.a = "2"
|
|
33641
|
+
*
|
|
33642
|
+
* isChanged(obj, { a: "1" }, affected) // true
|
|
33643
|
+
*/
|
|
33644
|
+
const isChanged = (prevObj, nextObj, affected, cache, isEqual = Object.is) => {
|
|
33645
|
+
if (isEqual(prevObj, nextObj)) {
|
|
33646
|
+
return false;
|
|
33647
|
+
}
|
|
33648
|
+
if (!isObject(prevObj) || !isObject(nextObj))
|
|
33232
33649
|
return true;
|
|
33233
|
-
|
|
33234
|
-
|
|
33235
|
-
|
|
33236
|
-
|
|
33237
|
-
|
|
33238
|
-
|
|
33239
|
-
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33245
|
-
value.status = "rejected";
|
|
33246
|
-
value.reason = e;
|
|
33247
|
-
notifyUpdate(["reject", [prop], e]);
|
|
33650
|
+
const used = affected.get(getOriginalObject(prevObj));
|
|
33651
|
+
if (!used)
|
|
33652
|
+
return true;
|
|
33653
|
+
if (cache) {
|
|
33654
|
+
const hit = cache.get(prevObj);
|
|
33655
|
+
if (hit && hit[NEXT_OBJECT_PROPERTY] === nextObj) {
|
|
33656
|
+
return hit[CHANGED_PROPERTY];
|
|
33657
|
+
}
|
|
33658
|
+
// for object with cycles
|
|
33659
|
+
cache.set(prevObj, {
|
|
33660
|
+
[NEXT_OBJECT_PROPERTY]: nextObj,
|
|
33661
|
+
[CHANGED_PROPERTY]: false,
|
|
33248
33662
|
});
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33663
|
+
}
|
|
33664
|
+
let changed = null;
|
|
33665
|
+
try {
|
|
33666
|
+
for (const key of used[HAS_KEY_PROPERTY] || []) {
|
|
33667
|
+
changed = Reflect.has(prevObj, key) !== Reflect.has(nextObj, key);
|
|
33668
|
+
if (changed)
|
|
33669
|
+
return changed;
|
|
33252
33670
|
}
|
|
33253
|
-
|
|
33254
|
-
|
|
33255
|
-
|
|
33671
|
+
if (used[ALL_OWN_KEYS_PROPERTY] === true) {
|
|
33672
|
+
changed = isAllOwnKeysChanged(prevObj, nextObj);
|
|
33673
|
+
if (changed)
|
|
33674
|
+
return changed;
|
|
33256
33675
|
}
|
|
33257
|
-
|
|
33258
|
-
|
|
33259
|
-
|
|
33260
|
-
|
|
33261
|
-
|
|
33262
|
-
|
|
33263
|
-
|
|
33264
|
-
|
|
33265
|
-
const proxyState = [
|
|
33266
|
-
baseObject,
|
|
33267
|
-
ensureVersion,
|
|
33268
|
-
createSnapshot,
|
|
33269
|
-
addListener
|
|
33270
|
-
];
|
|
33271
|
-
proxyStateMap.set(proxyObject, proxyState);
|
|
33272
|
-
Reflect.ownKeys(initialObject).forEach((key) => {
|
|
33273
|
-
const desc = Object.getOwnPropertyDescriptor(
|
|
33274
|
-
initialObject,
|
|
33275
|
-
key
|
|
33276
|
-
);
|
|
33277
|
-
if ("value" in desc) {
|
|
33278
|
-
proxyObject[key] = initialObject[key];
|
|
33279
|
-
delete desc.value;
|
|
33280
|
-
delete desc.writable;
|
|
33281
|
-
}
|
|
33282
|
-
Object.defineProperty(baseObject, key, desc);
|
|
33283
|
-
});
|
|
33284
|
-
return proxyObject;
|
|
33285
|
-
}) => [
|
|
33286
|
-
// public functions
|
|
33287
|
-
proxyFunction,
|
|
33288
|
-
// shared state
|
|
33289
|
-
proxyStateMap,
|
|
33290
|
-
refSet,
|
|
33291
|
-
// internal things
|
|
33292
|
-
objectIs,
|
|
33293
|
-
newProxy,
|
|
33294
|
-
canProxy,
|
|
33295
|
-
defaultHandlePromise,
|
|
33296
|
-
snapCache,
|
|
33297
|
-
createSnapshot,
|
|
33298
|
-
proxyCache,
|
|
33299
|
-
versionHolder
|
|
33300
|
-
];
|
|
33301
|
-
const [defaultProxyFunction] = buildProxyFunction();
|
|
33302
|
-
function proxy(initialObject = {}) {
|
|
33303
|
-
return defaultProxyFunction(initialObject);
|
|
33304
|
-
}
|
|
33305
|
-
function getVersion(proxyObject) {
|
|
33306
|
-
const proxyState = proxyStateMap.get(proxyObject);
|
|
33307
|
-
return proxyState == null ? void 0 : proxyState[1]();
|
|
33308
|
-
}
|
|
33309
|
-
function subscribe(proxyObject, callback, notifyInSync) {
|
|
33310
|
-
const proxyState = proxyStateMap.get(proxyObject);
|
|
33311
|
-
if (( false ? 0 : void 0) !== "production" && !proxyState) {
|
|
33312
|
-
console.warn("Please use proxy object");
|
|
33313
|
-
}
|
|
33314
|
-
let promise;
|
|
33315
|
-
const ops = [];
|
|
33316
|
-
const addListener = proxyState[3];
|
|
33317
|
-
let isListenerActive = false;
|
|
33318
|
-
const listener = (op) => {
|
|
33319
|
-
ops.push(op);
|
|
33320
|
-
if (notifyInSync) {
|
|
33321
|
-
callback(ops.splice(0));
|
|
33322
|
-
return;
|
|
33323
|
-
}
|
|
33324
|
-
if (!promise) {
|
|
33325
|
-
promise = Promise.resolve().then(() => {
|
|
33326
|
-
promise = void 0;
|
|
33327
|
-
if (isListenerActive) {
|
|
33328
|
-
callback(ops.splice(0));
|
|
33676
|
+
else {
|
|
33677
|
+
for (const key of used[HAS_OWN_KEY_PROPERTY] || []) {
|
|
33678
|
+
const hasPrev = !!Reflect.getOwnPropertyDescriptor(prevObj, key);
|
|
33679
|
+
const hasNext = !!Reflect.getOwnPropertyDescriptor(nextObj, key);
|
|
33680
|
+
changed = hasPrev !== hasNext;
|
|
33681
|
+
if (changed)
|
|
33682
|
+
return changed;
|
|
33683
|
+
}
|
|
33329
33684
|
}
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
isListenerActive = true;
|
|
33335
|
-
return () => {
|
|
33336
|
-
isListenerActive = false;
|
|
33337
|
-
removeListener();
|
|
33338
|
-
};
|
|
33339
|
-
}
|
|
33340
|
-
function snapshot(proxyObject, handlePromise) {
|
|
33341
|
-
const proxyState = proxyStateMap.get(proxyObject);
|
|
33342
|
-
if (( false ? 0 : void 0) !== "production" && !proxyState) {
|
|
33343
|
-
console.warn("Please use proxy object");
|
|
33344
|
-
}
|
|
33345
|
-
const [target, ensureVersion, createSnapshot] = proxyState;
|
|
33346
|
-
return createSnapshot(target, ensureVersion(), handlePromise);
|
|
33347
|
-
}
|
|
33348
|
-
function ref(obj) {
|
|
33349
|
-
refSet.add(obj);
|
|
33350
|
-
return obj;
|
|
33351
|
-
}
|
|
33352
|
-
const unstable_buildProxyFunction = buildProxyFunction;
|
|
33353
|
-
|
|
33354
|
-
|
|
33355
|
-
|
|
33356
|
-
|
|
33357
|
-
/***/ }),
|
|
33358
|
-
|
|
33359
|
-
/***/ "../../node_modules/valtio/esm/vanilla/utils.mjs":
|
|
33360
|
-
/*!*******************************************************!*\
|
|
33361
|
-
!*** ../../node_modules/valtio/esm/vanilla/utils.mjs ***!
|
|
33362
|
-
\*******************************************************/
|
|
33363
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
33364
|
-
|
|
33365
|
-
"use strict";
|
|
33366
|
-
__webpack_require__.r(__webpack_exports__);
|
|
33367
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33368
|
-
/* harmony export */ addComputed: () => (/* binding */ addComputed_DEPRECATED),
|
|
33369
|
-
/* harmony export */ derive: () => (/* reexport safe */ derive_valtio__WEBPACK_IMPORTED_MODULE_0__.derive),
|
|
33370
|
-
/* harmony export */ devtools: () => (/* binding */ devtools),
|
|
33371
|
-
/* harmony export */ proxyMap: () => (/* binding */ proxyMap),
|
|
33372
|
-
/* harmony export */ proxySet: () => (/* binding */ proxySet),
|
|
33373
|
-
/* harmony export */ proxyWithComputed: () => (/* binding */ proxyWithComputed_DEPRECATED),
|
|
33374
|
-
/* harmony export */ proxyWithHistory: () => (/* binding */ proxyWithHistory_DEPRECATED),
|
|
33375
|
-
/* harmony export */ subscribeKey: () => (/* binding */ subscribeKey),
|
|
33376
|
-
/* harmony export */ underive: () => (/* reexport safe */ derive_valtio__WEBPACK_IMPORTED_MODULE_0__.underive),
|
|
33377
|
-
/* harmony export */ unstable_deriveSubscriptions: () => (/* reexport safe */ derive_valtio__WEBPACK_IMPORTED_MODULE_0__.unstable_deriveSubscriptions),
|
|
33378
|
-
/* harmony export */ watch: () => (/* binding */ watch)
|
|
33379
|
-
/* harmony export */ });
|
|
33380
|
-
/* harmony import */ var valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! valtio/vanilla */ "../../node_modules/valtio/esm/vanilla.mjs");
|
|
33381
|
-
/* harmony import */ var derive_valtio__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! derive-valtio */ "../../node_modules/derive-valtio/dist/index.modern.js");
|
|
33382
|
-
|
|
33383
|
-
|
|
33384
|
-
|
|
33385
|
-
|
|
33386
|
-
function subscribeKey(proxyObject, key, callback, notifyInSync) {
|
|
33387
|
-
let prevValue = proxyObject[key];
|
|
33388
|
-
return (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.subscribe)(
|
|
33389
|
-
proxyObject,
|
|
33390
|
-
() => {
|
|
33391
|
-
const nextValue = proxyObject[key];
|
|
33392
|
-
if (!Object.is(prevValue, nextValue)) {
|
|
33393
|
-
callback(prevValue = nextValue);
|
|
33394
|
-
}
|
|
33395
|
-
},
|
|
33396
|
-
notifyInSync
|
|
33397
|
-
);
|
|
33398
|
-
}
|
|
33399
|
-
|
|
33400
|
-
let currentCleanups;
|
|
33401
|
-
function watch(callback, options) {
|
|
33402
|
-
let alive = true;
|
|
33403
|
-
const cleanups = /* @__PURE__ */ new Set();
|
|
33404
|
-
const subscriptions = /* @__PURE__ */ new Map();
|
|
33405
|
-
const cleanup = () => {
|
|
33406
|
-
if (alive) {
|
|
33407
|
-
alive = false;
|
|
33408
|
-
cleanups.forEach((clean) => clean());
|
|
33409
|
-
cleanups.clear();
|
|
33410
|
-
subscriptions.forEach((unsubscribe) => unsubscribe());
|
|
33411
|
-
subscriptions.clear();
|
|
33412
|
-
}
|
|
33413
|
-
};
|
|
33414
|
-
const revalidate = async () => {
|
|
33415
|
-
if (!alive) {
|
|
33416
|
-
return;
|
|
33417
|
-
}
|
|
33418
|
-
cleanups.forEach((clean) => clean());
|
|
33419
|
-
cleanups.clear();
|
|
33420
|
-
const proxiesToSubscribe = /* @__PURE__ */ new Set();
|
|
33421
|
-
const parent = currentCleanups;
|
|
33422
|
-
currentCleanups = cleanups;
|
|
33423
|
-
try {
|
|
33424
|
-
const promiseOrPossibleCleanup = callback((proxyObject) => {
|
|
33425
|
-
proxiesToSubscribe.add(proxyObject);
|
|
33426
|
-
if (alive && !subscriptions.has(proxyObject)) {
|
|
33427
|
-
const unsubscribe = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.subscribe)(proxyObject, revalidate, options == null ? void 0 : options.sync);
|
|
33428
|
-
subscriptions.set(proxyObject, unsubscribe);
|
|
33685
|
+
for (const key of used[KEYS_PROPERTY] || []) {
|
|
33686
|
+
changed = isChanged(prevObj[key], nextObj[key], affected, cache, isEqual);
|
|
33687
|
+
if (changed)
|
|
33688
|
+
return changed;
|
|
33429
33689
|
}
|
|
33430
|
-
|
|
33431
|
-
|
|
33432
|
-
|
|
33433
|
-
|
|
33434
|
-
|
|
33435
|
-
|
|
33436
|
-
|
|
33437
|
-
|
|
33690
|
+
if (changed === null)
|
|
33691
|
+
changed = true;
|
|
33692
|
+
return changed;
|
|
33693
|
+
}
|
|
33694
|
+
finally {
|
|
33695
|
+
if (cache) {
|
|
33696
|
+
cache.set(prevObj, {
|
|
33697
|
+
[NEXT_OBJECT_PROPERTY]: nextObj,
|
|
33698
|
+
[CHANGED_PROPERTY]: changed,
|
|
33699
|
+
});
|
|
33438
33700
|
}
|
|
33439
|
-
}
|
|
33440
|
-
} finally {
|
|
33441
|
-
currentCleanups = parent;
|
|
33442
33701
|
}
|
|
33443
|
-
|
|
33444
|
-
|
|
33445
|
-
|
|
33446
|
-
|
|
33447
|
-
|
|
33448
|
-
});
|
|
33449
|
-
};
|
|
33450
|
-
if (currentCleanups) {
|
|
33451
|
-
currentCleanups.add(cleanup);
|
|
33452
|
-
}
|
|
33453
|
-
revalidate();
|
|
33454
|
-
return cleanup;
|
|
33455
|
-
}
|
|
33456
|
-
|
|
33457
|
-
const DEVTOOLS = Symbol();
|
|
33458
|
-
function devtools(proxyObject, options) {
|
|
33459
|
-
if (typeof options === "string") {
|
|
33460
|
-
console.warn(
|
|
33461
|
-
"string name option is deprecated, use { name }. https://github.com/pmndrs/valtio/pull/400"
|
|
33462
|
-
);
|
|
33463
|
-
options = { name: options };
|
|
33464
|
-
}
|
|
33465
|
-
const { enabled, name = "", ...rest } = options || {};
|
|
33466
|
-
let extension;
|
|
33467
|
-
try {
|
|
33468
|
-
extension = (enabled != null ? enabled : ( false ? 0 : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
33469
|
-
} catch (e) {
|
|
33470
|
-
}
|
|
33471
|
-
if (!extension) {
|
|
33472
|
-
if (( false ? 0 : void 0) !== "production" && enabled) {
|
|
33473
|
-
console.warn("[Warning] Please install/enable Redux devtools extension");
|
|
33474
|
-
}
|
|
33475
|
-
return;
|
|
33476
|
-
}
|
|
33477
|
-
let isTimeTraveling = false;
|
|
33478
|
-
const devtools2 = extension.connect({ name, ...rest });
|
|
33479
|
-
const unsub1 = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.subscribe)(proxyObject, (ops) => {
|
|
33480
|
-
const action = ops.filter(([_, path]) => path[0] !== DEVTOOLS).map(([op, path]) => `${op}:${path.map(String).join(".")}`).join(", ");
|
|
33481
|
-
if (!action) {
|
|
33482
|
-
return;
|
|
33483
|
-
}
|
|
33484
|
-
if (isTimeTraveling) {
|
|
33485
|
-
isTimeTraveling = false;
|
|
33486
|
-
} else {
|
|
33487
|
-
const snapWithoutDevtools = Object.assign({}, (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.snapshot)(proxyObject));
|
|
33488
|
-
delete snapWithoutDevtools[DEVTOOLS];
|
|
33489
|
-
devtools2.send(
|
|
33490
|
-
{
|
|
33491
|
-
type: action,
|
|
33492
|
-
updatedAt: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
33493
|
-
},
|
|
33494
|
-
snapWithoutDevtools
|
|
33495
|
-
);
|
|
33702
|
+
};
|
|
33703
|
+
// explicitly track object with memo
|
|
33704
|
+
const trackMemo = (obj) => {
|
|
33705
|
+
if (isObjectToTrack(obj)) {
|
|
33706
|
+
return TRACK_MEMO_SYMBOL in obj;
|
|
33496
33707
|
}
|
|
33497
|
-
|
|
33498
|
-
|
|
33499
|
-
|
|
33500
|
-
|
|
33501
|
-
|
|
33502
|
-
|
|
33503
|
-
|
|
33504
|
-
|
|
33505
|
-
|
|
33506
|
-
|
|
33507
|
-
|
|
33508
|
-
|
|
33708
|
+
return false;
|
|
33709
|
+
};
|
|
33710
|
+
/**
|
|
33711
|
+
* Unwrap proxy to get the original object.
|
|
33712
|
+
*
|
|
33713
|
+
* Used to retrieve the original object used to create the proxy instance with `createProxy`.
|
|
33714
|
+
*
|
|
33715
|
+
* @param {Proxy<object>} obj - The proxy wrapper of the originial object.
|
|
33716
|
+
* @returns {object | null} - Return either the unwrapped object if exists.
|
|
33717
|
+
*
|
|
33718
|
+
* @example
|
|
33719
|
+
* import { createProxy, getUntracked } from 'proxy-compare';
|
|
33720
|
+
*
|
|
33721
|
+
* const original = { a: "1", c: "2", d: { e: "3" } };
|
|
33722
|
+
* const affected = new WeakMap();
|
|
33723
|
+
*
|
|
33724
|
+
* const proxy = createProxy(original, affected);
|
|
33725
|
+
* const originalFromProxy = getUntracked(proxy)
|
|
33726
|
+
*
|
|
33727
|
+
* Object.is(original, originalFromProxy) // true
|
|
33728
|
+
* isChanged(original, originalFromProxy, affected) // false
|
|
33729
|
+
*/
|
|
33730
|
+
const getUntracked = (obj) => {
|
|
33731
|
+
if (isObjectToTrack(obj)) {
|
|
33732
|
+
return obj[GET_ORIGINAL_SYMBOL] || null;
|
|
33509
33733
|
}
|
|
33510
|
-
|
|
33511
|
-
|
|
33512
|
-
|
|
33513
|
-
|
|
33514
|
-
|
|
33515
|
-
|
|
33516
|
-
|
|
33517
|
-
|
|
33518
|
-
|
|
33519
|
-
|
|
33520
|
-
|
|
33521
|
-
|
|
33522
|
-
|
|
33523
|
-
|
|
33524
|
-
|
|
33525
|
-
|
|
33526
|
-
|
|
33527
|
-
|
|
33528
|
-
|
|
33529
|
-
|
|
33734
|
+
return null;
|
|
33735
|
+
};
|
|
33736
|
+
/**
|
|
33737
|
+
* Mark object to be tracked.
|
|
33738
|
+
*
|
|
33739
|
+
* This function marks an object that will be passed into `createProxy`
|
|
33740
|
+
* as marked to track or not. By default only Array and Object are marked to track,
|
|
33741
|
+
* so this is useful for example to mark a class instance to track or to mark a object
|
|
33742
|
+
* to be untracked when creating your proxy.
|
|
33743
|
+
*
|
|
33744
|
+
* @param obj - Object to mark as tracked or not.
|
|
33745
|
+
* @param mark - Boolean indicating whether you want to track this object or not.
|
|
33746
|
+
* @returns - No return.
|
|
33747
|
+
*
|
|
33748
|
+
* @example
|
|
33749
|
+
* import { createProxy, markToTrack, isChanged } from 'proxy-compare';
|
|
33750
|
+
*
|
|
33751
|
+
* const nested = { e: "3" }
|
|
33752
|
+
*
|
|
33753
|
+
* markToTrack(nested, false)
|
|
33754
|
+
*
|
|
33755
|
+
* const original = { a: "1", c: "2", d: nested };
|
|
33756
|
+
* const affected = new WeakMap();
|
|
33757
|
+
*
|
|
33758
|
+
* const proxy = createProxy(original, affected);
|
|
33759
|
+
*
|
|
33760
|
+
* proxy.d.e
|
|
33761
|
+
*
|
|
33762
|
+
* isChanged(original, { d: { e: "3" } }, affected) // true
|
|
33763
|
+
*/
|
|
33764
|
+
const markToTrack = (obj, mark = true) => {
|
|
33765
|
+
objectsToTrack.set(obj, mark);
|
|
33766
|
+
};
|
|
33767
|
+
/**
|
|
33768
|
+
* Convert `affected` to path list
|
|
33769
|
+
*
|
|
33770
|
+
* `affected` is a weak map which is not printable.
|
|
33771
|
+
* This function is can convert it to printable path list.
|
|
33772
|
+
* It's for debugging purpose.
|
|
33773
|
+
*
|
|
33774
|
+
* @param obj - An object that is used with `createProxy`.
|
|
33775
|
+
* @param affected - A weak map that is used with `createProxy`.
|
|
33776
|
+
* @param onlyWithValues - An optional boolean to exclude object getters.
|
|
33777
|
+
* @returns - An array of paths.
|
|
33778
|
+
*/
|
|
33779
|
+
const affectedToPathList = (obj, affected, onlyWithValues) => {
|
|
33780
|
+
const list = [];
|
|
33781
|
+
const seen = new WeakSet();
|
|
33782
|
+
const walk = (x, path) => {
|
|
33783
|
+
var _a, _b, _c;
|
|
33784
|
+
if (seen.has(x)) {
|
|
33785
|
+
// for object with cycles
|
|
33786
|
+
return;
|
|
33530
33787
|
}
|
|
33531
|
-
|
|
33532
|
-
|
|
33533
|
-
|
|
33534
|
-
|
|
33535
|
-
|
|
33536
|
-
|
|
33537
|
-
|
|
33538
|
-
|
|
33539
|
-
}
|
|
33540
|
-
|
|
33541
|
-
|
|
33542
|
-
|
|
33543
|
-
|
|
33544
|
-
|
|
33545
|
-
|
|
33546
|
-
|
|
33547
|
-
|
|
33548
|
-
|
|
33549
|
-
|
|
33550
|
-
|
|
33551
|
-
|
|
33552
|
-
}
|
|
33553
|
-
|
|
33554
|
-
|
|
33555
|
-
|
|
33556
|
-
|
|
33557
|
-
|
|
33558
|
-
|
|
33559
|
-
|
|
33560
|
-
|
|
33561
|
-
|
|
33562
|
-
|
|
33563
|
-
|
|
33564
|
-
|
|
33565
|
-
|
|
33566
|
-
|
|
33567
|
-
|
|
33568
|
-
|
|
33569
|
-
|
|
33570
|
-
|
|
33571
|
-
|
|
33572
|
-
|
|
33573
|
-
const proxyObject = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.proxy)(initialObject);
|
|
33574
|
-
return proxyObject;
|
|
33575
|
-
}
|
|
33576
|
-
|
|
33577
|
-
const isObject = (x) => typeof x === "object" && x !== null;
|
|
33578
|
-
let refSet;
|
|
33579
|
-
const deepClone = (obj) => {
|
|
33580
|
-
if (!refSet) {
|
|
33581
|
-
refSet = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.unstable_buildProxyFunction)()[2];
|
|
33582
|
-
}
|
|
33583
|
-
if (!isObject(obj) || refSet.has(obj)) {
|
|
33584
|
-
return obj;
|
|
33585
|
-
}
|
|
33586
|
-
const baseObject = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj));
|
|
33587
|
-
Reflect.ownKeys(obj).forEach((key) => {
|
|
33588
|
-
baseObject[key] = deepClone(obj[key]);
|
|
33589
|
-
});
|
|
33590
|
-
return baseObject;
|
|
33788
|
+
if (isObject(x)) {
|
|
33789
|
+
seen.add(x);
|
|
33790
|
+
}
|
|
33791
|
+
const used = isObject(x) && affected.get(getOriginalObject(x));
|
|
33792
|
+
if (used) {
|
|
33793
|
+
(_a = used[HAS_KEY_PROPERTY]) === null || _a === void 0 ? void 0 : _a.forEach((key) => {
|
|
33794
|
+
const segment = `:has(${String(key)})`;
|
|
33795
|
+
list.push(path ? [...path, segment] : [segment]);
|
|
33796
|
+
});
|
|
33797
|
+
if (used[ALL_OWN_KEYS_PROPERTY] === true) {
|
|
33798
|
+
const segment = ':ownKeys';
|
|
33799
|
+
list.push(path ? [...path, segment] : [segment]);
|
|
33800
|
+
}
|
|
33801
|
+
else {
|
|
33802
|
+
(_b = used[HAS_OWN_KEY_PROPERTY]) === null || _b === void 0 ? void 0 : _b.forEach((key) => {
|
|
33803
|
+
const segment = `:hasOwn(${String(key)})`;
|
|
33804
|
+
list.push(path ? [...path, segment] : [segment]);
|
|
33805
|
+
});
|
|
33806
|
+
}
|
|
33807
|
+
(_c = used[KEYS_PROPERTY]) === null || _c === void 0 ? void 0 : _c.forEach((key) => {
|
|
33808
|
+
if (!onlyWithValues ||
|
|
33809
|
+
'value' in (Object.getOwnPropertyDescriptor(x, key) || {})) {
|
|
33810
|
+
walk(x[key], path ? [...path, key] : [key]);
|
|
33811
|
+
}
|
|
33812
|
+
});
|
|
33813
|
+
}
|
|
33814
|
+
else if (path) {
|
|
33815
|
+
list.push(path);
|
|
33816
|
+
}
|
|
33817
|
+
};
|
|
33818
|
+
walk(obj);
|
|
33819
|
+
return list;
|
|
33820
|
+
};
|
|
33821
|
+
/**
|
|
33822
|
+
* replace newProxy function.
|
|
33823
|
+
*
|
|
33824
|
+
* This can be used if you want to use proxy-polyfill.
|
|
33825
|
+
* Note that proxy-polyfill can't polyfill everything.
|
|
33826
|
+
* Use it at your own risk.
|
|
33827
|
+
*/
|
|
33828
|
+
const replaceNewProxy = (fn) => {
|
|
33829
|
+
newProxy = fn;
|
|
33591
33830
|
};
|
|
33592
|
-
function proxyWithHistory_DEPRECATED(initialValue, skipSubscribe = false) {
|
|
33593
|
-
if (( false ? 0 : void 0) !== "production") {
|
|
33594
|
-
console.warn(
|
|
33595
|
-
'proxyWithHistory is deprecated. Please use the "valtio-history" package; refer to the docs'
|
|
33596
|
-
);
|
|
33597
|
-
}
|
|
33598
|
-
const proxyObject = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.proxy)({
|
|
33599
|
-
value: initialValue,
|
|
33600
|
-
history: (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.ref)({
|
|
33601
|
-
wip: void 0,
|
|
33602
|
-
// to avoid infinite loop
|
|
33603
|
-
snapshots: [],
|
|
33604
|
-
index: -1
|
|
33605
|
-
}),
|
|
33606
|
-
clone: deepClone,
|
|
33607
|
-
canUndo: () => proxyObject.history.index > 0,
|
|
33608
|
-
undo: () => {
|
|
33609
|
-
if (proxyObject.canUndo()) {
|
|
33610
|
-
proxyObject.value = proxyObject.history.wip = proxyObject.clone(
|
|
33611
|
-
proxyObject.history.snapshots[--proxyObject.history.index]
|
|
33612
|
-
);
|
|
33613
|
-
}
|
|
33614
|
-
},
|
|
33615
|
-
canRedo: () => proxyObject.history.index < proxyObject.history.snapshots.length - 1,
|
|
33616
|
-
redo: () => {
|
|
33617
|
-
if (proxyObject.canRedo()) {
|
|
33618
|
-
proxyObject.value = proxyObject.history.wip = proxyObject.clone(
|
|
33619
|
-
proxyObject.history.snapshots[++proxyObject.history.index]
|
|
33620
|
-
);
|
|
33621
|
-
}
|
|
33622
|
-
},
|
|
33623
|
-
saveHistory: () => {
|
|
33624
|
-
proxyObject.history.snapshots.splice(proxyObject.history.index + 1);
|
|
33625
|
-
proxyObject.history.snapshots.push((0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.snapshot)(proxyObject).value);
|
|
33626
|
-
++proxyObject.history.index;
|
|
33627
|
-
},
|
|
33628
|
-
subscribe: () => (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.subscribe)(proxyObject, (ops) => {
|
|
33629
|
-
if (ops.every(
|
|
33630
|
-
(op) => op[1][0] === "value" && (op[0] !== "set" || op[2] !== proxyObject.history.wip)
|
|
33631
|
-
)) {
|
|
33632
|
-
proxyObject.saveHistory();
|
|
33633
|
-
}
|
|
33634
|
-
})
|
|
33635
|
-
});
|
|
33636
|
-
proxyObject.saveHistory();
|
|
33637
|
-
if (!skipSubscribe) {
|
|
33638
|
-
proxyObject.subscribe();
|
|
33639
|
-
}
|
|
33640
|
-
return proxyObject;
|
|
33641
|
-
}
|
|
33642
|
-
|
|
33643
|
-
function proxySet(initialValues) {
|
|
33644
|
-
const set = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.proxy)({
|
|
33645
|
-
data: Array.from(new Set(initialValues)),
|
|
33646
|
-
has(value) {
|
|
33647
|
-
return this.data.indexOf(value) !== -1;
|
|
33648
|
-
},
|
|
33649
|
-
add(value) {
|
|
33650
|
-
let hasProxy = false;
|
|
33651
|
-
if (typeof value === "object" && value !== null) {
|
|
33652
|
-
hasProxy = this.data.indexOf((0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.proxy)(value)) !== -1;
|
|
33653
|
-
}
|
|
33654
|
-
if (this.data.indexOf(value) === -1 && !hasProxy) {
|
|
33655
|
-
this.data.push(value);
|
|
33656
|
-
}
|
|
33657
|
-
return this;
|
|
33658
|
-
},
|
|
33659
|
-
delete(value) {
|
|
33660
|
-
const index = this.data.indexOf(value);
|
|
33661
|
-
if (index === -1) {
|
|
33662
|
-
return false;
|
|
33663
|
-
}
|
|
33664
|
-
this.data.splice(index, 1);
|
|
33665
|
-
return true;
|
|
33666
|
-
},
|
|
33667
|
-
clear() {
|
|
33668
|
-
this.data.splice(0);
|
|
33669
|
-
},
|
|
33670
|
-
get size() {
|
|
33671
|
-
return this.data.length;
|
|
33672
|
-
},
|
|
33673
|
-
forEach(cb) {
|
|
33674
|
-
this.data.forEach((value) => {
|
|
33675
|
-
cb(value, value, this);
|
|
33676
|
-
});
|
|
33677
|
-
},
|
|
33678
|
-
get [Symbol.toStringTag]() {
|
|
33679
|
-
return "Set";
|
|
33680
|
-
},
|
|
33681
|
-
toJSON() {
|
|
33682
|
-
return new Set(this.data);
|
|
33683
|
-
},
|
|
33684
|
-
[Symbol.iterator]() {
|
|
33685
|
-
return this.data[Symbol.iterator]();
|
|
33686
|
-
},
|
|
33687
|
-
values() {
|
|
33688
|
-
return this.data.values();
|
|
33689
|
-
},
|
|
33690
|
-
keys() {
|
|
33691
|
-
return this.data.values();
|
|
33692
|
-
},
|
|
33693
|
-
entries() {
|
|
33694
|
-
return new Set(this.data).entries();
|
|
33695
|
-
}
|
|
33696
|
-
});
|
|
33697
|
-
Object.defineProperties(set, {
|
|
33698
|
-
data: {
|
|
33699
|
-
enumerable: false
|
|
33700
|
-
},
|
|
33701
|
-
size: {
|
|
33702
|
-
enumerable: false
|
|
33703
|
-
},
|
|
33704
|
-
toJSON: {
|
|
33705
|
-
enumerable: false
|
|
33706
|
-
}
|
|
33707
|
-
});
|
|
33708
|
-
Object.seal(set);
|
|
33709
|
-
return set;
|
|
33710
|
-
}
|
|
33711
|
-
|
|
33712
|
-
function proxyMap(entries) {
|
|
33713
|
-
const map = (0,valtio_vanilla__WEBPACK_IMPORTED_MODULE_1__.proxy)({
|
|
33714
|
-
data: Array.from(entries || []),
|
|
33715
|
-
has(key) {
|
|
33716
|
-
return this.data.some((p) => p[0] === key);
|
|
33717
|
-
},
|
|
33718
|
-
set(key, value) {
|
|
33719
|
-
const record = this.data.find((p) => p[0] === key);
|
|
33720
|
-
if (record) {
|
|
33721
|
-
record[1] = value;
|
|
33722
|
-
} else {
|
|
33723
|
-
this.data.push([key, value]);
|
|
33724
|
-
}
|
|
33725
|
-
return this;
|
|
33726
|
-
},
|
|
33727
|
-
get(key) {
|
|
33728
|
-
var _a;
|
|
33729
|
-
return (_a = this.data.find((p) => p[0] === key)) == null ? void 0 : _a[1];
|
|
33730
|
-
},
|
|
33731
|
-
delete(key) {
|
|
33732
|
-
const index = this.data.findIndex((p) => p[0] === key);
|
|
33733
|
-
if (index === -1) {
|
|
33734
|
-
return false;
|
|
33735
|
-
}
|
|
33736
|
-
this.data.splice(index, 1);
|
|
33737
|
-
return true;
|
|
33738
|
-
},
|
|
33739
|
-
clear() {
|
|
33740
|
-
this.data.splice(0);
|
|
33741
|
-
},
|
|
33742
|
-
get size() {
|
|
33743
|
-
return this.data.length;
|
|
33744
|
-
},
|
|
33745
|
-
toJSON() {
|
|
33746
|
-
return new Map(this.data);
|
|
33747
|
-
},
|
|
33748
|
-
forEach(cb) {
|
|
33749
|
-
this.data.forEach((p) => {
|
|
33750
|
-
cb(p[1], p[0], this);
|
|
33751
|
-
});
|
|
33752
|
-
},
|
|
33753
|
-
keys() {
|
|
33754
|
-
return this.data.map((p) => p[0]).values();
|
|
33755
|
-
},
|
|
33756
|
-
values() {
|
|
33757
|
-
return this.data.map((p) => p[1]).values();
|
|
33758
|
-
},
|
|
33759
|
-
entries() {
|
|
33760
|
-
return new Map(this.data).entries();
|
|
33761
|
-
},
|
|
33762
|
-
get [Symbol.toStringTag]() {
|
|
33763
|
-
return "Map";
|
|
33764
|
-
},
|
|
33765
|
-
[Symbol.iterator]() {
|
|
33766
|
-
return this.entries();
|
|
33767
|
-
}
|
|
33768
|
-
});
|
|
33769
|
-
Object.defineProperties(map, {
|
|
33770
|
-
data: {
|
|
33771
|
-
enumerable: false
|
|
33772
|
-
},
|
|
33773
|
-
size: {
|
|
33774
|
-
enumerable: false
|
|
33775
|
-
},
|
|
33776
|
-
toJSON: {
|
|
33777
|
-
enumerable: false
|
|
33778
|
-
}
|
|
33779
|
-
});
|
|
33780
|
-
Object.seal(map);
|
|
33781
|
-
return map;
|
|
33782
|
-
}
|
|
33783
|
-
|
|
33784
|
-
|
|
33785
33831
|
|
|
33786
33832
|
|
|
33787
33833
|
/***/ })
|