@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.
Files changed (254) hide show
  1. package/audits/AuditLogsState/index.js +1 -1
  2. package/audits/AuditLogsState/saga.js +1 -18
  3. package/audits/AuditsMetadataState/index.js +1 -1
  4. package/audits/AuditsMetadataState/saga.js +1 -5
  5. package/audits/backward-compatibility/saga.js +0 -18
  6. package/audits/dummy.js +0 -16
  7. package/audits/index.js +4 -2
  8. package/audits/reducer.js +0 -2
  9. package/auth/AcceptInvitationState/index.d.ts +2 -0
  10. package/auth/AcceptInvitationState/index.js +1 -1
  11. package/auth/AcceptInvitationState/interfaces.js +0 -1
  12. package/auth/AcceptInvitationState/saga.js +0 -3
  13. package/auth/AccountSettingsState/index.d.ts +2 -0
  14. package/auth/AccountSettingsState/index.js +1 -1
  15. package/auth/AccountSettingsState/interfaces.d.ts +2 -0
  16. package/auth/AccountSettingsState/saga.js +1 -11
  17. package/auth/ActivateState/index.d.ts +3 -0
  18. package/auth/ActivateState/index.js +1 -1
  19. package/auth/ActivateState/interfaces.js +0 -1
  20. package/auth/ActivateState/saga.js +14 -34
  21. package/auth/ApiTokensState/index.d.ts +2 -0
  22. package/auth/ApiTokensState/index.js +1 -1
  23. package/auth/ApiTokensState/interfaces.d.ts +1 -0
  24. package/auth/ApiTokensState/interfaces.js +0 -1
  25. package/auth/ApiTokensState/saga.js +1 -44
  26. package/auth/ForgotPasswordState/index.d.ts +2 -0
  27. package/auth/ForgotPasswordState/index.js +1 -1
  28. package/auth/ForgotPasswordState/interfaces.js +0 -1
  29. package/auth/ForgotPasswordState/saga.js +5 -12
  30. package/auth/ImpersonationState/index.d.ts +2 -0
  31. package/auth/ImpersonationState/index.js +1 -1
  32. package/auth/ImpersonationState/interfaces.js +0 -1
  33. package/auth/ImpersonationState/saga.js +5 -9
  34. package/auth/LoginState/index.d.ts +2 -0
  35. package/auth/LoginState/index.js +1 -1
  36. package/auth/LoginState/interfaces.js +0 -6
  37. package/auth/LoginState/saga.d.ts +2 -38
  38. package/auth/LoginState/saga.js +132 -292
  39. package/auth/MfaState/index.d.ts +4 -2
  40. package/auth/MfaState/index.js +1 -1
  41. package/auth/MfaState/interfaces.d.ts +2 -2
  42. package/auth/MfaState/interfaces.js +0 -1
  43. package/auth/MfaState/saga.js +64 -143
  44. package/auth/ProfileState/index.d.ts +2 -0
  45. package/auth/ProfileState/index.js +1 -1
  46. package/auth/ProfileState/saga.js +22 -50
  47. package/auth/Provisioning/index.d.ts +2 -0
  48. package/auth/Provisioning/index.js +1 -1
  49. package/auth/Provisioning/saga.js +11 -23
  50. package/auth/ResetPhoneNumberState/index.d.ts +2 -0
  51. package/auth/ResetPhoneNumberState/index.js +1 -1
  52. package/auth/ResetPhoneNumberState/interfaces.js +0 -1
  53. package/auth/ResetPhoneNumberState/saga.js +17 -26
  54. package/auth/RestrictionsState/index.d.ts +3 -0
  55. package/auth/RestrictionsState/index.js +1 -1
  56. package/auth/RestrictionsState/saga.js +52 -105
  57. package/auth/RolesState/index.d.ts +2 -0
  58. package/auth/RolesState/index.js +1 -1
  59. package/auth/RolesState/saga.js +30 -51
  60. package/auth/SSOState/index.d.ts +2 -0
  61. package/auth/SSOState/index.js +1 -1
  62. package/auth/SSOState/interfaces.js +0 -3
  63. package/auth/SSOState/saga.js +10 -58
  64. package/auth/SSOState/saga.v2.js +13 -49
  65. package/auth/SecurityPolicyState/index.d.ts +13 -0
  66. package/auth/SecurityPolicyState/index.js +1 -1
  67. package/auth/SecurityPolicyState/saga.js +36 -90
  68. package/auth/SessionsPolicyState/index.d.ts +2 -0
  69. package/auth/SessionsPolicyState/index.js +1 -1
  70. package/auth/SessionsPolicyState/saga.js +7 -19
  71. package/auth/SessionsState/index.d.ts +2 -0
  72. package/auth/SessionsState/index.js +1 -1
  73. package/auth/SessionsState/saga.js +1 -15
  74. package/auth/SignUp/index.d.ts +2 -0
  75. package/auth/SignUp/index.js +1 -1
  76. package/auth/SignUp/interfaces.js +0 -1
  77. package/auth/SignUp/saga.js +6 -15
  78. package/auth/SocialLogins/index.d.ts +2 -0
  79. package/auth/SocialLogins/index.js +1 -1
  80. package/auth/SocialLogins/saga.js +10 -20
  81. package/auth/TeamState/index.d.ts +2 -0
  82. package/auth/TeamState/index.js +1 -1
  83. package/auth/TeamState/interfaces.js +0 -1
  84. package/auth/TeamState/saga.js +85 -205
  85. package/auth/TenantsState/index.d.ts +2 -0
  86. package/auth/TenantsState/index.js +1 -1
  87. package/auth/TenantsState/saga.js +1 -17
  88. package/auth/index.d.ts +2 -2
  89. package/auth/index.js +4 -3
  90. package/auth/interfaces.d.ts +2 -1
  91. package/auth/interfaces.js +0 -6
  92. package/auth/reducer.d.ts +2 -2
  93. package/auth/reducer.js +0 -2
  94. package/auth/saga.js +2 -1
  95. package/auth/utils.d.ts +4 -0
  96. package/auth/utils.js +7 -21
  97. package/connectivity/ConnectivityState/index.d.ts +9 -0
  98. package/connectivity/ConnectivityState/index.js +1 -1
  99. package/connectivity/consts.js +0 -5
  100. package/connectivity/index.js +4 -2
  101. package/connectivity/interfaces.d.ts +1 -0
  102. package/connectivity/reducer.js +0 -2
  103. package/connectivity/saga.js +48 -85
  104. package/helpers.js +4 -7
  105. package/index.js +1 -1
  106. package/node/audits/AuditLogsState/index.js +1 -8
  107. package/node/audits/AuditLogsState/saga.js +1 -26
  108. package/node/audits/AuditsMetadataState/index.js +1 -8
  109. package/node/audits/AuditsMetadataState/saga.js +1 -10
  110. package/node/audits/backward-compatibility/index.js +0 -8
  111. package/node/audits/backward-compatibility/reducer.js +0 -5
  112. package/node/audits/backward-compatibility/saga.js +0 -23
  113. package/node/audits/dummy.js +0 -19
  114. package/node/audits/index.js +0 -14
  115. package/node/audits/initialState.js +0 -3
  116. package/node/audits/reducer.js +0 -8
  117. package/node/audits/saga.js +0 -5
  118. package/node/audits/utils.js +0 -4
  119. package/node/auth/AcceptInvitationState/index.js +1 -7
  120. package/node/auth/AcceptInvitationState/interfaces.js +0 -1
  121. package/node/auth/AcceptInvitationState/saga.js +0 -7
  122. package/node/auth/AccountSettingsState/index.js +1 -6
  123. package/node/auth/AccountSettingsState/saga.js +1 -16
  124. package/node/auth/ActivateState/index.js +1 -7
  125. package/node/auth/ActivateState/interfaces.js +0 -1
  126. package/node/auth/ActivateState/saga.js +14 -41
  127. package/node/auth/ApiTokensState/index.js +1 -6
  128. package/node/auth/ApiTokensState/interfaces.js +0 -1
  129. package/node/auth/ApiTokensState/saga.js +1 -51
  130. package/node/auth/ForgotPasswordState/index.js +1 -7
  131. package/node/auth/ForgotPasswordState/interfaces.js +0 -1
  132. package/node/auth/ForgotPasswordState/saga.js +5 -19
  133. package/node/auth/ImpersonationState/index.js +1 -7
  134. package/node/auth/ImpersonationState/interfaces.js +0 -1
  135. package/node/auth/ImpersonationState/saga.js +5 -15
  136. package/node/auth/LoginState/index.js +1 -7
  137. package/node/auth/LoginState/interfaces.js +0 -7
  138. package/node/auth/LoginState/saga.js +132 -322
  139. package/node/auth/MfaState/index.js +1 -7
  140. package/node/auth/MfaState/interfaces.js +0 -1
  141. package/node/auth/MfaState/saga.js +64 -137
  142. package/node/auth/ProfileState/index.js +1 -6
  143. package/node/auth/ProfileState/saga.js +22 -58
  144. package/node/auth/Provisioning/index.js +1 -6
  145. package/node/auth/Provisioning/saga.js +11 -28
  146. package/node/auth/ResetPhoneNumberState/index.js +1 -7
  147. package/node/auth/ResetPhoneNumberState/interfaces.js +0 -1
  148. package/node/auth/ResetPhoneNumberState/saga.js +17 -32
  149. package/node/auth/RestrictionsState/index.js +1 -7
  150. package/node/auth/RestrictionsState/saga.js +52 -109
  151. package/node/auth/RolesState/index.js +1 -6
  152. package/node/auth/RolesState/saga.js +30 -54
  153. package/node/auth/SSOState/index.js +1 -6
  154. package/node/auth/SSOState/interfaces.js +0 -3
  155. package/node/auth/SSOState/saga.js +10 -63
  156. package/node/auth/SSOState/saga.v2.js +13 -53
  157. package/node/auth/SecurityPolicyState/index.js +1 -6
  158. package/node/auth/SecurityPolicyState/saga.js +36 -89
  159. package/node/auth/SessionsPolicyState/index.js +1 -6
  160. package/node/auth/SessionsPolicyState/saga.js +7 -24
  161. package/node/auth/SessionsState/index.js +1 -6
  162. package/node/auth/SessionsState/saga.js +1 -22
  163. package/node/auth/SignUp/index.js +1 -7
  164. package/node/auth/SignUp/interfaces.js +0 -1
  165. package/node/auth/SignUp/saga.js +6 -30
  166. package/node/auth/SocialLogins/index.js +1 -6
  167. package/node/auth/SocialLogins/saga.js +10 -33
  168. package/node/auth/TeamState/index.js +1 -6
  169. package/node/auth/TeamState/interfaces.js +0 -1
  170. package/node/auth/TeamState/saga.js +86 -190
  171. package/node/auth/TenantsState/index.js +1 -6
  172. package/node/auth/TenantsState/saga.js +1 -24
  173. package/node/auth/dummy.js +0 -5
  174. package/node/auth/index.js +0 -90
  175. package/node/auth/initialState.js +0 -23
  176. package/node/auth/interfaces.js +0 -6
  177. package/node/auth/reducer.js +0 -28
  178. package/node/auth/saga.js +2 -26
  179. package/node/auth/utils.js +7 -42
  180. package/node/connectivity/ConnectivityState/index.js +1 -7
  181. package/node/connectivity/consts.js +1 -7
  182. package/node/connectivity/index.js +0 -5
  183. package/node/connectivity/reducer.js +0 -6
  184. package/node/connectivity/saga.js +47 -91
  185. package/node/helpers.js +2 -14
  186. package/node/index.js +1 -17
  187. package/node/subscriptions/Billing/Information/index.js +0 -7
  188. package/node/subscriptions/Billing/Information/saga.js +1 -25
  189. package/node/subscriptions/Billing/Invoices/index.js +0 -6
  190. package/node/subscriptions/Billing/Invoices/saga.js +1 -13
  191. package/node/subscriptions/Billing/PaymentMethod/index.js +2 -8
  192. package/node/subscriptions/Billing/PaymentMethod/interfaces.js +0 -1
  193. package/node/subscriptions/Billing/PaymentMethod/saga.js +1 -17
  194. package/node/subscriptions/Billing/Subscription/index.js +0 -6
  195. package/node/subscriptions/Billing/Subscription/saga.js +3 -23
  196. package/node/subscriptions/Billing/index.js +0 -6
  197. package/node/subscriptions/Billing/interfaces.js +0 -8
  198. package/node/subscriptions/Billing/saga.js +0 -7
  199. package/node/subscriptions/Checkout/index.js +0 -6
  200. package/node/subscriptions/Checkout/saga.js +2 -22
  201. package/node/subscriptions/Config/index.js +0 -6
  202. package/node/subscriptions/Config/saga.js +1 -12
  203. package/node/subscriptions/Plans/index.js +0 -6
  204. package/node/subscriptions/Plans/saga.js +1 -13
  205. package/node/subscriptions/Stripe/index.js +0 -6
  206. package/node/subscriptions/Stripe/saga.js +0 -8
  207. package/node/subscriptions/VendorPublicConfig/index.js +0 -6
  208. package/node/subscriptions/VendorPublicConfig/saga.js +1 -9
  209. package/node/subscriptions/dummy.js +2 -4
  210. package/node/subscriptions/general.interfaces.js +0 -5
  211. package/node/subscriptions/index.js +0 -5
  212. package/node/subscriptions/interfaces.js +0 -14
  213. package/node/subscriptions/mapper.js +0 -11
  214. package/node/subscriptions/reducer.js +0 -9
  215. package/node/subscriptions/saga.js +0 -9
  216. package/node/subscriptions/utils.js +0 -6
  217. package/node/toolkit/index.js +0 -31
  218. package/node/toolkit/redux-saga.js +0 -3
  219. package/node/toolkit/redux.js +0 -1
  220. package/node/vendor/VendorState/index.js +1 -7
  221. package/node/vendor/index.js +0 -5
  222. package/node/vendor/reducer.js +0 -6
  223. package/node/vendor/saga.js +1 -9
  224. package/package.json +1 -1
  225. package/subscriptions/Billing/Information/index.js +0 -4
  226. package/subscriptions/Billing/Information/saga.js +1 -12
  227. package/subscriptions/Billing/Invoices/index.js +0 -4
  228. package/subscriptions/Billing/Invoices/saga.js +1 -5
  229. package/subscriptions/Billing/PaymentMethod/index.js +2 -6
  230. package/subscriptions/Billing/PaymentMethod/interfaces.js +1 -1
  231. package/subscriptions/Billing/PaymentMethod/saga.js +1 -9
  232. package/subscriptions/Billing/Subscription/index.js +0 -4
  233. package/subscriptions/Billing/Subscription/saga.js +3 -17
  234. package/subscriptions/Billing/interfaces.js +1 -0
  235. package/subscriptions/Checkout/index.js +0 -4
  236. package/subscriptions/Checkout/saga.js +2 -12
  237. package/subscriptions/Config/index.js +0 -4
  238. package/subscriptions/Config/saga.js +1 -7
  239. package/subscriptions/Plans/index.js +0 -2
  240. package/subscriptions/Plans/saga.js +1 -6
  241. package/subscriptions/Stripe/index.js +0 -4
  242. package/subscriptions/Stripe/saga.js +0 -4
  243. package/subscriptions/VendorPublicConfig/index.js +0 -2
  244. package/subscriptions/VendorPublicConfig/saga.js +1 -4
  245. package/subscriptions/dummy.js +3 -2
  246. package/subscriptions/general.interfaces.js +0 -5
  247. package/subscriptions/index.js +3 -1
  248. package/subscriptions/mapper.js +0 -5
  249. package/toolkit/index.d.ts +1 -1
  250. package/toolkit/index.js +0 -9
  251. package/vendor/VendorState/index.js +1 -0
  252. package/vendor/index.js +4 -2
  253. package/vendor/reducer.js +0 -2
  254. package/vendor/saga.js +1 -2
