@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
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ssoState = exports.ssoReducers = exports.ssoActions = 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 ssoState = {
15
11
  firstLoad: true,
16
12
  loading: true,
@@ -92,14 +88,13 @@ const actions = {
92
88
  payload
93
89
  }))
94
90
  };
91
+
95
92
  /**
96
93
  * To be used for actions types after dispatch, and should contains
97
94
  * the reducers and actions as standalone function
98
95
  */
99
-
100
96
  exports.ssoActions = actions;
101
97
  // noinspection JSUnusedLocalSymbols
102
-
103
98
  /**
104
99
  * if you see error in matcher that's mean the DispatchAction does not
105
100
  * contains the same functions in reducers and actions
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.SamlVendors = exports.SSOStateKeys = void 0;
7
7
  let SSOStateKeys;
8
8
  exports.SSOStateKeys = SSOStateKeys;
9
-
10
9
  (function (SSOStateKeys) {
11
10
  SSOStateKeys["LOAD_SSO_CONFIGURATIONS"] = "LOAD_SSO_CONFIGURATIONS";
12
11
  SSOStateKeys["SAVE_SSO_CONFIGURATION"] = "SAVE_SSO_CONFIGURATION";
@@ -22,10 +21,8 @@ exports.SSOStateKeys = SSOStateKeys;
22
21
  SSOStateKeys["SAVE_SSO_GROUPS"] = "SAVE_SSO_GROUPS";
23
22
  SSOStateKeys["GET_SSO_AUTHORIZATION_ROLES"] = "GET_SSO_AUTHORIZATION_ROLES";
24
23
  })(SSOStateKeys || (exports.SSOStateKeys = SSOStateKeys = {}));
25
-
26
24
  let SamlVendors;
27
25
  exports.SamlVendors = SamlVendors;
28
-
29
26
  (function (SamlVendors) {
30
27
  SamlVendors["Saml"] = "saml";
31
28
  SamlVendors["Okta"] = "okta";
@@ -1,40 +1,26 @@
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.ssoSagas = ssoSagas;
9
8
  exports.ssoSagasMock = ssoSagasMock;
10
-
11
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
-
13
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
14
-
15
11
  var _effects = require("redux-saga/effects");
16
-
17
12
  var _restApi = require("@frontegg/rest-api");
18
-
19
13
  var _reducer = require("../reducer");
20
-
21
14
  var _interfaces = require("./interfaces");
22
-
23
15
  var _helpers = require("../../helpers");
24
-
25
16
  var _utils = require("../utils");
26
-
27
17
  var _dummy = require("../dummy");
28
-
29
18
  var _saga = require("../LoginState/saga");
30
-
31
19
  const _excluded = ["callback", "samlVendor"],
32
- _excluded2 = ["callback", "samlVendor"];
33
-
20
+ _excluded2 = ["callback", "samlVendor"];
34
21
  function* loadSSOConfigurations() {
35
22
  try {
36
23
  var _samlMetadata$configu, _samlMetadata$configu2;
37
-
38
24
  yield (0, _effects.put)(_reducer.actions.setSSOState({
39
25
  loading: true
40
26
  }));
@@ -57,7 +43,6 @@ function* loadSSOConfigurations() {
57
43
  }));
58
44
  }
59
45
  }
60
-
61
46
  function* saveSSOConfigurationsFile({
62
47
  payload: configFile
63
48
  }) {
@@ -67,7 +52,6 @@ function* saveSSOConfigurationsFile({
67
52
  error: undefined,
68
53
  [loaderKey]: true
69
54
  }));
70
-
71
55
  try {
72
56
  const metadata = yield (0, _helpers.readFileAsText)(configFile[0]);
73
57
  const newSamlConfiguration = yield (0, _effects.call)(_restApi.api.auth.updateSamlVendorMetadata, {
@@ -87,7 +71,6 @@ function* saveSSOConfigurationsFile({
87
71
  }));
88
72
  }
89
73
  }
90
-
91
74
  function* saveSSOConfigurationsFileWithCallback({
92
75
  payload
93
76
  }) {
@@ -101,7 +84,6 @@ function* saveSSOConfigurationsFileWithCallback({
101
84
  error: undefined,
102
85
  [loaderKey]: true
103
86
  }));
104
-
105
87
  try {
106
88
  const metadata = yield (0, _helpers.readFileAsText)(configFile);
107
89
  const newSamlConfiguration = yield (0, _effects.call)(_restApi.api.auth.updateSamlVendorMetadata, {
@@ -123,26 +105,22 @@ function* saveSSOConfigurationsFileWithCallback({
123
105
  callback == null ? void 0 : callback(null, e);
124
106
  }
125
107
  }
126
-
127
108
  function* saveSSOConfigurations({
128
109
  payload
129
110
  }) {
130
111
  const {
131
- callback,
132
- samlVendor
133
- } = payload,
134
- newSamlConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded);
112
+ callback,
113
+ samlVendor
114
+ } = payload,
115
+ newSamlConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded);
135
116
  const oldSamlConfiguration = yield (0, _effects.select)(state => state.auth.ssoState.samlConfiguration);
136
117
  const samlConfiguration = (0, _extends2.default)({}, oldSamlConfiguration, newSamlConfiguration);
137
118
  let loaderKey = 'saving';
138
-
139
119
  if ((samlConfiguration == null ? void 0 : samlConfiguration.enabled) !== oldSamlConfiguration.enabled) {
140
120
  loaderKey = 'loading';
141
121
  }
142
-
143
122
  try {
144
123
  const firstTimeConfigure = !(samlConfiguration != null && samlConfiguration.domain);
145
-
146
124
  if (firstTimeConfigure) {
147
125
  yield (0, _effects.put)(_reducer.actions.setSSOState({
148
126
  samlConfiguration: (0, _extends2.default)({}, oldSamlConfiguration, samlConfiguration)
@@ -154,23 +132,18 @@ function* saveSSOConfigurations({
154
132
  [loaderKey]: true
155
133
  }));
156
134
  }
157
-
158
135
  if (payload.type === _interfaces.SamlVendors.Saml) {
159
136
  var _samlMetadata$configu3, _samlMetadata$configu4;
160
-
161
137
  const samlMetadata = yield (0, _effects.call)(_restApi.api.metadata.getSamlMetadata);
162
138
  samlConfiguration.acsUrl = samlMetadata == null ? void 0 : (_samlMetadata$configu3 = samlMetadata.configuration) == null ? void 0 : _samlMetadata$configu3.acsUrl;
163
139
  samlConfiguration.spEntityId = samlMetadata == null ? void 0 : (_samlMetadata$configu4 = samlMetadata.configuration) == null ? void 0 : _samlMetadata$configu4.spEntityId;
164
140
  }
165
-
166
141
  const updateSamlConfiguration = (0, _helpers.omitProps)(samlConfiguration, ['validated', 'generatedVerification', 'createdAt', 'updatedAt']);
167
-
168
142
  if ((oldSamlConfiguration == null ? void 0 : oldSamlConfiguration.domain) !== (updateSamlConfiguration == null ? void 0 : updateSamlConfiguration.domain)) {
169
143
  updateSamlConfiguration.ssoEndpoint = '';
170
144
  updateSamlConfiguration.publicCertificate = '';
171
145
  updateSamlConfiguration.signRequest = false;
172
146
  }
173
-
174
147
  updateSamlConfiguration.type = samlVendor == null ? void 0 : samlVendor.toLowerCase();
175
148
  const newSamlConfiguration = yield (0, _effects.call)(_restApi.api.auth.updateSamlConfiguration, updateSamlConfiguration);
176
149
  newSamlConfiguration.isSamlActive = oldSamlConfiguration == null ? void 0 : oldSamlConfiguration.isSamlActive;
@@ -189,14 +162,12 @@ function* saveSSOConfigurations({
189
162
  callback == null ? void 0 : callback(null, e);
190
163
  }
191
164
  }
192
-
193
165
  function* validateSSODomain({
194
166
  payload: {
195
167
  callback
196
168
  } = {}
197
169
  }) {
198
170
  const samlConfiguration = yield (0, _effects.select)(state => state.auth.ssoState.samlConfiguration);
199
-
200
171
  try {
201
172
  yield (0, _effects.put)(_reducer.actions.setSSOState({
202
173
  error: undefined,
@@ -222,7 +193,6 @@ function* validateSSODomain({
222
193
  callback == null ? void 0 : callback(null, e);
223
194
  }
224
195
  }
225
-
226
196
  function* getAuthorizationRoles() {
227
197
  try {
228
198
  const data = yield (0, _effects.call)(_restApi.api.auth.getSamlRoles);
@@ -238,7 +208,6 @@ function* getAuthorizationRoles() {
238
208
  }));
239
209
  }
240
210
  }
241
-
242
211
  function* updateRolesGroups(groups) {
243
212
  try {
244
213
  yield (0, _effects.all)(groups.map(group => (0, _effects.call)(_restApi.api.auth.updateSamlGroup, {
@@ -252,7 +221,6 @@ function* updateRolesGroups(groups) {
252
221
  }));
253
222
  }
254
223
  }
255
-
256
224
  function* updateAuthorizationRoles({
257
225
  payload: {
258
226
  callback,
@@ -268,11 +236,9 @@ function* updateAuthorizationRoles({
268
236
  yield (0, _effects.call)(_restApi.api.auth.updateSamlRoles, {
269
237
  roleIds: authorizationRoles
270
238
  });
271
-
272
239
  if (groups) {
273
240
  yield updateRolesGroups(groups);
274
241
  }
275
-
276
242
  yield getAuthorizationRoles();
277
243
  yield (0, _effects.put)(_reducer.actions.setSSOState({
278
244
  error: undefined,
@@ -287,7 +253,6 @@ function* updateAuthorizationRoles({
287
253
  callback == null ? void 0 : callback(null, e);
288
254
  }
289
255
  }
290
-
291
256
  function* deleteSamlGroupFunction({
292
257
  payload: {
293
258
  callback,
@@ -316,7 +281,6 @@ function* deleteSamlGroupFunction({
316
281
  callback == null ? void 0 : callback(null, e);
317
282
  }
318
283
  }
319
-
320
284
  function* createSamlGroupFunction({
321
285
  payload: {
322
286
  group,
@@ -347,7 +311,6 @@ function* createSamlGroupFunction({
347
311
  callback == null ? void 0 : callback(null, e);
348
312
  }
349
313
  }
350
-
351
314
  function* oidcPostloginFunction({
352
315
  payload
353
316
  }) {
@@ -356,7 +319,6 @@ function* oidcPostloginFunction({
356
319
  redirectUri: payload.redirectUri,
357
320
  RelayState: payload.state
358
321
  };
359
-
360
322
  try {
361
323
  yield (0, _effects.put)(_reducer.actions.setSSOState({
362
324
  loading: true
@@ -368,7 +330,6 @@ function* oidcPostloginFunction({
368
330
  }));
369
331
  } catch (e) {
370
332
  var _e$message;
371
-
372
333
  yield (0, _effects.put)(_reducer.actions.setSSOState({
373
334
  loading: false,
374
335
  error: (_e$message = e.message) != null ? _e$message : 'Failed to authenticate',
@@ -376,7 +337,6 @@ function* oidcPostloginFunction({
376
337
  }));
377
338
  }
378
339
  }
379
-
380
340
  function* ssoSagas() {
381
341
  yield (0, _effects.takeEvery)(_reducer.actions.loadSSOConfigurations, loadSSOConfigurations);
382
342
  yield (0, _effects.takeEvery)(_reducer.actions.saveSSOConfigurations, saveSSOConfigurations);
@@ -389,11 +349,11 @@ function* ssoSagas() {
389
349
  yield (0, _effects.takeEvery)(_reducer.actions.createSamlGroup, createSamlGroupFunction);
390
350
  yield (0, _effects.takeEvery)(_reducer.actions.oidcPostlogin, oidcPostloginFunction);
391
351
  }
352
+
392
353
  /*********************************
393
354
  * Preview Sagas
394
355
  *********************************/
