@frontegg/redux-store 6.50.0 → 6.51.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.
Files changed (47) hide show
  1. package/auth/AcceptInvitationState/index.d.ts +2 -0
  2. package/auth/AccountSettingsState/index.d.ts +2 -8
  3. package/auth/ActivateState/index.d.ts +15 -0
  4. package/auth/ApiTokensState/index.d.ts +2 -0
  5. package/auth/ForgotPasswordState/index.d.ts +2 -0
  6. package/auth/LoginState/index.d.ts +2 -0
  7. package/auth/MfaState/index.d.ts +2 -0
  8. package/auth/ProfileState/index.d.ts +2 -0
  9. package/auth/Provisioning/index.d.ts +110 -0
  10. package/auth/Provisioning/index.js +37 -0
  11. package/auth/Provisioning/interfaces.d.ts +6 -0
  12. package/auth/Provisioning/interfaces.js +1 -0
  13. package/auth/Provisioning/saga.d.ts +1 -0
  14. package/auth/Provisioning/saga.js +132 -0
  15. package/auth/ResetPhoneNumberState/index.d.ts +2 -0
  16. package/auth/RestrictionsState/index.d.ts +3 -0
  17. package/auth/RestrictionsState/saga.js +18 -11
  18. package/auth/RolesState/index.d.ts +2 -0
  19. package/auth/SSOState/index.d.ts +2 -0
  20. package/auth/SecurityPolicyState/index.d.ts +11 -0
  21. package/auth/SessionsPolicyState/index.d.ts +2 -0
  22. package/auth/SessionsState/index.d.ts +2 -0
  23. package/auth/SignUp/index.d.ts +2 -0
  24. package/auth/SocialLogins/index.d.ts +2 -0
  25. package/auth/TeamState/index.d.ts +2 -0
  26. package/auth/TenantsState/index.d.ts +2 -0
  27. package/auth/index.d.ts +12 -0
  28. package/auth/index.js +2 -0
  29. package/auth/initialState.js +3 -1
  30. package/auth/interfaces.d.ts +2 -0
  31. package/auth/reducer.d.ts +12 -1
  32. package/auth/reducer.js +3 -2
  33. package/auth/saga.js +2 -1
  34. package/auth/utils.d.ts +4 -0
  35. package/index.js +1 -1
  36. package/interfaces.d.ts +3 -0
  37. package/node/auth/Provisioning/index.js +49 -0
  38. package/node/auth/Provisioning/interfaces.js +5 -0
  39. package/node/auth/Provisioning/saga.js +144 -0
  40. package/node/auth/RestrictionsState/saga.js +19 -11
  41. package/node/auth/index.js +28 -0
  42. package/node/auth/initialState.js +4 -1
  43. package/node/auth/reducer.js +4 -2
  44. package/node/auth/saga.js +3 -1
  45. package/node/index.js +1 -1
  46. package/package.json +2 -2
  47. package/toolkit/index.d.ts +1 -1