@@ -1,5 +1,4 @@
1
1
  export let SSOStateKeys;
2
-
3
2
  (function (SSOStateKeys) {
4
3
  SSOStateKeys["LOAD_SSO_CONFIGURATIONS"] = "LOAD_SSO_CONFIGURATIONS";
5
4
  SSOStateKeys["SAVE_SSO_CONFIGURATION"] = "SAVE_SSO_CONFIGURATION";
@@ -15,9 +14,7 @@ export let SSOStateKeys;
15
14
  SSOStateKeys["SAVE_SSO_GROUPS"] = "SAVE_SSO_GROUPS";
16
15
  SSOStateKeys["GET_SSO_AUTHORIZATION_ROLES"] = "GET_SSO_AUTHORIZATION_ROLES";
17
16
  })(SSOStateKeys || (SSOStateKeys = {}));
18
-
19
17
  export let SamlVendors;
20
-
21
18
  (function (SamlVendors) {
22
19
  SamlVendors["Saml"] = "saml";
23
20
  SamlVendors["Okta"] = "okta";
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["callback", "samlVendor"],
4
- _excluded2 = ["callback", "samlVendor"];
4
+ _excluded2 = ["callback", "samlVendor"];
5
5
  import { all, call, put, select, takeEvery } from 'redux-saga/effects';
6
6
  import { api } from '@frontegg/rest-api';
7
7
  import { actions } from '../reducer';
@@ -10,11 +10,9 @@ import { omitProps, readFileAsText } from '../../helpers';
10
10
  import { delay } from '../utils';
11
11
  import { samlConfigurationDemo, samlMetadataDemo, ssoStateDemo } from '../dummy';
12
12
  import { refreshToken } from '../LoginState/saga';
13
-
14
13
  function* loadSSOConfigurations() {
15
14
  try {
16
15
  var _samlMetadata$configu, _samlMetadata$configu2;
17
-
18
16
  yield put(actions.setSSOState({
19
17
  loading: true
20
18
  }));
@@ -37,7 +35,6 @@ function* loadSSOConfigurations() {
37
35
  }));
38
36
  }
39
37
  }