395
356
 
396
-
397
357
  function* loadSSOConfigurationsMock() {
398
358
  yield (0, _effects.put)(_reducer.actions.setSSOState({
399
359
  loading: true
@@ -405,7 +365,6 @@ function* loadSSOConfigurationsMock() {
405
365
  firstLoad: false
406
366
  }));
407
367
  }
408
-
409
368
  function* saveSSOConfigurationsFileMock({
410
369
  payload: configFile
411
370
  }) {
@@ -424,27 +383,22 @@ function* saveSSOConfigurationsFileMock({
424
383
  [loaderKey]: false
425
384
  }));
426
385
  }
427
-
428
386
  function* saveSSOConfigurationsMock({
429
387
  payload
430
388
  }) {
431
389
  var _samlMetadataDemo$con, _samlMetadataDemo$con2;
432
-
433
390
  const {
434
- callback,
435
- samlVendor
436
- } = payload,
437
- newSamlConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded2);
391
+ callback,
392
+ samlVendor
393
+ } = payload,
394
+ newSamlConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded2);
438
395
  const oldSamlConfiguration = _dummy.ssoStateDemo.samlConfiguration;
439
396
  const samlConfiguration = (0, _extends2.default)({}, oldSamlConfiguration, newSamlConfiguration);
