@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
|
@@ -5,21 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.sessionsSaga = sessionsSaga;
|
|
7
7
|
exports.sessionsSagaMock = sessionsSagaMock;
|
|
8
|
-
|
|
9
8
|
var _effects = require("redux-saga/effects");
|
|
10
|
-
|
|
11
9
|
var _restApi = require("@frontegg/rest-api");
|
|
12
|
-
|
|
13
10
|
var _reducer = require("../reducer");
|
|
14
|
-
|
|
15
11
|
var _dummy = require("../dummy");
|
|
16
|
-
|
|
17
12
|
function* loadCurrentUserSessions() {
|
|
18
13
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
19
14
|
loading: true,
|
|
20
15
|
error: null
|
|
21
16
|
}));
|
|
22
|
-
|
|
23
17
|
try {
|
|
24
18
|
const sessions = yield (0, _effects.call)(_restApi.api.auth.getCurrentUserSessions);
|
|
25
19
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
@@ -33,13 +27,11 @@ function* loadCurrentUserSessions() {
|
|
|
33
27
|
}));
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
function* loadCurrentUserSession() {
|
|
38
31
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
39
32
|
loading: true,
|
|
40
33
|
error: null
|
|
41
34
|
}));
|
|
42
|
-
|
|
43
35
|
try {
|
|
44
36
|
const session = yield (0, _effects.call)(_restApi.api.auth.getCurrentUserSession);
|
|
45
37
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
@@ -53,7 +45,6 @@ function* loadCurrentUserSession() {
|
|
|
53
45
|
}));
|
|
54
46
|
}
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
function* deleteUserSession({
|
|
58
49
|
payload: {
|
|
59
50
|
id
|
|
@@ -63,7 +54,6 @@ function* deleteUserSession({
|
|
|
63
54
|
loading: true,
|
|
64
55
|
error: null
|
|
65
56
|
}));
|
|
66
|
-
|
|
67
57
|
try {
|
|
68
58
|
yield (0, _effects.call)(_restApi.api.auth.deleteSessionForUser, id);
|
|
69
59
|
yield (0, _effects.put)(_reducer.actions.loadUserSessions());
|
|
@@ -74,7 +64,6 @@ function* deleteUserSession({
|
|
|
74
64
|
}));
|
|
75
65
|
}
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
function* revokeUserSessions({
|
|
79
68
|
payload: {
|
|
80
69
|
callback,
|
|
@@ -85,7 +74,6 @@ function* revokeUserSessions({
|
|
|
85
74
|
loading: true,
|
|
86
75
|
error: null
|
|
87
76
|
}));
|
|
88
|
-
|
|
89
77
|
try {
|
|
90
78
|
yield (0, _effects.call)(_restApi.api.auth.revokeSessionsForUser, userId);
|
|
91
79
|
callback == null ? void 0 : callback(true);
|
|
@@ -97,13 +85,11 @@ function* revokeUserSessions({
|
|
|
97
85
|
callback == null ? void 0 : callback(false);
|
|
98
86
|
}
|
|
99
87
|
}
|
|
100
|
-
|
|
101
88
|
function* deleteAllUserSessions() {
|
|
102
89
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
103
90
|
loading: true,
|
|
104
91
|
error: null
|
|
105
92
|
}));
|
|
106
|
-
|
|
107
93
|
try {
|
|
108
94
|
yield (0, _effects.call)(_restApi.api.auth.deleteAllSessionsForUser);
|
|
109
95
|
yield (0, _effects.put)(_reducer.actions.loadUserSessions());
|
|
@@ -114,7 +100,6 @@ function* deleteAllUserSessions() {
|
|
|
114
100
|
}));
|
|
115
101
|
}
|
|
116
102
|
}
|
|
117
|
-
|
|
118
103
|
function* sessionsSaga() {
|
|
119
104
|
yield (0, _effects.takeLatest)(_reducer.actions.loadUserSessions, loadCurrentUserSessions);
|
|
120
105
|
yield (0, _effects.takeLatest)(_reducer.actions.deleteUserSession, deleteUserSession);
|
|
@@ -122,11 +107,11 @@ function* sessionsSaga() {
|
|
|
122
107
|
yield (0, _effects.takeLatest)(_reducer.actions.loadCurrentUserSession, loadCurrentUserSession);
|
|
123
108
|
yield (0, _effects.takeEvery)(_reducer.actions.revokeUserSessions, revokeUserSessions);
|
|
124
109
|
}
|
|
110
|
+
|
|
125
111
|
/*********************************
|
|
126
112
|
* Preview Sagas
|
|
127
113
|
*********************************/
|
|
128
114
|
|
|
129
|
-
|
|
130
115
|
function* loadCurrentUserSessionsMock() {
|
|
131
116
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
132
117
|
loading: true,
|
|
@@ -137,7 +122,6 @@ function* loadCurrentUserSessionsMock() {
|
|
|
137
122
|
loading: false
|
|
138
123
|
}));
|
|
139
124
|
}
|
|
140
|
-
|
|
141
125
|
function* deleteUserSessionMock({
|
|
142
126
|
payload: {
|
|
143
127
|
id
|
|
@@ -149,7 +133,6 @@ function* deleteUserSessionMock({
|
|
|
149
133
|
}));
|
|
150
134
|
const currentSessions = yield (0, _effects.select)(state => {
|
|
151
135
|
var _state$auth$sessionsS;
|
|
152
|
-
|
|
153
136
|
return (_state$auth$sessionsS = state.auth.sessionsState.sessions) != null ? _state$auth$sessionsS : [];
|
|
154
137
|
});
|
|
155
138
|
const newSessions = currentSessions.filter(s => s.id !== id);
|
|
@@ -158,21 +141,17 @@ function* deleteUserSessionMock({
|
|
|
158
141
|
loading: false
|
|
159
142
|
}));
|
|
160
143
|
}
|
|
161
|
-
|
|
162
144
|
function* deleteAllUserSessionsMock() {
|
|
163
145
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
164
146
|
loading: true,
|
|
165
147
|
error: null
|
|
166
148
|
}));
|
|
167
|
-
|
|
168
149
|
const newSessions = _dummy.sessionsMock.filter(s => s.current);
|
|
169
|
-
|
|
170
150
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
171
151
|
sessions: newSessions,
|
|
172
152
|
loading: false
|
|
173
153
|
}));
|
|
174
154
|
}
|
|
175
|
-
|
|
176
155
|
function* sessionsSagaMock() {
|
|
177
156
|
yield (0, _effects.takeLatest)(_reducer.actions.loadUserSessions, loadCurrentUserSessionsMock);
|
|
178
157
|
yield (0, _effects.takeLatest)(_reducer.actions.deleteUserSession, deleteUserSessionMock);
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.signUpState = exports.signUpReducers = exports.signUpActions = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _interfaces = require("./interfaces");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../../constants");
|
|
15
|
-
|
|
16
11
|
const signUpState = {
|
|
17
12
|
loading: false,
|
|
18
13
|
allowSignUps: false,
|
|
@@ -34,14 +29,13 @@ const actions = {
|
|
|
34
29
|
})),
|
|
35
30
|
resetSignUpStateSoft: (0, _toolkit.createAction)(`${_constants.authStoreName}/resetSignUpStateSoft`)
|
|
36
31
|
};
|
|
32
|
+
|
|
37
33
|
/**
|
|
38
34
|
* To be used for actions types after dispatch, and should contains
|
|
39
35
|
* the reducers and actions as standalone function
|
|
40
36
|
*/
|
|
41
|
-
|
|
42
37
|
exports.signUpActions = actions;
|
|
43
38
|
// noinspection JSUnusedLocalSymbols
|
|
44
|
-
|
|
45
39
|
/**
|
|
46
40
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
47
41
|
* contains the same functions in reducers and actions
|
package/node/auth/SignUp/saga.js
CHANGED
|
@@ -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
|
});
|
|
@@ -9,28 +8,18 @@ exports.loadAllowSignUps = loadAllowSignUps;
|
|
|
9
8
|
exports.resetSignUpStateSoft = resetSignUpStateSoft;
|
|
10
9
|
exports.signUpSaga = signUpSaga;
|
|
11
10
|
exports.signUpUser = signUpUser;
|
|
12
|
-
|
|
13
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
14
|
-
|
|
15
12
|
var _effects = require("redux-saga/effects");
|
|
16
|
-
|
|
17
13
|
var _restApi = require("@frontegg/rest-api");
|
|
18
|
-
|
|
19
14
|
var _reducer = require("../reducer");
|
|
20
|
-
|
|
21
15
|
var _interfaces = require("./interfaces");
|
|
22
|
-
|
|
23
16
|
var _interfaces2 = require("../interfaces");
|
|
24
|
-
|
|
25
17
|
var _saga = require("../LoginState/saga");
|
|
26
|
-
|
|
27
18
|
const _excluded = ["events", "url"];
|
|
28
|
-
|
|
29
19
|
function* loadAllowSignUps() {
|
|
30
20
|
yield (0, _effects.put)(_reducer.actions.setSignUpState({
|
|
31
21
|
loading: true
|
|
32
22
|
}));
|
|
33
|
-
|
|
34
23
|
try {
|
|
35
24
|
const policy = yield (0, _effects.call)(_restApi.api.auth.getVendorConfig);
|
|
36
25
|
const {
|
|
@@ -55,19 +44,17 @@ function* loadAllowSignUps() {
|
|
|
55
44
|
}));
|
|
56
45
|
}
|
|
57
46
|
}
|
|
58
|
-
|
|
59
47
|
function* signUpUser(_ref) {
|
|
60
48
|
let {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
payload: {
|
|
50
|
+
events,
|
|
51
|
+
url
|
|
52
|
+
}
|
|
53
|
+
} = _ref,
|
|
54
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
|
|
67
55
|
yield (0, _effects.put)(_reducer.actions.setSignUpState({
|
|
68
56
|
loading: true
|
|
69
57
|
}));
|
|
70
|
-
|
|
71
58
|
try {
|
|
72
59
|
const {
|
|
73
60
|
routes,
|
|
@@ -79,10 +66,8 @@ function* signUpUser(_ref) {
|
|
|
79
66
|
tenantId,
|
|
80
67
|
userId
|
|
81
68
|
} = yield (0, _effects.call)(_restApi.api.auth.signUpUser, payload);
|
|
82
|
-
|
|
83
69
|
if (!payload.invitationToken) {
|
|
84
70
|
var _events$signUpComplet;
|
|
85
|
-
|
|
86
71
|
const {
|
|
87
72
|
email,
|
|
88
73
|
name,
|
|
@@ -99,11 +84,8 @@ function* signUpUser(_ref) {
|
|
|
99
84
|
createdAt: new Date()
|
|
100
85
|
});
|
|
101
86
|
}
|
|
102
|
-
|
|
103
87
|
_restApi.ContextHolder.setAccessToken(user == null ? void 0 : user.accessToken);
|
|
104
|
-
|
|
105
88
|
_restApi.ContextHolder.setUser(user);
|
|
106
|
-
|
|
107
89
|
if (!shouldActivate && user && (0, _saga.isMfaRequired)(user)) {
|
|
108
90
|
const mfaRequiredState = yield (0, _saga.getMfaRequiredState)(user);
|
|
109
91
|
yield (0, _effects.put)(_reducer.actions.setState(mfaRequiredState));
|
|
@@ -118,27 +100,22 @@ function* signUpUser(_ref) {
|
|
|
118
100
|
user,
|
|
119
101
|
isAuthenticated: !!(user != null && user.accessToken)
|
|
120
102
|
}));
|
|
121
|
-
|
|
122
103
|
if (!shouldActivate) {
|
|
123
104
|
yield (0, _effects.put)(_reducer.actions.loadTenants());
|
|
124
105
|
}
|
|
125
106
|
}
|
|
126
107
|
} catch (e) {
|
|
127
108
|
_restApi.ContextHolder.setAccessToken(null);
|
|
128
|
-
|
|
129
109
|
_restApi.ContextHolder.setUser(null);
|
|
130
|
-
|
|
131
110
|
yield (0, _effects.put)(_reducer.actions.setSignUpState({
|
|
132
111
|
loading: false,
|
|
133
112
|
error: e.message
|
|
134
113
|
}));
|
|
135
114
|
}
|
|
136
|
-
|
|
137
115
|
yield (0, _effects.put)(_reducer.actions.setSignUpState({
|
|
138
116
|
loading: false
|
|
139
117
|
}));
|
|
140
118
|
}
|
|
141
|
-
|
|
142
119
|
function* resetSignUpStateSoft() {
|
|
143
120
|
const {
|
|
144
121
|
allowSignUps,
|
|
@@ -150,7 +127,6 @@ function* resetSignUpStateSoft() {
|
|
|
150
127
|
allowNotVerifiedUsersLogin
|
|
151
128
|
}));
|
|
152
129
|
}
|
|
153
|
-
|
|
154
130
|
function* signUpSaga() {
|
|
155
131
|
yield (0, _effects.takeLeading)(_reducer.actions.signUpUser, signUpUser);
|
|
156
132
|
yield (0, _effects.takeLeading)(_reducer.actions.resetSignUpStateSoft, resetSignUpStateSoft);
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.socialLoginsReducer = exports.socialLoginsActions = exports.socialLoginState = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
10
|
const socialLoginState = {
|
|
15
11
|
firstLoad: true,
|
|
16
12
|
loading: false,
|
|
@@ -34,14 +30,13 @@ const actions = {
|
|
|
34
30
|
payload
|
|
35
31
|
}))
|
|
36
32
|
};
|
|
33
|
+
|
|
37
34
|
/**
|
|
38
35
|
* To be used for actions types after dispatch, and should contains
|
|
39
36
|
* the reducers and actions as standalone function
|
|
40
37
|
*/
|
|
41
|
-
|
|
42
38
|
exports.socialLoginsActions = actions;
|
|
43
39
|
// noinspection JSUnusedLocalSymbols
|
|
44
|
-
|
|
45
40
|
/**
|
|
46
41
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
47
42
|
* contains the same functions in reducers and actions
|
|
@@ -1,33 +1,22 @@
|
|
|
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.loadSocialLoginsConfigurations = loadSocialLoginsConfigurations;
|
|
9
8
|
exports.loadSocialLoginsConfigurationsV2 = loadSocialLoginsConfigurationsV2;
|
|
10
9
|
exports.socialLoginsSaga = socialLoginsSaga;
|
|
11
|
-
|
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
15
|
-
|
|
16
12
|
var _restApi = require("@frontegg/rest-api");
|
|
17
|
-
|
|
18
13
|
var _effects = require("redux-saga/effects");
|
|
19
|
-
|
|
20
14
|
var _saga = require("../LoginState/saga");
|
|
21
|
-
|
|
22
15
|
var _reducer = require("../reducer");
|
|
23
|
-
|
|
24
16
|
var _index = require("../../index");
|
|
25
|
-
|
|
26
17
|
var _interfaces = require("../interfaces");
|
|
27
|
-
|
|
28
18
|
const _excluded = ["authorizationUrl"],
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
_excluded2 = ["events", "url"];
|
|
31
20
|
function* loadSocialLoginsConfigurations() {
|
|
32
21
|
try {
|
|
33
22
|
yield (0, _effects.put)(_reducer.actions.setSocialLoginsState({
|
|
@@ -47,7 +36,6 @@ function* loadSocialLoginsConfigurations() {
|
|
|
47
36
|
}));
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
function* loadSocialLoginsConfigurationsV2() {
|
|
52
40
|
try {
|
|
53
41
|
const context = yield (0, _effects.select)(state => state.root.context);
|
|
@@ -57,12 +45,10 @@ function* loadSocialLoginsConfigurationsV2() {
|
|
|
57
45
|
const socialLoginsConfigV2 = yield (0, _effects.call)(_restApi.api.auth.getSocialLoginProvidersV2);
|
|
58
46
|
const socialLoginsConfigWithFullUrl = socialLoginsConfigV2.map(_ref => {
|
|
59
47
|
let {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
authorizationUrl
|
|
49
|
+
} = _ref,
|
|
50
|
+
config = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
64
51
|
const baseUrl = _restApi.fetch.getBaseUrl(context, authorizationUrl != null ? authorizationUrl : '');
|
|
65
|
-
|
|
66
52
|
return (0, _extends2.default)({}, config, {
|
|
67
53
|
authorizationUrl: authorizationUrl ? `${baseUrl}${authorizationUrl}` : null
|
|
68
54
|
});
|
|
@@ -80,16 +66,14 @@ function* loadSocialLoginsConfigurationsV2() {
|
|
|
80
66
|
}));
|
|
81
67
|
}
|
|
82
68
|
}
|
|
83
|
-
|
|
84
69
|
function* loginViaSocialLogin(_ref2) {
|
|
85
70
|
let {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
payload: {
|
|
72
|
+
events,
|
|
73
|
+
url
|
|
74
|
+
}
|
|
75
|
+
} = _ref2,
|
|
76
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
|
|
93
77
|
try {
|
|
94
78
|
yield (0, _effects.put)(_reducer.actions.setSocialLoginsState({
|
|
95
79
|
loading: true
|
|
@@ -101,10 +85,8 @@ function* loginViaSocialLogin(_ref2) {
|
|
|
101
85
|
tenantId,
|
|
102
86
|
name
|
|
103
87
|
} = yield (0, _effects.call)(_restApi.api.auth.loginViaSocialLogin, payload);
|
|
104
|
-
|
|
105
88
|
if (isNewUser) {
|
|
106
89
|
var _events$signUpComplet, _events$userVerified;
|
|
107
|
-
|
|
108
90
|
events == null ? void 0 : (_events$signUpComplet = events.signUpComplete) == null ? void 0 : _events$signUpComplet.call(events, {
|
|
109
91
|
email,
|
|
110
92
|
url,
|
|
@@ -124,11 +106,9 @@ function* loginViaSocialLogin(_ref2) {
|
|
|
124
106
|
name
|
|
125
107
|
});
|
|
126
108
|
}
|
|
127
|
-
|
|
128
109
|
if (userId) {
|
|
129
110
|
localStorage.setItem('userId', userId);
|
|
130
111
|
}
|
|
131
|
-
|
|
132
112
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
133
113
|
email,
|
|
134
114
|
isNewUser
|
|
@@ -140,7 +120,6 @@ function* loginViaSocialLogin(_ref2) {
|
|
|
140
120
|
}));
|
|
141
121
|
} catch (e) {
|
|
142
122
|
var _e$message;
|
|
143
|
-
|
|
144
123
|
yield (0, _effects.put)(_reducer.actions.setSocialLoginsState({
|
|
145
124
|
loading: false,
|
|
146
125
|
error: (_e$message = e.message) != null ? _e$message : 'Failed to authenticate',
|
|
@@ -148,7 +127,6 @@ function* loginViaSocialLogin(_ref2) {
|
|
|
148
127
|
}));
|
|
149
128
|
}
|
|
150
129
|
}
|
|
151
|
-
|
|
152
130
|
function* setSocialLoginError({
|
|
153
131
|
payload
|
|
154
132
|
}) {
|
|
@@ -158,7 +136,6 @@ function* setSocialLoginError({
|
|
|
158
136
|
firstLoad: false
|
|
159
137
|
}));
|
|
160
138
|
}
|
|
161
|
-
|
|
162
139
|
function* socialLoginsSaga() {
|
|
163
140
|
yield (0, _effects.takeLeading)(_reducer.actions.loadSocialLoginsConfiguration, loadSocialLoginsConfigurations);
|
|
164
141
|
yield (0, _effects.takeLeading)(_reducer.actions.loadSocialLoginsConfigurationV2, loadSocialLoginsConfigurationsV2);
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.teamState = exports.teamReducers = exports.teamActions = void 0;
|
|
7
|
-
|
|
8
7
|
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
8
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
9
|
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
10
|
const teamState = {
|
|
15
11
|
loaders: {},
|
|
16
12
|
pageOffset: 0,
|
|
@@ -128,14 +124,13 @@ const actions = {
|
|
|
128
124
|
payload
|
|
129
125
|
}))
|
|
130
126
|
};
|
|
127
|
+
|
|
131
128
|
/**
|
|
132
129
|
* To be used for actions types after dispatch, and should contains
|
|
133
130
|
* the reducers and actions as standalone function
|
|
134
131
|
*/
|
|
135
|
-
|
|
136
132
|
exports.teamActions = actions;
|
|
137
133
|
// noinspection JSUnusedLocalSymbols
|
|
138
|
-
|
|
139
134
|
/**
|
|
140
135
|
* if you see error in matcher that's mean the DispatchAction does not
|
|
141
136
|
* contains the same functions in reducers and actions
|