40
-
41
38
  function* saveSSOConfigurationsFile({
42
39
  payload: configFile
43
40
  }) {
@@ -47,7 +44,6 @@ function* saveSSOConfigurationsFile({
47
44
  error: undefined,
48
45
  [loaderKey]: true
49
46
  }));
50
-
51
47
  try {
52
48
  const metadata = yield readFileAsText(configFile[0]);
53
49
  const newSamlConfiguration = yield call(api.auth.updateSamlVendorMetadata, {
@@ -67,7 +63,6 @@ function* saveSSOConfigurationsFile({
67
63
  }));
68
64
  }
69
65
  }
70
-
71
66
  function* saveSSOConfigurationsFileWithCallback({
72
67
  payload
73
68
  }) {
@@ -81,7 +76,6 @@ function* saveSSOConfigurationsFileWithCallback({
81
76
  error: undefined,
82
77
  [loaderKey]: true
83
78
  }));
84
-
85
79
  try {
86
80
  const metadata = yield readFileAsText(configFile);
87
81
  const newSamlConfiguration = yield call(api.auth.updateSamlVendorMetadata, {
@@ -103,29 +97,22 @@ function* saveSSOConfigurationsFileWithCallback({
103
97
  callback == null ? void 0 : callback(null, e);
104
98
  }
105
99
  }
106
-
107
100
  function* saveSSOConfigurations({
108
101
  payload
109
102
  }) {
110
103
  const {
111
- callback,
112
- samlVendor
113
- } = payload,
114
- newSamlConfiguration = _objectWithoutPropertiesLoose(payload, _excluded);
115
-
104
+ callback,
105
+ samlVendor
106
+ } = payload,
107
+ newSamlConfiguration = _objectWithoutPropertiesLoose(payload, _excluded);
116
108
  const oldSamlConfiguration = yield select(state => state.auth.ssoState.samlConfiguration);
117
-
118
109
  const samlConfiguration = _extends({}, oldSamlConfiguration, newSamlConfiguration);
119
-
120
110
  let loaderKey = 'saving';
121
-
122
111
  if ((samlConfiguration == null ? void 0 : samlConfiguration.enabled) !== oldSamlConfiguration.enabled) {
123
112
  loaderKey = 'loading';
124
113
  }
125
-
126
114
  try {
127
115
  const firstTimeConfigure = !(samlConfiguration != null && samlConfiguration.domain);
128
-
129
116
  if (firstTimeConfigure) {
130
117
  yield put(actions.setSSOState({
131
118
  samlConfiguration: _extends({}, oldSamlConfiguration, samlConfiguration)
@@ -137,23 +124,18 @@ function* saveSSOConfigurations({
137
124
  [loaderKey]: true
138
125
  }));
139
126
  }
140
-
141
127
  if (payload.type === SamlVendors.Saml) {
142
128
  var _samlMetadata$configu3, _samlMetadata$configu4;
143
-
144
129
  const samlMetadata = yield call(api.metadata.getSamlMetadata);
145
130
  samlConfiguration.acsUrl = samlMetadata == null ? void 0 : (_samlMetadata$configu3 = samlMetadata.configuration) == null ? void 0 : _samlMetadata$configu3.acsUrl;
146
131
  samlConfiguration.spEntityId = samlMetadata == null ? void 0 : (_samlMetadata$configu4 = samlMetadata.configuration) == null ? void 0 : _samlMetadata$configu4.spEntityId;
147
132
  }
148
-
149
133
  const updateSamlConfiguration = omitProps(samlConfiguration, ['validated', 'generatedVerification', 'createdAt', 'updatedAt']);
150
-
151
134
  if ((oldSamlConfiguration == null ? void 0 : oldSamlConfiguration.domain) !== (updateSamlConfiguration == null ? void 0 : updateSamlConfiguration.domain)) {
152
135
  updateSamlConfiguration.ssoEndpoint = '';
153
136
  updateSamlConfiguration.publicCertificate = '';
154
137
  updateSamlConfiguration.signRequest = false;
155
138
  }
156
-
157
139
  updateSamlConfiguration.type = samlVendor == null ? void 0 : samlVendor.toLowerCase();
158
140
  const newSamlConfiguration = yield call(api.auth.updateSamlConfiguration, updateSamlConfiguration);
159
141
  newSamlConfiguration.isSamlActive = oldSamlConfiguration == null ? void 0 : oldSamlConfiguration.isSamlActive;
@@ -172,14 +154,12 @@ function* saveSSOConfigurations({
172
154
  callback == null ? void 0 : callback(null, e);
173
155
  }
174
156
  }
175
-
176
157
  function* validateSSODomain({
177
158
  payload: {
178
159
  callback
179
160
  } = {}
180
161
  }) {
181
162
  const samlConfiguration = yield select(state => state.auth.ssoState.samlConfiguration);
182
-
183
163
  try {
184
164
  yield put(actions.setSSOState({
185
165
  error: undefined,
@@ -205,7 +185,6 @@ function* validateSSODomain({
205
185
  callback == null ? void 0 : callback(null, e);
206
186
  }
207
187
  }
208
-
209
188
  function* getAuthorizationRoles() {
210
189
  try {
211
190
  const data = yield call(api.auth.getSamlRoles);
@@ -221,7 +200,6 @@ function* getAuthorizationRoles() {
221
200
  }));
222
201
  }
223
202
  }
224
-
225
203
  function* updateRolesGroups(groups) {
226
204
  try {
227
205
  yield all(groups.map(group => call(api.auth.updateSamlGroup, {
@@ -235,7 +213,6 @@ function* updateRolesGroups(groups) {
235
213
  }));
236
214
  }
237
215
  }
238
-
239
216
  function* updateAuthorizationRoles({
240
217
  payload: {
241
218
  callback,
@@ -251,11 +228,9 @@ function* updateAuthorizationRoles({
251
228
  yield call(api.auth.updateSamlRoles, {
252
229
  roleIds: authorizationRoles
253
230
  });
254
-
255
231
  if (groups) {
256
232
  yield updateRolesGroups(groups);
257
233
  }
258
-
259
234
  yield getAuthorizationRoles();
260
235
  yield put(actions.setSSOState({
261
236
  error: undefined,
@@ -270,7 +245,6 @@ function* updateAuthorizationRoles({
270
245
  callback == null ? void 0 : callback(null, e);
271
246
  }
272
247
  }
273
-
274
248
  function* deleteSamlGroupFunction({
275
249
  payload: {
276
250
  callback,
@@ -299,7 +273,6 @@ function* deleteSamlGroupFunction({
299
273
  callback == null ? void 0 : callback(null, e);
300
274
  }
301
275
  }
302
-
303
276
  function* createSamlGroupFunction({
304
277
  payload: {
305
278
  group,
@@ -330,7 +303,6 @@ function* createSamlGroupFunction({
330
303
  callback == null ? void 0 : callback(null, e);
331
304
  }
332
305
  }
333
-
334
306
  function* oidcPostloginFunction({
335
307
  payload
336
308
  }) {
@@ -339,7 +311,6 @@ function* oidcPostloginFunction({
339
311
  redirectUri: payload.redirectUri,
340
312
  RelayState: payload.state
341
313
  };
342
-
343
314
  try {
344
315
  yield put(actions.setSSOState({
345
316
  loading: true
@@ -351,7 +322,6 @@ function* oidcPostloginFunction({
351
322
  }));
352
323
  } catch (e) {
353
324
  var _e$message;
354
-
355
325
  yield put(actions.setSSOState({
356
326
  loading: false,
357
327
  error: (_e$message = e.message) != null ? _e$message : 'Failed to authenticate',
@@ -359,7 +329,6 @@ function* oidcPostloginFunction({
359
329
  }));
360
330
  }
361
331
  }
362
-
363
332
  export function* ssoSagas() {
364
333
  yield takeEvery(actions.loadSSOConfigurations, loadSSOConfigurations);
365
334
  yield takeEvery(actions.saveSSOConfigurations, saveSSOConfigurations);
@@ -372,6 +341,7 @@ export function* ssoSagas() {
372
341
  yield takeEvery(actions.createSamlGroup, createSamlGroupFunction);
373
342
  yield takeEvery(actions.oidcPostlogin, oidcPostloginFunction);
374
343
  }
344
+
375
345
  /*********************************
376
346
  * Preview Sagas
377
347
  *********************************/
@@ -387,7 +357,6 @@ function* loadSSOConfigurationsMock() {
387
357
  firstLoad: false
388
358
  }));
389
359
  }
390
-
391
360
  function* saveSSOConfigurationsFileMock({
392
361
  payload: configFile
393
362
  }) {
@@ -397,41 +366,31 @@ function* saveSSOConfigurationsFileMock({
397
366
  [loaderKey]: true
398
367
  }));
399
368
  const oldSamlConfiguration = yield select(state => state.auth.ssoState.samlConfiguration);
400
-
401
369
  const newSamlConfiguration = _extends({}, oldSamlConfiguration, {
402
370
  enabled: true
403
371
  }, configFile[0]);
404
-
405
372
  yield put(actions.setSSOState({
406
373
  samlConfiguration: newSamlConfiguration,
407
374
  error: undefined,
408
375
  [loaderKey]: false
409
376
  }));
410
377
  }
411
-
412
378
  function* saveSSOConfigurationsMock({
413
379
  payload
414
380
  }) {
415
381
  var _samlMetadataDemo$con, _samlMetadataDemo$con2;
416
-
417
382
  const {
418
- callback,
419
- samlVendor
420
- } = payload,
421
- newSamlConfiguration = _objectWithoutPropertiesLoose(payload, _excluded2);
422
-
383
+ callback,
384
+ samlVendor
385
+ } = payload,
386
+ newSamlConfiguration = _objectWithoutPropertiesLoose(payload, _excluded2);
423
387
  const oldSamlConfiguration = ssoStateDemo.samlConfiguration;
424
-
425
388
  const samlConfiguration = _extends({}, oldSamlConfiguration, newSamlConfiguration);
426
-
427
389
  let loaderKey = 'saving';
428
-
429
390
  if ((samlConfiguration == null ? void 0 : samlConfiguration.enabled) !== oldSamlConfiguration.enabled) {
430
391
  loaderKey = 'loading';
431
392
  }
432
-
433
393
  const firstTimeConfigure = !(samlConfiguration != null && samlConfiguration.domain);
434
-
435
394
  if (firstTimeConfigure) {
436
395
  yield put(actions.setSSOState({
437
396
  samlConfiguration: _extends({}, oldSamlConfiguration, samlConfiguration)
@@ -443,18 +402,15 @@ function* saveSSOConfigurationsMock({
443
402
  [loaderKey]: true
444
403
  }));
445
404
  }
446
-
447
405
  yield delay();
448
406
  samlConfiguration.acsUrl = samlMetadataDemo == null ? void 0 : (_samlMetadataDemo$con = samlMetadataDemo.configuration) == null ? void 0 : _samlMetadataDemo$con.acsUrl;
449
407
  samlConfiguration.spEntityId = samlMetadataDemo == null ? void 0 : (_samlMetadataDemo$con2 = samlMetadataDemo.configuration) == null ? void 0 : _samlMetadataDemo$con2.spEntityId;
450
408
  const updateSamlConfiguration = omitProps(samlConfiguration, ['validated', 'generatedVerification', 'createdAt', 'updatedAt']);
451
-
452
409
  if ((oldSamlConfiguration == null ? void 0 : oldSamlConfiguration.domain) !== (updateSamlConfiguration == null ? void 0 : updateSamlConfiguration.domain)) {
453
410
  updateSamlConfiguration.ssoEndpoint = '';
454
411
  updateSamlConfiguration.publicCertificate = '';
455
412
  updateSamlConfiguration.signRequest = false;
456
413
  }
457
-
458
414
  updateSamlConfiguration.type = samlVendor == null ? void 0 : samlVendor.toLowerCase();
459
415
  yield delay();
460
416
  yield put(actions.setSSOState({
@@ -464,7 +420,6 @@ function* saveSSOConfigurationsMock({
464
420
  }));
465
421
  callback == null ? void 0 : callback(true);
466
422
  }
467
-
468
423
  function* validateSSODomainMock({
469
424
  payload: {
470
425
  callback
@@ -485,7 +440,6 @@ function* validateSSODomainMock({
485
440
  }));
486
441
  callback == null ? void 0 : callback(true);
487
442
  }
488
-
489
443
  function* getAuthorizationRolesMock() {
490
444
  yield delay();
491
445
  const data = {
@@ -496,7 +450,6 @@ function* getAuthorizationRolesMock() {
496
450
  error: undefined
497
451
  }));
498
452
  }
499
-
500
453
  function* updateAuthorizationRolesMock({
501
454
  payload: {
502
455
  callback,
@@ -515,7 +468,6 @@ function* updateAuthorizationRolesMock({
515
468
  }));
516
469
  callback == null ? void 0 : callback(true);
517
470
  }
518
-
519
471
  export function* ssoSagasMock() {
520
472
  yield takeEvery(actions.loadSSOConfigurations, loadSSOConfigurationsMock);
521
473
  yield takeEvery(actions.saveSSOConfigurations, saveSSOConfigurationsMock);
@@ -1,14 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["callback"],
4
- _excluded2 = ["callback", "ssoConfigId"],
5
- _excluded3 = ["callback", "ssoConfigId"];
4
+ _excluded2 = ["callback", "ssoConfigId"],
5
+ _excluded3 = ["callback", "ssoConfigId"];
6
6
  import { all, call, put, select, takeEvery } from 'redux-saga/effects';
7
7
  import { api } from '@frontegg/rest-api';
8
8
  import { actions } from '../reducer';
9
9
  import { SSOStateKeys } from './interfaces';
10
10
  import { readFileAsText } from '../../helpers';
11
-
12
11
  function* loadOidc() {
13
12
  try {
14
13
  const oidcConfiguration = yield call(api.auth.getOidcConfiguration);
@@ -17,7 +16,6 @@ function* loadOidc() {
17
16
  return null;
18
17
  }
19
18
  }
20
-
21
19
  function* loadSaml() {
22
20
  try {
23
21
  const samlMetadata = yield call(api.metadata.getSamlMetadata);
@@ -26,7 +24,6 @@ function* loadSaml() {
26
24
  return null;
27
25
  }
28
26
  }
29
-
30
27
  function* loadSSOConfigurationsV2() {
31
28
  try {
32
29
  yield put(actions.setSSOLoader({
@@ -52,7 +49,6 @@ function* loadSSOConfigurationsV2() {
52
49
  }));
53
50
  }
54
51
  }
55
-
56
52
  function* saveSSOConfigurationV2({
57
53
  payload
58
54
  }) {
@@ -60,17 +56,13 @@ function* saveSSOConfigurationV2({
60
56
  key: SSOStateKeys.SAVE_SSO_CONFIGURATION,
61
57
  value: true
62
58
  }));
63
-
64
59
  const {
65
- callback
66
- } = payload,
67
- ssoConfiguration = _objectWithoutPropertiesLoose(payload, _excluded);
68
-
60
+ callback
61
+ } = payload,
62
+ ssoConfiguration = _objectWithoutPropertiesLoose(payload, _excluded);
69
63
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
70
-
71
64
  try {
72
65
  var _ssoConfiguration$ena;
73
-
74
66
  const newSsoConfiguration = yield call(api.auth.createSSOConfiguration, _extends({}, ssoConfiguration, {
75
67
  enabled: (_ssoConfiguration$ena = ssoConfiguration.enabled) != null ? _ssoConfiguration$ena : false
76
68
  }));
@@ -91,7 +83,6 @@ function* saveSSOConfigurationV2({
91
83
  }));
92
84
  }
93
85
  }
94
-
95
86
  function* saveSSOConfigurationByMetadata({
96
87
  payload
97
88
  }) {
@@ -104,7 +95,6 @@ function* saveSSOConfigurationByMetadata({
104
95
  callback
105
96
  } = payload;
106
97
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
107
-
108
98
  try {
109
99
  const metadata = yield readFileAsText(configFile);
110
100
  const newSsoConfiguration = yield call(api.auth.createSSOConfigurationByMetadata, {
@@ -127,7 +117,6 @@ function* saveSSOConfigurationByMetadata({
127
117
  }));
128
118
  }
129
119
  }
130
-
131
120
  function* updateSSOConfiguration({
132
121
  payload
133
122
  }) {
@@ -135,15 +124,12 @@ function* updateSSOConfiguration({
135
124
  key: SSOStateKeys.UPDATE_SSO_CONFIGURATION,
136
125
  value: true
137
126
  }));
138
-
139
127
  const {
140
- callback,
141
- ssoConfigId
142
- } = payload,
143
- ssoConfiguration = _objectWithoutPropertiesLoose(payload, _excluded2);
144
-
128
+ callback,
129
+ ssoConfigId
130
+ } = payload,
131
+ ssoConfiguration = _objectWithoutPropertiesLoose(payload, _excluded2);
145
132
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
146
-
147
133
  try {
148
134
  const newSsoConfiguration = yield call(api.auth.updateSSOConfiguration, ssoConfigId, ssoConfiguration);
149
135
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => ssoConfig.id === ssoConfigId ? newSsoConfiguration : ssoConfig);
@@ -164,7 +150,6 @@ function* updateSSOConfiguration({
164
150
  }));
165
151
  }
166
152
  }
167
-
168
153
  function* updateSSOConfigurationByMetadata({
169
154
  payload
170
155
  }) {
@@ -178,7 +163,6 @@ function* updateSSOConfigurationByMetadata({
178
163
  configFile
179
164
  } = payload;
180
165
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
181
-
182
166
  try {
183
167
  const metadata = yield readFileAsText(configFile);
184
168
  const newSsoConfiguration = yield call(api.auth.updateSSOConfigurationByMetadata, ssoConfigId, {
@@ -202,7 +186,6 @@ function* updateSSOConfigurationByMetadata({
202
186
  }));
203
187
  }
204
188
  }
205
-
206
189
  function* deleteSSOConfiguration({
207
190
  payload
208
191
  }) {
@@ -215,7 +198,6 @@ function* deleteSSOConfiguration({
215
198
  callback
216
199
  } = payload;
217
200
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
218
-
219
201
  try {
220
202
  yield call(api.auth.deleteSSOConfiguration, ssoConfigId);
221
203
  yield put(actions.setSSOState({
@@ -237,22 +219,19 @@ function* deleteSSOConfiguration({
237
219
  }));
238
220
  }
239
221
  }
240
-
241
222
  function* saveSSODomain({
242
223
  payload
243
224
  }) {
244
225
  const {
245
- callback,
246
- ssoConfigId
247
- } = payload,
248
- body = _objectWithoutPropertiesLoose(payload, _excluded3);
249
-
226
+ callback,
227
+ ssoConfigId
228
+ } = payload,
229
+ body = _objectWithoutPropertiesLoose(payload, _excluded3);
250
230
  yield put(actions.setSSOLoader({
251
231
  key: SSOStateKeys.SAVE_SSO_DOMAIN,
252
232
  value: true
253
233
  }));
254
234
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
255
-
256
235
  try {
257
236
  const domain = yield call(api.auth.createSSODomain, ssoConfigId, body);
258
237
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => {
@@ -261,7 +240,6 @@ function* saveSSODomain({
261
240
  domains: [...ssoConfig.domains, domain]
262
241
  });
263
242
  }
264
-
265
243
  return ssoConfig;
266
244
  });
267
245
  yield put(actions.setSSOState({
@@ -281,7 +259,6 @@ function* saveSSODomain({
281
259
  }));
282
260
  }
283
261
  }
284
-
285
262
  function* deleteSSODomain({
286
263
  payload
287
264
  }) {
@@ -295,7 +272,6 @@ function* deleteSSODomain({
295
272
  value: true
296
273
  }));
297
274
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
298
-
299
275
  try {
300
276
  yield call(api.auth.deleteSSODomain, ssoConfigId, domainId);
301
277
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => {
@@ -306,7 +282,6 @@ function* deleteSSODomain({
306
282
  }) => id !== domainId)
307
283
  });
308
284
  }
309
-
310
285
  return ssoConfig;
311
286
  });
312
287
  yield put(actions.setSSOState({
@@ -326,7 +301,6 @@ function* deleteSSODomain({
326
301
  }));
327
302
  }
328
303
  }
329
-
330
304
  function* validateSSODomainV2({
331
305
  payload
332
306
  }) {
@@ -340,7 +314,6 @@ function* validateSSODomainV2({
340
314
  value: true
341
315
  }));
342
316
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
343
-
344
317
  try {
345
318
  yield call(api.auth.validateSSODomain, ssoConfigId, domainId);
346
319
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => {
@@ -351,7 +324,6 @@ function* validateSSODomainV2({
351
324
  }) : ssoDomain)
352
325
  });
353
326
  }
354
-
355
327
  return ssoConfig;
356
328
  });
357
329
  yield put(actions.setSSOState({
@@ -371,7 +343,6 @@ function* validateSSODomainV2({
371
343
  }));
372
344
  }
373
345
  }
374
-
375
346
  function* setSSODefaultRoles({
376
347
  payload: {
377
348
  callback,
@@ -384,7 +355,6 @@ function* setSSODefaultRoles({
384
355
  value: true
385
356
  }));
386
357
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
387
-
388
358
  try {
389
359
  yield call(api.auth.setSSODefaultRoles, ssoConfigId, {
390
360
  roleIds
@@ -395,7 +365,6 @@ function* setSSODefaultRoles({
395
365
  roleIds
396
366
  });
397
367
  }
398
-
399
368
  return ssoConfig;
400
369
  });
401
370
  yield put(actions.setSSOState({
@@ -415,7 +384,6 @@ function* setSSODefaultRoles({
415
384
  }));
416
385
  }
417
386
  }
418
-
419
387
  function* setSSOGroups({
420
388
  payload: {
421
389
  groupsToAdd,
@@ -429,7 +397,6 @@ function* setSSOGroups({
429
397
  value: true
430
398
  }));
431
399
  const ssoConfigurations = yield select(state => state.auth.ssoState.ssoConfigurations);
432
-
433
400
  try {
434
401
  yield all(groupsToDelete.map(groupId => call(api.auth.deleteSSOGroup, ssoConfigId, groupId)));
435
402
  yield all(groupsToAdd.map(group => call(api.auth.createSSOGroup, ssoConfigId, group)));
@@ -440,7 +407,6 @@ function* setSSOGroups({
440
407
  groups
441
408
  });
442
409
  }
443
-
444
410
  return ssoConfig;
445
411
  });
446
412
  yield put(actions.setSSOState({
@@ -460,7 +426,6 @@ function* setSSOGroups({
460
426
  }));
461
427
  }
462
428
  }
463
-
464
429
  function* updateSSOGroups({
465
430
  payload: {
466
431
  ssoConfigId,
@@ -484,7 +449,6 @@ function* updateSSOGroups({
484
449
  }));
485
450
  }
486
451
  }
487
-
488
452
  export function* ssoSagas() {
489
453
  yield takeEvery(actions.loadSSOConfigurationsV2, loadSSOConfigurationsV2);
490
454
  yield takeEvery(actions.saveSSOConfigurationV2, saveSSOConfigurationV2);
@@ -18,6 +18,7 @@ declare const reducers: {
18
18
  user?: import("..").User | null | undefined;
19
19
  isSSOAuth: boolean;
20
20
  ssoACS?: string | undefined;
21
+ includeQueryParam?: boolean | undefined;
21
22
  loginState: import("..").LoginState;
22
23
  activateState: import("..").ActivateAccountState;
23
24
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -69,6 +70,7 @@ declare const reducers: {
69
70
  user?: import("..").User | null | undefined;
70
71
  isSSOAuth: boolean;
71
72
  ssoACS?: string | undefined;
73
+ includeQueryParam?: boolean | undefined;
72
74
  loginState: import("..").LoginState;
73
75
  activateState: import("..").ActivateAccountState;
74
76
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -120,6 +122,7 @@ declare const reducers: {
120
122
  user?: import("..").User | null | undefined;
121
123
  isSSOAuth: boolean;
122
124
  ssoACS?: string | undefined;
125
+ includeQueryParam?: boolean | undefined;
123
126
  loginState: import("..").LoginState;
124
127
  activateState: import("..").ActivateAccountState;
125
128
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -171,6 +174,7 @@ declare const reducers: {
171
174
  user?: import("..").User | null | undefined;
172
175
  isSSOAuth: boolean;
173
176
  ssoACS?: string | undefined;
177
+ includeQueryParam?: boolean | undefined;
174
178
  loginState: import("..").LoginState;
175
179
  activateState: import("..").ActivateAccountState;
176
180
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -222,6 +226,7 @@ declare const reducers: {
222
226
  user?: import("..").User | null | undefined;
223
227
  isSSOAuth: boolean;
224
228
  ssoACS?: string | undefined;
229
+ includeQueryParam?: boolean | undefined;
225
230
  loginState: import("..").LoginState;
226
231
  activateState: import("..").ActivateAccountState;
227
232
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -273,6 +278,7 @@ declare const reducers: {
273
278
  user?: import("..").User | null | undefined;
274
279
  isSSOAuth: boolean;
275
280
  ssoACS?: string | undefined;
281
+ includeQueryParam?: boolean | undefined;
276
282
  loginState: import("..").LoginState;
277
283
  activateState: import("..").ActivateAccountState;
278
284
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -324,6 +330,7 @@ declare const reducers: {
324
330
  user?: import("..").User | null | undefined;
325
331
  isSSOAuth: boolean;
326
332
  ssoACS?: string | undefined;
333
+ includeQueryParam?: boolean | undefined;
327
334
  loginState: import("..").LoginState;
328
335
  activateState: import("..").ActivateAccountState;
329
336
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -375,6 +382,7 @@ declare const reducers: {
375
382
  user?: import("..").User | null | undefined;
376
383
  isSSOAuth: boolean;
377
384
  ssoACS?: string | undefined;
385
+ includeQueryParam?: boolean | undefined;
378
386
  loginState: import("..").LoginState;
379
387
  activateState: import("..").ActivateAccountState;
380
388
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -426,6 +434,7 @@ declare const reducers: {
426
434
  user?: import("..").User | null | undefined;
427
435
  isSSOAuth: boolean;
428
436
  ssoACS?: string | undefined;
437
+ includeQueryParam?: boolean | undefined;
429
438
  loginState: import("..").LoginState;
430
439
  activateState: import("..").ActivateAccountState;
431
440
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -477,6 +486,7 @@ declare const reducers: {
477
486
  user?: import("..").User | null | undefined;
478
487
  isSSOAuth: boolean;
479
488
  ssoACS?: string | undefined;
489
+ includeQueryParam?: boolean | undefined;
480
490
  loginState: import("..").LoginState;
481
491
  activateState: import("..").ActivateAccountState;
482
492
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -528,6 +538,7 @@ declare const reducers: {
528
538
  user?: import("..").User | null | undefined;
529
539
  isSSOAuth: boolean;
530
540
  ssoACS?: string | undefined;
541
+ includeQueryParam?: boolean | undefined;
531
542
  loginState: import("..").LoginState;
532
543
  activateState: import("..").ActivateAccountState;
533
544
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -579,6 +590,7 @@ declare const reducers: {
579
590
  user?: import("..").User | null | undefined;
580
591
  isSSOAuth: boolean;
581
592
  ssoACS?: string | undefined;
593
+ includeQueryParam?: boolean | undefined;
582
594
  loginState: import("..").LoginState;
583
595
  activateState: import("..").ActivateAccountState;
584
596
  acceptInvitationState: import("..").AcceptInvitationState;
@@ -617,6 +629,7 @@ declare const reducers: {
617
629
  user?: import("..").User | null | undefined;
618
630
  isSSOAuth: boolean;
619
631
  ssoACS?: string | undefined;
632
+ includeQueryParam?: boolean | undefined;
620
633
  loginState: import("..").LoginState;
621
634
  activateState: import("..").ActivateAccountState;
622
635
  acceptInvitationState: import("..").AcceptInvitationState;