440
397
  let loaderKey = 'saving';
441
-
442
398
  if ((samlConfiguration == null ? void 0 : samlConfiguration.enabled) !== oldSamlConfiguration.enabled) {
443
399
  loaderKey = 'loading';
444
400
  }
445
-
446
401
  const firstTimeConfigure = !(samlConfiguration != null && samlConfiguration.domain);
447
-
448
402
  if (firstTimeConfigure) {
449
403
  yield (0, _effects.put)(_reducer.actions.setSSOState({
450
404
  samlConfiguration: (0, _extends2.default)({}, oldSamlConfiguration, samlConfiguration)
@@ -456,18 +410,15 @@ function* saveSSOConfigurationsMock({
456
410
  [loaderKey]: true
457
411
  }));
458
412
  }
459
-
460
413
  yield (0, _utils.delay)();
461
414
  samlConfiguration.acsUrl = _dummy.samlMetadataDemo == null ? void 0 : (_samlMetadataDemo$con = _dummy.samlMetadataDemo.configuration) == null ? void 0 : _samlMetadataDemo$con.acsUrl;
462
415
  samlConfiguration.spEntityId = _dummy.samlMetadataDemo == null ? void 0 : (_samlMetadataDemo$con2 = _dummy.samlMetadataDemo.configuration) == null ? void 0 : _samlMetadataDemo$con2.spEntityId;
463
416
  const updateSamlConfiguration = (0, _helpers.omitProps)(samlConfiguration, ['validated', 'generatedVerification', 'createdAt', 'updatedAt']);
464
-
465
417
  if ((oldSamlConfiguration == null ? void 0 : oldSamlConfiguration.domain) !== (updateSamlConfiguration == null ? void 0 : updateSamlConfiguration.domain)) {
466
418
  updateSamlConfiguration.ssoEndpoint = '';
467
419
  updateSamlConfiguration.publicCertificate = '';
468
420
  updateSamlConfiguration.signRequest = false;
469
421
  }
470
-
471
422
  updateSamlConfiguration.type = samlVendor == null ? void 0 : samlVendor.toLowerCase();
472
423
  yield (0, _utils.delay)();
473
424
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -477,7 +428,6 @@ function* saveSSOConfigurationsMock({
477
428
  }));
478
429
  callback == null ? void 0 : callback(true);
479
430
  }
