@frontegg/redux-store 6.69.0 → 6.70.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/audits/AuditLogsState/index.js +1 -1
- package/audits/AuditLogsState/saga.js +1 -18
- package/audits/AuditsMetadataState/index.js +1 -1
- package/audits/AuditsMetadataState/saga.js +1 -5
- package/audits/backward-compatibility/saga.js +0 -18
- package/audits/dummy.js +0 -16
- package/audits/index.js +4 -2
- package/audits/reducer.js +0 -2
- package/auth/AcceptInvitationState/index.d.ts +2 -0
- package/auth/AcceptInvitationState/index.js +1 -1
- package/auth/AcceptInvitationState/interfaces.js +0 -1
- package/auth/AcceptInvitationState/saga.js +0 -3
- package/auth/AccountSettingsState/index.d.ts +2 -0
- package/auth/AccountSettingsState/index.js +1 -1
- package/auth/AccountSettingsState/interfaces.d.ts +2 -0
- package/auth/AccountSettingsState/saga.js +1 -11
- package/auth/ActivateState/index.d.ts +3 -0
- package/auth/ActivateState/index.js +1 -1
- package/auth/ActivateState/interfaces.js +0 -1
- package/auth/ActivateState/saga.js +14 -34
- package/auth/ApiTokensState/index.d.ts +2 -0
- package/auth/ApiTokensState/index.js +1 -1
- package/auth/ApiTokensState/interfaces.d.ts +1 -0
- package/auth/ApiTokensState/interfaces.js +0 -1
- package/auth/ApiTokensState/saga.js +1 -44
- package/auth/ForgotPasswordState/index.d.ts +2 -0
- package/auth/ForgotPasswordState/index.js +1 -1
- package/auth/ForgotPasswordState/interfaces.js +0 -1
- package/auth/ForgotPasswordState/saga.js +5 -12
- package/auth/ImpersonationState/index.d.ts +2 -0
- package/auth/ImpersonationState/index.js +1 -1
- package/auth/ImpersonationState/interfaces.js +0 -1
- package/auth/ImpersonationState/saga.js +5 -9
- package/auth/LoginState/index.d.ts +2 -0
- package/auth/LoginState/index.js +1 -1
- package/auth/LoginState/interfaces.js +0 -6
- package/auth/LoginState/saga.d.ts +2 -38
- package/auth/LoginState/saga.js +132 -292
- package/auth/MfaState/index.d.ts +4 -2
- package/auth/MfaState/index.js +1 -1
- package/auth/MfaState/interfaces.d.ts +2 -2
- package/auth/MfaState/interfaces.js +0 -1
- package/auth/MfaState/saga.js +64 -143
- package/auth/ProfileState/index.d.ts +2 -0
- package/auth/ProfileState/index.js +1 -1
- package/auth/ProfileState/saga.js +22 -50
- package/auth/Provisioning/index.d.ts +2 -0
- package/auth/Provisioning/index.js +1 -1
- package/auth/Provisioning/saga.js +11 -23
- package/auth/ResetPhoneNumberState/index.d.ts +2 -0
- package/auth/ResetPhoneNumberState/index.js +1 -1
- package/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/auth/ResetPhoneNumberState/saga.js +17 -26
- package/auth/RestrictionsState/index.d.ts +3 -0
- package/auth/RestrictionsState/index.js +1 -1
- package/auth/RestrictionsState/saga.js +52 -105
- package/auth/RolesState/index.d.ts +2 -0
- package/auth/RolesState/index.js +1 -1
- package/auth/RolesState/saga.js +30 -51
- package/auth/SSOState/index.d.ts +2 -0
- package/auth/SSOState/index.js +1 -1
- package/auth/SSOState/interfaces.js +0 -3
- package/auth/SSOState/saga.js +10 -58
- package/auth/SSOState/saga.v2.js +13 -49
- package/auth/SecurityPolicyState/index.d.ts +13 -0
- package/auth/SecurityPolicyState/index.js +1 -1
- package/auth/SecurityPolicyState/saga.js +36 -90
- package/auth/SessionsPolicyState/index.d.ts +2 -0
- package/auth/SessionsPolicyState/index.js +1 -1
- package/auth/SessionsPolicyState/saga.js +7 -19
- package/auth/SessionsState/index.d.ts +2 -0
- package/auth/SessionsState/index.js +1 -1
- package/auth/SessionsState/saga.js +1 -15
- package/auth/SignUp/index.d.ts +2 -0
- package/auth/SignUp/index.js +1 -1
- package/auth/SignUp/interfaces.js +0 -1
- package/auth/SignUp/saga.js +6 -15
- package/auth/SocialLogins/index.d.ts +2 -0
- package/auth/SocialLogins/index.js +1 -1
- package/auth/SocialLogins/saga.js +10 -20
- package/auth/TeamState/index.d.ts +2 -0
- package/auth/TeamState/index.js +1 -1
- package/auth/TeamState/interfaces.js +0 -1
- package/auth/TeamState/saga.js +85 -205
- package/auth/TenantsState/index.d.ts +2 -0
- package/auth/TenantsState/index.js +1 -1
- package/auth/TenantsState/saga.js +1 -17
- package/auth/index.d.ts +2 -2
- package/auth/index.js +4 -3
- package/auth/interfaces.d.ts +2 -1
- package/auth/interfaces.js +0 -6
- package/auth/reducer.d.ts +2 -2
- package/auth/reducer.js +0 -2
- package/auth/saga.js +2 -1
- package/auth/utils.d.ts +4 -0
- package/auth/utils.js +7 -21
- package/connectivity/ConnectivityState/index.d.ts +9 -0
- package/connectivity/ConnectivityState/index.js +1 -1
- package/connectivity/consts.js +0 -5
- package/connectivity/index.js +4 -2
- package/connectivity/interfaces.d.ts +1 -0
- package/connectivity/reducer.js +0 -2
- package/connectivity/saga.js +48 -85
- package/helpers.js +4 -7
- package/index.js +1 -1
- package/node/audits/AuditLogsState/index.js +1 -8
- package/node/audits/AuditLogsState/saga.js +1 -26
- package/node/audits/AuditsMetadataState/index.js +1 -8
- package/node/audits/AuditsMetadataState/saga.js +1 -10
- package/node/audits/backward-compatibility/index.js +0 -8
- package/node/audits/backward-compatibility/reducer.js +0 -5
- package/node/audits/backward-compatibility/saga.js +0 -23
- package/node/audits/dummy.js +0 -19
- package/node/audits/index.js +0 -14
- package/node/audits/initialState.js +0 -3
- package/node/audits/reducer.js +0 -8
- package/node/audits/saga.js +0 -5
- package/node/audits/utils.js +0 -4
- package/node/auth/AcceptInvitationState/index.js +1 -7
- package/node/auth/AcceptInvitationState/interfaces.js +0 -1
- package/node/auth/AcceptInvitationState/saga.js +0 -7
- package/node/auth/AccountSettingsState/index.js +1 -6
- package/node/auth/AccountSettingsState/saga.js +1 -16
- package/node/auth/ActivateState/index.js +1 -7
- package/node/auth/ActivateState/interfaces.js +0 -1
- package/node/auth/ActivateState/saga.js +14 -41
- package/node/auth/ApiTokensState/index.js +1 -6
- package/node/auth/ApiTokensState/interfaces.js +0 -1
- package/node/auth/ApiTokensState/saga.js +1 -51
- package/node/auth/ForgotPasswordState/index.js +1 -7
- package/node/auth/ForgotPasswordState/interfaces.js +0 -1
- package/node/auth/ForgotPasswordState/saga.js +5 -19
- package/node/auth/ImpersonationState/index.js +1 -7
- package/node/auth/ImpersonationState/interfaces.js +0 -1
- package/node/auth/ImpersonationState/saga.js +5 -15
- package/node/auth/LoginState/index.js +1 -7
- package/node/auth/LoginState/interfaces.js +0 -7
- package/node/auth/LoginState/saga.js +132 -322
- package/node/auth/MfaState/index.js +1 -7
- package/node/auth/MfaState/interfaces.js +0 -1
- package/node/auth/MfaState/saga.js +64 -137
- package/node/auth/ProfileState/index.js +1 -6
- package/node/auth/ProfileState/saga.js +22 -58
- package/node/auth/Provisioning/index.js +1 -6
- package/node/auth/Provisioning/saga.js +11 -28
- package/node/auth/ResetPhoneNumberState/index.js +1 -7
- package/node/auth/ResetPhoneNumberState/interfaces.js +0 -1
- package/node/auth/ResetPhoneNumberState/saga.js +17 -32
- package/node/auth/RestrictionsState/index.js +1 -7
- package/node/auth/RestrictionsState/saga.js +52 -109
- package/node/auth/RolesState/index.js +1 -6
- package/node/auth/RolesState/saga.js +30 -54
- package/node/auth/SSOState/index.js +1 -6
- package/node/auth/SSOState/interfaces.js +0 -3
- package/node/auth/SSOState/saga.js +10 -63
- package/node/auth/SSOState/saga.v2.js +13 -53
- package/node/auth/SecurityPolicyState/index.js +1 -6
- package/node/auth/SecurityPolicyState/saga.js +36 -89
- package/node/auth/SessionsPolicyState/index.js +1 -6
- package/node/auth/SessionsPolicyState/saga.js +7 -24
- package/node/auth/SessionsState/index.js +1 -6
- package/node/auth/SessionsState/saga.js +1 -22
- package/node/auth/SignUp/index.js +1 -7
- package/node/auth/SignUp/interfaces.js +0 -1
- package/node/auth/SignUp/saga.js +6 -30
- package/node/auth/SocialLogins/index.js +1 -6
- package/node/auth/SocialLogins/saga.js +10 -33
- package/node/auth/TeamState/index.js +1 -6
- package/node/auth/TeamState/interfaces.js +0 -1
- package/node/auth/TeamState/saga.js +86 -190
- package/node/auth/TenantsState/index.js +1 -6
- package/node/auth/TenantsState/saga.js +1 -24
- package/node/auth/dummy.js +0 -5
- package/node/auth/index.js +0 -90
- package/node/auth/initialState.js +0 -23
- package/node/auth/interfaces.js +0 -6
- package/node/auth/reducer.js +0 -28
- package/node/auth/saga.js +2 -26
- package/node/auth/utils.js +7 -42
- package/node/connectivity/ConnectivityState/index.js +1 -7
- package/node/connectivity/consts.js +1 -7
- package/node/connectivity/index.js +0 -5
- package/node/connectivity/reducer.js +0 -6
- package/node/connectivity/saga.js +47 -91
- package/node/helpers.js +2 -14
- package/node/index.js +1 -17
- package/node/subscriptions/Billing/Information/index.js +0 -7
- package/node/subscriptions/Billing/Information/saga.js +1 -25
- package/node/subscriptions/Billing/Invoices/index.js +0 -6
- package/node/subscriptions/Billing/Invoices/saga.js +1 -13
- package/node/subscriptions/Billing/PaymentMethod/index.js +2 -8
- package/node/subscriptions/Billing/PaymentMethod/interfaces.js +0 -1
- package/node/subscriptions/Billing/PaymentMethod/saga.js +1 -17
- package/node/subscriptions/Billing/Subscription/index.js +0 -6
- package/node/subscriptions/Billing/Subscription/saga.js +3 -23
- package/node/subscriptions/Billing/index.js +0 -6
- package/node/subscriptions/Billing/interfaces.js +0 -8
- package/node/subscriptions/Billing/saga.js +0 -7
- package/node/subscriptions/Checkout/index.js +0 -6
- package/node/subscriptions/Checkout/saga.js +2 -22
- package/node/subscriptions/Config/index.js +0 -6
- package/node/subscriptions/Config/saga.js +1 -12
- package/node/subscriptions/Plans/index.js +0 -6
- package/node/subscriptions/Plans/saga.js +1 -13
- package/node/subscriptions/Stripe/index.js +0 -6
- package/node/subscriptions/Stripe/saga.js +0 -8
- package/node/subscriptions/VendorPublicConfig/index.js +0 -6
- package/node/subscriptions/VendorPublicConfig/saga.js +1 -9
- package/node/subscriptions/dummy.js +2 -4
- package/node/subscriptions/general.interfaces.js +0 -5
- package/node/subscriptions/index.js +0 -5
- package/node/subscriptions/interfaces.js +0 -14
- package/node/subscriptions/mapper.js +0 -11
- package/node/subscriptions/reducer.js +0 -9
- package/node/subscriptions/saga.js +0 -9
- package/node/subscriptions/utils.js +0 -6
- package/node/toolkit/index.js +0 -31
- package/node/toolkit/redux-saga.js +0 -3
- package/node/toolkit/redux.js +0 -1
- package/node/vendor/VendorState/index.js +1 -7
- package/node/vendor/index.js +0 -5
- package/node/vendor/reducer.js +0 -6
- package/node/vendor/saga.js +1 -9
- package/package.json +1 -1
- package/subscriptions/Billing/Information/index.js +0 -4
- package/subscriptions/Billing/Information/saga.js +1 -12
- package/subscriptions/Billing/Invoices/index.js +0 -4
- package/subscriptions/Billing/Invoices/saga.js +1 -5
- package/subscriptions/Billing/PaymentMethod/index.js +2 -6
- package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -1
- package/subscriptions/Billing/PaymentMethod/saga.js +1 -9
- package/subscriptions/Billing/Subscription/index.js +0 -4
- package/subscriptions/Billing/Subscription/saga.js +3 -17
- package/subscriptions/Billing/interfaces.js +1 -0
- package/subscriptions/Checkout/index.js +0 -4
- package/subscriptions/Checkout/saga.js +2 -12
- package/subscriptions/Config/index.js +0 -4
- package/subscriptions/Config/saga.js +1 -7
- package/subscriptions/Plans/index.js +0 -2
- package/subscriptions/Plans/saga.js +1 -6
- package/subscriptions/Stripe/index.js +0 -4
- package/subscriptions/Stripe/saga.js +0 -4
- package/subscriptions/VendorPublicConfig/index.js +0 -2
- package/subscriptions/VendorPublicConfig/saga.js +1 -4
- package/subscriptions/dummy.js +3 -2
- package/subscriptions/general.interfaces.js +0 -5
- package/subscriptions/index.js +3 -1
- package/subscriptions/mapper.js +0 -5
- package/toolkit/index.d.ts +1 -1
- package/toolkit/index.js +0 -9
- package/vendor/VendorState/index.js +1 -0
- package/vendor/index.js +4 -2
- package/vendor/reducer.js +0 -2
- package/vendor/saga.js +1 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -53,7 +52,5 @@ Object.defineProperty(exports, "takeLatest", {
|
|
|
53
52
|
return _effects.takeLatest;
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
|
-
|
|
57
55
|
var _reduxSaga = _interopRequireDefault(require("redux-saga"));
|
|
58
|
-
|
|
59
56
|
var _effects = require("redux-saga/effects");
|
package/node/toolkit/redux.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.vendorReducers = exports.vendorActions = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _toolkit = require("@reduxjs/toolkit");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../constants");
|
|
15
|
-
|
|
16
11
|
const reducers = {
|
|
17
12
|
setVendorState: (state, {
|
|
18
13
|
payload
|
|
@@ -22,13 +17,12 @@ exports.vendorReducers = reducers;
|
|
|
22
17
|
const actions = {
|
|
23
18
|
loadVendorPublicInfo: (0, _toolkit.createAction)(`${_constants.vendorStoreName}/loadVendorPublicInfo`)
|
|
24
19
|
};
|
|
20
|
+
|
|
25
21
|
/**
|
|
26
22
|
* To be used for actions types after dispatch, and should contains
|
|
27
23
|
* the reducers and actions as standalone function
|
|
28
24
|
*/
|
|
29
|
-
|
|
30
25
|
exports.vendorActions = actions;
|
|
31
|
-
|
|
32
26
|
/**
|
|
33
27
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
34
28
|
* contains the same functions in reducers and actions
|
package/node/vendor/index.js
CHANGED
|
@@ -41,15 +41,10 @@ Object.defineProperty(exports, "vendorStoreName", {
|
|
|
41
41
|
return _constants.vendorStoreName;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
|
|
45
44
|
var _reducer = require("./reducer");
|
|
46
|
-
|
|
47
45
|
var _saga = require("./saga");
|
|
48
|
-
|
|
49
46
|
var _constants = require("../constants");
|
|
50
|
-
|
|
51
47
|
var _interfaces = require("./interfaces");
|
|
52
|
-
|
|
53
48
|
Object.keys(_interfaces).forEach(function (key) {
|
|
54
49
|
if (key === "default" || key === "__esModule") return;
|
|
55
50
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
package/node/vendor/reducer.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.reducer = exports.initialState = exports.actions = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _constants = require("../constants");
|
|
13
|
-
|
|
14
10
|
var _toolkit = require("@reduxjs/toolkit");
|
|
15
|
-
|
|
16
11
|
var _VendorState = require("./VendorState");
|
|
17
|
-
|
|
18
12
|
const initialState = {
|
|
19
13
|
loading: false
|
|
20
14
|
};
|
package/node/vendor/saga.js
CHANGED
|
@@ -6,20 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.loadVendorPublicInfo = loadVendorPublicInfo;
|
|
7
7
|
exports.sagas = sagas;
|
|
8
8
|
exports.vendorSagasMock = vendorSagasMock;
|
|
9
|
-
|
|
10
9
|
var _effects = require("redux-saga/effects");
|
|
11
|
-
|
|
12
10
|
var _restApi = require("@frontegg/rest-api");
|
|
13
|
-
|
|
14
11
|
var _reducer = require("./reducer");
|
|
15
|
-
|
|
16
12
|
var _utils = require("../auth/utils");
|
|
17
|
-
|
|
18
13
|
function* loadVendorPublicInfo() {
|
|
19
14
|
yield (0, _effects.put)(_reducer.actions.setVendorState({
|
|
20
15
|
loading: true
|
|
21
16
|
}));
|
|
22
|
-
|
|
23
17
|
try {
|
|
24
18
|
const {
|
|
25
19
|
whiteLabelMode = false
|
|
@@ -35,11 +29,11 @@ function* loadVendorPublicInfo() {
|
|
|
35
29
|
console.error('failed to getVendorPublicInfo - ', e);
|
|
36
30
|
}
|
|
37
31
|
}
|
|
32
|
+
|
|
38
33
|
/*********************************
|
|
39
34
|
* Preview Sagas
|
|
40
35
|
*********************************/
|
|
41
36
|
|
|
42
|
-
|
|
43
37
|
function* loadVendorPublicInfoMock() {
|
|
44
38
|
try {
|
|
45
39
|
yield (0, _effects.put)(_reducer.actions.setVendorState({
|
|
@@ -50,11 +44,9 @@ function* loadVendorPublicInfoMock() {
|
|
|
50
44
|
console.error('failed to getVendorPublicInfo - ', e);
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
|
-
|
|
54
47
|
function* vendorSagasMock() {
|
|
55
48
|
yield (0, _effects.takeEvery)(_reducer.actions.loadVendorPublicInfo, loadVendorPublicInfoMock);
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
function* sagas() {
|
|
59
51
|
yield (0, _effects.takeEvery)(_reducer.actions.loadVendorPublicInfo, loadVendorPublicInfo);
|
|
60
52
|
}
|
package/package.json
CHANGED
|
@@ -8,9 +8,7 @@ export const initialBillingInformationState = {
|
|
|
8
8
|
error: null,
|
|
9
9
|
fetching: true
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
const reducers = _extends({}, createModuleCaseReducers());
|
|
13
|
-
|
|
14
12
|
const {
|
|
15
13
|
reducer,
|
|
16
14
|
actions: overviewActions,
|
|
@@ -20,11 +18,9 @@ const {
|
|
|
20
18
|
initialState: initialBillingInformationState,
|
|
21
19
|
reducers
|
|
22
20
|
});
|
|
23
|
-
|
|
24
21
|
const actions = _extends({
|
|
25
22
|
loadBillingInformation: createAction(`${name}/loadBillingInformation`),
|
|
26
23
|
cancelSubscription: subscriptionActions.cancelSubscription,
|
|
27
24
|
renewSubscription: subscriptionActions.renewSubscription
|
|
28
25
|
}, overviewActions);
|
|
29
|
-
|
|
30
26
|
export { reducer as informationReducer, actions as informationActions };
|
|
@@ -12,33 +12,25 @@ export function* subscriptionBillingInformationSagas() {
|
|
|
12
12
|
export function* loadBillingInformation() {
|
|
13
13
|
yield loadBillingInformationAction(false);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
function* loadBillingInformationAction(forceActive) {
|
|
17
16
|
const paymentProvider = yield select(state => {
|
|
18
17
|
var _state$subscriptions$;
|
|
19
|
-
|
|
20
18
|
return (_state$subscriptions$ = state.subscriptions.config.config) == null ? void 0 : _state$subscriptions$.paymentProvider;
|
|
21
19
|
});
|
|
22
20
|
const tenantId = yield select(state => {
|
|
23
21
|
var _state$auth, _state$auth$user;
|
|
24
|
-
|
|
25
22
|
return (_state$auth = state.auth) == null ? void 0 : (_state$auth$user = _state$auth.user) == null ? void 0 : _state$auth$user.tenantId;
|
|
26
23
|
});
|
|
27
|
-
|
|
28
24
|
if (!paymentProvider || !tenantId) {
|
|
29
25
|
yield put(informationActions.setError(!paymentProvider ? 'Internal feature failure' : 'Not authorized'));
|
|
30
26
|
return;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
yield loadSummaries(tenantId, forceActive);
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
export function* loadSummaries(tenantId, forceActive) {
|
|
37
31
|
yield put(informationActions.setLoading(true));
|
|
38
|
-
|
|
39
32
|
try {
|
|
40
33
|
var _planResponse$price, _planResponse$price2;
|
|
41
|
-
|
|
42
34
|
const summary = yield call(api.subscriptions.getSubscriptionSummaries, tenantId);
|
|
43
35
|
const {
|
|
44
36
|
currentPlanId,
|
|
@@ -46,14 +38,12 @@ export function* loadSummaries(tenantId, forceActive) {
|
|
|
46
38
|
} = summary;
|
|
47
39
|
let subscriptionResponse = null;
|
|
48
40
|
let planResponse;
|
|
49
|
-
|
|
50
41
|
if (!externallyManaged) {
|
|
51
42
|
[, planResponse] = yield all([call(loadSubscription), call(api.subscriptions.getSubscriptionPlan, currentPlanId)]);
|
|
52
43
|
subscriptionResponse = yield select(state => state.subscriptions.billing.subscription.subscription || null);
|
|
53
44
|
} else {
|
|
54
45
|
planResponse = yield call(api.subscriptions.getSubscriptionPlan, currentPlanId);
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
yield put(informationActions.setState(_extends({
|
|
58
48
|
loading: false,
|
|
59
49
|
fetching: false,
|
|
@@ -84,6 +74,7 @@ export function* loadSummaries(tenantId, forceActive) {
|
|
|
84
74
|
yield put(informationActions.setError(e.message));
|
|
85
75
|
}
|
|
86
76
|
}
|
|
77
|
+
|
|
87
78
|
/*********************************
|
|
88
79
|
* Preview Sagas
|
|
89
80
|
*********************************/
|
|
@@ -91,10 +82,8 @@ export function* loadSummaries(tenantId, forceActive) {
|
|
|
91
82
|
function* loadBillingInformationMock() {
|
|
92
83
|
yield loadSummariesMock();
|
|
93
84
|
}
|
|
94
|
-
|
|
95
85
|
export function* loadSummariesMock() {
|
|
96
86
|
var _planResponseMock$0$p, _planResponseMock$0$p2;
|
|
97
|
-
|
|
98
87
|
yield put(informationActions.setLoading(true));
|
|
99
88
|
yield delay(500);
|
|
100
89
|
yield put(informationActions.setState({
|
|
@@ -12,7 +12,6 @@ export const initialInvoicesState = {
|
|
|
12
12
|
error: null
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
|
|
16
15
|
const reducers = _extends({}, createModuleCaseReducers(), {
|
|
17
16
|
setInvoiceDownloadState: {
|
|
18
17
|
prepare: payload => ({
|
|
@@ -23,7 +22,6 @@ const reducers = _extends({}, createModuleCaseReducers(), {
|
|
|
23
22
|
})
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
|
-
|
|
27
25
|
const {
|
|
28
26
|
reducer,
|
|
29
27
|
actions: sliceActions,
|
|
@@ -33,12 +31,10 @@ const {
|
|
|
33
31
|
initialState: initialInvoicesState,
|
|
34
32
|
reducers
|
|
35
33
|
});
|
|
36
|
-
|
|
37
34
|
const actions = _extends({
|
|
38
35
|
loadInvoices: createAction(`${name}/loadInvoices`),
|
|
39
36
|
downloadInvoice: createAction(`${name}/downloadInvoice`, payload => ({
|
|
40
37
|
payload
|
|
41
38
|
}))
|
|
42
39
|
}, sliceActions);
|
|
43
|
-
|
|
44
40
|
export { reducer as invoicesReducer, actions as invoicesActions };
|
|
@@ -9,7 +9,6 @@ export function* subscriptionInvoicesSagas() {
|
|
|
9
9
|
}
|
|
10
10
|
export function* loadInvoices() {
|
|
11
11
|
yield put(invoicesActions.setLoading(true));
|
|
12
|
-
|
|
13
12
|
try {
|
|
14
13
|
const responseInvoices = yield call(api.subscriptions.getSubscriptionInvoices);
|
|
15
14
|
const invoices = responseInvoices.map(invoice => ({
|
|
@@ -31,7 +30,6 @@ export function* loadInvoices() {
|
|
|
31
30
|
yield put(invoicesActions.setError(e.message));
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
function* downloadInvoice({
|
|
36
34
|
payload
|
|
37
35
|
}) {
|
|
@@ -39,7 +37,6 @@ function* downloadInvoice({
|
|
|
39
37
|
loading: true,
|
|
40
38
|
error: null
|
|
41
39
|
}));
|
|
42
|
-
|
|
43
40
|
try {
|
|
44
41
|
yield call(api.subscriptions.getSubscriptionInvoicePdf, payload.invoiceId, payload.filename);
|
|
45
42
|
yield put(invoicesActions.setInvoiceDownloadState({
|
|
@@ -53,11 +50,11 @@ function* downloadInvoice({
|
|
|
53
50
|
}));
|
|
54
51
|
}
|
|
55
52
|
}
|
|
53
|
+
|
|
56
54
|
/*********************************
|
|
57
55
|
* Preview Sagas
|
|
58
56
|
*********************************/
|
|
59
57
|
|
|
60
|
-
|
|
61
58
|
function* loadInvoicesMock() {
|
|
62
59
|
yield put(invoicesActions.setLoading(true));
|
|
63
60
|
yield delay(500);
|
|
@@ -73,7 +70,6 @@ function* loadInvoicesMock() {
|
|
|
73
70
|
}));
|
|
74
71
|
yield put(invoicesActions.setLoading(false));
|
|
75
72
|
}
|
|
76
|
-
|
|
77
73
|
export function* subscriptionInvoicesSagasMock() {
|
|
78
74
|
yield takeEvery(invoicesActions.loadInvoices, loadInvoicesMock);
|
|
79
75
|
}
|
|
@@ -7,7 +7,6 @@ export const initialPaymentMethodState = {
|
|
|
7
7
|
error: null,
|
|
8
8
|
fetching: true
|
|
9
9
|
};
|
|
10
|
-
|
|
11
10
|
const reducers = _extends({}, createModuleCaseReducers(), {
|
|
12
11
|
setState: {
|
|
13
12
|
prepare: payload => ({
|
|
@@ -16,7 +15,6 @@ const reducers = _extends({}, createModuleCaseReducers(), {
|
|
|
16
15
|
reducer: (state, action) => _extends({}, state, action.payload)
|
|
17
16
|
}
|
|
18
17
|
});
|
|
19
|
-
|
|
20
18
|
const {
|
|
21
19
|
reducer,
|
|
22
20
|
actions: paymentActions,
|
|
@@ -26,7 +24,6 @@ const {
|
|
|
26
24
|
initialState: initialPaymentMethodState,
|
|
27
25
|
reducers
|
|
28
26
|
});
|
|
29
|
-
|
|
30
27
|
const actions = _extends({
|
|
31
28
|
loadPaymentMethod: createAction(`${name}/loadPaymentMethod`),
|
|
32
29
|
submitPaymentMethod: createAction(`${name}/submitPaymentMethod`),
|
|
@@ -35,7 +32,6 @@ const actions = _extends({
|
|
|
35
32
|
updatePaymentMethodBillingDetails: createAction(`${name}/updateBillingDetails`, payload => ({
|
|
36
33
|
payload
|
|
37
34
|
}))
|
|
38
|
-
}, paymentActions);
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
}, paymentActions);
|
|
36
|
+
//TODO: refactor to general code-style like export type ConnectivityActions = DispatchedActions;
|
|
41
37
|
export { reducer as subscriptionsPaymentMethodReducer, actions as subscriptionsPaymentMethodActions };
|
|
@@ -12,7 +12,6 @@ export function* subscriptionsPaymentMethodSagas() {
|
|
|
12
12
|
}
|
|
13
13
|
export function* loadPaymentMethod() {
|
|
14
14
|
yield put(subscriptionsPaymentMethodActions.setLoading(true));
|
|
15
|
-
|
|
16
15
|
try {
|
|
17
16
|
const paymentMethods = yield call(api.subscriptions.getPaymentMethods);
|
|
18
17
|
const paymentMethod = paymentMethods[0];
|
|
@@ -25,7 +24,6 @@ export function* loadPaymentMethod() {
|
|
|
25
24
|
yield put(subscriptionsPaymentMethodActions.setError(e.message));
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
function* updateBillingDetails({
|
|
30
28
|
payload
|
|
31
29
|
}) {
|
|
@@ -36,7 +34,6 @@ function* updateBillingDetails({
|
|
|
36
34
|
address,
|
|
37
35
|
callback
|
|
38
36
|
} = payload;
|
|
39
|
-
|
|
40
37
|
try {
|
|
41
38
|
yield call(api.subscriptions.updatePaymentMethodBillingDetails, id, _extends({
|
|
42
39
|
email
|
|
@@ -47,28 +44,24 @@ function* updateBillingDetails({
|
|
|
47
44
|
yield put(subscriptionsPaymentMethodActions.setError(e.message));
|
|
48
45
|
callback == null ? void 0 : callback(false);
|
|
49
46
|
}
|
|
50
|
-
|
|
51
47
|
yield put(subscriptionsPaymentMethodActions.setLoading(false));
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
function* submitPaymentMethod() {
|
|
55
50
|
yield put(subscriptionsPaymentMethodActions.setLoading(true));
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
function* submitPaymentMethodError({
|
|
59
53
|
payload: error
|
|
60
54
|
}) {
|
|
61
55
|
yield put(subscriptionsPaymentMethodActions.setError(error));
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
function* submitPaymentMethodSuccess() {
|
|
65
58
|
yield put(subscriptionsPaymentMethodActions.loadPaymentMethod());
|
|
66
59
|
}
|
|
60
|
+
|
|
67
61
|
/*********************************
|
|
68
62
|
* Preview Sagas
|
|
69
63
|
*********************************/
|
|
70
64
|
|
|
71
|
-
|
|
72
65
|
function* loadPaymentMethodMock() {
|
|
73
66
|
yield put(subscriptionsPaymentMethodActions.setLoading(true));
|
|
74
67
|
yield delay(500);
|
|
@@ -79,7 +72,6 @@ function* loadPaymentMethodMock() {
|
|
|
79
72
|
fetching: false
|
|
80
73
|
}));
|
|
81
74
|
}
|
|
82
|
-
|
|
83
75
|
export function* subscriptionsPaymentMethodSagasMock() {
|
|
84
76
|
yield takeEvery(subscriptionsPaymentMethodActions.loadPaymentMethod, loadPaymentMethodMock);
|
|
85
77
|
}
|
|
@@ -15,14 +15,12 @@ export const initialSubscriptionState = {
|
|
|
15
15
|
error: null
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
|
|
19
18
|
const reducers = _extends({}, createModuleCaseReducers(), {
|
|
20
19
|
setCancellationLoading: createKeyCaseLoadingReducer('cancellation'),
|
|
21
20
|
setCancellationError: createKeyCaseErrorReducer('cancellation'),
|
|
22
21
|
setRenewalLoading: createKeyCaseLoadingReducer('renewal'),
|
|
23
22
|
setRenewalError: createKeyCaseErrorReducer('renewal')
|
|
24
23
|
});
|
|
25
|
-
|
|
26
24
|
const {
|
|
27
25
|
reducer,
|
|
28
26
|
actions: overviewActions,
|
|
@@ -32,11 +30,9 @@ const {
|
|
|
32
30
|
initialState: initialSubscriptionState,
|
|
33
31
|
reducers
|
|
34
32
|
});
|
|
35
|
-
|
|
36
33
|
const actions = _extends({
|
|
37
34
|
load: createAction(`${name}/loadSubscription`),
|
|
38
35
|
cancelSubscription: createAction(`${name}/cancelSubscription`),
|
|
39
36
|
renewSubscription: createAction(`${name}/renewSubscription`)
|
|
40
37
|
}, overviewActions);
|
|
41
|
-
|
|
42
38
|
export { reducer as subscriptionReducer, actions as subscriptionActions };
|
|
@@ -8,20 +8,17 @@ export function* subscriptionSagas() {
|
|
|
8
8
|
yield takeEvery(subscriptionActions.cancelSubscription, cancelSubscription);
|
|
9
9
|
yield takeEvery(subscriptionActions.renewSubscription, renewSubscription);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
function* loadSubscriptionTenant() {
|
|
13
12
|
const tenantId = yield select(state => {
|
|
14
13
|
var _state$auth, _state$auth$user;
|
|
15
|
-
|
|
16
14
|
return (_state$auth = state.auth) == null ? void 0 : (_state$auth$user = _state$auth.user) == null ? void 0 : _state$auth$user.tenantId;
|
|
17
15
|
});
|
|
18
16
|
yield loadSummaries(tenantId);
|
|
19
|
-
}
|
|
20
|
-
|
|
17
|
+
}
|
|
21
18
|
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
20
|
export function* loadSubscription() {
|
|
23
21
|
yield put(subscriptionActions.setLoading(true));
|
|
24
|
-
|
|
25
22
|
try {
|
|
26
23
|
const [subscription] = yield call(api.subscriptions.getManagedSubscriptions);
|
|
27
24
|
yield put(subscriptionActions.setState({
|
|
@@ -34,29 +31,24 @@ export function* loadSubscription() {
|
|
|
34
31
|
yield put(subscriptionActions.setError(e));
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
function* cancelSubscription() {
|
|
39
35
|
const {
|
|
40
36
|
subscription
|
|
41
37
|
} = yield select(state => state.subscriptions.billing.subscription);
|
|
42
|
-
|
|
43
38
|
if (!subscription) {
|
|
44
39
|
yield put(subscriptionActions.setCancellationError('Subscription not found.'));
|
|
45
40
|
return;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
if (subscription != null && subscription.externallyManaged) {
|
|
49
43
|
yield put(subscriptionActions.setCancellationError('Billing is externally managed.'));
|
|
50
44
|
return;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
const {
|
|
54
47
|
id: subscriptionId,
|
|
55
48
|
cancellation,
|
|
56
49
|
status
|
|
57
50
|
} = subscription || {};
|
|
58
51
|
const isCancellable = !cancellation && status === ISubscriptionStatus.ACTIVE;
|
|
59
|
-
|
|
60
52
|
if (isCancellable) {
|
|
61
53
|
try {
|
|
62
54
|
yield put(subscriptionActions.setCancellationLoading(true));
|
|
@@ -68,28 +60,23 @@ function* cancelSubscription() {
|
|
|
68
60
|
}
|
|
69
61
|
}
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
function* renewSubscription() {
|
|
73
64
|
const {
|
|
74
65
|
subscription
|
|
75
66
|
} = yield select(state => state.subscriptions.billing.subscription);
|
|
76
|
-
|
|
77
67
|
if (!subscription) {
|
|
78
68
|
yield put(subscriptionActions.setCancellationError('Subscription not found.'));
|
|
79
69
|
return;
|
|
80
70
|
}
|
|
81
|
-
|
|
82
71
|
if (subscription != null && subscription.externallyManaged) {
|
|
83
72
|
yield put(subscriptionActions.setCancellationError('Billing is externally managed'));
|
|
84
73
|
return;
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
const {
|
|
88
76
|
id: subscriptionId,
|
|
89
77
|
cancellation
|
|
90
78
|
} = subscription || {};
|
|
91
79
|
const renewable = (cancellation == null ? void 0 : cancellation.policy) === ISubscriptionCancellationPolicy.AT_PERIOD_END;
|
|
92
|
-
|
|
93
80
|
if (renewable) {
|
|
94
81
|
try {
|
|
95
82
|
yield put(subscriptionActions.setRenewalLoading(true));
|
|
@@ -101,11 +88,11 @@ function* renewSubscription() {
|
|
|
101
88
|
}
|
|
102
89
|
}
|
|
103
90
|
}
|
|
91
|
+
|
|
104
92
|
/*********************************
|
|
105
93
|
* Preview Sagas
|
|
106
94
|
*********************************/
|
|
107
95
|
|
|
108
|
-
|
|
109
96
|
function* loadMock() {
|
|
110
97
|
yield put(subscriptionActions.setLoading(true));
|
|
111
98
|
yield delay(500);
|
|
@@ -116,7 +103,6 @@ function* loadMock() {
|
|
|
116
103
|
error: null
|
|
117
104
|
}));
|
|
118
105
|
}
|
|
119
|
-
|
|
120
106
|
export function* subscriptionSagasMock() {
|
|
121
107
|
yield takeEvery(subscriptionActions.load, loadMock);
|
|
122
108
|
}
|
|
@@ -8,9 +8,7 @@ export const checkoutInitialState = {
|
|
|
8
8
|
error: null,
|
|
9
9
|
confirmed: false
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
const reducers = _extends({}, createModuleCaseReducers());
|
|
13
|
-
|
|
14
12
|
const {
|
|
15
13
|
actions: checkoutActions,
|
|
16
14
|
reducer,
|
|
@@ -20,7 +18,6 @@ const {
|
|
|
20
18
|
initialState: checkoutInitialState,
|
|
21
19
|
reducers
|
|
22
20
|
});
|
|
23
|
-
|
|
24
21
|
const actions = _extends({
|
|
25
22
|
loadCheckout: createAction(`${name}/loadCheckout`),
|
|
26
23
|
resetCheckout: createAction(`${name}/resetCheckout`),
|
|
@@ -32,5 +29,4 @@ const actions = _extends({
|
|
|
32
29
|
payload
|
|
33
30
|
}))
|
|
34
31
|
}, checkoutActions);
|
|
35
|
-
|
|
36
32
|
export { reducer as checkoutReducer, actions as checkoutActions };
|
|
@@ -13,7 +13,6 @@ export function* checkoutSagas() {
|
|
|
13
13
|
yield takeEvery(checkoutActions.confirmCheckout, confirmPlan);
|
|
14
14
|
yield takeEvery(checkoutActions.errorCheckout, errorCheckout);
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
function* loadCheckout() {
|
|
18
17
|
yield put(checkoutActions.setState({
|
|
19
18
|
fetching: false,
|
|
@@ -22,7 +21,6 @@ function* loadCheckout() {
|
|
|
22
21
|
confirmed: false
|
|
23
22
|
}));
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
function* resetCheckout() {
|
|
27
25
|
yield put(checkoutActions.setState({
|
|
28
26
|
loading: false,
|
|
@@ -30,18 +28,16 @@ function* resetCheckout() {
|
|
|
30
28
|
confirmed: false
|
|
31
29
|
}));
|
|
32
30
|
}
|
|
31
|
+
|
|
33
32
|
/**
|
|
34
33
|
* Based on payment provider type
|
|
35
34
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
35
|
function* submitCheckout() {
|
|
39
36
|
yield put(checkoutActions.setState({
|
|
40
37
|
loading: true,
|
|
41
38
|
error: null
|
|
42
39
|
}));
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
function* confirmPlan({
|
|
46
42
|
payload: {
|
|
47
43
|
paymentMethodId,
|
|
@@ -52,7 +48,6 @@ function* confirmPlan({
|
|
|
52
48
|
const summary = yield select(state => state.subscriptions.billing.information.summary);
|
|
53
49
|
const isTrialing = (subscription == null ? void 0 : subscription.status) === ISubscriptionStatus.TRIALING;
|
|
54
50
|
const hasPaymentMethod = !!(summary != null && summary.paymentMethodId);
|
|
55
|
-
|
|
56
51
|
if (!subscription) {
|
|
57
52
|
yield put(checkoutActions.setState({
|
|
58
53
|
loading: false,
|
|
@@ -60,12 +55,10 @@ function* confirmPlan({
|
|
|
60
55
|
}));
|
|
61
56
|
return;
|
|
62
57
|
}
|
|
63
|
-
|
|
64
58
|
yield put(checkoutActions.setState({
|
|
65
59
|
loading: true,
|
|
66
60
|
error: null
|
|
67
61
|
}));
|
|
68
|
-
|
|
69
62
|
if (isTrialing && hasPaymentMethod) {
|
|
70
63
|
yield confirmCheckout();
|
|
71
64
|
yield put(subscriptionActions.setState({
|
|
@@ -75,7 +68,6 @@ function* confirmPlan({
|
|
|
75
68
|
}));
|
|
76
69
|
return;
|
|
77
70
|
}
|
|
78
|
-
|
|
79
71
|
try {
|
|
80
72
|
yield call(api.subscriptions.updateManagedSubscription, subscription.id, {
|
|
81
73
|
paymentMethodId,
|
|
@@ -90,7 +82,6 @@ function* confirmPlan({
|
|
|
90
82
|
}));
|
|
91
83
|
}
|
|
92
84
|
}
|
|
93
|
-
|
|
94
85
|
function* confirmCheckout() {
|
|
95
86
|
yield put(checkoutActions.setState({
|
|
96
87
|
loading: false,
|
|
@@ -98,7 +89,6 @@ function* confirmCheckout() {
|
|
|
98
89
|
confirmed: true
|
|
99
90
|
}));
|
|
100
91
|
}
|
|
101
|
-
|
|
102
92
|
function* errorCheckout({
|
|
103
93
|
payload
|
|
104
94
|
}) {
|
|
@@ -107,11 +97,11 @@ function* errorCheckout({
|
|
|
107
97
|
error: payload
|
|
108
98
|
}));
|
|
109
99
|
}
|
|
100
|
+
|
|
110
101
|
/*********************************
|
|
111
102
|
* Preview Sagas
|
|
112
103
|
*********************************/
|
|
113
104
|
|
|
114
|
-
|
|
115
105
|
export function* checkoutSagasMock() {
|
|
116
106
|
yield takeEvery(checkoutActions.resetCheckout, resetCheckout);
|
|
117
107
|
}
|
|
@@ -8,9 +8,7 @@ export const configInitialState = {
|
|
|
8
8
|
fetching: true,
|
|
9
9
|
config: null
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
const reducers = _extends({}, createModuleCaseReducers());
|
|
13
|
-
|
|
14
12
|
const {
|
|
15
13
|
actions: configActions,
|
|
16
14
|
reducer,
|
|
@@ -20,9 +18,7 @@ const {
|
|
|
20
18
|
initialState: configInitialState,
|
|
21
19
|
reducers
|
|
22
20
|
});
|
|
23
|
-
|
|
24
21
|
const actions = _extends({
|
|
25
22
|
loadPaymentConfiguration: createAction(`${name}/loadPaymentConfiguration`)
|
|
26
23
|
}, configActions);
|
|
27
|
-
|
|
28
24
|
export { reducer as configReducer, actions as configActions };
|