@@ -33,6 +33,7 @@ declare const reducers: {
33
33
  apiTokensState: import("..").ApiTokensState;
34
34
  securityPolicyState: import("..").SecurityPolicyState;
35
35
  restrictionsState: import("..").RestrictionsState;
36
+ provisioningState: import("..").ProvisioningState;
36
37
  accountSettingsState: import("..").AccountSettingsState;
37
38
  tenantsState: import("..").TenantsState;
38
39
  rolesState: import("..").RolesState;
@@ -69,6 +70,7 @@ declare const reducers: {
69
70
  apiTokensState: import("..").ApiTokensState;
70
71
  securityPolicyState: import("..").SecurityPolicyState;
71
72
  restrictionsState: import("..").RestrictionsState;
73
+ provisioningState: import("..").ProvisioningState;
72
74
  accountSettingsState: import("..").AccountSettingsState;
73
75
  tenantsState: import("..").TenantsState;
74
76
  rolesState: import("..").RolesState;
@@ -34,6 +34,7 @@ declare const reducers: {
34
34
  apiTokensState: import("..").ApiTokensState;
35
35
  securityPolicyState: import("..").SecurityPolicyState;
36
36
  restrictionsState: import("..").RestrictionsState;
37
+ provisioningState: import("..").ProvisioningState;
37
38
  accountSettingsState: AccountSettingsState;
38
39
  tenantsState: import("..").TenantsState;
39
40
  rolesState: import("..").RolesState;
@@ -41,10 +42,6 @@ declare const reducers: {
41
42
  hostedLoginBox?: boolean | undefined;
42
43
  disableSilentRefresh?: boolean | undefined;
43
44
  sessionsPolicyState: import("..").SessionsPolicyState;
44
- /**
45
- * if you see error in matcher that's mean the DispatchAction does not
46
- * contains the same functions in reducers and actions
47
- */
48
45
  routes: import("..").AuthPageRoutes;
49
46
  header?: any;
50
47
  loaderComponent?: any;
@@ -74,6 +71,7 @@ declare const reducers: {
74
71
  apiTokensState: import("..").ApiTokensState;
75
72
  securityPolicyState: import("..").SecurityPolicyState;
76
73
  restrictionsState: import("..").RestrictionsState;
74
+ provisioningState: import("..").ProvisioningState;
77
75
  accountSettingsState: AccountSettingsState;
78
76
  tenantsState: import("..").TenantsState;
79
77
  rolesState: import("..").RolesState;
@@ -81,10 +79,6 @@ declare const reducers: {
81
79
  hostedLoginBox?: boolean | undefined;
82
80
  disableSilentRefresh?: boolean | undefined;
83
81
  sessionsPolicyState: import("..").SessionsPolicyState;
84
- /**
85
- * if you see error in matcher that's mean the DispatchAction does not
86
- * contains the same functions in reducers and actions
87
- */
88
82
  routes: import("..").AuthPageRoutes;
89
83
  header?: any;
90
84
  loaderComponent?: any;
@@ -30,10 +30,15 @@ declare const reducers: {
30
30
  mfaState: import("..").MFAState;
31
31
  teamState: import("..").TeamState;
32
32
  socialLoginState: import("..").SocialLoginState;
33
+ /**
34
+ * if you see error in matcher that's mean the DispatchAction does not
35
+ * contains the same functions in reducers and actions
36
+ */
33
37
  signUpState: import("..").SignUpState;
34
38
  apiTokensState: import("..").ApiTokensState;
35
39
  securityPolicyState: import("..").SecurityPolicyState;
36
40
  restrictionsState: import("..").RestrictionsState;
41
+ provisioningState: import("..").ProvisioningState;
37
42
  accountSettingsState: import("..").AccountSettingsState;
38
43
  tenantsState: import("..").TenantsState;
39
44
  rolesState: import("..").RolesState;
@@ -66,10 +71,15 @@ declare const reducers: {
66
71
  mfaState: import("..").MFAState;
67
72
  teamState: import("..").TeamState;
68
73
  socialLoginState: import("..").SocialLoginState;
74
+ /**
75
+ * if you see error in matcher that's mean the DispatchAction does not
76
+ * contains the same functions in reducers and actions
77
+ */
69
78
  signUpState: import("..").SignUpState;
70
79
  apiTokensState: import("..").ApiTokensState;
71
80
  securityPolicyState: import("..").SecurityPolicyState;
72
81
  restrictionsState: import("..").RestrictionsState;
82
+ provisioningState: import("..").ProvisioningState;
73
83
  accountSettingsState: import("..").AccountSettingsState;
74
84
  tenantsState: import("..").TenantsState;
75
85
  rolesState: import("..").RolesState;
@@ -108,10 +118,15 @@ declare const reducers: {
108
118
  mfaState: import("..").MFAState;
109
119
  teamState: import("..").TeamState;
110
120
  socialLoginState: import("..").SocialLoginState;
121
+ /**
122
+ * if you see error in matcher that's mean the DispatchAction does not
123
+ * contains the same functions in reducers and actions
124
+ */
111
125
  signUpState: import("..").SignUpState;
112
126
  apiTokensState: import("..").ApiTokensState;
113
127
  securityPolicyState: import("..").SecurityPolicyState;
114
128
  restrictionsState: import("..").RestrictionsState;
129
+ provisioningState: import("..").ProvisioningState;
115
130
  accountSettingsState: import("..").AccountSettingsState;
116
131
  tenantsState: import("..").TenantsState;
117
132
  rolesState: import("..").RolesState;
@@ -51,6 +51,7 @@ declare const reducers: {
51
51
  apiTokensState: ApiTokensState;
52
52
  securityPolicyState: import("..").SecurityPolicyState;
53
53
  restrictionsState: import("..").RestrictionsState;
54
+ provisioningState: import("..").ProvisioningState;
54
55
  accountSettingsState: import("..").AccountSettingsState;
55
56
  tenantsState: import("..").TenantsState;
56
57
  rolesState: import("..").RolesState;
@@ -87,6 +88,7 @@ declare const reducers: {
87
88
  apiTokensState: ApiTokensState;
88
89
  securityPolicyState: import("..").SecurityPolicyState;
89
90
  restrictionsState: import("..").RestrictionsState;
91
+ provisioningState: import("..").ProvisioningState;
90
92
  accountSettingsState: import("..").AccountSettingsState;
91
93
  tenantsState: import("..").TenantsState;
92
94
  rolesState: import("..").RolesState;
@@ -34,6 +34,7 @@ declare const reducers: {
34
34
  apiTokensState: import("..").ApiTokensState;
35
35
  securityPolicyState: import("..").SecurityPolicyState;
36
36
  restrictionsState: import("..").RestrictionsState;
37
+ provisioningState: import("..").ProvisioningState;
37
38
  accountSettingsState: import("..").AccountSettingsState;
38
39
  tenantsState: import("..").TenantsState;
39
40
  rolesState: import("..").RolesState;
@@ -70,6 +71,7 @@ declare const reducers: {
70
71
  apiTokensState: import("..").ApiTokensState;
71
72
  securityPolicyState: import("..").SecurityPolicyState;
72
73
  restrictionsState: import("..").RestrictionsState;
74
+ provisioningState: import("..").ProvisioningState;
73
75
  accountSettingsState: import("..").AccountSettingsState;
74
76
  tenantsState: import("..").TenantsState;
75
77
  rolesState: import("..").RolesState;
@@ -35,6 +35,7 @@ declare const reducers: {
35
35
  apiTokensState: import("..").ApiTokensState;
36
36
  securityPolicyState: import("..").SecurityPolicyState;
37
37
  restrictionsState: import("..").RestrictionsState;
38
+ provisioningState: import("..").ProvisioningState;
38
39
  accountSettingsState: import("..").AccountSettingsState;
39
40
  tenantsState: import("..").TenantsState;
40
41
  rolesState: import("..").RolesState;
@@ -71,6 +72,7 @@ declare const reducers: {
71
72
  apiTokensState: import("..").ApiTokensState;
72
73
  securityPolicyState: import("..").SecurityPolicyState;
73
74
  restrictionsState: import("..").RestrictionsState;
75
+ provisioningState: import("..").ProvisioningState;
74
76
  accountSettingsState: import("..").AccountSettingsState;
75
77
  tenantsState: import("..").TenantsState;
76
78
  rolesState: import("..").RolesState;
@@ -35,6 +35,7 @@ declare const reducers: {
35
35
  apiTokensState: import("..").ApiTokensState;
36
36
  securityPolicyState: import("..").SecurityPolicyState;
37
37
  restrictionsState: import("..").RestrictionsState;
38
+ provisioningState: import("..").ProvisioningState;
38
39
  accountSettingsState: import("..").AccountSettingsState;
39
40
  tenantsState: import("..").TenantsState;
40
41
  rolesState: import("..").RolesState;
@@ -71,6 +72,7 @@ declare const reducers: {
71
72
  apiTokensState: import("..").ApiTokensState;
72
73
  securityPolicyState: import("..").SecurityPolicyState;
73
74
  restrictionsState: import("..").RestrictionsState;
75
+ provisioningState: import("..").ProvisioningState;
74
76
  accountSettingsState: import("..").AccountSettingsState;
75
77
  tenantsState: import("..").TenantsState;
76
78
  rolesState: import("..").RolesState;
@@ -34,6 +34,7 @@ declare const reducers: {
34
34
  apiTokensState: import("..").ApiTokensState;
35
35
  securityPolicyState: import("..").SecurityPolicyState;
36
36
  restrictionsState: import("..").RestrictionsState;
37
+ provisioningState: import("..").ProvisioningState;
37
38
  accountSettingsState: import("..").AccountSettingsState;
38
39
  tenantsState: import("..").TenantsState;
39
40
  rolesState: import("..").RolesState;
@@ -70,6 +71,7 @@ declare const reducers: {
70
71
  apiTokensState: import("..").ApiTokensState;
71
72
  securityPolicyState: import("..").SecurityPolicyState;
72
73
  restrictionsState: import("..").RestrictionsState;
74
+ provisioningState: import("..").ProvisioningState;
73
75
  accountSettingsState: import("..").AccountSettingsState;
74
76
  tenantsState: import("..").TenantsState;
75
77
  rolesState: import("..").RolesState;
@@ -0,0 +1,110 @@
1
+ import { Scim2CreateConnectionConfigRequest, Scim2CreateConnectionConfigResponse, Scim2PatchConnectionConfigRequest } from '@frontegg/rest-api';
2
+ import { ProvisioningState } from './interfaces';
3
+ import { WithCallback, WithId } from '../../interfaces';
4
+ declare const provisioningState: ProvisioningState;
5
+ declare const reducers: {
6
+ setProvisioningState: {
7
+ prepare: (payload: Partial<ProvisioningState>) => {
8
+ payload: Partial<ProvisioningState>;
9
+ };
10
+ reducer: (state: import("..").AuthState, { payload }: {
11
+ payload: Partial<ProvisioningState>;
12
+ type: string;
13
+ }) => {
14
+ onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
15
+ error?: any;
16
+ isAuthenticated: boolean;
17
+ userIp?: string | undefined;
18
+ isLoading: boolean;
19
+ keepSessionAlive?: boolean | undefined;
20
+ user?: import("..").User | null | undefined;
21
+ isSSOAuth: boolean;
22
+ ssoACS?: string | undefined;
23
+ loginState: import("..").LoginState;
24
+ activateState: import("..").ActivateAccountState;
25
+ acceptInvitationState: import("..").AcceptInvitationState;
26
+ forgotPasswordState: import("..").ForgotPasswordState;
27
+ resetPhoneNumberState: import("..").ResetPhoneNumberState;
28
+ ssoState: import("..").SSOState;
29
+ profileState: import("..").ProfileState;
30
+ mfaState: import("..").MFAState;
31
+ teamState: import("..").TeamState;
32
+ socialLoginState: import("..").SocialLoginState;
33
+ signUpState: import("..").SignUpState;
34
+ apiTokensState: import("..").ApiTokensState;
35
+ securityPolicyState: import("..").SecurityPolicyState;
36
+ restrictionsState: import("..").RestrictionsState;
37
+ provisioningState: ProvisioningState;
38
+ accountSettingsState: import("..").AccountSettingsState;
39
+ tenantsState: import("..").TenantsState;
40
+ rolesState: import("..").RolesState;
41
+ sessionsState: import("..").SessionsState;
42
+ hostedLoginBox?: boolean | undefined;
43
+ disableSilentRefresh?: boolean | undefined;
44
+ sessionsPolicyState: import("..").SessionsPolicyState;
45
+ routes: import("..").AuthPageRoutes;
46
+ header?: any;
47
+ loaderComponent?: any;
48
+ };
49
+ };
50
+ resetProvisioningState: (state: import("..").AuthState) => {
51
+ onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
52
+ error?: any;
53
+ isAuthenticated: boolean;
54
+ userIp?: string | undefined;
55
+ isLoading: boolean;
56
+ keepSessionAlive?: boolean | undefined;
57
+ user?: import("..").User | null | undefined;
58
+ isSSOAuth: boolean;
59
+ ssoACS?: string | undefined;
60
+ loginState: import("..").LoginState;
61
+ activateState: import("..").ActivateAccountState;
62
+ acceptInvitationState: import("..").AcceptInvitationState;
63
+ forgotPasswordState: import("..").ForgotPasswordState;
64
+ resetPhoneNumberState: import("..").ResetPhoneNumberState;
65
+ ssoState: import("..").SSOState;
66
+ profileState: import("..").ProfileState;
67
+ mfaState: import("..").MFAState;
68
+ teamState: import("..").TeamState;
69
+ socialLoginState: import("..").SocialLoginState;
70
+ signUpState: import("..").SignUpState;
71
+ apiTokensState: import("..").ApiTokensState;
72
+ securityPolicyState: import("..").SecurityPolicyState;
73
+ restrictionsState: import("..").RestrictionsState;
74
+ provisioningState: ProvisioningState;
75
+ accountSettingsState: import("..").AccountSettingsState;
76
+ tenantsState: import("..").TenantsState;
77
+ rolesState: import("..").RolesState;
78
+ sessionsState: import("..").SessionsState;
79
+ hostedLoginBox?: boolean | undefined;
80
+ disableSilentRefresh?: boolean | undefined;
81
+ sessionsPolicyState: import("..").SessionsPolicyState;
82
+ routes: import("..").AuthPageRoutes;
83
+ header?: any;
84
+ loaderComponent?: any;
85
+ };
86
+ };
87
+ declare const actions: {
88
+ loadProvisionConnections: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
89
+ createProvisionConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Scim2CreateConnectionConfigRequest, Scim2CreateConnectionConfigResponse>], WithCallback<Scim2CreateConnectionConfigRequest, Scim2CreateConnectionConfigResponse>, string, never, never>;
90
+ deleteProvisionConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<{
91
+ id: string;
92
+ }, boolean>], WithCallback<{
93
+ id: string;
94
+ }, boolean>, string, never, never>;
95
+ updateProvisionConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithId<Scim2PatchConnectionConfigRequest>], WithId<Scim2PatchConnectionConfigRequest>, string, never, never>;
96
+ };
97
+ /**
98
+ * To be used for actions types after dispatch, and should contains
99
+ * the reducers and actions as standalone function
100
+ */
101
+ declare type DispatchedActions = {
102
+ setProvisioningState: (state: Partial<ProvisioningState>) => void;
103
+ resetProvisioningState: () => void;
104
+ loadProvisionConnections: () => void;
105
+ createProvisionConnection: (payload: WithCallback<Scim2CreateConnectionConfigRequest, Scim2CreateConnectionConfigResponse>) => void;
106
+ deleteProvisionConnection: (payload: WithCallback<WithId>) => void;
107
+ updateProvisionConnection: (payload: WithId<Scim2PatchConnectionConfigRequest>) => void;
108
+ };
109
+ export declare type ProvisioningActions = DispatchedActions;
110
+ export { provisioningState, reducers as provisioningReducers, actions as provisioningActions };
@@ -0,0 +1,37 @@
1
+ import { createAction } from '@reduxjs/toolkit';
2
+ import { resetStateByKey, typeReducerForKey } from '../utils';
3
+ import { authStoreName } from '../../constants';
4
+ const provisioningState = {
5
+ loading: false
6
+ };
7
+ const reducers = {
8
+ setProvisioningState: typeReducerForKey('provisioningState'),
9
+ resetProvisioningState: resetStateByKey('provisioningState', {
10
+ provisioningState
11
+ })
12
+ };
13
+ const actions = {
14
+ loadProvisionConnections: createAction(`${authStoreName}/loadProvisionConnections`),
15
+ createProvisionConnection: createAction(`${authStoreName}/createProvisionConnection`, payload => ({
16
+ payload
17
+ })),
18
+ deleteProvisionConnection: createAction(`${authStoreName}/deleteProvisionConnection`, payload => ({
19
+ payload
20
+ })),
21
+ updateProvisionConnection: createAction(`${authStoreName}/updateProvisionConnection`, payload => ({
22
+ payload
23
+ }))
24
+ };
25
+ /**
26
+ * To be used for actions types after dispatch, and should contains
27
+ * the reducers and actions as standalone function
28
+ */
29
+
30
+ // noinspection JSUnusedLocalSymbols
31
+
32
+ /**
33
+ * if you see error in matcher that's mean the DispatchAction does not
34
+ * contains the same functions in reducers and actions
35
+ */
36
+ const Matcher = {};
37
+ export { provisioningState, reducers as provisioningReducers, actions as provisioningActions };
@@ -0,0 +1,6 @@
1
+ import { WithStatus } from '../../interfaces';
2
+ import { Scim2ConnectionConfigResponse, Scim2CountResponse } from '@frontegg/rest-api';
3
+ export declare type Scim2ConnectionConfig = Scim2ConnectionConfigResponse & Scim2CountResponse;
4
+ export declare type ProvisioningState = WithStatus & {
5
+ connections?: Scim2ConnectionConfig[];
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function provisionSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
@@ -0,0 +1,132 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["callback"],
4
+ _excluded2 = ["id"];
5
+ import { all, call, put, takeEvery, takeLeading } from 'redux-saga/effects';
6
+ import { api } from '@frontegg/rest-api';
7
+ import { actions } from '../reducer';
8
+
9
+ function* loadCountForConnection(connection) {
10
+ const {
11
+ count
12
+ } = yield call(api.directory.countConfigurationUsers, connection.id);
13
+ return _extends({}, connection, {
14
+ count
15
+ });
16
+ }
17
+
18
+ function* loadScim2Connections() {
19
+ yield put(actions.setProvisioningState({
20
+ loading: true,
21
+ error: null
22
+ }));
23
+
24
+ try {
25
+ const connections = yield call(api.directory.getConfigs);
26
+ const connectionsWithCount = yield all(connections.map(connection => loadCountForConnection(connection)));
27
+ yield put(actions.setProvisioningState({
28
+ connections: connectionsWithCount,
29
+ loading: false
30
+ }));
31
+ } catch (e) {
32
+ yield put(actions.setProvisioningState({
33
+ error: e.message,
34
+ loading: false
35
+ }));
36
+ }
37
+ }
38
+
39
+ function* createScim2Connection(_ref) {
40
+ let {
41
+ payload: {
42
+ callback
43
+ }
44
+ } = _ref,
45
+ newConnectionBody = _objectWithoutPropertiesLoose(_ref.payload, _excluded);
46
+
47
+ yield put(actions.setProvisioningState({
48
+ loading: true,
49
+ error: null
50
+ }));
51
+
52
+ try {
53
+ const newConnectionResponse = yield call(api.directory.createConfiguration, newConnectionBody);
54
+ const connections = yield call(api.directory.getConfigs);
55
+ const connectionsWithCount = yield all(connections.map(connection => loadCountForConnection(connection)));
56
+ yield put(actions.setProvisioningState({
57
+ connections: connectionsWithCount,
58
+ loading: false
59
+ }));
60
+ callback == null ? void 0 : callback(newConnectionResponse);
61
+ } catch (e) {
62
+ yield put(actions.setProvisioningState({
63
+ error: e.message,
64
+ loading: false
65
+ }));
66
+ }
67
+ }
68
+
69
+ function* updateScim2Connection(_ref2) {
70
+ let {
71
+ payload: {
72
+ id
73
+ }
74
+ } = _ref2,
75
+ updateRequest = _objectWithoutPropertiesLoose(_ref2.payload, _excluded2);
76
+
77
+ yield put(actions.setProvisioningState({
78
+ loading: true,
79
+ error: null
80
+ }));
81
+
82
+ try {
83
+ yield call(api.directory.updateConfiguration, id, updateRequest);
84
+ const connections = yield call(api.directory.getConfigs);
85
+ const connectionsWithCount = yield all(connections.map(connection => loadCountForConnection(connection)));
86
+ yield put(actions.setProvisioningState({
87
+ connections: connectionsWithCount,
88
+ loading: false
89
+ }));
90
+ } catch (e) {
91
+ yield put(actions.setProvisioningState({
92
+ error: e.message,
93
+ loading: false
94
+ }));
95
+ }
96
+ }
97
+
98
+ function* deleteScim2Connection({
99
+ payload: {
100
+ id,
101
+ callback
102
+ }
103
+ }) {
104
+ yield put(actions.setProvisioningState({
105
+ loading: true,
106
+ error: null
107
+ }));
108
+
109
+ try {
110
+ yield call(api.directory.deleteConfiguration, id);
111
+ const connections = yield call(api.directory.getConfigs);
112
+ const connectionsWithCount = yield all(connections.map(connection => loadCountForConnection(connection)));
113
+ yield put(actions.setProvisioningState({
114
+ connections: connectionsWithCount,
115
+ loading: false
116
+ }));
117
+ callback == null ? void 0 : callback(true);
118
+ } catch (e) {
119
+ yield put(actions.setProvisioningState({
120
+ error: e.message,
121
+ loading: false
122
+ }));
123
+ callback == null ? void 0 : callback(false, e);
124
+ }
125
+ }
126
+
127
+ export function* provisionSagas() {
128
+ yield takeLeading(actions.loadProvisionConnections, loadScim2Connections);
129
+ yield takeEvery(actions.createProvisionConnection, createScim2Connection);
130
+ yield takeEvery(actions.deleteProvisionConnection, deleteScim2Connection);
131
+ yield takeEvery(actions.updateProvisionConnection, updateScim2Connection);
132
+ }
@@ -34,6 +34,7 @@ declare const reducers: {
34
34
  apiTokensState: import("..").ApiTokensState;
35
35
  securityPolicyState: import("..").SecurityPolicyState;
36
36
  restrictionsState: import("..").RestrictionsState;
37
+ provisioningState: import("..").ProvisioningState;
37
38
  accountSettingsState: import("..").AccountSettingsState;
38
39
  tenantsState: import("..").TenantsState;
39
40
  rolesState: import("..").RolesState;
@@ -70,6 +71,7 @@ declare const reducers: {
70
71
  apiTokensState: import("..").ApiTokensState;
71
72
  securityPolicyState: import("..").SecurityPolicyState;
72
73
  restrictionsState: import("..").RestrictionsState;
74
+ provisioningState: import("..").ProvisioningState;
73
75
  accountSettingsState: import("..").AccountSettingsState;
74
76
  tenantsState: import("..").TenantsState;
75
77
  rolesState: import("..").RolesState;
@@ -34,6 +34,7 @@ declare const reducers: {
34
34
  apiTokensState: import("..").ApiTokensState;
35
35
  securityPolicyState: import("..").SecurityPolicyState;
36
36
  restrictionsState: RestrictionsState;
37
+ provisioningState: import("..").ProvisioningState;
37
38
  accountSettingsState: import("..").AccountSettingsState;
38
39
  tenantsState: import("..").TenantsState;
39
40
  rolesState: import("..").RolesState;
@@ -77,6 +78,7 @@ declare const reducers: {
77
78
  apiTokensState: import("..").ApiTokensState;
78
79
  securityPolicyState: import("..").SecurityPolicyState;
79
80
  restrictionsState: RestrictionsState;
81
+ provisioningState: import("..").ProvisioningState;
80
82
  accountSettingsState: import("..").AccountSettingsState;
81
83
  tenantsState: import("..").TenantsState;
82
84
  rolesState: import("..").RolesState;
@@ -120,6 +122,7 @@ declare const reducers: {
120
122
  apiTokensState: import("..").ApiTokensState;
121
123
  securityPolicyState: import("..").SecurityPolicyState;
122
124
  restrictionsState: RestrictionsState;
125
+ provisioningState: import("..").ProvisioningState;
123
126
  accountSettingsState: import("..").AccountSettingsState;
124
127
  tenantsState: import("..").TenantsState;
125
128
  rolesState: import("..").RolesState;
@@ -11,6 +11,7 @@ const _excluded = ["callback"],
11
11
  import { all, call, put, select as sagaSelect, takeEvery, takeLeading } from 'redux-saga/effects';
12
12
  import { api, RestrictionType } from '@frontegg/rest-api';
13
13
  import { actions } from '../reducer';
14
+ import { v4 as uuid } from 'uuid';
14
15
  import { authStoreName } from '../../constants';
15
16
  import { dummyIpConfig, dummyIps } from '../dummy';
16
17
  import { delay } from '../utils';
@@ -479,7 +480,7 @@ function* checkIfUserIpValidMock() {
479
480
  }
480
481
 
481
482
  function* saveIpRestrictionMock(_ref5) {
482
- var _ipRestrictionsState$4, _ipRestrictionsState$5;
483
+ var _ipRestrictionsState$4, _ipRestrictionsState$5, _newRestriction$isAct;
483
484
 
484
485
  let {
485
486
  payload: {
@@ -493,17 +494,18 @@ function* saveIpRestrictionMock(_ref5) {
493
494
  error: null
494
495
  }));
495
496
  const ipRestrictionsState = yield selectIpRestrictionsState();
497
+ const filteredRestrictions = ipRestrictionsState.data.restrictions.filter(r => r.ip !== newRestriction.ip);
496
498
  yield put(actions.setIpRestrictionsState({
497
499
  data: {
498
500
  config: (_ipRestrictionsState$4 = (_ipRestrictionsState$5 = ipRestrictionsState.data) == null ? void 0 : _ipRestrictionsState$5.config) != null ? _ipRestrictionsState$4 : {
499
501
  isActive: false,
500
502
  strategy: RestrictionType.ALLOW
501
503
  },
502
- restrictions: [...ipRestrictionsState.data.restrictions, _extends({}, newRestriction, {
504
+ restrictions: [...filteredRestrictions, _extends({}, newRestriction, {
503
505
  createdAt: new Date(),
504
506
  updatedAt: new Date(),
505
- id: '123',
506
- isActive: true,
507
+ id: uuid(),
508
+ isActive: (_newRestriction$isAct = newRestriction.isActive) != null ? _newRestriction$isAct : true,
507
509
  strategy: ipRestrictionsState.data.config.strategy
508
510
  })]
509
511
  },
@@ -519,6 +521,8 @@ function* saveIpRestrictionMock(_ref5) {
519
521
  }
520
522
 
521
523
  function* saveIpRestrictionsConfigMock(_ref6) {
524
+ var _ipRestrictionsState$6, _ipRestrictionsState$7, _ipRestrictionsState$8;
525
+
522
526
  let {
523
527
  payload: {
524
528
  callback
@@ -526,14 +530,15 @@ function* saveIpRestrictionsConfigMock(_ref6) {
526
530
  } = _ref6,
527
531
  config = _objectWithoutPropertiesLoose(_ref6.payload, _excluded6);
528
532
 
533
+ const ipRestrictionsState = yield selectIpRestrictionsState();
529
534
  yield put(actions.setIpRestrictionsState({
530
535
  saving: true,
531
536
  error: null
532
537
  }));
533
538
  yield put(actions.setIpRestrictionsState({
534
539
  data: {
535
- config,
536
- restrictions: dummyIps.filter(ip => ip.strategy === config.strategy)
540
+ config: _extends({}, (_ipRestrictionsState$6 = ipRestrictionsState.data) == null ? void 0 : _ipRestrictionsState$6.config, config),
541
+ restrictions: (_ipRestrictionsState$7 = (_ipRestrictionsState$8 = ipRestrictionsState.data) == null ? void 0 : _ipRestrictionsState$8.restrictions) != null ? _ipRestrictionsState$7 : []
537
542
  },
538
543
  pagination: {
539
544
  _filter: RestrictionType.ALLOW,
@@ -552,10 +557,11 @@ function* saveIpRestrictionsConfigMock(_ref6) {
552
557
 
553
558
  function* deleteIpRestrictionMock({
554
559
  payload: {
555
- id
560
+ id,
561
+ callback
556
562
  }
557
563
  }) {
558
- var _ipRestrictionsState$6;
564
+ var _ipRestrictionsState$9;
559
565
 
560
566
  yield put(actions.setIpRestrictionsState({
561
567
  saving: true,
@@ -564,7 +570,7 @@ function* deleteIpRestrictionMock({
564
570
  const ipRestrictionsState = yield selectIpRestrictionsState();
565
571
  yield put(actions.setIpRestrictionsState({
566
572
  data: {
567
- config: ((_ipRestrictionsState$6 = ipRestrictionsState.data) == null ? void 0 : _ipRestrictionsState$6.config) || {
573
+ config: ((_ipRestrictionsState$9 = ipRestrictionsState.data) == null ? void 0 : _ipRestrictionsState$9.config) || {
568
574
  isActive: false,
569
575
  strategy: RestrictionType.ALLOW
570
576
  },
@@ -576,8 +582,10 @@ function* deleteIpRestrictionMock({
576
582
  _offset: 0
577
583
  },
578
584
  totalPages: 1,
579
- saving: false
585
+ saving: false,
586
+ error: null
580
587
  }));
588
+ callback == null ? void 0 : callback(true);
581
589
  }
582
590
 
583
591
  function* addCurrentUserIpAndActivateMock({
@@ -615,7 +623,6 @@ function* loadEmailDomainRestrictionsMock() {
615
623
  loading: true,
616
624
  error: null
617
625
  }));
618
- yield delay();
619
626
  yield put(actions.setEmailDomainRestrictionsState({
620
627
  loading: false,
621
628
  data: {
@@ -34,6 +34,7 @@ declare const reducers: {
34
34
  apiTokensState: import("..").ApiTokensState;
35
35
  securityPolicyState: import("..").SecurityPolicyState;
36
36
  restrictionsState: import("..").RestrictionsState;
37
+ provisioningState: import("..").ProvisioningState;
37
38
  accountSettingsState: import("..").AccountSettingsState;
38
39
  tenantsState: import("..").TenantsState;
39
40
  rolesState: RolesState;
@@ -70,6 +71,7 @@ declare const reducers: {
70
71
  apiTokensState: import("..").ApiTokensState;
71
72
  securityPolicyState: import("..").SecurityPolicyState;
72
73
  restrictionsState: import("..").RestrictionsState;
74
+ provisioningState: import("..").ProvisioningState;
73
75
  accountSettingsState: import("..").AccountSettingsState;
74
76
  tenantsState: import("..").TenantsState;
75
77
  rolesState: RolesState;
@@ -52,6 +52,7 @@ declare const reducers: {
52
52
  apiTokensState: import("..").ApiTokensState;
53
53
  securityPolicyState: import("..").SecurityPolicyState;
54
54
  restrictionsState: import("..").RestrictionsState;
55
+ provisioningState: import("..").ProvisioningState;
55
56
  accountSettingsState: import("..").AccountSettingsState;
56
57
  tenantsState: import("..").TenantsState;
57
58
  rolesState: import("..").RolesState;
@@ -88,6 +89,7 @@ declare const reducers: {
88
89
  apiTokensState: import("..").ApiTokensState;
89
90
  securityPolicyState: import("..").SecurityPolicyState;
90
91
  restrictionsState: import("..").RestrictionsState;
92
+ provisioningState: import("..").ProvisioningState;
91
93
  accountSettingsState: import("..").AccountSettingsState;
92
94
  tenantsState: import("..").TenantsState;
93
95
  rolesState: import("..").RolesState;