480
-
481
431
  function* validateSSODomainMock({
482
432
  payload: {
483
433
  callback
@@ -498,7 +448,6 @@ function* validateSSODomainMock({
498
448
  }));
499
449
  callback == null ? void 0 : callback(true);
500
450
  }
501
-
502
451
  function* getAuthorizationRolesMock() {
503
452
  yield (0, _utils.delay)();
504
453
  const data = {
@@ -509,7 +458,6 @@ function* getAuthorizationRolesMock() {
509
458
  error: undefined
510
459
  }));
511
460
  }
512
-
513
461
  function* updateAuthorizationRolesMock({
514
462
  payload: {
515
463
  callback,
@@ -528,7 +476,6 @@ function* updateAuthorizationRolesMock({
528
476
  }));
529
477
  callback == null ? void 0 : callback(true);
530
478
  }
531
-
532
479
  function* ssoSagasMock() {
533
480
  yield (0, _effects.takeEvery)(_reducer.actions.loadSSOConfigurations, loadSSOConfigurationsMock);
534
481
  yield (0, _effects.takeEvery)(_reducer.actions.saveSSOConfigurations, saveSSOConfigurationsMock);
@@ -1,30 +1,20 @@
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.ssoSagas = ssoSagas;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
-
14
10
  var _effects = require("redux-saga/effects");
15
-
16
11
  var _restApi = require("@frontegg/rest-api");
17
-
18
12
  var _reducer = require("../reducer");
19
-
20
13
  var _interfaces = require("./interfaces");
21
-
22
14
  var _helpers = require("../../helpers");
23
-
24
15
  const _excluded = ["callback"],
25
- _excluded2 = ["callback", "ssoConfigId"],
26
- _excluded3 = ["callback", "ssoConfigId"];
27
-
16
+ _excluded2 = ["callback", "ssoConfigId"],
17
+ _excluded3 = ["callback", "ssoConfigId"];
28
18
  function* loadOidc() {
29
19
  try {
30
20
  const oidcConfiguration = yield (0, _effects.call)(_restApi.api.auth.getOidcConfiguration);
@@ -33,7 +23,6 @@ function* loadOidc() {
33
23
  return null;
34
24
  }
35
25
  }
36
-
37
26
  function* loadSaml() {
38
27
  try {
39
28
  const samlMetadata = yield (0, _effects.call)(_restApi.api.metadata.getSamlMetadata);
@@ -42,7 +31,6 @@ function* loadSaml() {
42
31
  return null;
43
32
  }
44
33
  }
45
-
46
34
  function* loadSSOConfigurationsV2() {
47
35
  try {
48
36
  yield (0, _effects.put)(_reducer.actions.setSSOLoader({
@@ -68,7 +56,6 @@ function* loadSSOConfigurationsV2() {
68
56
  }));
69
57
  }
70
58
  }
71
-
72
59
  function* saveSSOConfigurationV2({
73
60
  payload
74
61
  }) {
@@ -77,14 +64,12 @@ function* saveSSOConfigurationV2({
77
64
  value: true
78
65
  }));
79
66
  const {
80
- callback
81
- } = payload,
82
- ssoConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded);
67
+ callback
68
+ } = payload,
69
+ ssoConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded);
83
70
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
84
-
85
71
  try {
86
72
  var _ssoConfiguration$ena;
87
-
88
73
  const newSsoConfiguration = yield (0, _effects.call)(_restApi.api.auth.createSSOConfiguration, (0, _extends2.default)({}, ssoConfiguration, {
89
74
  enabled: (_ssoConfiguration$ena = ssoConfiguration.enabled) != null ? _ssoConfiguration$ena : false
90
75
  }));
@@ -105,7 +90,6 @@ function* saveSSOConfigurationV2({
105
90
  }));
106
91
  }
107
92
  }
