@frontegg/redux-store 6.186.0-alpha.6 → 6.187.0-alpha.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/auth/MSP/AllAccountsState/allAccountsDialogsState.d.ts +225 -1
- package/auth/MSP/AllAccountsState/allAccountsDialogsState.js +24 -0
- package/auth/MSP/AllAccountsState/index.d.ts +2 -0
- package/auth/MSP/AllAccountsState/index.js +3 -0
- package/auth/MSP/AllAccountsState/saga.js +77 -2
- package/auth/MSP/AllAccountsState/types/dialogsStateTypes.d.ts +6 -0
- package/auth/MSP/AllAccountsState/types/stateTypes.d.ts +4 -1
- package/auth/MSP/AllAccountsState/types/stateTypes.js +1 -0
- package/auth/MSP/AllAccountsState/utils/getAccountsWithUsersCount.d.ts +1 -0
- package/auth/MSP/AllAccountsState/utils/getAccountsWithUsersCount.js +2 -1
- package/auth/MSP/AllAccountsState/utils/updateNodeIsReseller.d.ts +2 -0
- package/auth/MSP/AllAccountsState/utils/updateNodeIsReseller.js +13 -0
- package/auth/index.d.ts +5 -0
- package/auth/reducer.d.ts +5 -0
- package/index.js +1 -1
- package/node/auth/MSP/AllAccountsState/allAccountsDialogsState.js +24 -0
- package/node/auth/MSP/AllAccountsState/index.js +3 -0
- package/node/auth/MSP/AllAccountsState/saga.js +77 -2
- package/node/auth/MSP/AllAccountsState/types/stateTypes.js +1 -0
- package/node/auth/MSP/AllAccountsState/utils/getAccountsWithUsersCount.js +2 -1
- package/node/auth/MSP/AllAccountsState/utils/updateNodeIsReseller.js +21 -0
- package/node/index.js +1 -1
- package/node/vendor/saga.js +5 -1
- package/package.json +2 -2
- package/vendor/VendorState/index.d.ts +2 -0
- package/vendor/interfaces.d.ts +2 -0
- package/vendor/saga.d.ts +2 -0
- package/vendor/saga.js +5 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAllAccountsDialogsState } from './types';
|
|
2
|
-
import { TAddUsersToSubAccountDialogState, TCreateSubAccountDialogState, TDeleteSubAccountDialogState, TDeleteUserFromSubAccountDialogState, TEditUserRolesDialogState, TUpdateAccountDialogState } from './types/dialogsStateTypes';
|
|
2
|
+
import { TAddUsersToSubAccountDialogState, TCreateSubAccountDialogState, TDeleteSubAccountDialogState, TDeleteUserFromSubAccountDialogState, TEditUserRolesDialogState, TUpdateAccountDialogState, TUpdateSubAccountManagementState } from './types/dialogsStateTypes';
|
|
3
3
|
declare const allAccountsDialogsState: IAllAccountsDialogsState;
|
|
4
4
|
declare const reducers: {
|
|
5
5
|
setAllAccountDialogsState: {
|
|
@@ -466,6 +466,226 @@ declare const reducers: {
|
|
|
466
466
|
header?: any;
|
|
467
467
|
loaderComponent?: any;
|
|
468
468
|
};
|
|
469
|
+
openDisableSubAccountManagementDialog: {
|
|
470
|
+
prepare: (payload: Partial<TUpdateSubAccountManagementState>) => {
|
|
471
|
+
payload: Partial<TUpdateSubAccountManagementState>;
|
|
472
|
+
};
|
|
473
|
+
reducer: (state: import("../..").AuthState, { payload }: {
|
|
474
|
+
payload: Partial<TUpdateSubAccountManagementState>;
|
|
475
|
+
type: string;
|
|
476
|
+
}) => {
|
|
477
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
478
|
+
error?: any;
|
|
479
|
+
isAuthenticated: boolean;
|
|
480
|
+
userIp?: string | undefined;
|
|
481
|
+
isLoading: boolean;
|
|
482
|
+
keepSessionAlive?: boolean | undefined;
|
|
483
|
+
socialLoginOptions?: {
|
|
484
|
+
promptConsent?: boolean | undefined;
|
|
485
|
+
} | undefined;
|
|
486
|
+
user?: import("../..").User | null | undefined;
|
|
487
|
+
isSSOAuth: boolean;
|
|
488
|
+
ssoACS?: string | undefined;
|
|
489
|
+
includeQueryParam?: boolean | undefined;
|
|
490
|
+
loginState: import("../..").LoginState;
|
|
491
|
+
activateState: import("../..").ActivateAccountState;
|
|
492
|
+
acceptInvitationState: import("../..").AcceptInvitationState;
|
|
493
|
+
forgotPasswordState: import("../..").ForgotPasswordState;
|
|
494
|
+
resetPhoneNumberState: import("../..").ResetPhoneNumberState;
|
|
495
|
+
ssoState: import("../..").SSOState;
|
|
496
|
+
profileState: import("../..").ProfileState;
|
|
497
|
+
mfaState: import("../..").MFAState;
|
|
498
|
+
teamState: import("../..").TeamState;
|
|
499
|
+
groupsState: import("../..").GroupsState;
|
|
500
|
+
groupsDialogsState: import("../..").GroupsDialogsState;
|
|
501
|
+
socialLoginState: import("../..").SocialLoginState;
|
|
502
|
+
signUpState: import("../..").SignUpState;
|
|
503
|
+
apiTokensState: import("../..").ApiTokensState;
|
|
504
|
+
securityPolicyState: import("../..").SecurityPolicyState;
|
|
505
|
+
restrictionsState: import("../..").RestrictionsState;
|
|
506
|
+
provisioningState: import("../..").ProvisioningState;
|
|
507
|
+
accountSettingsState: import("../..").AccountSettingsState;
|
|
508
|
+
tenantsState: import("../..").TenantsState;
|
|
509
|
+
rolesState: import("../..").RolesState;
|
|
510
|
+
sessionsState: import("../..").SessionsState;
|
|
511
|
+
hostedLoginBox?: boolean | undefined;
|
|
512
|
+
disableSilentRefresh?: boolean | undefined;
|
|
513
|
+
sessionsPolicyState: import("../..").SessionsPolicyState;
|
|
514
|
+
impersonateState?: import("../..").ImpersonateState | undefined;
|
|
515
|
+
passkeysState?: import("../..").PasskeysState | undefined;
|
|
516
|
+
customLoginState?: import("../..").CustomLoginState | undefined;
|
|
517
|
+
allAccountsState?: import("./types").IAllAccountsState | undefined;
|
|
518
|
+
allAccountsDialogsState?: IAllAccountsDialogsState | undefined;
|
|
519
|
+
securityCenterState?: import("../..").SecurityCenterState | undefined;
|
|
520
|
+
smsState?: import("../..").SmsState | undefined;
|
|
521
|
+
stepUpState?: import("../..").StepUpState | undefined;
|
|
522
|
+
applicationsState?: import("../..").ApplicationsState | undefined;
|
|
523
|
+
routes: import("../..").AuthPageRoutes;
|
|
524
|
+
header?: any;
|
|
525
|
+
loaderComponent?: any;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
closeDisableSubAccountManagementDialog: (state: import("../..").AuthState) => {
|
|
529
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
530
|
+
error?: any;
|
|
531
|
+
isAuthenticated: boolean;
|
|
532
|
+
userIp?: string | undefined;
|
|
533
|
+
isLoading: boolean;
|
|
534
|
+
keepSessionAlive?: boolean | undefined;
|
|
535
|
+
socialLoginOptions?: {
|
|
536
|
+
promptConsent?: boolean | undefined;
|
|
537
|
+
} | undefined;
|
|
538
|
+
user?: import("../..").User | null | undefined;
|
|
539
|
+
isSSOAuth: boolean;
|
|
540
|
+
ssoACS?: string | undefined;
|
|
541
|
+
includeQueryParam?: boolean | undefined;
|
|
542
|
+
loginState: import("../..").LoginState;
|
|
543
|
+
activateState: import("../..").ActivateAccountState;
|
|
544
|
+
acceptInvitationState: import("../..").AcceptInvitationState;
|
|
545
|
+
forgotPasswordState: import("../..").ForgotPasswordState;
|
|
546
|
+
resetPhoneNumberState: import("../..").ResetPhoneNumberState;
|
|
547
|
+
ssoState: import("../..").SSOState;
|
|
548
|
+
profileState: import("../..").ProfileState;
|
|
549
|
+
mfaState: import("../..").MFAState;
|
|
550
|
+
teamState: import("../..").TeamState;
|
|
551
|
+
groupsState: import("../..").GroupsState;
|
|
552
|
+
groupsDialogsState: import("../..").GroupsDialogsState;
|
|
553
|
+
socialLoginState: import("../..").SocialLoginState;
|
|
554
|
+
signUpState: import("../..").SignUpState;
|
|
555
|
+
apiTokensState: import("../..").ApiTokensState;
|
|
556
|
+
securityPolicyState: import("../..").SecurityPolicyState;
|
|
557
|
+
restrictionsState: import("../..").RestrictionsState;
|
|
558
|
+
provisioningState: import("../..").ProvisioningState;
|
|
559
|
+
accountSettingsState: import("../..").AccountSettingsState;
|
|
560
|
+
tenantsState: import("../..").TenantsState;
|
|
561
|
+
rolesState: import("../..").RolesState;
|
|
562
|
+
sessionsState: import("../..").SessionsState;
|
|
563
|
+
hostedLoginBox?: boolean | undefined;
|
|
564
|
+
disableSilentRefresh?: boolean | undefined;
|
|
565
|
+
sessionsPolicyState: import("../..").SessionsPolicyState;
|
|
566
|
+
impersonateState?: import("../..").ImpersonateState | undefined;
|
|
567
|
+
passkeysState?: import("../..").PasskeysState | undefined;
|
|
568
|
+
customLoginState?: import("../..").CustomLoginState | undefined;
|
|
569
|
+
allAccountsState?: import("./types").IAllAccountsState | undefined;
|
|
570
|
+
allAccountsDialogsState?: IAllAccountsDialogsState | undefined;
|
|
571
|
+
securityCenterState?: import("../..").SecurityCenterState | undefined;
|
|
572
|
+
smsState?: import("../..").SmsState | undefined;
|
|
573
|
+
stepUpState?: import("../..").StepUpState | undefined;
|
|
574
|
+
applicationsState?: import("../..").ApplicationsState | undefined;
|
|
575
|
+
routes: import("../..").AuthPageRoutes;
|
|
576
|
+
header?: any;
|
|
577
|
+
loaderComponent?: any;
|
|
578
|
+
};
|
|
579
|
+
openEnableSubAccountManagementDialog: {
|
|
580
|
+
prepare: (payload: Partial<TUpdateSubAccountManagementState>) => {
|
|
581
|
+
payload: Partial<TUpdateSubAccountManagementState>;
|
|
582
|
+
};
|
|
583
|
+
reducer: (state: import("../..").AuthState, { payload }: {
|
|
584
|
+
payload: Partial<TUpdateSubAccountManagementState>;
|
|
585
|
+
type: string;
|
|
586
|
+
}) => {
|
|
587
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
588
|
+
error?: any;
|
|
589
|
+
isAuthenticated: boolean;
|
|
590
|
+
userIp?: string | undefined;
|
|
591
|
+
isLoading: boolean;
|
|
592
|
+
keepSessionAlive?: boolean | undefined;
|
|
593
|
+
socialLoginOptions?: {
|
|
594
|
+
promptConsent?: boolean | undefined;
|
|
595
|
+
} | undefined;
|
|
596
|
+
user?: import("../..").User | null | undefined;
|
|
597
|
+
isSSOAuth: boolean;
|
|
598
|
+
ssoACS?: string | undefined;
|
|
599
|
+
includeQueryParam?: boolean | undefined;
|
|
600
|
+
loginState: import("../..").LoginState;
|
|
601
|
+
activateState: import("../..").ActivateAccountState;
|
|
602
|
+
acceptInvitationState: import("../..").AcceptInvitationState;
|
|
603
|
+
forgotPasswordState: import("../..").ForgotPasswordState;
|
|
604
|
+
resetPhoneNumberState: import("../..").ResetPhoneNumberState;
|
|
605
|
+
ssoState: import("../..").SSOState;
|
|
606
|
+
profileState: import("../..").ProfileState;
|
|
607
|
+
mfaState: import("../..").MFAState;
|
|
608
|
+
teamState: import("../..").TeamState;
|
|
609
|
+
groupsState: import("../..").GroupsState;
|
|
610
|
+
groupsDialogsState: import("../..").GroupsDialogsState;
|
|
611
|
+
socialLoginState: import("../..").SocialLoginState;
|
|
612
|
+
signUpState: import("../..").SignUpState;
|
|
613
|
+
apiTokensState: import("../..").ApiTokensState;
|
|
614
|
+
securityPolicyState: import("../..").SecurityPolicyState;
|
|
615
|
+
restrictionsState: import("../..").RestrictionsState;
|
|
616
|
+
provisioningState: import("../..").ProvisioningState;
|
|
617
|
+
accountSettingsState: import("../..").AccountSettingsState;
|
|
618
|
+
tenantsState: import("../..").TenantsState;
|
|
619
|
+
rolesState: import("../..").RolesState;
|
|
620
|
+
sessionsState: import("../..").SessionsState;
|
|
621
|
+
hostedLoginBox?: boolean | undefined;
|
|
622
|
+
disableSilentRefresh?: boolean | undefined;
|
|
623
|
+
sessionsPolicyState: import("../..").SessionsPolicyState;
|
|
624
|
+
impersonateState?: import("../..").ImpersonateState | undefined;
|
|
625
|
+
passkeysState?: import("../..").PasskeysState | undefined;
|
|
626
|
+
customLoginState?: import("../..").CustomLoginState | undefined;
|
|
627
|
+
allAccountsState?: import("./types").IAllAccountsState | undefined;
|
|
628
|
+
allAccountsDialogsState?: IAllAccountsDialogsState | undefined;
|
|
629
|
+
securityCenterState?: import("../..").SecurityCenterState | undefined;
|
|
630
|
+
smsState?: import("../..").SmsState | undefined;
|
|
631
|
+
stepUpState?: import("../..").StepUpState | undefined;
|
|
632
|
+
applicationsState?: import("../..").ApplicationsState | undefined;
|
|
633
|
+
routes: import("../..").AuthPageRoutes;
|
|
634
|
+
header?: any;
|
|
635
|
+
loaderComponent?: any;
|
|
636
|
+
};
|
|
637
|
+
};
|
|
638
|
+
closeEnableSubAccountManagementDialog: (state: import("../..").AuthState) => {
|
|
639
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
640
|
+
error?: any;
|
|
641
|
+
isAuthenticated: boolean;
|
|
642
|
+
userIp?: string | undefined;
|
|
643
|
+
isLoading: boolean;
|
|
644
|
+
keepSessionAlive?: boolean | undefined;
|
|
645
|
+
socialLoginOptions?: {
|
|
646
|
+
promptConsent?: boolean | undefined;
|
|
647
|
+
} | undefined;
|
|
648
|
+
user?: import("../..").User | null | undefined;
|
|
649
|
+
isSSOAuth: boolean;
|
|
650
|
+
ssoACS?: string | undefined;
|
|
651
|
+
includeQueryParam?: boolean | undefined;
|
|
652
|
+
loginState: import("../..").LoginState;
|
|
653
|
+
activateState: import("../..").ActivateAccountState;
|
|
654
|
+
acceptInvitationState: import("../..").AcceptInvitationState;
|
|
655
|
+
forgotPasswordState: import("../..").ForgotPasswordState;
|
|
656
|
+
resetPhoneNumberState: import("../..").ResetPhoneNumberState;
|
|
657
|
+
ssoState: import("../..").SSOState;
|
|
658
|
+
profileState: import("../..").ProfileState;
|
|
659
|
+
mfaState: import("../..").MFAState;
|
|
660
|
+
teamState: import("../..").TeamState;
|
|
661
|
+
groupsState: import("../..").GroupsState;
|
|
662
|
+
groupsDialogsState: import("../..").GroupsDialogsState;
|
|
663
|
+
socialLoginState: import("../..").SocialLoginState;
|
|
664
|
+
signUpState: import("../..").SignUpState;
|
|
665
|
+
apiTokensState: import("../..").ApiTokensState;
|
|
666
|
+
securityPolicyState: import("../..").SecurityPolicyState;
|
|
667
|
+
restrictionsState: import("../..").RestrictionsState;
|
|
668
|
+
provisioningState: import("../..").ProvisioningState;
|
|
669
|
+
accountSettingsState: import("../..").AccountSettingsState;
|
|
670
|
+
tenantsState: import("../..").TenantsState;
|
|
671
|
+
rolesState: import("../..").RolesState;
|
|
672
|
+
sessionsState: import("../..").SessionsState;
|
|
673
|
+
hostedLoginBox?: boolean | undefined;
|
|
674
|
+
disableSilentRefresh?: boolean | undefined;
|
|
675
|
+
sessionsPolicyState: import("../..").SessionsPolicyState;
|
|
676
|
+
impersonateState?: import("../..").ImpersonateState | undefined;
|
|
677
|
+
passkeysState?: import("../..").PasskeysState | undefined;
|
|
678
|
+
customLoginState?: import("../..").CustomLoginState | undefined;
|
|
679
|
+
allAccountsState?: import("./types").IAllAccountsState | undefined;
|
|
680
|
+
allAccountsDialogsState?: IAllAccountsDialogsState | undefined;
|
|
681
|
+
securityCenterState?: import("../..").SecurityCenterState | undefined;
|
|
682
|
+
smsState?: import("../..").SmsState | undefined;
|
|
683
|
+
stepUpState?: import("../..").StepUpState | undefined;
|
|
684
|
+
applicationsState?: import("../..").ApplicationsState | undefined;
|
|
685
|
+
routes: import("../..").AuthPageRoutes;
|
|
686
|
+
header?: any;
|
|
687
|
+
loaderComponent?: any;
|
|
688
|
+
};
|
|
469
689
|
openAddUsersToAccountDialog: {
|
|
470
690
|
prepare: (payload: Partial<import("../../..").WithCallback<import("./types").TUserJwtPayload & import("./types").BaseAllAccountsDialogState & {
|
|
471
691
|
accountName: string;
|
|
@@ -834,6 +1054,10 @@ declare type DispatchedActions = {
|
|
|
834
1054
|
closeCreateSubAccountDialog: () => void;
|
|
835
1055
|
openUpdateSubAccountDialog: (payload: Partial<TUpdateAccountDialogState>) => void;
|
|
836
1056
|
closeUpdateSubAccountDialog: () => void;
|
|
1057
|
+
openEnableSubAccountManagementDialog: (payload: Partial<TUpdateSubAccountManagementState>) => void;
|
|
1058
|
+
closeEnableSubAccountManagementDialog: () => void;
|
|
1059
|
+
openDisableSubAccountManagementDialog: (payload: Partial<TUpdateSubAccountManagementState>) => void;
|
|
1060
|
+
closeDisableSubAccountManagementDialog: () => void;
|
|
837
1061
|
openDeleteSubAccountDialog: (payload: Partial<TDeleteSubAccountDialogState>) => void;
|
|
838
1062
|
closeDeleteSubAccountDialog: () => void;
|
|
839
1063
|
openAddUsersToAccountDialog: (payload: Partial<TAddUsersToSubAccountDialogState>) => void;
|
|
@@ -15,6 +15,20 @@ const allAccountsDialogsState = {
|
|
|
15
15
|
error: false,
|
|
16
16
|
jwt: ''
|
|
17
17
|
},
|
|
18
|
+
disableSubAccountManagementDialog: {
|
|
19
|
+
accountId: '',
|
|
20
|
+
accountName: '',
|
|
21
|
+
loading: false,
|
|
22
|
+
open: false,
|
|
23
|
+
error: false
|
|
24
|
+
},
|
|
25
|
+
enableSubAccountManagementDialog: {
|
|
26
|
+
accountId: '',
|
|
27
|
+
accountName: '',
|
|
28
|
+
loading: false,
|
|
29
|
+
open: false,
|
|
30
|
+
error: false
|
|
31
|
+
},
|
|
18
32
|
deleteSubAccountDialog: {
|
|
19
33
|
accountId: '',
|
|
20
34
|
accountName: '',
|
|
@@ -70,6 +84,16 @@ const reducers = {
|
|
|
70
84
|
open: true
|
|
71
85
|
}),
|
|
72
86
|
closeDeleteSubAccountDialog: dialogStateForKeyWithoutPayload('allAccountsDialogsState', 'deleteSubAccountDialog', allAccountsDialogsState.deleteSubAccountDialog),
|
|
87
|
+
// Disable sub account management dialog
|
|
88
|
+
openDisableSubAccountManagementDialog: dialogStateForKey('allAccountsDialogsState', 'disableSubAccountManagementDialog', {
|
|
89
|
+
open: true
|
|
90
|
+
}),
|
|
91
|
+
closeDisableSubAccountManagementDialog: dialogStateForKeyWithoutPayload('allAccountsDialogsState', 'disableSubAccountManagementDialog', allAccountsDialogsState.disableSubAccountManagementDialog),
|
|
92
|
+
// Enable sub account management dialog
|
|
93
|
+
openEnableSubAccountManagementDialog: dialogStateForKey('allAccountsDialogsState', 'enableSubAccountManagementDialog', {
|
|
94
|
+
open: true
|
|
95
|
+
}),
|
|
96
|
+
closeEnableSubAccountManagementDialog: dialogStateForKeyWithoutPayload('allAccountsDialogsState', 'enableSubAccountManagementDialog', allAccountsDialogsState.enableSubAccountManagementDialog),
|
|
73
97
|
// Add users to account dialog
|
|
74
98
|
openAddUsersToAccountDialog: dialogStateForKey('allAccountsDialogsState', 'addUsersToAccountDialog', {
|
|
75
99
|
open: true
|
|
@@ -209,6 +209,7 @@ declare const actions: {
|
|
|
209
209
|
} & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
210
210
|
createSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../../../interfaces").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./types").TUserJwtPayload, boolean>], import("../../../interfaces").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
211
211
|
updateSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../../../interfaces").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./types").TUserJwtPayload, boolean>], import("../../../interfaces").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
212
|
+
updateSubAccountManagement: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../../../interfaces").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantManagementRequest & import("./types").TUserJwtPayload, boolean>], import("../../../interfaces").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantManagementRequest & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
212
213
|
deleteSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../../../interfaces").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequestTenantDto & import("./types").TUserJwtPayload, boolean>], import("../../../interfaces").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequestTenantDto & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
213
214
|
updateSubAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../../../interfaces").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantRequest & import("./types").TUserJwtPayload, boolean>], import("../../../interfaces").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantRequest & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
214
215
|
addUsersToAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../../../interfaces").WithCallback<import("@frontegg/rest-api").AddUsersToSubTenantRequest & import("./types").TUserJwtPayload, boolean>], import("../../../interfaces").WithCallback<import("@frontegg/rest-api").AddUsersToSubTenantRequest & import("./types").TUserJwtPayload, boolean>, string, never, never>;
|
|
@@ -237,6 +238,7 @@ declare type DispatchedActions = {
|
|
|
237
238
|
updateSubAccount: (payload: IAllAccountsStateActionsPayloads['updateSubAccount']) => void;
|
|
238
239
|
deleteSubAccount: (payload: IAllAccountsStateActionsPayloads['deleteSubAccount']) => void;
|
|
239
240
|
updateSubAccountSettings: (payload: IAllAccountsStateActionsPayloads['updateSubAccountSettings']) => void;
|
|
241
|
+
updateSubAccountManagement: (payload: IAllAccountsStateActionsPayloads['updateSubAccountManagement']) => void;
|
|
240
242
|
addUsersToAccount: (payload: IAllAccountsStateActionsPayloads['addUsersToAccount']) => void;
|
|
241
243
|
getAccountUsers: (payload: IAllAccountsStateActionsPayloads['getAccountUsers']) => void;
|
|
242
244
|
deleteUsersFromAccount: (payload: IAllAccountsStateActionsPayloads['deleteUsersFromAccount']) => void;
|
|
@@ -63,6 +63,9 @@ const actions = {
|
|
|
63
63
|
updateSubAccount: createAction(`${authStoreName}/updateAccount`, payload => ({
|
|
64
64
|
payload
|
|
65
65
|
})),
|
|
66
|
+
updateSubAccountManagement: createAction(`${authStoreName}/updateSubAccountManagement`, payload => ({
|
|
67
|
+
payload
|
|
68
|
+
})),
|
|
66
69
|
deleteSubAccount: createAction(`${authStoreName}/deleteAccount`, payload => ({
|
|
67
70
|
payload
|
|
68
71
|
})),
|
|
@@ -9,6 +9,7 @@ import { updateNodeName } from './utils/updateNodeName';
|
|
|
9
9
|
import { removeNodeFromTree } from './utils/removeNodeFromTree';
|
|
10
10
|
import { appendChildrenToNode } from './utils/appendChildrenToNode';
|
|
11
11
|
import { getAccountsWithUsersCount } from './utils/getAccountsWithUsersCount';
|
|
12
|
+
import { updateNodeIsReseller } from './utils/updateNodeIsReseller';
|
|
12
13
|
export const selectTenantsState = () => sagaSelect(_ => _[authStoreName].tenantsState);
|
|
13
14
|
export const selectAllAccountsState = () => sagaSelect(_ => _[authStoreName].allAccountsState);
|
|
14
15
|
function* loadAccounts({
|
|
@@ -60,7 +61,8 @@ function* loadAccounts({
|
|
|
60
61
|
createdAt: account.createdAt,
|
|
61
62
|
metadata: account.metadata,
|
|
62
63
|
children: [],
|
|
63
|
-
loadMoreLink: _links == null ? void 0 : _links.next
|
|
64
|
+
loadMoreLink: _links == null ? void 0 : _links.next,
|
|
65
|
+
isReseller: account.isReseller
|
|
64
66
|
})));
|
|
65
67
|
yield put(actions.setSelectedAccountState({
|
|
66
68
|
accounts: updatedSingleAccountViewAccounts
|
|
@@ -87,7 +89,8 @@ function* loadAccounts({
|
|
|
87
89
|
createdAt: account.createdAt,
|
|
88
90
|
metadata: account.metadata,
|
|
89
91
|
children: [],
|
|
90
|
-
loadMoreLink: _links == null ? void 0 : _links.next
|
|
92
|
+
loadMoreLink: _links == null ? void 0 : _links.next,
|
|
93
|
+
isReseller: account.isReseller
|
|
91
94
|
})));
|
|
92
95
|
yield put(actions.setAllAccountsState({
|
|
93
96
|
accounts: updatedAccounts
|
|
@@ -400,6 +403,77 @@ function* updateSubAccountSettings({
|
|
|
400
403
|
}
|
|
401
404
|
}
|
|
402
405
|
|
|
406
|
+
//update sub account management
|
|
407
|
+
function* updateSubAccountManagement({
|
|
408
|
+
payload
|
|
409
|
+
}) {
|
|
410
|
+
const key = AllAccountsStateKeys.UPDATE_SUB_ACCOUNT_MANAGEMENT;
|
|
411
|
+
yield put(actions.setAllAccountsLoader({
|
|
412
|
+
key,
|
|
413
|
+
value: true
|
|
414
|
+
}));
|
|
415
|
+
const {
|
|
416
|
+
jwt,
|
|
417
|
+
isReseller,
|
|
418
|
+
callback,
|
|
419
|
+
tenantId
|
|
420
|
+
} = payload;
|
|
421
|
+
console.log('from saga: payload', payload);
|
|
422
|
+
try {
|
|
423
|
+
const isSelectedAccountChange = !!jwt;
|
|
424
|
+
if (isSelectedAccountChange) {
|
|
425
|
+
console.log('from saga: isSelectedAccountChange');
|
|
426
|
+
const {
|
|
427
|
+
selectedAccount,
|
|
428
|
+
accounts
|
|
429
|
+
} = yield selectAllAccountsState();
|
|
430
|
+
yield call(api.subTenants.updateSubTenantManagement, {
|
|
431
|
+
tenantId
|
|
432
|
+
}, {
|
|
433
|
+
isReseller
|
|
434
|
+
}, {
|
|
435
|
+
jwt
|
|
436
|
+
});
|
|
437
|
+
const updatedAccs = updateNodeIsReseller(selectedAccount.accounts, tenantId, isReseller != null ? isReseller : false);
|
|
438
|
+
yield put(actions.setSelectedAccountState({
|
|
439
|
+
isReseller,
|
|
440
|
+
accounts: updatedAccs
|
|
441
|
+
}));
|
|
442
|
+
const udpatedAccsForAllAccountsPage = updateNodeIsReseller(accounts, tenantId, isReseller != null ? isReseller : false);
|
|
443
|
+
yield put(actions.setAllAccountsState({
|
|
444
|
+
accounts: udpatedAccsForAllAccountsPage
|
|
445
|
+
}));
|
|
446
|
+
console.log('from saga: udpatedAccsForAllAccountsPage', udpatedAccsForAllAccountsPage);
|
|
447
|
+
} else {
|
|
448
|
+
const {
|
|
449
|
+
accounts
|
|
450
|
+
} = yield selectAllAccountsState();
|
|
451
|
+
yield call(api.subTenants.updateSubTenantManagement, {
|
|
452
|
+
tenantId
|
|
453
|
+
}, {
|
|
454
|
+
isReseller
|
|
455
|
+
});
|
|
456
|
+
const udpatedAccs = updateNodeIsReseller(accounts, tenantId, isReseller != null ? isReseller : false);
|
|
457
|
+
yield put(actions.setAllAccountsState({
|
|
458
|
+
accounts: udpatedAccs
|
|
459
|
+
}));
|
|
460
|
+
console.log('from saga: updatedAccs', udpatedAccs);
|
|
461
|
+
}
|
|
462
|
+
callback == null ? void 0 : callback(true);
|
|
463
|
+
} catch (e) {
|
|
464
|
+
yield put(actions.setAllAccountsError({
|
|
465
|
+
key,
|
|
466
|
+
value: errorHandler(e)
|
|
467
|
+
}));
|
|
468
|
+
callback == null ? void 0 : callback(false);
|
|
469
|
+
} finally {
|
|
470
|
+
yield put(actions.setAllAccountsLoader({
|
|
471
|
+
key,
|
|
472
|
+
value: false
|
|
473
|
+
}));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
403
477
|
//delete user from tenants and subtenants
|
|
404
478
|
function* deleteUserFromAccount({
|
|
405
479
|
payload
|
|
@@ -815,6 +889,7 @@ export function* allAccountsSagas() {
|
|
|
815
889
|
yield takeLatest(actions.createSubAccount, createSubAccount);
|
|
816
890
|
yield takeLatest(actions.deleteSubAccount, deleteSubAccount);
|
|
817
891
|
yield takeLatest(actions.updateSubAccountSettings, updateSubAccountSettings);
|
|
892
|
+
yield takeLatest(actions.updateSubAccountManagement, updateSubAccountManagement);
|
|
818
893
|
yield takeLatest(actions.addUsersToAccount, addUsersToAccount);
|
|
819
894
|
yield takeLatest(actions.deleteUsersFromAccount, deleteUserFromAccount);
|
|
820
895
|
yield takeLatest(actions.setUserRolesForSubAccount, setUserRolesForSubAccount);
|
|
@@ -16,6 +16,10 @@ export declare type TUpdateAccountDialogState = TUserJwtPayload & BaseAllAccount
|
|
|
16
16
|
accountName: string;
|
|
17
17
|
accountId: string;
|
|
18
18
|
};
|
|
19
|
+
export declare type TUpdateSubAccountManagementState = BaseAllAccountsDialogState & TUserJwtPayload & {
|
|
20
|
+
accountName: string;
|
|
21
|
+
accountId: string;
|
|
22
|
+
};
|
|
19
23
|
export declare type TDeleteSubAccountDialogState = WithCallback<TUserJwtPayload & BaseAllAccountsDialogState & {
|
|
20
24
|
accountName: string;
|
|
21
25
|
accountId: string;
|
|
@@ -42,6 +46,8 @@ export declare type TEditUserRolesDialogState = TUserJwtPayload & BaseAllAccount
|
|
|
42
46
|
export interface IAllAccountsDialogsState {
|
|
43
47
|
updateSubAccountDialog: TUpdateAccountDialogState;
|
|
44
48
|
deleteSubAccountDialog: TDeleteSubAccountDialogState;
|
|
49
|
+
enableSubAccountManagementDialog: TUpdateSubAccountManagementState;
|
|
50
|
+
disableSubAccountManagementDialog: TUpdateSubAccountManagementState;
|
|
45
51
|
editUserRolesDialog: TEditUserRolesDialogState;
|
|
46
52
|
createSubAccountDialog: TCreateSubAccountDialogState;
|
|
47
53
|
addUsersToAccountDialog: TAddUsersToSubAccountDialogState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRole, ITeamUser, IUsersV3Data, ISettingsResponse, GetUserJwtResponseDto, SearchSubTenantsParams, FronteggPaginationLinks, ISearchUserQueryParamsV3, IGetTenantsUserCountResponse, UpdateSubAccountAccessRequestDto, UpdateUserRolesForSubTenantsRequestDto } from '@frontegg/rest-api';
|
|
1
|
+
import { IRole, ITeamUser, IUsersV3Data, ISettingsResponse, GetUserJwtResponseDto, SearchSubTenantsParams, FronteggPaginationLinks, ISearchUserQueryParamsV3, IGetTenantsUserCountResponse, UpdateSubAccountAccessRequestDto, UpdateUserRolesForSubTenantsRequestDto, UpdateSubTenantManagementRequest } from '@frontegg/rest-api';
|
|
2
2
|
import { LoaderIndicatorState, WithCallback } from '../../../../interfaces';
|
|
3
3
|
import { IParentTenant, GetUserJwtRequestDto, CreateSubTenantRequest, UpdateSubTenantRequest, AddUsersToSubTenantRequest, UpdateSubTenantRequestParams, RemoveUserFromSubTenantsRequest, RemoveUserFromSubTenantsRequestTenantDto } from '@frontegg/rest-api';
|
|
4
4
|
export declare enum AllAccountsStateKeys {
|
|
@@ -16,6 +16,7 @@ export declare enum AllAccountsStateKeys {
|
|
|
16
16
|
DELETE_USERS_FROM_ACCOUNT = "DELETE_USERS_FROM_ACCOUNT",
|
|
17
17
|
SET_USER_ROLES_FOR_SUB_ACCOUNT = "SET_USER_ROLES_FOR_SUB_ACCOUNT",
|
|
18
18
|
UPDATE_SUB_ACCOUNT_SETTINGS = "UPDATE_SUB_ACCOUNT_SETTINGS",
|
|
19
|
+
UPDATE_SUB_ACCOUNT_MANAGEMENT = "UPDATE_SUB_ACCOUNT_MANAGEMENT",
|
|
19
20
|
GET_USER_JWT = "GET_USER_JWT",
|
|
20
21
|
GET_TEAM_USERS = "GET_TEAM_USERS"
|
|
21
22
|
}
|
|
@@ -32,6 +33,7 @@ export declare type TAccountsTree = {
|
|
|
32
33
|
metadata?: {
|
|
33
34
|
isParent?: boolean;
|
|
34
35
|
};
|
|
36
|
+
isReseller?: boolean;
|
|
35
37
|
};
|
|
36
38
|
export declare type TSubAccountUser = IUsersV3Data & {
|
|
37
39
|
roles?: IRole[];
|
|
@@ -95,6 +97,7 @@ export interface IAllAccountsStateActionsPayloads {
|
|
|
95
97
|
updateSubAccount: WithCallback<CreateSubTenantRequest & TUserJwtPayload>;
|
|
96
98
|
deleteSubAccount: WithCallback<RemoveUserFromSubTenantsRequestTenantDto & TUserJwtPayload>;
|
|
97
99
|
updateSubAccountSettings: WithCallback<UpdateSubTenantRequestParams & UpdateSubTenantRequest & TUserJwtPayload>;
|
|
100
|
+
updateSubAccountManagement: WithCallback<UpdateSubTenantRequestParams & UpdateSubTenantManagementRequest & TUserJwtPayload>;
|
|
98
101
|
getUserJwtForSubAccount: WithCallback<GetUserJwtRequestDto>;
|
|
99
102
|
addUsersToAccount: WithCallback<AddUsersToSubTenantRequest & TUserJwtPayload>;
|
|
100
103
|
deleteUsersFromAccount: WithCallback<RemoveUserFromSubTenantsRequest & TUserJwtPayload>;
|
|
@@ -17,6 +17,7 @@ export let AllAccountsStateKeys;
|
|
|
17
17
|
AllAccountsStateKeys["DELETE_USERS_FROM_ACCOUNT"] = "DELETE_USERS_FROM_ACCOUNT";
|
|
18
18
|
AllAccountsStateKeys["SET_USER_ROLES_FOR_SUB_ACCOUNT"] = "SET_USER_ROLES_FOR_SUB_ACCOUNT";
|
|
19
19
|
AllAccountsStateKeys["UPDATE_SUB_ACCOUNT_SETTINGS"] = "UPDATE_SUB_ACCOUNT_SETTINGS";
|
|
20
|
+
AllAccountsStateKeys["UPDATE_SUB_ACCOUNT_MANAGEMENT"] = "UPDATE_SUB_ACCOUNT_MANAGEMENT";
|
|
20
21
|
AllAccountsStateKeys["GET_USER_JWT"] = "GET_USER_JWT";
|
|
21
22
|
AllAccountsStateKeys["GET_TEAM_USERS"] = "GET_TEAM_USERS";
|
|
22
23
|
})(AllAccountsStateKeys || (AllAccountsStateKeys = {}));
|
|
@@ -13,7 +13,8 @@ export const getAccountsWithUsersCount = ({
|
|
|
13
13
|
tenantId: account.tenantId,
|
|
14
14
|
numberOfUsers: (_tenantsUsersCountArr = (_tenantsUsersCountArr2 = tenantsUsersCountArray.find(i => i.tenantId === account.tenantId)) == null ? void 0 : _tenantsUsersCountArr2.totalUsers) != null ? _tenantsUsersCountArr : 0,
|
|
15
15
|
createdAt: account.createdAt,
|
|
16
|
-
metadata: account.metadata
|
|
16
|
+
metadata: account.metadata,
|
|
17
|
+
isReseller: account.isReseller
|
|
17
18
|
};
|
|
18
19
|
});
|
|
19
20
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
// update node is reseller
|
|
3
|
+
export const updateNodeIsReseller = (treeNode, id, isReseller) => {
|
|
4
|
+
var _treeNode$children$ma, _treeNode$children;
|
|
5
|
+
if (treeNode.tenantId === id) {
|
|
6
|
+
return _extends({}, treeNode, {
|
|
7
|
+
isReseller: isReseller
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return _extends({}, treeNode, {
|
|
11
|
+
children: (_treeNode$children$ma = treeNode == null ? void 0 : (_treeNode$children = treeNode.children) == null ? void 0 : _treeNode$children.map(child => updateNodeIsReseller(child, id, isReseller))) != null ? _treeNode$children$ma : []
|
|
12
|
+
});
|
|
13
|
+
};
|
package/auth/index.d.ts
CHANGED
|
@@ -110,6 +110,7 @@ declare const _default: {
|
|
|
110
110
|
} & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
111
111
|
createSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
112
112
|
updateSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
113
|
+
updateSubAccountManagement: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantManagementRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantManagementRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
113
114
|
deleteSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequestTenantDto & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequestTenantDto & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
114
115
|
updateSubAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
115
116
|
addUsersToAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").AddUsersToSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").AddUsersToSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
@@ -609,6 +610,10 @@ declare const _default: {
|
|
|
609
610
|
isParentAccount: boolean;
|
|
610
611
|
}, boolean>>, string, never, never>;
|
|
611
612
|
closeDeleteSubAccountDialog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
613
|
+
openDisableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>], Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>, string, never, never>;
|
|
614
|
+
closeDisableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
615
|
+
openEnableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>], Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>, string, never, never>;
|
|
616
|
+
closeEnableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
612
617
|
openAddUsersToAccountDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("..").WithCallback<import("./MSP/AllAccountsState").TUserJwtPayload & import("./MSP/AllAccountsState").BaseAllAccountsDialogState & {
|
|
613
618
|
accountName: string;
|
|
614
619
|
accountId: string;
|
package/auth/reducer.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ declare const actions: {
|
|
|
67
67
|
} & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
68
68
|
createSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
69
69
|
updateSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").CreateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
70
|
+
updateSubAccountManagement: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantManagementRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantManagementRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
70
71
|
deleteSubAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequestTenantDto & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").RemoveUserFromSubTenantsRequestTenantDto & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
71
72
|
updateSubAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").UpdateSubTenantRequestParams & import("@frontegg/rest-api").UpdateSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
72
73
|
addUsersToAccount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").AddUsersToSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>], import("..").WithCallback<import("@frontegg/rest-api").AddUsersToSubTenantRequest & import("./MSP/AllAccountsState").TUserJwtPayload, boolean>, string, never, never>;
|
|
@@ -566,6 +567,10 @@ declare const actions: {
|
|
|
566
567
|
isParentAccount: boolean;
|
|
567
568
|
}, boolean>>, string, never, never>;
|
|
568
569
|
closeDeleteSubAccountDialog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
570
|
+
openDisableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>], Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>, string, never, never>;
|
|
571
|
+
closeDisableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
572
|
+
openEnableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>], Partial<import("./MSP/AllAccountsState").TUpdateSubAccountManagementState>, string, never, never>;
|
|
573
|
+
closeEnableSubAccountManagementDialog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
569
574
|
openAddUsersToAccountDialog: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("..").WithCallback<import("./MSP/AllAccountsState").TUserJwtPayload & import("./MSP/AllAccountsState").BaseAllAccountsDialogState & {
|
|
570
575
|
accountName: string;
|
|
571
576
|
accountId: string;
|
package/index.js
CHANGED
|
@@ -21,6 +21,20 @@ const allAccountsDialogsState = {
|
|
|
21
21
|
error: false,
|
|
22
22
|
jwt: ''
|
|
23
23
|
},
|
|
24
|
+
disableSubAccountManagementDialog: {
|
|
25
|
+
accountId: '',
|
|
26
|
+
accountName: '',
|
|
27
|
+
loading: false,
|
|
28
|
+
open: false,
|
|
29
|
+
error: false
|
|
30
|
+
},
|
|
31
|
+
enableSubAccountManagementDialog: {
|
|
32
|
+
accountId: '',
|
|
33
|
+
accountName: '',
|
|
34
|
+
loading: false,
|
|
35
|
+
open: false,
|
|
36
|
+
error: false
|
|
37
|
+
},
|
|
24
38
|
deleteSubAccountDialog: {
|
|
25
39
|
accountId: '',
|
|
26
40
|
accountName: '',
|
|
@@ -77,6 +91,16 @@ const reducers = {
|
|
|
77
91
|
open: true
|
|
78
92
|
}),
|
|
79
93
|
closeDeleteSubAccountDialog: (0, _utils.dialogStateForKeyWithoutPayload)('allAccountsDialogsState', 'deleteSubAccountDialog', allAccountsDialogsState.deleteSubAccountDialog),
|
|
94
|
+
// Disable sub account management dialog
|
|
95
|
+
openDisableSubAccountManagementDialog: (0, _utils.dialogStateForKey)('allAccountsDialogsState', 'disableSubAccountManagementDialog', {
|
|
96
|
+
open: true
|
|
97
|
+
}),
|
|
98
|
+
closeDisableSubAccountManagementDialog: (0, _utils.dialogStateForKeyWithoutPayload)('allAccountsDialogsState', 'disableSubAccountManagementDialog', allAccountsDialogsState.disableSubAccountManagementDialog),
|
|
99
|
+
// Enable sub account management dialog
|
|
100
|
+
openEnableSubAccountManagementDialog: (0, _utils.dialogStateForKey)('allAccountsDialogsState', 'enableSubAccountManagementDialog', {
|
|
101
|
+
open: true
|
|
102
|
+
}),
|
|
103
|
+
closeEnableSubAccountManagementDialog: (0, _utils.dialogStateForKeyWithoutPayload)('allAccountsDialogsState', 'enableSubAccountManagementDialog', allAccountsDialogsState.enableSubAccountManagementDialog),
|
|
80
104
|
// Add users to account dialog
|
|
81
105
|
openAddUsersToAccountDialog: (0, _utils.dialogStateForKey)('allAccountsDialogsState', 'addUsersToAccountDialog', {
|
|
82
106
|
open: true
|
|
@@ -88,6 +88,9 @@ const actions = {
|
|
|
88
88
|
updateSubAccount: (0, _toolkit.createAction)(`${_constants.authStoreName}/updateAccount`, payload => ({
|
|
89
89
|
payload
|
|
90
90
|
})),
|
|
91
|
+
updateSubAccountManagement: (0, _toolkit.createAction)(`${_constants.authStoreName}/updateSubAccountManagement`, payload => ({
|
|
92
|
+
payload
|
|
93
|
+
})),
|
|
91
94
|
deleteSubAccount: (0, _toolkit.createAction)(`${_constants.authStoreName}/deleteAccount`, payload => ({
|
|
92
95
|
payload
|
|
93
96
|
})),
|
|
@@ -17,6 +17,7 @@ var _updateNodeName = require("./utils/updateNodeName");
|
|
|
17
17
|
var _removeNodeFromTree = require("./utils/removeNodeFromTree");
|
|
18
18
|
var _appendChildrenToNode = require("./utils/appendChildrenToNode");
|
|
19
19
|
var _getAccountsWithUsersCount = require("./utils/getAccountsWithUsersCount");
|
|
20
|
+
var _updateNodeIsReseller = require("./utils/updateNodeIsReseller");
|
|
20
21
|
const selectTenantsState = () => (0, _effects.select)(_ => _[_constants.authStoreName].tenantsState);
|
|
21
22
|
exports.selectTenantsState = selectTenantsState;
|
|
22
23
|
const selectAllAccountsState = () => (0, _effects.select)(_ => _[_constants.authStoreName].allAccountsState);
|
|
@@ -70,7 +71,8 @@ function* loadAccounts({
|
|
|
70
71
|
createdAt: account.createdAt,
|
|
71
72
|
metadata: account.metadata,
|
|
72
73
|
children: [],
|
|
73
|
-
loadMoreLink: _links == null ? void 0 : _links.next
|
|
74
|
+
loadMoreLink: _links == null ? void 0 : _links.next,
|
|
75
|
+
isReseller: account.isReseller
|
|
74
76
|
})));
|
|
75
77
|
yield (0, _effects.put)(_reducer.actions.setSelectedAccountState({
|
|
76
78
|
accounts: updatedSingleAccountViewAccounts
|
|
@@ -97,7 +99,8 @@ function* loadAccounts({
|
|
|
97
99
|
createdAt: account.createdAt,
|
|
98
100
|
metadata: account.metadata,
|
|
99
101
|
children: [],
|
|
100
|
-
loadMoreLink: _links == null ? void 0 : _links.next
|
|
102
|
+
loadMoreLink: _links == null ? void 0 : _links.next,
|
|
103
|
+
isReseller: account.isReseller
|
|
101
104
|
})));
|
|
102
105
|
yield (0, _effects.put)(_reducer.actions.setAllAccountsState({
|
|
103
106
|
accounts: updatedAccounts
|
|
@@ -410,6 +413,77 @@ function* updateSubAccountSettings({
|
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
415
|
|
|
416
|
+
//update sub account management
|
|
417
|
+
function* updateSubAccountManagement({
|
|
418
|
+
payload
|
|
419
|
+
}) {
|
|
420
|
+
const key = _stateTypes.AllAccountsStateKeys.UPDATE_SUB_ACCOUNT_MANAGEMENT;
|
|
421
|
+
yield (0, _effects.put)(_reducer.actions.setAllAccountsLoader({
|
|
422
|
+
key,
|
|
423
|
+
value: true
|
|
424
|
+
}));
|
|
425
|
+
const {
|
|
426
|
+
jwt,
|
|
427
|
+
isReseller,
|
|
428
|
+
callback,
|
|
429
|
+
tenantId
|
|
430
|
+
} = payload;
|
|
431
|
+
console.log('from saga: payload', payload);
|
|
432
|
+
try {
|
|
433
|
+
const isSelectedAccountChange = !!jwt;
|
|
434
|
+
if (isSelectedAccountChange) {
|
|
435
|
+
console.log('from saga: isSelectedAccountChange');
|
|
436
|
+
const {
|
|
437
|
+
selectedAccount,
|
|
438
|
+
accounts
|
|
439
|
+
} = yield selectAllAccountsState();
|
|
440
|
+
yield (0, _effects.call)(_restApi.api.subTenants.updateSubTenantManagement, {
|
|
441
|
+
tenantId
|
|
442
|
+
}, {
|
|
443
|
+
isReseller
|
|
444
|
+
}, {
|
|
445
|
+
jwt
|
|
446
|
+
});
|
|
447
|
+
const updatedAccs = (0, _updateNodeIsReseller.updateNodeIsReseller)(selectedAccount.accounts, tenantId, isReseller != null ? isReseller : false);
|
|
448
|
+
yield (0, _effects.put)(_reducer.actions.setSelectedAccountState({
|
|
449
|
+
isReseller,
|
|
450
|
+
accounts: updatedAccs
|
|
451
|
+
}));
|
|
452
|
+
const udpatedAccsForAllAccountsPage = (0, _updateNodeIsReseller.updateNodeIsReseller)(accounts, tenantId, isReseller != null ? isReseller : false);
|
|
453
|
+
yield (0, _effects.put)(_reducer.actions.setAllAccountsState({
|
|
454
|
+
accounts: udpatedAccsForAllAccountsPage
|
|
455
|
+
}));
|
|
456
|
+
console.log('from saga: udpatedAccsForAllAccountsPage', udpatedAccsForAllAccountsPage);
|
|
457
|
+
} else {
|
|
458
|
+
const {
|
|
459
|
+
accounts
|
|
460
|
+
} = yield selectAllAccountsState();
|
|
461
|
+
yield (0, _effects.call)(_restApi.api.subTenants.updateSubTenantManagement, {
|
|
462
|
+
tenantId
|
|
463
|
+
}, {
|
|
464
|
+
isReseller
|
|
465
|
+
});
|
|
466
|
+
const udpatedAccs = (0, _updateNodeIsReseller.updateNodeIsReseller)(accounts, tenantId, isReseller != null ? isReseller : false);
|
|
467
|
+
yield (0, _effects.put)(_reducer.actions.setAllAccountsState({
|
|
468
|
+
accounts: udpatedAccs
|
|
469
|
+
}));
|
|
470
|
+
console.log('from saga: updatedAccs', udpatedAccs);
|
|
471
|
+
}
|
|
472
|
+
callback == null ? void 0 : callback(true);
|
|
473
|
+
} catch (e) {
|
|
474
|
+
yield (0, _effects.put)(_reducer.actions.setAllAccountsError({
|
|
475
|
+
key,
|
|
476
|
+
value: (0, _utils.errorHandler)(e)
|
|
477
|
+
}));
|
|
478
|
+
callback == null ? void 0 : callback(false);
|
|
479
|
+
} finally {
|
|
480
|
+
yield (0, _effects.put)(_reducer.actions.setAllAccountsLoader({
|
|
481
|
+
key,
|
|
482
|
+
value: false
|
|
483
|
+
}));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
413
487
|
//delete user from tenants and subtenants
|
|
414
488
|
function* deleteUserFromAccount({
|
|
415
489
|
payload
|
|
@@ -825,6 +899,7 @@ function* allAccountsSagas() {
|
|
|
825
899
|
yield (0, _effects.takeLatest)(_reducer.actions.createSubAccount, createSubAccount);
|
|
826
900
|
yield (0, _effects.takeLatest)(_reducer.actions.deleteSubAccount, deleteSubAccount);
|
|
827
901
|
yield (0, _effects.takeLatest)(_reducer.actions.updateSubAccountSettings, updateSubAccountSettings);
|
|
902
|
+
yield (0, _effects.takeLatest)(_reducer.actions.updateSubAccountManagement, updateSubAccountManagement);
|
|
828
903
|
yield (0, _effects.takeLatest)(_reducer.actions.addUsersToAccount, addUsersToAccount);
|
|
829
904
|
yield (0, _effects.takeLatest)(_reducer.actions.deleteUsersFromAccount, deleteUserFromAccount);
|
|
830
905
|
yield (0, _effects.takeLatest)(_reducer.actions.setUserRolesForSubAccount, setUserRolesForSubAccount);
|
|
@@ -22,6 +22,7 @@ exports.AllAccountsStateKeys = AllAccountsStateKeys;
|
|
|
22
22
|
AllAccountsStateKeys["DELETE_USERS_FROM_ACCOUNT"] = "DELETE_USERS_FROM_ACCOUNT";
|
|
23
23
|
AllAccountsStateKeys["SET_USER_ROLES_FOR_SUB_ACCOUNT"] = "SET_USER_ROLES_FOR_SUB_ACCOUNT";
|
|
24
24
|
AllAccountsStateKeys["UPDATE_SUB_ACCOUNT_SETTINGS"] = "UPDATE_SUB_ACCOUNT_SETTINGS";
|
|
25
|
+
AllAccountsStateKeys["UPDATE_SUB_ACCOUNT_MANAGEMENT"] = "UPDATE_SUB_ACCOUNT_MANAGEMENT";
|
|
25
26
|
AllAccountsStateKeys["GET_USER_JWT"] = "GET_USER_JWT";
|
|
26
27
|
AllAccountsStateKeys["GET_TEAM_USERS"] = "GET_TEAM_USERS";
|
|
27
28
|
})(AllAccountsStateKeys || (exports.AllAccountsStateKeys = AllAccountsStateKeys = {}));
|
|
@@ -19,7 +19,8 @@ const getAccountsWithUsersCount = ({
|
|
|
19
19
|
tenantId: account.tenantId,
|
|
20
20
|
numberOfUsers: (_tenantsUsersCountArr = (_tenantsUsersCountArr2 = tenantsUsersCountArray.find(i => i.tenantId === account.tenantId)) == null ? void 0 : _tenantsUsersCountArr2.totalUsers) != null ? _tenantsUsersCountArr : 0,
|
|
21
21
|
createdAt: account.createdAt,
|
|
22
|
-
metadata: account.metadata
|
|
22
|
+
metadata: account.metadata,
|
|
23
|
+
isReseller: account.isReseller
|
|
23
24
|
};
|
|
24
25
|
});
|
|
25
26
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.updateNodeIsReseller = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
// update node is reseller
|
|
10
|
+
const updateNodeIsReseller = (treeNode, id, isReseller) => {
|
|
11
|
+
var _treeNode$children$ma, _treeNode$children;
|
|
12
|
+
if (treeNode.tenantId === id) {
|
|
13
|
+
return (0, _extends2.default)({}, treeNode, {
|
|
14
|
+
isReseller: isReseller
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return (0, _extends2.default)({}, treeNode, {
|
|
18
|
+
children: (_treeNode$children$ma = treeNode == null ? void 0 : (_treeNode$children = treeNode.children) == null ? void 0 : _treeNode$children.map(child => updateNodeIsReseller(child, id, isReseller))) != null ? _treeNode$children$ma : []
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
exports.updateNodeIsReseller = updateNodeIsReseller;
|
package/node/index.js
CHANGED
package/node/vendor/saga.js
CHANGED
|
@@ -16,10 +16,14 @@ function* loadVendorPublicInfo() {
|
|
|
16
16
|
}));
|
|
17
17
|
try {
|
|
18
18
|
const {
|
|
19
|
-
whiteLabelMode = false
|
|
19
|
+
whiteLabelMode = false,
|
|
20
|
+
name,
|
|
21
|
+
logo
|
|
20
22
|
} = yield _restApi.api.vendor.getVendorPublicInfo();
|
|
21
23
|
yield (0, _effects.put)(_reducer.actions.setVendorState({
|
|
22
24
|
whiteLabelMode,
|
|
25
|
+
name,
|
|
26
|
+
logo,
|
|
23
27
|
loading: false
|
|
24
28
|
}));
|
|
25
29
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.187.0-alpha.0",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
9
|
"@frontegg/entitlements-javascript-commons": "1.1.2",
|
|
10
|
-
"@frontegg/rest-api": "3.1.
|
|
10
|
+
"@frontegg/rest-api": "3.1.72",
|
|
11
11
|
"@reduxjs/toolkit": "1.8.5",
|
|
12
12
|
"fast-deep-equal": "3.1.3",
|
|
13
13
|
"redux-saga": "^1.2.1",
|
|
@@ -2,6 +2,8 @@ import { VendorState } from '../interfaces';
|
|
|
2
2
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
3
3
|
declare const reducers: {
|
|
4
4
|
setVendorState: (state: VendorState, { payload }: PayloadAction<Partial<VendorState>>) => {
|
|
5
|
+
name?: string | undefined;
|
|
6
|
+
logo?: string | undefined;
|
|
5
7
|
whiteLabelMode?: boolean | undefined;
|
|
6
8
|
loading: boolean;
|
|
7
9
|
};
|
package/vendor/interfaces.d.ts
CHANGED
package/vendor/saga.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare function loadVendorPublicInfo(): Generator<import("redux-saga/eff
|
|
|
3
3
|
type: string;
|
|
4
4
|
}> | Promise<import("@frontegg/rest-api").IVendorPublicInfoResponse>, void, {
|
|
5
5
|
whiteLabelMode?: false | undefined;
|
|
6
|
+
name: any;
|
|
7
|
+
logo: any;
|
|
6
8
|
}>;
|
|
7
9
|
export declare function vendorSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
8
10
|
export declare function sagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
package/vendor/saga.js
CHANGED
|
@@ -8,10 +8,14 @@ export function* loadVendorPublicInfo() {
|
|
|
8
8
|
}));
|
|
9
9
|
try {
|
|
10
10
|
const {
|
|
11
|
-
whiteLabelMode = false
|
|
11
|
+
whiteLabelMode = false,
|
|
12
|
+
name,
|
|
13
|
+
logo
|
|
12
14
|
} = yield api.vendor.getVendorPublicInfo();
|
|
13
15
|
yield put(actions.setVendorState({
|
|
14
16
|
whiteLabelMode,
|
|
17
|
+
name,
|
|
18
|
+
logo,
|
|
15
19
|
loading: false
|
|
16
20
|
}));
|
|
17
21
|
} catch (e) {
|