@greatapps/common 1.1.543 → 1.1.546
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/dist/components/account/ConfirmDeleteAccountModal.mjs +12 -10
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +21 -5
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +3 -61
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +5 -4
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/modules/accounts/actions/account-management.action.mjs +2 -2
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -1
- package/dist/modules/accounts/services/account.service.mjs +5 -2
- package/dist/modules/accounts/services/account.service.mjs.map +1 -1
- package/dist/modules/auth/hooks/useUserQuery.mjs +1 -1
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -1
- package/dist/modules/cards/types.mjs +13 -12
- package/dist/modules/cards/types.mjs.map +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs +2 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -1
- package/dist/store/useAccountModals.mjs +25 -4
- package/dist/store/useAccountModals.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/account/ConfirmDeleteAccountModal.tsx +16 -7
- package/src/components/account/DeleteAccountModal.tsx +24 -4
- package/src/components/account/sections/MyProfileSection.tsx +2 -68
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +7 -4
- package/src/modules/accounts/actions/account-management.action.ts +3 -2
- package/src/modules/accounts/hooks/useAccountManagement.ts +2 -1
- package/src/modules/accounts/services/account.service.ts +6 -2
- package/src/modules/accounts/types.ts +4 -0
- package/src/modules/auth/hooks/useUserQuery.ts +1 -1
- package/src/modules/cards/types.ts +14 -12
- package/src/modules/plans/utils/map-api-plan-to-ui.ts +1 -1
- package/src/modules/subscriptions/types/subscription.type.ts +2 -1
- package/src/store/useAccountModals.ts +41 -8
|
@@ -13,18 +13,29 @@ export interface AccountModalsConfig {
|
|
|
13
13
|
onGoToSubscription?: () => void;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
interface DeleteAccountPayload {
|
|
17
|
+
password: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
interface AccountModalsState {
|
|
17
21
|
activeModal: AccountModalType | null;
|
|
18
22
|
config: AccountModalsConfig;
|
|
19
23
|
initialSection?: AccountSectionType;
|
|
20
24
|
|
|
25
|
+
/** Payload coletado no DeleteAccountModal, consumido pelo ConfirmDeleteAccountModal. */
|
|
26
|
+
deleteAccountPayload: DeleteAccountPayload | null;
|
|
27
|
+
/** Mensagem de erro do backend quando o delete falha (ex.: senha inválida).
|
|
28
|
+
* Mostrada no DeleteAccountModal quando o usuário é mandado de volta. */
|
|
29
|
+
deleteAccountError: string | null;
|
|
30
|
+
|
|
21
31
|
/** Called by <AccountModals> to keep app-level config in sync */
|
|
22
32
|
updateConfig: (config: AccountModalsConfig) => void;
|
|
23
33
|
|
|
24
34
|
openConfigurations: (initialSection?: AccountSectionType) => void;
|
|
25
|
-
openDeleteAccount: () => void;
|
|
35
|
+
openDeleteAccount: (error?: string) => void;
|
|
26
36
|
openIsntPossibleDelete: () => void;
|
|
27
|
-
openConfirmDelete: () => void;
|
|
37
|
+
openConfirmDelete: (payload: DeleteAccountPayload) => void;
|
|
38
|
+
clearDeleteAccountError: () => void;
|
|
28
39
|
close: () => void;
|
|
29
40
|
}
|
|
30
41
|
|
|
@@ -32,21 +43,43 @@ export const useAccountModals = create<AccountModalsState>((set) => ({
|
|
|
32
43
|
activeModal: null,
|
|
33
44
|
config: {},
|
|
34
45
|
initialSection: undefined,
|
|
46
|
+
deleteAccountPayload: null,
|
|
47
|
+
deleteAccountError: null,
|
|
35
48
|
|
|
36
49
|
updateConfig: (config) => set({ config }),
|
|
37
50
|
|
|
38
51
|
openConfigurations: (initialSection) =>
|
|
39
|
-
set({
|
|
52
|
+
set({
|
|
53
|
+
activeModal: 'configurations',
|
|
54
|
+
initialSection,
|
|
55
|
+
deleteAccountPayload: null,
|
|
56
|
+
deleteAccountError: null,
|
|
57
|
+
}),
|
|
40
58
|
|
|
41
|
-
openDeleteAccount: () =>
|
|
42
|
-
set({
|
|
59
|
+
openDeleteAccount: (error) =>
|
|
60
|
+
set({
|
|
61
|
+
activeModal: 'deleteAccount',
|
|
62
|
+
deleteAccountPayload: null,
|
|
63
|
+
deleteAccountError: error ?? null,
|
|
64
|
+
}),
|
|
43
65
|
|
|
44
66
|
openIsntPossibleDelete: () =>
|
|
45
67
|
set({ activeModal: 'isntPossibleDelete' }),
|
|
46
68
|
|
|
47
|
-
openConfirmDelete: () =>
|
|
48
|
-
set({
|
|
69
|
+
openConfirmDelete: (payload) =>
|
|
70
|
+
set({
|
|
71
|
+
activeModal: 'confirmDelete',
|
|
72
|
+
deleteAccountPayload: payload,
|
|
73
|
+
deleteAccountError: null,
|
|
74
|
+
}),
|
|
75
|
+
|
|
76
|
+
clearDeleteAccountError: () => set({ deleteAccountError: null }),
|
|
49
77
|
|
|
50
78
|
close: () =>
|
|
51
|
-
set({
|
|
79
|
+
set({
|
|
80
|
+
activeModal: null,
|
|
81
|
+
initialSection: undefined,
|
|
82
|
+
deleteAccountPayload: null,
|
|
83
|
+
deleteAccountError: null,
|
|
84
|
+
}),
|
|
52
85
|
}));
|