108
-
109
93
  function* saveSSOConfigurationByMetadata({
110
94
  payload
111
95
  }) {
@@ -118,7 +102,6 @@ function* saveSSOConfigurationByMetadata({
118
102
  callback
119
103
  } = payload;
120
104
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
121
-
122
105
  try {
123
106
  const metadata = yield (0, _helpers.readFileAsText)(configFile);
124
107
  const newSsoConfiguration = yield (0, _effects.call)(_restApi.api.auth.createSSOConfigurationByMetadata, {
@@ -141,7 +124,6 @@ function* saveSSOConfigurationByMetadata({
141
124
  }));
142
125
  }
143
126
  }
144
-
145
127
  function* updateSSOConfiguration({
146
128
  payload
147
129
  }) {
@@ -150,12 +132,11 @@ function* updateSSOConfiguration({
150
132
  value: true
151
133
  }));
152
134
  const {
153
- callback,
154
- ssoConfigId
155
- } = payload,
156
- ssoConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded2);
135
+ callback,
136
+ ssoConfigId
137
+ } = payload,
138
+ ssoConfiguration = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded2);
157
139
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
158
-
159
140
  try {
160
141
  const newSsoConfiguration = yield (0, _effects.call)(_restApi.api.auth.updateSSOConfiguration, ssoConfigId, ssoConfiguration);
161
142
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => ssoConfig.id === ssoConfigId ? newSsoConfiguration : ssoConfig);
@@ -176,7 +157,6 @@ function* updateSSOConfiguration({
176
157
  }));
