@frontegg/redux-store 6.2.5 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/audits/backward-compatibility/reducer.d.ts +1 -1
- package/audits/backward-compatibility/saga.js +4 -1
- package/audits/index.d.ts +1 -1
- package/audits/reducer.d.ts +1 -1
- package/auth/ApiTokensState/index.d.ts +14 -2
- package/auth/ApiTokensState/index.js +6 -0
- package/auth/ApiTokensState/saga.js +128 -2
- package/auth/LoginState/saga.js +9 -5
- package/auth/MfaState/saga.js +1 -1
- package/auth/SSOState/saga.js +1 -1
- package/auth/SecurityPolicyState/saga.d.ts +3 -2
- package/auth/SocialLogins/saga.d.ts +2 -2
- package/auth/index.d.ts +11 -1
- package/auth/reducer.d.ts +11 -1
- package/connectivity/index.d.ts +1 -1
- package/connectivity/reducer.d.ts +1 -1
- package/connectivity/saga.js +31 -10
- package/index.js +1 -1
- package/node/audits/backward-compatibility/saga.js +4 -1
- package/node/auth/ApiTokensState/index.js +6 -0
- package/node/auth/ApiTokensState/saga.js +128 -2
- package/node/auth/LoginState/saga.js +9 -5
- package/node/auth/MfaState/saga.js +1 -1
- package/node/auth/SSOState/saga.js +1 -1
- package/node/connectivity/saga.js +31 -10
- package/node/index.js +1 -1
- package/node/subscriptions/Billing/Information/saga.js +1 -1
- package/node/subscriptions/Billing/Subscription/saga.js +1 -2
- package/node/subscriptions/Checkout/saga.js +1 -3
- package/node/vendor/reducer.js +1 -1
- package/node/vendor/saga.js +9 -1
- package/package.json +5 -5
- package/subscriptions/Billing/Information/index.d.ts +1 -1
- package/subscriptions/Billing/Information/saga.d.ts +8 -26
- package/subscriptions/Billing/Information/saga.js +1 -1
- package/subscriptions/Billing/Invoices/index.d.ts +1 -1
- package/subscriptions/Billing/PaymentMethod/index.d.ts +1 -1
- package/subscriptions/Billing/Subscription/index.d.ts +1 -1
- package/subscriptions/Billing/Subscription/saga.d.ts +1 -11
- package/subscriptions/Billing/Subscription/saga.js +1 -2
- package/subscriptions/Billing/index.d.ts +1 -1
- package/subscriptions/Checkout/index.d.ts +1 -1
- package/subscriptions/Checkout/saga.js +1 -2
- package/subscriptions/Config/index.d.ts +1 -1
- package/subscriptions/Plans/index.d.ts +1 -1
- package/subscriptions/Stripe/index.d.ts +1 -1
- package/subscriptions/VendorPublicConfig/index.d.ts +1 -1
- package/subscriptions/index.d.ts +3 -3
- package/subscriptions/reducer.d.ts +3 -3
- package/toolkit/redux.d.ts +1 -1
- package/vendor/VendorState/index.d.ts +2 -1
- package/vendor/index.d.ts +1 -1
- package/vendor/interfaces.d.ts +2 -1
- package/vendor/reducer.d.ts +1 -1
- package/vendor/reducer.js +1 -1
- package/vendor/saga.d.ts +2 -2
- package/vendor/saga.js +9 -1
|
@@ -285,8 +285,84 @@ function* loadApiTokens({
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
function* loadUserApiTokens({
|
|
289
|
+
payload
|
|
290
|
+
}) {
|
|
291
|
+
if (!(payload != null && payload.silentLoading)) {
|
|
292
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
293
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
294
|
+
value: true
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
try {
|
|
299
|
+
var _payload$callback3;
|
|
300
|
+
|
|
301
|
+
const apiTokensData = yield (0, _effects.call)(_restApi.api.auth.getUserApiTokensData);
|
|
302
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
303
|
+
apiTokensDataUser: apiTokensData != null ? apiTokensData : []
|
|
304
|
+
}));
|
|
305
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
306
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
307
|
+
value: false
|
|
308
|
+
}));
|
|
309
|
+
payload == null ? void 0 : (_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
|
|
310
|
+
} catch (e) {
|
|
311
|
+
var _payload$callback4;
|
|
312
|
+
|
|
313
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensError({
|
|
314
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
315
|
+
value: e.message
|
|
316
|
+
}));
|
|
317
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
318
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
319
|
+
value: false
|
|
320
|
+
}));
|
|
321
|
+
payload == null ? void 0 : (_payload$callback4 = payload.callback) == null ? void 0 : _payload$callback4.call(payload, null, e);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function* loadTenantApiTokens({
|
|
326
|
+
payload
|
|
327
|
+
}) {
|
|
328
|
+
if (!(payload != null && payload.silentLoading)) {
|
|
329
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
330
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
331
|
+
value: true
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
try {
|
|
336
|
+
var _payload$callback5;
|
|
337
|
+
|
|
338
|
+
const apiTokensData = yield (0, _effects.call)(_restApi.api.auth.getTenantApiTokensData);
|
|
339
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
340
|
+
apiTokensDataTenant: apiTokensData != null ? apiTokensData : []
|
|
341
|
+
}));
|
|
342
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
343
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
344
|
+
value: false
|
|
345
|
+
}));
|
|
346
|
+
payload == null ? void 0 : (_payload$callback5 = payload.callback) == null ? void 0 : _payload$callback5.call(payload, true);
|
|
347
|
+
} catch (e) {
|
|
348
|
+
var _payload$callback6;
|
|
349
|
+
|
|
350
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensError({
|
|
351
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
352
|
+
value: e.message
|
|
353
|
+
}));
|
|
354
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
355
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
356
|
+
value: false
|
|
357
|
+
}));
|
|
358
|
+
payload == null ? void 0 : (_payload$callback6 = payload.callback) == null ? void 0 : _payload$callback6.call(payload, null, e);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
288
362
|
function* apiTokensSaga() {
|
|
289
363
|
yield (0, _effects.takeLeading)(_reducer.actions.loadApiTokens, loadApiTokens);
|
|
364
|
+
yield (0, _effects.takeLeading)(_reducer.actions.loadUserApiTokens, loadUserApiTokens);
|
|
365
|
+
yield (0, _effects.takeLeading)(_reducer.actions.loadTenantApiTokens, loadTenantApiTokens);
|
|
290
366
|
yield (0, _effects.takeLeading)(_reducer.actions.initApiTokensData, loadApiTokensData);
|
|
291
367
|
yield (0, _effects.takeEvery)(_reducer.actions.addUserApiToken, addUserApiToken);
|
|
292
368
|
yield (0, _effects.takeEvery)(_reducer.actions.addTenantApiToken, addTenantApiToken);
|
|
@@ -397,7 +473,7 @@ function* deleteTenantApiTokenMock({
|
|
|
397
473
|
function* loadApiTokensMock({
|
|
398
474
|
payload
|
|
399
475
|
}) {
|
|
400
|
-
var _payload$
|
|
476
|
+
var _payload$callback7;
|
|
401
477
|
|
|
402
478
|
if (!(payload != null && payload.silentLoading)) {
|
|
403
479
|
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
@@ -417,11 +493,61 @@ function* loadApiTokensMock({
|
|
|
417
493
|
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
418
494
|
value: false
|
|
419
495
|
}));
|
|
420
|
-
payload == null ? void 0 : (_payload$
|
|
496
|
+
payload == null ? void 0 : (_payload$callback7 = payload.callback) == null ? void 0 : _payload$callback7.call(payload, true);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function* loadUserApiTokensMock({
|
|
500
|
+
payload
|
|
501
|
+
}) {
|
|
502
|
+
var _payload$callback8;
|
|
503
|
+
|
|
504
|
+
if (!(payload != null && payload.silentLoading)) {
|
|
505
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
506
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
507
|
+
value: true
|
|
508
|
+
}));
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const apiTokensDataUser = [_dummy.apiTokensDataDemo];
|
|
512
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
513
|
+
apiTokensDataUser
|
|
514
|
+
}));
|
|
515
|
+
yield (0, _effects.delay)(200);
|
|
516
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
517
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
518
|
+
value: false
|
|
519
|
+
}));
|
|
520
|
+
payload == null ? void 0 : (_payload$callback8 = payload.callback) == null ? void 0 : _payload$callback8.call(payload, true);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function* loadTenantApiTokensMock({
|
|
524
|
+
payload
|
|
525
|
+
}) {
|
|
526
|
+
var _payload$callback9;
|
|
527
|
+
|
|
528
|
+
if (!(payload != null && payload.silentLoading)) {
|
|
529
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
530
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
531
|
+
value: true
|
|
532
|
+
}));
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const apiTokensDataTenant = [_dummy.apiTokensDataTenantDemo];
|
|
536
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
537
|
+
apiTokensDataTenant
|
|
538
|
+
}));
|
|
539
|
+
yield (0, _effects.delay)(200);
|
|
540
|
+
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
541
|
+
key: _interfaces.ApiStateKeys.LOAD_API_TOKENS,
|
|
542
|
+
value: false
|
|
543
|
+
}));
|
|
544
|
+
payload == null ? void 0 : (_payload$callback9 = payload.callback) == null ? void 0 : _payload$callback9.call(payload, true);
|
|
421
545
|
}
|
|
422
546
|
|
|
423
547
|
function* apiTokensSagaMock() {
|
|
424
548
|
yield (0, _effects.takeLeading)(_reducer.actions.loadApiTokens, loadApiTokensMock);
|
|
549
|
+
yield (0, _effects.takeLeading)(_reducer.actions.loadUserApiTokens, loadUserApiTokensMock);
|
|
550
|
+
yield (0, _effects.takeLeading)(_reducer.actions.loadTenantApiTokens, loadTenantApiTokensMock);
|
|
425
551
|
yield (0, _effects.takeLeading)(_reducer.actions.initApiTokensData, loadApiTokensDataMock);
|
|
426
552
|
yield (0, _effects.takeEvery)(_reducer.actions.addTenantApiToken, addTenantApiTokenMock);
|
|
427
553
|
yield (0, _effects.takeLatest)(_reducer.actions.deleteTenantApiToken, deleteTenantApiTokenMock);
|
|
@@ -283,7 +283,7 @@ function* refreshTokenEmbedded() {
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
const quickLoginToRegister = (_ref = localStorage.getItem('register-quick-login')) != null ? _ref : loginState.quickLoginToRegister;
|
|
286
|
-
const
|
|
286
|
+
const shouldNavigateToRegisterQuickLogin = quickLoginToRegister && localStorage.getItem(`${user.id}-${quickLoginToRegister}`) !== 'true' && !window.location.pathname.endsWith(routes.logoutUrl);
|
|
287
287
|
yield (0, _effects.put)(_reducer.actions.setTenantsState({
|
|
288
288
|
tenants,
|
|
289
289
|
loading: false
|
|
@@ -293,7 +293,7 @@ function* refreshTokenEmbedded() {
|
|
|
293
293
|
isAuthenticated: true,
|
|
294
294
|
loginState: (0, _extends2.default)({}, loginState, {
|
|
295
295
|
quickLoginToRegister,
|
|
296
|
-
flow:
|
|
296
|
+
flow: shouldNavigateToRegisterQuickLogin ? _interfaces2.LoginFlow.RegisterQuickLogin : _interfaces2.LoginFlow.Login
|
|
297
297
|
})
|
|
298
298
|
}));
|
|
299
299
|
const url = new URL((_window2 = window) == null ? void 0 : _window2.location.href);
|
|
@@ -304,7 +304,7 @@ function* refreshTokenEmbedded() {
|
|
|
304
304
|
redirectRoutes.push(routes.loginUrl, routes.signUpUrl);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
if (
|
|
307
|
+
if (shouldNavigateToRegisterQuickLogin) {
|
|
308
308
|
onRedirectTo(routes.loginUrl);
|
|
309
309
|
} else if (redirectRoutes.some(url => url && window.location.pathname.endsWith(url))) {
|
|
310
310
|
if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
|
|
@@ -552,7 +552,9 @@ function* quickSmsPasswordlessPreLogin(_ref4) {
|
|
|
552
552
|
try {
|
|
553
553
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
554
554
|
loading: true
|
|
555
|
-
}));
|
|
555
|
+
})); // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
556
|
+
// @ts-ignore
|
|
557
|
+
|
|
556
558
|
const preloginRes = yield (0, _effects.call)(_restApi.api.auth.passwordlessPreLogin, (0, _extends2.default)({}, payload, {
|
|
557
559
|
type: _restApi.AuthStrategyEnum.SmsCode
|
|
558
560
|
}));
|
|
@@ -595,7 +597,9 @@ function* passwordlessPreLogin(_ref5) {
|
|
|
595
597
|
}));
|
|
596
598
|
yield (0, _effects.put)(_reducer.actions.setLoginState({
|
|
597
599
|
loading: true
|
|
598
|
-
}));
|
|
600
|
+
})); // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
601
|
+
// @ts-ignore
|
|
602
|
+
|
|
599
603
|
const preloginRes = yield (0, _effects.call)(_restApi.api.auth.passwordlessPreLogin, payload);
|
|
600
604
|
const step = authStrategyLoginStepMap[payload.type];
|
|
601
605
|
|
|
@@ -137,7 +137,7 @@ function* disableMfa({
|
|
|
137
137
|
var _payload$callback;
|
|
138
138
|
|
|
139
139
|
const user = yield (0, _effects.select)(state => state.auth.user);
|
|
140
|
-
yield _restApi.api.auth.disableMfa
|
|
140
|
+
yield (0, _effects.call)(_restApi.api.auth.disableMfa, payload);
|
|
141
141
|
yield (0, _effects.put)(_reducer.actions.setMfaState({
|
|
142
142
|
loading: false,
|
|
143
143
|
error: undefined
|
|
@@ -362,7 +362,7 @@ function* oidcPostloginFunction({
|
|
|
362
362
|
loading: true
|
|
363
363
|
}));
|
|
364
364
|
yield (0, _effects.call)(_restApi.api.auth.oidcPostLoginV2, data);
|
|
365
|
-
yield (0, _saga.refreshToken)
|
|
365
|
+
yield (0, _effects.call)(_saga.refreshToken);
|
|
366
366
|
yield (0, _effects.put)(_reducer.actions.setSSOState({
|
|
367
367
|
loading: false
|
|
368
368
|
}));
|
|
@@ -23,8 +23,8 @@ const _excluded = ["id"],
|
|
|
23
23
|
_excluded2 = ["id", "enabled"];
|
|
24
24
|
const addApi = ['categories', 'channelMap'];
|
|
25
25
|
|
|
26
|
-
function*
|
|
27
|
-
return yield loadFunction
|
|
26
|
+
function* loadPlatformData(ch) {
|
|
27
|
+
return yield (0, _effects.call)(loadFunction, {
|
|
28
28
|
payload: {
|
|
29
29
|
api: ch
|
|
30
30
|
},
|
|
@@ -40,13 +40,19 @@ function* loadDataFunction({
|
|
|
40
40
|
}));
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
|
-
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
const values = yield (0, _effects.all)([// @ts-ignore
|
|
45
|
+
...payload.map(loadPlatformData), // @ts-ignore
|
|
46
|
+
yield loadFunction({
|
|
44
47
|
payload: {
|
|
45
48
|
api: 'categories'
|
|
46
49
|
},
|
|
47
50
|
type: ''
|
|
48
|
-
}),
|
|
51
|
+
}), // @ts-ignore
|
|
52
|
+
yield function* () {
|
|
53
|
+
// @ts-ignore
|
|
49
54
|
const res = yield (0, _effects.all)(payload.map(function* (ch) {
|
|
55
|
+
// @ts-ignore
|
|
50
56
|
return yield loadFunction({
|
|
51
57
|
payload: {
|
|
52
58
|
api: 'channelMap',
|
|
@@ -58,7 +64,8 @@ function* loadDataFunction({
|
|
|
58
64
|
return res.reduce((acc, curr, idx) => (0, _extends2.default)({}, acc, {
|
|
59
65
|
[`${payload[idx]}`]: curr
|
|
60
66
|
}), {});
|
|
61
|
-
}()]);
|
|
67
|
+
}()]); // @ts-ignore
|
|
68
|
+
|
|
62
69
|
const webhooks = yield loadFunction({
|
|
63
70
|
payload: {
|
|
64
71
|
api: 'webhook'
|
|
@@ -100,6 +107,8 @@ function* loadFunction({
|
|
|
100
107
|
}
|
|
101
108
|
}) {
|
|
102
109
|
try {
|
|
110
|
+
// TODO: [ Refactor Saga ] refactor mapping routes
|
|
111
|
+
// @ts-ignore
|
|
103
112
|
return yield (0, _effects.call)(_consts.type2ApiGet[api], params);
|
|
104
113
|
} catch (e) {
|
|
105
114
|
return undefined;
|
|
@@ -112,7 +121,9 @@ function* loadSlackFunction() {
|
|
|
112
121
|
slackChannels: {
|
|
113
122
|
isLoading: true
|
|
114
123
|
}
|
|
115
|
-
}));
|
|
124
|
+
})); // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
|
|
116
127
|
const data = yield (0, _effects.call)(_restApi.api.connectivity.getSlackChannels);
|
|
117
128
|
yield (0, _effects.put)(_reducer.actions.setConnectivityState({
|
|
118
129
|
error: undefined,
|
|
@@ -186,6 +197,7 @@ function* postDataFunction({
|
|
|
186
197
|
}
|
|
187
198
|
|
|
188
199
|
if (!['sms', 'email'].includes(platform)) {
|
|
200
|
+
// @ts-ignore
|
|
189
201
|
const newData = yield loadFunction({
|
|
190
202
|
payload: {
|
|
191
203
|
api: platform
|
|
@@ -259,6 +271,7 @@ function* postSlackData({
|
|
|
259
271
|
|
|
260
272
|
return acc;
|
|
261
273
|
}, []).map(function* (el) {
|
|
274
|
+
// @ts-ignore
|
|
262
275
|
return yield (0, _effects.call)(_consts.type2ApiPost.slack, el);
|
|
263
276
|
}), ...slackSubscriptions.reduce((acc, curr) => {
|
|
264
277
|
if (curr.id && !curr.slackEvents[0].channelIds.length) {
|
|
@@ -267,6 +280,7 @@ function* postSlackData({
|
|
|
267
280
|
|
|
268
281
|
return acc;
|
|
269
282
|
}, []).map(function* (el) {
|
|
283
|
+
// @ts-ignore
|
|
270
284
|
return yield (0, _effects.call)(_restApi.api.connectivity.deleteSlackConfiguration, el);
|
|
271
285
|
}) // clean the old data
|
|
272
286
|
// ...stateSlackSubscriptions
|
|
@@ -312,6 +326,8 @@ function* postEmailSMSData({
|
|
|
312
326
|
|
|
313
327
|
return acc;
|
|
314
328
|
}, []).map(function* (data) {
|
|
329
|
+
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
330
|
+
// @ts-ignore
|
|
315
331
|
return yield (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.postEmailConfiguration : _restApi.api.connectivity.postSMSConfiguration, data);
|
|
316
332
|
}), // update exists
|
|
317
333
|
...payload.reduce((acc, curr) => {
|
|
@@ -334,11 +350,14 @@ function* postEmailSMSData({
|
|
|
334
350
|
id = '',
|
|
335
351
|
enabled
|
|
336
352
|
} = _subscriptions$,
|
|
337
|
-
body = (0, _objectWithoutPropertiesLoose2.default)(_subscriptions$, _excluded2);
|
|
338
|
-
|
|
353
|
+
body = (0, _objectWithoutPropertiesLoose2.default)(_subscriptions$, _excluded2); // @ts-ignore
|
|
354
|
+
|
|
355
|
+
return yield (0, _effects.all)([// @ts-ignore
|
|
356
|
+
yield (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.patchEmailConfiguration : _restApi.api.connectivity.patchSMSConfiguration, {
|
|
339
357
|
eventKey,
|
|
340
358
|
enabled
|
|
341
|
-
}),
|
|
359
|
+
}), // @ts-ignore
|
|
360
|
+
yield (0, _effects.call)(type === 'email' ? _restApi.api.connectivity.putEmailSubscriptions : _restApi.api.connectivity.putSMSSubscriptions, id, eventKey, (0, _extends2.default)({}, body, {
|
|
342
361
|
enabled
|
|
343
362
|
}))]);
|
|
344
363
|
}), // delete record with empty recipients
|
|
@@ -361,6 +380,7 @@ function* postEmailSMSData({
|
|
|
361
380
|
} catch {}
|
|
362
381
|
|
|
363
382
|
if (actionsResult.length) {
|
|
383
|
+
// @ts-ignore
|
|
364
384
|
const newData = yield loadFunction({
|
|
365
385
|
payload: {
|
|
366
386
|
api: type
|
|
@@ -453,7 +473,8 @@ function* deleteWebhookConfigFunction({
|
|
|
453
473
|
yield (0, _effects.call)(_restApi.api.connectivity.deleteWebhooksConfiguration, webhookId);
|
|
454
474
|
} catch (e) {
|
|
455
475
|
callback == null ? void 0 : callback(null, e.message);
|
|
456
|
-
}
|
|
476
|
+
} // @ts-ignore
|
|
477
|
+
|
|
457
478
|
|
|
458
479
|
const newData = yield loadFunction({
|
|
459
480
|
payload: {
|
package/node/index.js
CHANGED
|
@@ -70,7 +70,7 @@ function* loadSummaries(tenantId, forceActive) {
|
|
|
70
70
|
let planResponse;
|
|
71
71
|
|
|
72
72
|
if (!externallyManaged) {
|
|
73
|
-
[, planResponse] = yield (0, _effects.all)([
|
|
73
|
+
[, planResponse] = yield (0, _effects.all)([(0, _effects.call)(_saga.loadSubscription), (0, _effects.call)(_restApi.api.subscriptions.getSubscriptionPlan, currentPlanId)]);
|
|
74
74
|
subscriptionResponse = yield (0, _effects.select)(state => state.subscriptions.billing.subscription.subscription || null);
|
|
75
75
|
} else {
|
|
76
76
|
planResponse = yield (0, _effects.call)(_restApi.api.subscriptions.getSubscriptionPlan, currentPlanId);
|
|
@@ -30,8 +30,7 @@ function* loadSubscriptionTenant() {
|
|
|
30
30
|
return (_state$auth = state.auth) == null ? void 0 : (_state$auth$user = _state$auth.user) == null ? void 0 : _state$auth$user.tenantId;
|
|
31
31
|
});
|
|
32
32
|
yield (0, _saga.loadSummaries)(tenantId);
|
|
33
|
-
}
|
|
34
|
-
|
|
33
|
+
}
|
|
35
34
|
|
|
36
35
|
function* loadSubscription() {
|
|
37
36
|
yield (0, _effects.put)(_index.subscriptionActions.setLoading(true));
|
|
@@ -16,8 +16,6 @@ var _index = require("./index");
|
|
|
16
16
|
|
|
17
17
|
var _restApi = require("@frontegg/rest-api");
|
|
18
18
|
|
|
19
|
-
var _general = require("../general.interfaces");
|
|
20
|
-
|
|
21
19
|
var _Subscription = require("../Billing/Subscription");
|
|
22
20
|
|
|
23
21
|
var _saga = require("../Billing/Information/saga");
|
|
@@ -70,7 +68,7 @@ function* confirmPlan({
|
|
|
70
68
|
}) {
|
|
71
69
|
const subscription = yield (0, _effects.select)(state => state.subscriptions.billing.subscription.subscription);
|
|
72
70
|
const summary = yield (0, _effects.select)(state => state.subscriptions.billing.information.summary);
|
|
73
|
-
const isTrialing = (subscription == null ? void 0 : subscription.status) ===
|
|
71
|
+
const isTrialing = (subscription == null ? void 0 : subscription.status) === _restApi.ISubscriptionStatus.TRIALING;
|
|
74
72
|
const hasPaymentMethod = !!(summary != null && summary.paymentMethodId);
|
|
75
73
|
|
|
76
74
|
if (!subscription) {
|
package/node/vendor/reducer.js
CHANGED
package/node/vendor/saga.js
CHANGED
|
@@ -16,14 +16,22 @@ var _reducer = require("./reducer");
|
|
|
16
16
|
var _utils = require("../auth/utils");
|
|
17
17
|
|
|
18
18
|
function* loadVendorPublicInfo() {
|
|
19
|
+
yield (0, _effects.put)(_reducer.actions.setVendorState({
|
|
20
|
+
loading: true
|
|
21
|
+
}));
|
|
22
|
+
|
|
19
23
|
try {
|
|
20
24
|
const {
|
|
21
25
|
whiteLabelMode = false
|
|
22
26
|
} = yield _restApi.api.vendor.getVendorPublicInfo();
|
|
23
27
|
yield (0, _effects.put)(_reducer.actions.setVendorState({
|
|
24
|
-
whiteLabelMode
|
|
28
|
+
whiteLabelMode,
|
|
29
|
+
loading: false
|
|
25
30
|
}));
|
|
26
31
|
} catch (e) {
|
|
32
|
+
yield (0, _effects.put)(_reducer.actions.setVendorState({
|
|
33
|
+
loading: false
|
|
34
|
+
}));
|
|
27
35
|
console.error('failed to getVendorPublicInfo - ', e);
|
|
28
36
|
}
|
|
29
37
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@babel/runtime": "^7.
|
|
9
|
-
"@frontegg/rest-api": "3.0.
|
|
10
|
-
"@reduxjs/toolkit": "^1.8.
|
|
11
|
-
"redux-saga": "^1.1
|
|
8
|
+
"@babel/runtime": "^7.18.6",
|
|
9
|
+
"@frontegg/rest-api": "3.0.25",
|
|
10
|
+
"@reduxjs/toolkit": "^1.8.5",
|
|
11
|
+
"redux-saga": "^1.2.1",
|
|
12
12
|
"uuid": "^8.3.2"
|
|
13
13
|
},
|
|
14
14
|
"sideEffects": false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BillingInformationState } from './interfaces';
|
|
2
2
|
export declare const initialBillingInformationState: BillingInformationState;
|
|
3
|
-
declare const reducer: import("
|
|
3
|
+
declare const reducer: import("redux").Reducer<BillingInformationState, import("redux").AnyAction>;
|
|
4
4
|
declare const actions: {
|
|
5
5
|
setLoading: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[boolean], boolean, string, never, never>;
|
|
6
6
|
setError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string | null], string | null, string, never, never>;
|
|
@@ -4,44 +4,26 @@ export declare function subscriptionBillingInformationSagas(): Generator<import(
|
|
|
4
4
|
export declare function loadBillingInformation(): Generator<Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
|
|
5
5
|
payload: string | null;
|
|
6
6
|
type: string;
|
|
7
|
-
}> | Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
|
|
7
|
+
}> | Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<any>> | import("redux-saga/effects").PutEffect<{
|
|
8
8
|
payload: boolean;
|
|
9
9
|
type: string;
|
|
10
|
-
}> | import("redux-saga/effects").
|
|
11
|
-
payload: string | null;
|
|
12
|
-
type: string;
|
|
13
|
-
}> | Generator<import("redux-saga/effects").PutEffect<{
|
|
14
|
-
payload: boolean;
|
|
15
|
-
type: string;
|
|
16
|
-
}> | import("redux-saga/effects").CallEffect<ISubscriptionResponse[]> | import("redux-saga/effects").PutEffect<{
|
|
17
|
-
payload: Partial<import("../Subscription/interfaces").SubscriptionState>;
|
|
18
|
-
type: string;
|
|
19
|
-
}> | import("redux-saga/effects").PutEffect<{
|
|
20
|
-
payload: string | null;
|
|
21
|
-
type: string;
|
|
22
|
-
}>, void, [any]> | import("redux-saga/effects").CallEffect<IPlanResponse[]> | import("redux-saga/effects").PutEffect<{
|
|
10
|
+
}> | import("redux-saga/effects").CallEffect<ISubscriptionSummariesResponse> | import("redux-saga/effects").CallEffect<IPlanResponse[]> | import("redux-saga/effects").PutEffect<{
|
|
23
11
|
payload: Partial<import("./interfaces").BillingInformationState>;
|
|
24
12
|
type: string;
|
|
25
|
-
}
|
|
26
|
-
export declare function loadSummaries(tenantId: string, forceActive?: boolean): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
|
|
27
|
-
payload: boolean;
|
|
28
|
-
type: string;
|
|
29
|
-
}> | import("redux-saga/effects").AllEffect<any> | import("redux-saga/effects").CallEffect<ISubscriptionSummariesResponse> | import("redux-saga/effects").PutEffect<{
|
|
13
|
+
}> | import("redux-saga/effects").PutEffect<{
|
|
30
14
|
payload: string | null;
|
|
31
15
|
type: string;
|
|
32
|
-
}
|
|
16
|
+
}>, void, ISubscriptionSummariesResponse & [undefined, IPlanResponse] & ISubscriptionResponse & IPlanResponse>, void, PaymentProvider>, void, unknown>;
|
|
17
|
+
export declare function loadSummaries(tenantId: string, forceActive?: boolean): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<any>> | import("redux-saga/effects").PutEffect<{
|
|
33
18
|
payload: boolean;
|
|
34
19
|
type: string;
|
|
35
|
-
}> | import("redux-saga/effects").CallEffect<
|
|
36
|
-
payload: Partial<import("
|
|
20
|
+
}> | import("redux-saga/effects").CallEffect<ISubscriptionSummariesResponse> | import("redux-saga/effects").CallEffect<IPlanResponse[]> | import("redux-saga/effects").PutEffect<{
|
|
21
|
+
payload: Partial<import("./interfaces").BillingInformationState>;
|
|
37
22
|
type: string;
|
|
38
23
|
}> | import("redux-saga/effects").PutEffect<{
|
|
39
24
|
payload: string | null;
|
|
40
25
|
type: string;
|
|
41
|
-
}>, void, [
|
|
42
|
-
payload: Partial<import("./interfaces").BillingInformationState>;
|
|
43
|
-
type: string;
|
|
44
|
-
}>, void, any>;
|
|
26
|
+
}>, void, ISubscriptionSummariesResponse & [undefined, IPlanResponse] & ISubscriptionResponse & IPlanResponse>;
|
|
45
27
|
export declare function loadSummariesMock(): Generator<import("redux-saga/effects").CallEffect<true> | import("redux-saga/effects").PutEffect<{
|
|
46
28
|
payload: boolean;
|
|
47
29
|
type: string;
|
|
@@ -48,7 +48,7 @@ export function* loadSummaries(tenantId, forceActive) {
|
|
|
48
48
|
let planResponse;
|
|
49
49
|
|
|
50
50
|
if (!externallyManaged) {
|
|
51
|
-
[, planResponse] = yield all([
|
|
51
|
+
[, planResponse] = yield all([call(loadSubscription), call(api.subscriptions.getSubscriptionPlan, currentPlanId)]);
|
|
52
52
|
subscriptionResponse = yield select(state => state.subscriptions.billing.subscription.subscription || null);
|
|
53
53
|
} else {
|
|
54
54
|
planResponse = yield call(api.subscriptions.getSubscriptionPlan, currentPlanId);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DownloadInvoiceActionPayload, InvoicesState } from './interfaces';
|
|
2
2
|
export declare const initialInvoicesState: InvoicesState;
|
|
3
|
-
declare const reducer: import("
|
|
3
|
+
declare const reducer: import("redux").Reducer<InvoicesState, import("redux").AnyAction>;
|
|
4
4
|
declare const actions: {
|
|
5
5
|
setInvoiceDownloadState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
6
6
|
loading: boolean;
|
|
@@ -2,7 +2,7 @@ import { PaymentMethodState } from './interfaces';
|
|
|
2
2
|
import { ISubscriptionUpdatePaymentMethodBillingDetails } from '@frontegg/rest-api';
|
|
3
3
|
import { WithCallback } from '../../../interfaces';
|
|
4
4
|
export declare const initialPaymentMethodState: PaymentMethodState;
|
|
5
|
-
declare const reducer: import("
|
|
5
|
+
declare const reducer: import("redux").Reducer<PaymentMethodState, import("redux").AnyAction>;
|
|
6
6
|
declare const actions: {
|
|
7
7
|
setState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<PaymentMethodState>], Partial<PaymentMethodState>, string, never, never>;
|
|
8
8
|
setLoading: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[boolean], boolean, string, never, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SubscriptionState } from './interfaces';
|
|
2
2
|
export declare const initialSubscriptionState: SubscriptionState;
|
|
3
|
-
declare const reducer: import("
|
|
3
|
+
declare const reducer: import("redux").Reducer<SubscriptionState, import("redux").AnyAction>;
|
|
4
4
|
declare const actions: {
|
|
5
5
|
setCancellationLoading: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[boolean], boolean, string, never, never>;
|
|
6
6
|
setCancellationError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string | null], string | null, string, never, never>;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { SubscriptionState } from './interfaces';
|
|
2
1
|
export declare function subscriptionSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
3
|
-
export declare function loadSubscription(): Generator<
|
|
4
|
-
payload: boolean;
|
|
5
|
-
type: string;
|
|
6
|
-
}> | import("redux-saga/effects").CallEffect<import("@frontegg/rest-api").ISubscriptionResponse[]> | import("redux-saga/effects").PutEffect<{
|
|
7
|
-
payload: Partial<SubscriptionState>;
|
|
8
|
-
type: string;
|
|
9
|
-
}> | import("redux-saga/effects").PutEffect<{
|
|
10
|
-
payload: string | null;
|
|
11
|
-
type: string;
|
|
12
|
-
}>, void, [any]>;
|
|
2
|
+
export declare function loadSubscription(): Generator<any, any, any>;
|
|
13
3
|
export declare function subscriptionSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
@@ -16,8 +16,7 @@ function* loadSubscriptionTenant() {
|
|
|
16
16
|
return (_state$auth = state.auth) == null ? void 0 : (_state$auth$user = _state$auth.user) == null ? void 0 : _state$auth$user.tenantId;
|
|
17
17
|
});
|
|
18
18
|
yield loadSummaries(tenantId);
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
}
|
|
21
20
|
|
|
22
21
|
export function* loadSubscription() {
|
|
23
22
|
yield put(subscriptionActions.setLoading(true));
|
|
@@ -51,4 +51,4 @@ export declare const billingActions: {
|
|
|
51
51
|
renewSubscription: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
|
-
export declare const billingReducer: import("
|
|
54
|
+
export declare const billingReducer: import("redux").Reducer<import("redux").CombinedState<BillingState>, AnyAction>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CheckoutState, ConfirmCheckoutActionPayload } from './interfaces';
|
|
2
2
|
export declare const checkoutInitialState: CheckoutState;
|
|
3
|
-
declare const reducer: import("
|
|
3
|
+
declare const reducer: import("redux").Reducer<CheckoutState, import("redux").AnyAction>;
|
|
4
4
|
declare const actions: {
|
|
5
5
|
setLoading: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[boolean], boolean, string, never, never>;
|
|
6
6
|
setError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string | null], string | null, string, never, never>;
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { all, call, put, select, takeEvery } from 'redux-saga/effects';
|
|
3
3
|
import { checkoutActions } from './index';
|
|
4
4
|
import { api, ISubscriptionStatus } from '@frontegg/rest-api';
|
|
5
|
-
import { SubscriptionStatus } from '../general.interfaces';
|
|
6
5
|
import { subscriptionActions } from '../Billing/Subscription';
|
|
7
6
|
import { loadBillingInformation } from '../Billing/Information/saga';
|
|
8
7
|
import { loadPaymentMethod } from '../Billing/PaymentMethod/saga';
|
|
@@ -51,7 +50,7 @@ function* confirmPlan({
|
|
|
51
50
|
}) {
|
|
52
51
|
const subscription = yield select(state => state.subscriptions.billing.subscription.subscription);
|
|
53
52
|
const summary = yield select(state => state.subscriptions.billing.information.summary);
|
|
54
|
-
const isTrialing = (subscription == null ? void 0 : subscription.status) ===
|
|
53
|
+
const isTrialing = (subscription == null ? void 0 : subscription.status) === ISubscriptionStatus.TRIALING;
|
|
55
54
|
const hasPaymentMethod = !!(summary != null && summary.paymentMethodId);
|
|
56
55
|
|
|
57
56
|
if (!subscription) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PaymentProviderConfigState } from './interfaces';
|
|
2
2
|
export declare const configInitialState: PaymentProviderConfigState;
|
|
3
|
-
declare const reducer: import("
|
|
3
|
+
declare const reducer: import("redux").Reducer<PaymentProviderConfigState, import("redux").AnyAction>;
|
|
4
4
|
declare const actions: {
|
|
5
5
|
setLoading: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[boolean], boolean, string, never, never>;
|
|
6
6
|
setError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string | null], string | null, string, never, never>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PlansState } from './interfaces';
|
|
2
2
|
export declare const plansInitialState: PlansState;
|
|
3
|
-
declare const reducer: import("
|
|
3
|
+
declare const reducer: import("redux").Reducer<PlansState, import("redux").AnyAction>;
|
|
4
4
|
declare const actions: {
|
|
5
5
|
setLoading: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[boolean], boolean, string, never, never>;
|
|
6
6
|
setError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[string | null], string | null, string, never, never>;
|