177
158
  }
178
159
  }
179
-
180
160
  function* updateSSOConfigurationByMetadata({
181
161
  payload
182
162
  }) {
@@ -190,7 +170,6 @@ function* updateSSOConfigurationByMetadata({
190
170
  configFile
191
171
  } = payload;
192
172
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
193
-
194
173
  try {
195
174
  const metadata = yield (0, _helpers.readFileAsText)(configFile);
196
175
  const newSsoConfiguration = yield (0, _effects.call)(_restApi.api.auth.updateSSOConfigurationByMetadata, ssoConfigId, {
@@ -214,7 +193,6 @@ function* updateSSOConfigurationByMetadata({
214
193
  }));
215
194
  }
216
195
  }
217
-
218
196
  function* deleteSSOConfiguration({
219
197
  payload
220
198
  }) {
@@ -227,7 +205,6 @@ function* deleteSSOConfiguration({
227
205
  callback
228
206
  } = payload;
229
207
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
230
-
231
208
  try {
232
209
  yield (0, _effects.call)(_restApi.api.auth.deleteSSOConfiguration, ssoConfigId);
233
210
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -249,21 +226,19 @@ function* deleteSSOConfiguration({
249
226
  }));
250
227
  }
251
228
  }
252
-
253
229
  function* saveSSODomain({
254
230
  payload
255
231
  }) {
256
232
  const {
257
- callback,
258
- ssoConfigId
259
- } = payload,
260
- body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded3);
233
+ callback,
234
+ ssoConfigId
235
+ } = payload,
236
+ body = (0, _objectWithoutPropertiesLoose2.default)(payload, _excluded3);
261
237
  yield (0, _effects.put)(_reducer.actions.setSSOLoader({
262
238
  key: _interfaces.SSOStateKeys.SAVE_SSO_DOMAIN,
263
239
  value: true
264
240
  }));
265
241
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
266
-
267
242
  try {
268
243
  const domain = yield (0, _effects.call)(_restApi.api.auth.createSSODomain, ssoConfigId, body);
269
244
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => {
@@ -272,7 +247,6 @@ function* saveSSODomain({
272
247
  domains: [...ssoConfig.domains, domain]
273
248
  });
274
249
  }
275
-
276
250
  return ssoConfig;
277
251
  });
278
252
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -292,7 +266,6 @@ function* saveSSODomain({
292
266
  }));
293
267
  }
294
268
  }
295
-
296
269
  function* deleteSSODomain({
297
270
  payload
298
271
  }) {
@@ -306,7 +279,6 @@ function* deleteSSODomain({
306
279
  value: true
307
280
  }));
308
281
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
309
-
310
282
  try {
311
283
  yield (0, _effects.call)(_restApi.api.auth.deleteSSODomain, ssoConfigId, domainId);
312
284
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => {
@@ -317,7 +289,6 @@ function* deleteSSODomain({
317
289
  }) => id !== domainId)
318
290
  });
319
291
  }
320
-
321
292
  return ssoConfig;
322
293
  });
323
294
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -337,7 +308,6 @@ function* deleteSSODomain({
337
308
  }));
338
309
  }
339
310
  }
340
-
341
311
  function* validateSSODomainV2({
342
312
  payload
343
313
  }) {
@@ -351,7 +321,6 @@ function* validateSSODomainV2({
351
321
  value: true
352
322
  }));
353
323
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
354
-
355
324
  try {
356
325
  yield (0, _effects.call)(_restApi.api.auth.validateSSODomain, ssoConfigId, domainId);
357
326
  const newSsoConfigurations = ssoConfigurations.map(ssoConfig => {
@@ -362,7 +331,6 @@ function* validateSSODomainV2({
362
331
  }) : ssoDomain)
363
332
  });
364
333
  }
365
-
366
334
  return ssoConfig;
367
335
  });
368
336
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -382,7 +350,6 @@ function* validateSSODomainV2({
382
350
  }));
383
351
  }
384
352
  }
385
-
386
353
  function* setSSODefaultRoles({
387
354
  payload: {
388
355
  callback,
@@ -395,7 +362,6 @@ function* setSSODefaultRoles({
395
362
  value: true
396
363
  }));
397
364
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
398
-
399
365
  try {
400
366
  yield (0, _effects.call)(_restApi.api.auth.setSSODefaultRoles, ssoConfigId, {
401
367
  roleIds
@@ -406,7 +372,6 @@ function* setSSODefaultRoles({
406
372
  roleIds
407
373
  });
408
374
  }
409
-
410
375
  return ssoConfig;
411
376
  });
412
377
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -426,7 +391,6 @@ function* setSSODefaultRoles({
426
391
  }));
427
392
  }
428
393
  }
429
-
430
394
  function* setSSOGroups({
431
395
  payload: {
432
396
  groupsToAdd,
@@ -440,7 +404,6 @@ function* setSSOGroups({
440
404
  value: true
441
405
  }));
442
406
  const ssoConfigurations = yield (0, _effects.select)(state => state.auth.ssoState.ssoConfigurations);
443
-
444
407
  try {
445
408
  yield (0, _effects.all)(groupsToDelete.map(groupId => (0, _effects.call)(_restApi.api.auth.deleteSSOGroup, ssoConfigId, groupId)));
446
409
  yield (0, _effects.all)(groupsToAdd.map(group => (0, _effects.call)(_restApi.api.auth.createSSOGroup, ssoConfigId, group)));
@@ -451,7 +414,6 @@ function* setSSOGroups({
451
414
  groups
452
415
  });
453
416
  }
454
-
455
417
  return ssoConfig;
456
418
  });
457
419
  yield (0, _effects.put)(_reducer.actions.setSSOState({
@@ -471,7 +433,6 @@ function* setSSOGroups({
471
433
  }));
472
434
  }
473
435
  }
474
-
475
436
  function* updateSSOGroups({
476
437
  payload: {
477
438
  ssoConfigId,
@@ -495,7 +456,6 @@ function* updateSSOGroups({
495
456
  }));
496
457
  }
497
458
  }
498
-
499
459
  function* ssoSagas() {
500
460
  yield (0, _effects.takeEvery)(_reducer.actions.loadSSOConfigurationsV2, loadSSOConfigurationsV2);
501
461
  yield (0, _effects.takeEvery)(_reducer.actions.saveSSOConfigurationV2, saveSSOConfigurationV2);
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.securityPolicyState = exports.securityPolicyReducers = exports.securityPolicyActions = 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 securityPolicyState = {
15
11
  globalPolicy: {
16
12
  loading: true
@@ -87,14 +83,13 @@ const actions = {
87
83
  loadVendorPasswordConfig: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadVendorPasswordConfig`),
88
84
  loadPublicAuthStrategiesPolicy: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadPublicAuthStrategiesPolicy`)
89
85
  };
86
+
90
87
  /**
91
88
  * To be used for actions types after dispatch, and should contains
92
89
  * the reducers and actions as standalone function
93
90
  */
94
-
95
91
  exports.securityPolicyActions = actions;
96
92
  // noinspection JSUnusedLocalSymbols
97
-
98
93
  /**
99
94
  * if you see error in matcher that's mean the DispatchAction does not
100
95
  * contains the same functions in reducers and actions