@greatapps/common 1.1.477 → 1.1.479
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/hooks/useDisableTwoFactorAuthForm.mjs +3 -1
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
- package/dist/hooks/useAuthQueryKey.mjs +23 -0
- package/dist/hooks/useAuthQueryKey.mjs.map +1 -0
- package/dist/index.mjs +17 -2
- package/dist/index.mjs.map +1 -1
- package/dist/modules/accounts/hooks/current-account.hook.mjs +5 -2
- package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useAccountManagement.mjs +19 -9
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useCurrencies.mjs +3 -1
- package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useTimezones.mjs +3 -1
- package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -1
- package/dist/modules/auth/hooks/useUserQuery.mjs +15 -6
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -1
- package/dist/modules/cards/hooks/cards.hook.mjs +3 -1
- package/dist/modules/cards/hooks/cards.hook.mjs.map +1 -1
- package/dist/modules/cards/hooks/create-card.hook.mjs +3 -1
- package/dist/modules/cards/hooks/create-card.hook.mjs.map +1 -1
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +3 -1
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -1
- package/dist/modules/plans/hooks/list-plans.hook.mjs +3 -1
- package/dist/modules/plans/hooks/list-plans.hook.mjs.map +1 -1
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs +4 -2
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +1 -1
- package/dist/modules/plans/services/plans.service.mjs +4 -2
- package/dist/modules/plans/services/plans.service.mjs.map +1 -1
- package/dist/modules/projects/hooks/add-project-user.hook.mjs +15 -12
- package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +3 -1
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +3 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +3 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs +15 -12
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs +2 -0
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +3 -1
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +3 -1
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs +6 -3
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +1 -1
- package/dist/modules/users/hooks/messages.hook.mjs +9 -4
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
- package/dist/providers/auth.provider.mjs +6 -4
- package/dist/providers/auth.provider.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +3 -1
- package/src/hooks/useAuthQueryKey.ts +32 -0
- package/src/index.ts +10 -1
- package/src/modules/accounts/hooks/current-account.hook.tsx +7 -3
- package/src/modules/accounts/hooks/useAccountManagement.ts +20 -11
- package/src/modules/accounts/hooks/useCurrencies.ts +5 -2
- package/src/modules/accounts/hooks/useTimezones.ts +5 -2
- package/src/modules/auth/hooks/useUserQuery.ts +75 -65
- package/src/modules/cards/hooks/cards.hook.ts +5 -2
- package/src/modules/cards/hooks/create-card.hook.ts +3 -1
- package/src/modules/ia-credits/hooks/ia-credits.hook.ts +99 -97
- package/src/modules/plans/hooks/list-plans.hook.ts +5 -2
- package/src/modules/plans/hooks/use-plan-by-id.hook.ts +4 -2
- package/src/modules/plans/services/plans.service.ts +4 -2
- package/src/modules/projects/hooks/add-project-user.hook.ts +16 -13
- package/src/modules/projects/hooks/list-all-account-users.hook.ts +8 -3
- package/src/modules/projects/hooks/list-available-users.hook.ts +8 -3
- package/src/modules/projects/hooks/list-project-users.hook.ts +8 -3
- package/src/modules/projects/hooks/remove-project-user.hook.ts +16 -13
- package/src/modules/subscriptions/constants/query-keys.constants.ts +3 -1
- package/src/modules/subscriptions/hooks/find-active-subscription.hook.ts +4 -1
- package/src/modules/subscriptions/hooks/list-subscriptions.hook.ts +4 -1
- package/src/modules/subscriptions/hooks/update-subscription-plan.hook.ts +6 -3
- package/src/modules/users/hooks/messages.hook.ts +12 -5
- package/src/providers/auth.provider.tsx +162 -160
|
@@ -6,12 +6,14 @@ import { toast } from "sonner";
|
|
|
6
6
|
import { Toast } from "../../ui/feedback/Toast";
|
|
7
7
|
import { USER_QUERY_KEY } from "../../../modules/auth/hooks/useUserQuery";
|
|
8
8
|
import { disableTwoFactorAction } from "../../../modules/accounts/actions/account-management.action";
|
|
9
|
+
import { useWlQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
9
10
|
function useDisableTwoFactorAuthForm({
|
|
10
11
|
onClose,
|
|
11
12
|
onSuccess
|
|
12
13
|
}) {
|
|
13
14
|
const [code, setCode] = useState("");
|
|
14
15
|
const queryClient = useQueryClient();
|
|
16
|
+
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
15
17
|
const isValid = code.length === 6;
|
|
16
18
|
const mutation = useMutation({
|
|
17
19
|
mutationFn: (otpCode) => disableTwoFactorAction(otpCode),
|
|
@@ -20,7 +22,7 @@ function useDisableTwoFactorAuthForm({
|
|
|
20
22
|
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: result.error ?? "C\xF3digo inv\xE1lido", toastId: t }));
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
queryClient.invalidateQueries({ queryKey:
|
|
25
|
+
queryClient.invalidateQueries({ queryKey: userKey });
|
|
24
26
|
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Autentica\xE7\xE3o de dois fatores desabilitada", toastId: t }));
|
|
25
27
|
setCode("");
|
|
26
28
|
onSuccess?.();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/hooks/useDisableTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';\r\nimport { disableTwoFactorAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\ninterface UseDisableTwoFactorAuthFormProps {\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useDisableTwoFactorAuthForm({\r\n onClose,\r\n onSuccess,\r\n}: UseDisableTwoFactorAuthFormProps) {\r\n const [code, setCode] = useState('');\r\n const queryClient = useQueryClient();\r\n\r\n const isValid = code.length === 6;\r\n\r\n const mutation = useMutation({\r\n mutationFn: (otpCode: string) => disableTwoFactorAction(otpCode),\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Código inválido'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n queryClient.invalidateQueries({ queryKey:
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/hooks/useDisableTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';\r\nimport { disableTwoFactorAction } from '../../../modules/accounts/actions/account-management.action';\r\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\r\n\r\ninterface UseDisableTwoFactorAuthFormProps {\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useDisableTwoFactorAuthForm({\r\n onClose,\r\n onSuccess,\r\n}: UseDisableTwoFactorAuthFormProps) {\r\n const [code, setCode] = useState('');\r\n const queryClient = useQueryClient();\r\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\r\n\r\n const isValid = code.length === 6;\r\n\r\n const mutation = useMutation({\r\n mutationFn: (otpCode: string) => disableTwoFactorAction(otpCode),\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Código inválido'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n queryClient.invalidateQueries({ queryKey: userKey });\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Autenticação de dois fatores desabilitada\" toastId={t} />\r\n ));\r\n setCode('');\r\n onSuccess?.();\r\n },\r\n onError: () => {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao desabilitar 2FA. Tente novamente.\" toastId={t} />\r\n ));\r\n },\r\n });\r\n\r\n const { mutate, reset } = mutation;\r\n\r\n const handleClose = useCallback(() => {\r\n setCode('');\r\n reset();\r\n onClose();\r\n }, [onClose, reset]);\r\n\r\n const handleSubmit = useCallback(() => {\r\n if (!isValid) return;\r\n mutate(code);\r\n }, [code, isValid, mutate]);\r\n\r\n return {\r\n code,\r\n setCode,\r\n isValid,\r\n isLoading: mutation.isPending,\r\n handleClose,\r\n handleSubmit,\r\n };\r\n}\r\n"],"mappings":";AA8BU;AA5BV,SAAS,UAAU,mBAAmB;AACt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,SAAS;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAuth } from "../providers/auth.provider";
|
|
3
|
+
import { useWhitelabel } from "../providers/whitelabel.provider";
|
|
4
|
+
function useWlId() {
|
|
5
|
+
const { whitelabel } = useWhitelabel();
|
|
6
|
+
return whitelabel?.id ?? 0;
|
|
7
|
+
}
|
|
8
|
+
function useWlQueryKey(baseKey) {
|
|
9
|
+
const wlId = useWlId();
|
|
10
|
+
return ["whitelabel", wlId, ...baseKey];
|
|
11
|
+
}
|
|
12
|
+
function useAuthQueryKey(baseKey) {
|
|
13
|
+
const wlId = useWlId();
|
|
14
|
+
const { user } = useAuth();
|
|
15
|
+
const userId = user?.id ?? 0;
|
|
16
|
+
return ["whitelabel", wlId, "user", userId, ...baseKey];
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
useAuthQueryKey,
|
|
20
|
+
useWlId,
|
|
21
|
+
useWlQueryKey
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useAuthQueryKey.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useAuthQueryKey.ts"],"sourcesContent":["'use client';\n\nimport { useAuth } from '../providers/auth.provider';\nimport { useWhitelabel } from '../providers/whitelabel.provider';\n\n/**\n * Retorna o id da whitelabel do contexto.\n */\nexport function useWlId(): number {\n const { whitelabel } = useWhitelabel();\n return whitelabel?.id ?? 0;\n}\n\n/**\n * Prefixa query keys com ['whitelabel', wlId] para isolamento por whitelabel.\n * Usar para queries públicas e bootstrap (plans, currencies, user, account, etc).\n */\nexport function useWlQueryKey<T extends readonly unknown[]>(baseKey: [...T]): ['whitelabel', number, ...T] {\n const wlId = useWlId();\n return ['whitelabel', wlId, ...baseKey];\n}\n\n/**\n * Prefixa query keys com ['whitelabel', wlId, 'user', userId] para isolamento\n * por whitelabel + usuário. Usar para queries autenticadas (cards, subscriptions, etc).\n */\nexport function useAuthQueryKey<T extends readonly unknown[]>(baseKey: [...T]): ['whitelabel', number, 'user', number, ...T] {\n const wlId = useWlId();\n const { user } = useAuth();\n const userId = user?.id ?? 0;\n return ['whitelabel', wlId, 'user', userId, ...baseKey];\n}\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAKvB,SAAS,UAAkB;AAChC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO,YAAY,MAAM;AAC3B;AAMO,SAAS,cAA4C,SAA+C;AACzG,QAAM,OAAO,QAAQ;AACrB,SAAO,CAAC,cAAc,MAAM,GAAG,OAAO;AACxC;AAMO,SAAS,gBAA8C,SAA+D;AAC3H,QAAM,OAAO,QAAQ;AACrB,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,SAAS,MAAM,MAAM;AAC3B,SAAO,CAAC,cAAc,MAAM,QAAQ,QAAQ,GAAG,OAAO;AACxD;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,11 @@ import {
|
|
|
15
15
|
LIST_AVAILABLE_USERS_QUERY_KEY,
|
|
16
16
|
LIST_AVAILABLE_USERS_BASE_KEY
|
|
17
17
|
} from "./modules/projects/hooks/list-available-users.hook";
|
|
18
|
+
import {
|
|
19
|
+
useListAllAccountUsers,
|
|
20
|
+
LIST_ALL_ACCOUNT_USERS_QUERY_KEY,
|
|
21
|
+
LIST_ALL_ACCOUNT_USERS_BASE_KEY
|
|
22
|
+
} from "./modules/projects/hooks/list-all-account-users.hook";
|
|
18
23
|
import {
|
|
19
24
|
useUserQuery,
|
|
20
25
|
useUserValidateSession,
|
|
@@ -25,7 +30,7 @@ import {
|
|
|
25
30
|
} from "./modules/auth/hooks/useUserQuery";
|
|
26
31
|
import { useManagementPermissions } from "./modules/auth/hooks/useManagementPermissions";
|
|
27
32
|
import { useSubscriptions } from "./modules/subscriptions/hooks/list-subscriptions.hook";
|
|
28
|
-
import { SUBSCRIPTIONS_QUERY_KEY } from "./modules/subscriptions/constants/query-keys.constants";
|
|
33
|
+
import { SUBSCRIPTIONS_QUERY_KEY, CHARGES_QUERY_KEY } from "./modules/subscriptions/constants/query-keys.constants";
|
|
29
34
|
import { useActiveSubscription } from "./modules/subscriptions/hooks/find-active-subscription.hook";
|
|
30
35
|
import { useCancelledSubscriptionGuard } from "./modules/subscriptions/hooks/use-cancelled-subscription-guard";
|
|
31
36
|
import { usePlanById } from "./modules/plans/hooks/use-plan-by-id.hook";
|
|
@@ -88,6 +93,7 @@ import { NavBarItem } from "./components/layouts/NavBarItem";
|
|
|
88
93
|
import { AppNavigation } from "./components/navigation/AppNavigation";
|
|
89
94
|
import { CancelledSubscriptionBanner } from "./components/navigation/CancelledSubscriptionBanner";
|
|
90
95
|
import { useMobileNavbarSheet } from "./store/useMobileNavbarSheet";
|
|
96
|
+
import { useAuthQueryKey, useWlQueryKey, useWlId } from "./hooks/useAuthQueryKey";
|
|
91
97
|
import { default as default7 } from "./hooks/copy-to-clipboard.hook";
|
|
92
98
|
import { Button, buttonVariants } from "./components/ui/buttons/Button";
|
|
93
99
|
import { CopyButton } from "./components/ui/buttons/CopyButton";
|
|
@@ -259,7 +265,8 @@ import {
|
|
|
259
265
|
useUpdateAccountUser,
|
|
260
266
|
useUpdateAccountUserById,
|
|
261
267
|
useDeleteAccountUser,
|
|
262
|
-
useDeleteAccount
|
|
268
|
+
useDeleteAccount,
|
|
269
|
+
ACCOUNT_USERS_QUERY_KEY
|
|
263
270
|
} from "./modules/accounts/hooks/useAccountManagement";
|
|
264
271
|
import { useViaCep } from "./modules/accounts/hooks/useViaCep";
|
|
265
272
|
import { default as default16 } from "./components/account/AccountModals";
|
|
@@ -308,6 +315,7 @@ export {
|
|
|
308
315
|
ACCEPTED_IMAGE_FORMATS,
|
|
309
316
|
ACCEPTED_IMAGE_FORMATS_STRING,
|
|
310
317
|
ACCOUNT_QUERY_KEY,
|
|
318
|
+
ACCOUNT_USERS_QUERY_KEY,
|
|
311
319
|
ADDON_IDS,
|
|
312
320
|
AI_CREDIT_OPTIONS,
|
|
313
321
|
AI_CREDIT_VALUES,
|
|
@@ -326,6 +334,7 @@ export {
|
|
|
326
334
|
Button,
|
|
327
335
|
default2 as BuyCreditsModal,
|
|
328
336
|
CARDS_QUERY_KEY,
|
|
337
|
+
CHARGES_QUERY_KEY,
|
|
329
338
|
CURRENCY_OPTIONS,
|
|
330
339
|
Calendar,
|
|
331
340
|
CalendarDayButton,
|
|
@@ -387,6 +396,8 @@ export {
|
|
|
387
396
|
InputOTPSeparator,
|
|
388
397
|
InputOTPSlot,
|
|
389
398
|
LANGUAGE_OPTIONS2 as LANGUAGE_OPTIONS,
|
|
399
|
+
LIST_ALL_ACCOUNT_USERS_BASE_KEY,
|
|
400
|
+
LIST_ALL_ACCOUNT_USERS_QUERY_KEY,
|
|
390
401
|
LIST_AVAILABLE_USERS_BASE_KEY,
|
|
391
402
|
LIST_AVAILABLE_USERS_QUERY_KEY,
|
|
392
403
|
LIST_PROJECT_USERS_BASE_KEY,
|
|
@@ -529,6 +540,7 @@ export {
|
|
|
529
540
|
updateCrispUser,
|
|
530
541
|
useAccountModals,
|
|
531
542
|
useActiveSubscription,
|
|
543
|
+
useAuthQueryKey,
|
|
532
544
|
useBuyCreditsModal,
|
|
533
545
|
useCalculateSubscription,
|
|
534
546
|
useCancelledSubscriptionGuard,
|
|
@@ -548,6 +560,7 @@ export {
|
|
|
548
560
|
useImageUpload,
|
|
549
561
|
useInvalidateUser,
|
|
550
562
|
default13 as useIsMobile,
|
|
563
|
+
useListAllAccountUsers,
|
|
551
564
|
useListAvailableUsers,
|
|
552
565
|
useListProjectUsers,
|
|
553
566
|
useManagementPermissions,
|
|
@@ -568,6 +581,8 @@ export {
|
|
|
568
581
|
useUserQuery,
|
|
569
582
|
useUserValidateSession,
|
|
570
583
|
useViaCep,
|
|
584
|
+
useWlId,
|
|
585
|
+
useWlQueryKey,
|
|
571
586
|
validateImage,
|
|
572
587
|
validateImageFormat,
|
|
573
588
|
validateImageSize,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"./modules/auth/schema\";\nexport * from \"./modules/users/schema\";\nexport * from \"./modules/whitelabel/schema\";\n// Style types now come from whitelabel schema directly\nexport * from \"./infra/api/types\";\n\n// Contexts\nexport * from \"./providers/query.provider\";\nexport * from \"./providers/auth.provider\";\nexport * from \"./providers/whitelabel.provider\";\n\n// Hooks\nexport {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport type {\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useManagementPermissions } from \"./modules/auth/hooks/useManagementPermissions\";\nexport type { ManagementPermission } from \"./modules/auth/types/management-permission.type\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport { SUBSCRIPTIONS_QUERY_KEY } from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { useCancelledSubscriptionGuard } from \"./modules/subscriptions/hooks/use-cancelled-subscription-guard\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useCreateCard } from \"./modules/cards/hooks/create-card.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport { ADDON_IDS, AI_CREDIT_OPTIONS, AI_CREDIT_VALUES } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { AddonKindEnum, AiCreditOption } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { Plan, PlanItem, UiPlan, PlanFeature, PlanMainFeatures, PlanPricingByPeriod, PlanTooltips } from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport { mapApiPlanToUiPlan } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport type { PlanBillingPeriod } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport { usePlans, PLANS_QUERY_KEY } from \"./modules/plans/hooks/list-plans.hook\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type { Card as PaymentCard, CreateCardRequest } from \"./modules/cards/types\";\nexport { CardSchema as PaymentCardSchema, CreateCardRequestSchema } from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { hasSubscriptionExpired } from \"./modules/subscriptions/utils/has-subscription-expired\";\nexport { getPriceFromCalculatedData, periodicityToBillingPeriod } from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { usePaidPlanRequiredModal } from \"./store/usePaidPlanRequiredModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { default as PaidPlanRequiredModal } from \"./components/modals/PaidPlanRequiredModal\";\nexport { default as AddCardModal } from \"./components/modals/cards/AddCardModal\";\nexport { CardFormFields, cardFormSchema } from \"./components/modals/cards/CardFormFields\";\nexport type { CardFormData } from \"./components/modals/cards/CardFormFields\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\n\n// Providers\nexport { QueryProvider } from \"./providers/query.provider\";\n\n// Middleware\nexport { createAuthMiddleware } from \"./middlewares/create-auth-middleware\";\nexport { createMiddlewareChain } from \"./middlewares/chain\";\nexport { continueChain, stopChain } from \"./middlewares/types\";\nexport type {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { formatShortDate, formatDateTime } from \"./infra/utils/date\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} from \"./components/layouts/MainLayout\";\nexport { NavBar } from \"./components/layouts/NavBar\";\nexport type { NavBarProps } from \"./components/layouts/NavBar\";\nexport { AppNavBar } from \"./components/layouts/AppNavBar\";\nexport type { AppNavBarProps } from \"./components/layouts/AppNavBar\";\nexport { AppMobileNavBar } from \"./components/layouts/AppMobileNavBar\";\nexport type { AppMobileNavBarProps } from \"./components/layouts/AppMobileNavBar\";\nexport { SideBarNavigation } from \"./components/layouts/SideBarNavigation\";\nexport { MdSideBarNavigation } from \"./components/layouts/MdSideBarNavigation\";\nexport { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { NotFoundPage } from \"./components/pages/NotFoundPage\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { default as WhitelabelCodes } from \"./components/layouts/WhitelabelCodes\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from './components/navigation/AppNavigation';\nexport { CancelledSubscriptionBanner } from './components/navigation/CancelledSubscriptionBanner';\nexport type { NavItemConfig } from './components/navigation/subcomponents/NavItems';\nexport type { NavigationProject } from './components/navigation/types';\nexport { useMobileNavbarSheet } from './store/useMobileNavbarSheet';\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\n\n// UI - Buttons\nexport { Button, buttonVariants } from \"./components/ui/buttons/Button\";\nexport { CopyButton } from \"./components/ui/buttons/CopyButton\";\nexport { default as CancelButton } from \"./components/ui/buttons/CancelButton\";\n\n// UI - Data Display\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} from \"./components/ui/data-display/Tabs\";\nexport { UserAvatar } from \"./components/ui/data-display/UserAvatar\";\nexport type { UserAvatarProps } from \"./components/ui/data-display/UserAvatar\";\n\n// UI - Feedback\nexport { default as CircularProgress } from \"./components/ui/feedback/CircularProgress\";\nexport { default as DefaultCircularProgress } from \"./components/ui/feedback/DefaultCircularProgress\";\nexport { Progress } from \"./components/ui/feedback/Progress\";\nexport { LoadingOverlay } from \"./components/ui/feedback/LoadingOverlay\";\nexport {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} from \"./components/ui/feedback/Toast\";\nexport type { ToastProps } from \"./components/ui/feedback/Toast\";\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from \"./components/ui/form/Calendar\";\nexport { Checkbox } from \"./components/ui/form/Checkbox\";\nexport { DatePicker } from \"./components/ui/form/DatePicker\";\nexport { DateRangePicker } from \"./components/ui/form/DateRangePicker\";\nexport { Input } from \"./components/ui/form/Input\";\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport { CrispEmbed, openCrispHelpdesk, hideCrisp, showCrisp, updateCrispUser } from \"./components/embeds/CrispEmbed\";\nexport { EmbedWidgets } from \"./components/embeds/EmbedWidgets\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useDesktopSidebarStore } from \"./store/useDesktopSidebarStore\";\nexport { useModalManager } from \"./store/useModalManager\";\nexport type { ModalData } from \"./store/useModalManager\";\n\n// Enums\nexport { AccountSectionType } from \"./enums/AccountSectionType\";\n\n// Hooks\nexport { default as usePasswordVisibility } from \"./hooks/usePasswordVisibility\";\nexport { default as useCountdownTimer } from \"./hooks/useCountdownTimer\";\nexport { default as useIsMobile } from \"./hooks/useIsMobile\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCNPJ,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport { formatCurrencyNumber } from \"./utils/format/currency\";\nexport { BR_STATE_OPTIONS } from \"./utils/constants/br-states\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} from \"./utils/intl/locales\";\nexport type { LocaleOption } from \"./utils/intl/locales\";\nexport { copyToClipboard, readFromClipboard } from \"./utils/browser/clipboard\";\n\n// UI - Form (new widgets)\nexport { FormField } from \"./components/ui/form/FormField\";\nexport { SelectField } from \"./components/ui/form/SelectField\";\nexport { ComboboxField } from \"./components/ui/form/ComboboxField\";\nexport type { ComboboxOption } from \"./components/ui/form/ComboboxField\";\nexport { default as PhoneInput } from \"./components/ui/form/PhoneInput\";\nexport { default as SwitchOptionFieldWithIcon } from \"./components/ui/form/SwitchOptionFieldWithIcon\";\nexport { TextAreaField } from \"./components/ui/form/TextAreaField\";\n\n// Account Module - Hooks\nexport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from \"./modules/accounts/hooks/useAccountManagement\";\nexport { useViaCep } from \"./modules/accounts/hooks/useViaCep\";\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from \"./modules/accounts/types\";\n\nexport { default as AccountModals } from \"./components/account/AccountModals\";\nexport { useAccountModals } from \"./store/useAccountModals\";\nexport type { AccountModalsConfig } from \"./store/useAccountModals\";\n\nexport { ModalManager } from \"./components/modals/ModalManager\";\nexport { Modals } from \"./components/modals/Modals\";\n\nexport { default as TwoFactorAuthModal } from \"./components/account/TwoFactorAuthModal\";\nexport { default as DisableTwoFactorAuthModal } from \"./components/account/DisableTwoFactorAuthModal\";\nexport { default as ConfirmGlobalPreferencesModal } from \"./components/account/ConfirmGlobalPreferencesModal\";\nexport { MyProfileSection } from \"./components/account/sections/MyProfileSection\";\nexport { PreferencesSection } from \"./components/account/sections/PreferencesSection\";\nexport { SecuritySection } from \"./components/account/sections/SecuritySection\";\nexport { ChangePasswordSection } from \"./components/account/sections/ChangePasswordSection\";\nexport { ChangeEmailModal } from \"./components/account/sections/ChangeEmailModal\";\nexport { ChangePhoneModal } from \"./components/account/sections/ChangePhoneModal\";\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n\n// Image Upload\nexport {\n ImageUpload,\n ImageCropModal,\n ImageTooSmallModal,\n} from \"./components/widgets/ImageUpload\";\nexport {\n useImageUpload,\n type ImageTooSmallError,\n} from \"./modules/images/hooks/use-image-upload.hook\";\nexport {\n ACCEPTED_IMAGE_FORMATS,\n ACCEPTED_IMAGE_FORMATS_STRING,\n MAX_FILE_SIZE_MB,\n} from \"./modules/images/constants/image.constants\";\nexport type {\n ImageConfig,\n CropArea,\n ProcessedImage,\n CompressImageOptions,\n} from \"./modules/images/types/image.type\";\nexport { compressImage } from \"./modules/images/utils/compress-image\";\nexport { cropImageToCanvas } from \"./modules/images/utils/crop-image\";\nexport { base64ToFile, fileToBase64 } from \"./modules/images/utils/base64\";\nexport {\n validateImage,\n validateImageFormat,\n validateImageSize,\n getImageDimensions,\n} from \"./modules/images/utils/validate-image\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA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C;AACrD,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAgB1B,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"./modules/auth/schema\";\nexport * from \"./modules/users/schema\";\nexport * from \"./modules/whitelabel/schema\";\n// Style types now come from whitelabel schema directly\nexport * from \"./infra/api/types\";\n\n// Contexts\nexport * from \"./providers/query.provider\";\nexport * from \"./providers/auth.provider\";\nexport * from \"./providers/whitelabel.provider\";\n\n// Hooks\nexport {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport {\n useListAllAccountUsers,\n LIST_ALL_ACCOUNT_USERS_QUERY_KEY,\n LIST_ALL_ACCOUNT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-all-account-users.hook\";\nexport type {\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useManagementPermissions } from \"./modules/auth/hooks/useManagementPermissions\";\nexport type { ManagementPermission } from \"./modules/auth/types/management-permission.type\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport { SUBSCRIPTIONS_QUERY_KEY, CHARGES_QUERY_KEY } from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { useCancelledSubscriptionGuard } from \"./modules/subscriptions/hooks/use-cancelled-subscription-guard\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useCreateCard } from \"./modules/cards/hooks/create-card.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport { ADDON_IDS, AI_CREDIT_OPTIONS, AI_CREDIT_VALUES } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { AddonKindEnum, AiCreditOption } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { Plan, PlanItem, UiPlan, PlanFeature, PlanMainFeatures, PlanPricingByPeriod, PlanTooltips } from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport { mapApiPlanToUiPlan } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport type { PlanBillingPeriod } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport { usePlans, PLANS_QUERY_KEY } from \"./modules/plans/hooks/list-plans.hook\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type { Card as PaymentCard, CreateCardRequest } from \"./modules/cards/types\";\nexport { CardSchema as PaymentCardSchema, CreateCardRequestSchema } from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { hasSubscriptionExpired } from \"./modules/subscriptions/utils/has-subscription-expired\";\nexport { getPriceFromCalculatedData, periodicityToBillingPeriod } from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { usePaidPlanRequiredModal } from \"./store/usePaidPlanRequiredModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { default as PaidPlanRequiredModal } from \"./components/modals/PaidPlanRequiredModal\";\nexport { default as AddCardModal } from \"./components/modals/cards/AddCardModal\";\nexport { CardFormFields, cardFormSchema } from \"./components/modals/cards/CardFormFields\";\nexport type { CardFormData } from \"./components/modals/cards/CardFormFields\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\n\n// Providers\nexport { QueryProvider } from \"./providers/query.provider\";\n\n// Middleware\nexport { createAuthMiddleware } from \"./middlewares/create-auth-middleware\";\nexport { createMiddlewareChain } from \"./middlewares/chain\";\nexport { continueChain, stopChain } from \"./middlewares/types\";\nexport type {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { formatShortDate, formatDateTime } from \"./infra/utils/date\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} from \"./components/layouts/MainLayout\";\nexport { NavBar } from \"./components/layouts/NavBar\";\nexport type { NavBarProps } from \"./components/layouts/NavBar\";\nexport { AppNavBar } from \"./components/layouts/AppNavBar\";\nexport type { AppNavBarProps } from \"./components/layouts/AppNavBar\";\nexport { AppMobileNavBar } from \"./components/layouts/AppMobileNavBar\";\nexport type { AppMobileNavBarProps } from \"./components/layouts/AppMobileNavBar\";\nexport { SideBarNavigation } from \"./components/layouts/SideBarNavigation\";\nexport { MdSideBarNavigation } from \"./components/layouts/MdSideBarNavigation\";\nexport { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { NotFoundPage } from \"./components/pages/NotFoundPage\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { default as WhitelabelCodes } from \"./components/layouts/WhitelabelCodes\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from './components/navigation/AppNavigation';\nexport { CancelledSubscriptionBanner } from './components/navigation/CancelledSubscriptionBanner';\nexport type { NavItemConfig } from './components/navigation/subcomponents/NavItems';\nexport type { NavigationProject } from './components/navigation/types';\nexport { useMobileNavbarSheet } from './store/useMobileNavbarSheet';\n\n// Auth Query Key Utilities\nexport { useAuthQueryKey, useWlQueryKey, useWlId } from \"./hooks/useAuthQueryKey\";\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\n\n// UI - Buttons\nexport { Button, buttonVariants } from \"./components/ui/buttons/Button\";\nexport { CopyButton } from \"./components/ui/buttons/CopyButton\";\nexport { default as CancelButton } from \"./components/ui/buttons/CancelButton\";\n\n// UI - Data Display\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} from \"./components/ui/data-display/Tabs\";\nexport { UserAvatar } from \"./components/ui/data-display/UserAvatar\";\nexport type { UserAvatarProps } from \"./components/ui/data-display/UserAvatar\";\n\n// UI - Feedback\nexport { default as CircularProgress } from \"./components/ui/feedback/CircularProgress\";\nexport { default as DefaultCircularProgress } from \"./components/ui/feedback/DefaultCircularProgress\";\nexport { Progress } from \"./components/ui/feedback/Progress\";\nexport { LoadingOverlay } from \"./components/ui/feedback/LoadingOverlay\";\nexport {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} from \"./components/ui/feedback/Toast\";\nexport type { ToastProps } from \"./components/ui/feedback/Toast\";\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from \"./components/ui/form/Calendar\";\nexport { Checkbox } from \"./components/ui/form/Checkbox\";\nexport { DatePicker } from \"./components/ui/form/DatePicker\";\nexport { DateRangePicker } from \"./components/ui/form/DateRangePicker\";\nexport { Input } from \"./components/ui/form/Input\";\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport { CrispEmbed, openCrispHelpdesk, hideCrisp, showCrisp, updateCrispUser } from \"./components/embeds/CrispEmbed\";\nexport { EmbedWidgets } from \"./components/embeds/EmbedWidgets\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useDesktopSidebarStore } from \"./store/useDesktopSidebarStore\";\nexport { useModalManager } from \"./store/useModalManager\";\nexport type { ModalData } from \"./store/useModalManager\";\n\n// Enums\nexport { AccountSectionType } from \"./enums/AccountSectionType\";\n\n// Hooks\nexport { default as usePasswordVisibility } from \"./hooks/usePasswordVisibility\";\nexport { default as useCountdownTimer } from \"./hooks/useCountdownTimer\";\nexport { default as useIsMobile } from \"./hooks/useIsMobile\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCNPJ,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport { formatCurrencyNumber } from \"./utils/format/currency\";\nexport { BR_STATE_OPTIONS } from \"./utils/constants/br-states\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} from \"./utils/intl/locales\";\nexport type { LocaleOption } from \"./utils/intl/locales\";\nexport { copyToClipboard, readFromClipboard } from \"./utils/browser/clipboard\";\n\n// UI - Form (new widgets)\nexport { FormField } from \"./components/ui/form/FormField\";\nexport { SelectField } from \"./components/ui/form/SelectField\";\nexport { ComboboxField } from \"./components/ui/form/ComboboxField\";\nexport type { ComboboxOption } from \"./components/ui/form/ComboboxField\";\nexport { default as PhoneInput } from \"./components/ui/form/PhoneInput\";\nexport { default as SwitchOptionFieldWithIcon } from \"./components/ui/form/SwitchOptionFieldWithIcon\";\nexport { TextAreaField } from \"./components/ui/form/TextAreaField\";\n\n// Account Module - Hooks\nexport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n ACCOUNT_USERS_QUERY_KEY,\n} from \"./modules/accounts/hooks/useAccountManagement\";\nexport { useViaCep } from \"./modules/accounts/hooks/useViaCep\";\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from \"./modules/accounts/types\";\n\nexport { default as AccountModals } from \"./components/account/AccountModals\";\nexport { useAccountModals } from \"./store/useAccountModals\";\nexport type { AccountModalsConfig } from \"./store/useAccountModals\";\n\nexport { ModalManager } from \"./components/modals/ModalManager\";\nexport { Modals } from \"./components/modals/Modals\";\n\nexport { default as TwoFactorAuthModal } from \"./components/account/TwoFactorAuthModal\";\nexport { default as DisableTwoFactorAuthModal } from \"./components/account/DisableTwoFactorAuthModal\";\nexport { default as ConfirmGlobalPreferencesModal } from \"./components/account/ConfirmGlobalPreferencesModal\";\nexport { MyProfileSection } from \"./components/account/sections/MyProfileSection\";\nexport { PreferencesSection } from \"./components/account/sections/PreferencesSection\";\nexport { SecuritySection } from \"./components/account/sections/SecuritySection\";\nexport { ChangePasswordSection } from \"./components/account/sections/ChangePasswordSection\";\nexport { ChangeEmailModal } from \"./components/account/sections/ChangeEmailModal\";\nexport { ChangePhoneModal } from \"./components/account/sections/ChangePhoneModal\";\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n\n// Image Upload\nexport {\n ImageUpload,\n ImageCropModal,\n ImageTooSmallModal,\n} from \"./components/widgets/ImageUpload\";\nexport {\n useImageUpload,\n type ImageTooSmallError,\n} from \"./modules/images/hooks/use-image-upload.hook\";\nexport {\n ACCEPTED_IMAGE_FORMATS,\n ACCEPTED_IMAGE_FORMATS_STRING,\n MAX_FILE_SIZE_MB,\n} from \"./modules/images/constants/image.constants\";\nexport type {\n ImageConfig,\n CropArea,\n ProcessedImage,\n CompressImageOptions,\n} from \"./modules/images/types/image.type\";\nexport { compressImage } from \"./modules/images/utils/compress-image\";\nexport { cropImageToCanvas } from \"./modules/images/utils/crop-image\";\nexport { base64ToFile, fileToBase64 } from \"./modules/images/utils/base64\";\nexport {\n validateImage,\n validateImageFormat,\n validateImageSize,\n getImageDimensions,\n} from \"./modules/images/utils/validate-image\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AAEzC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB,yBAAyB;AAC3D,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AACP,SAAS,iBAAiB;AAgB1B,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { findCurrentAccount } from "../actions/find-current-account.action";
|
|
4
4
|
import { withAction } from "../../../utils/withAction";
|
|
5
|
+
import { useWlQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
6
|
const ACCOUNT_QUERY_KEY = ["account"];
|
|
6
7
|
function useCurrentAccount() {
|
|
8
|
+
const queryKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);
|
|
7
9
|
return useQuery({
|
|
8
|
-
queryKey
|
|
10
|
+
queryKey,
|
|
9
11
|
queryFn: withAction(findCurrentAccount),
|
|
10
12
|
staleTime: 0,
|
|
11
13
|
gcTime: 10 * 60 * 1e3,
|
|
@@ -14,7 +16,8 @@ function useCurrentAccount() {
|
|
|
14
16
|
}
|
|
15
17
|
function useInvalidateAccount() {
|
|
16
18
|
const queryClient = useQueryClient();
|
|
17
|
-
|
|
19
|
+
const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);
|
|
20
|
+
return () => queryClient.invalidateQueries({ queryKey: accountKey });
|
|
18
21
|
}
|
|
19
22
|
export {
|
|
20
23
|
ACCOUNT_QUERY_KEY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/current-account.hook.tsx"],"sourcesContent":["'use client';\n\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { findCurrentAccount } from '../actions/find-current-account.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const ACCOUNT_QUERY_KEY = ['account'];\n\nexport function useCurrentAccount() {\n return useQuery({\n queryKey
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/accounts/hooks/current-account.hook.tsx"],"sourcesContent":["'use client';\n\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { findCurrentAccount } from '../actions/find-current-account.action';\nimport { withAction } from '../../../utils/withAction';\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const ACCOUNT_QUERY_KEY = ['account'] as const;\n\nexport function useCurrentAccount() {\n const queryKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: withAction(findCurrentAccount),\n staleTime: 0,\n gcTime: 10 * 60 * 1000,\n retry: false,\n });\n}\n\nexport function useInvalidateAccount() {\n const queryClient = useQueryClient();\n const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);\n return () => queryClient.invalidateQueries({ queryKey: accountKey });\n}\n"],"mappings":";AAEA,SAAS,UAAU,sBAAsB;AACzC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAEvB,MAAM,oBAAoB,CAAC,SAAS;AAEpC,SAAS,oBAAoB;AAClC,QAAM,WAAW,cAAc,CAAC,GAAG,iBAAiB,CAAC;AAErD,SAAO,SAAS;AAAA,IACd;AAAA,IACA,SAAS,WAAW,kBAAkB;AAAA,IACtC,WAAW;AAAA,IACX,QAAQ,KAAK,KAAK;AAAA,IAClB,OAAO;AAAA,EACT,CAAC;AACH;AAEO,SAAS,uBAAuB;AACrC,QAAM,cAAc,eAAe;AACnC,QAAM,aAAa,cAAc,CAAC,GAAG,iBAAiB,CAAC;AACvD,SAAO,MAAM,YAAY,kBAAkB,EAAE,UAAU,WAAW,CAAC;AACrE;","names":[]}
|
|
@@ -10,48 +10,57 @@ import {
|
|
|
10
10
|
deleteAccountAction
|
|
11
11
|
} from "../actions/account-management.action";
|
|
12
12
|
import { withAction } from "../../../utils/withAction";
|
|
13
|
+
import { useAuthQueryKey, useWlQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
13
14
|
const ACCOUNT_USERS_QUERY_KEY = ["account-users"];
|
|
14
15
|
function useUpdateAccount() {
|
|
15
16
|
const queryClient = useQueryClient();
|
|
17
|
+
const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);
|
|
18
|
+
const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);
|
|
19
|
+
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
16
20
|
return useMutation({
|
|
17
21
|
mutationFn: withAction(updateAccountAction),
|
|
18
22
|
onSuccess: () => {
|
|
19
|
-
queryClient.invalidateQueries({ queryKey:
|
|
20
|
-
queryClient.invalidateQueries({ queryKey:
|
|
21
|
-
queryClient.invalidateQueries({ queryKey:
|
|
23
|
+
queryClient.invalidateQueries({ queryKey: accountUsersKey });
|
|
24
|
+
queryClient.invalidateQueries({ queryKey: accountKey });
|
|
25
|
+
queryClient.invalidateQueries({ queryKey: userKey });
|
|
22
26
|
}
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
29
|
function useUpdateAccountUser() {
|
|
26
30
|
const queryClient = useQueryClient();
|
|
31
|
+
const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);
|
|
32
|
+
const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);
|
|
33
|
+
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
27
34
|
return useMutation({
|
|
28
35
|
mutationFn: withAction(updateUserAction),
|
|
29
36
|
onSuccess: () => {
|
|
30
|
-
queryClient.invalidateQueries({ queryKey:
|
|
31
|
-
queryClient.invalidateQueries({ queryKey:
|
|
32
|
-
queryClient.invalidateQueries({ queryKey:
|
|
37
|
+
queryClient.invalidateQueries({ queryKey: accountUsersKey });
|
|
38
|
+
queryClient.invalidateQueries({ queryKey: accountKey });
|
|
39
|
+
queryClient.invalidateQueries({ queryKey: userKey });
|
|
33
40
|
}
|
|
34
41
|
});
|
|
35
42
|
}
|
|
36
43
|
function useUpdateAccountUserById() {
|
|
37
44
|
const queryClient = useQueryClient();
|
|
45
|
+
const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);
|
|
38
46
|
return useMutation({
|
|
39
47
|
mutationFn: withAction(
|
|
40
|
-
({ userId, ...user }) => updateAccountUserByIdAction(
|
|
48
|
+
({ userId: targetUserId, ...user }) => updateAccountUserByIdAction(targetUserId, user)
|
|
41
49
|
),
|
|
42
50
|
onSuccess: () => {
|
|
43
|
-
queryClient.invalidateQueries({ queryKey:
|
|
51
|
+
queryClient.invalidateQueries({ queryKey: accountUsersKey });
|
|
44
52
|
}
|
|
45
53
|
});
|
|
46
54
|
}
|
|
47
55
|
function useDeleteAccountUser(options) {
|
|
48
56
|
const queryClient = useQueryClient();
|
|
57
|
+
const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);
|
|
49
58
|
return useMutation({
|
|
50
59
|
mutationFn: withAction(deleteAccountUserAction),
|
|
51
60
|
...options,
|
|
52
61
|
onSuccess: (...params) => {
|
|
53
62
|
options?.onSuccess?.(...params);
|
|
54
|
-
queryClient.invalidateQueries({ queryKey:
|
|
63
|
+
queryClient.invalidateQueries({ queryKey: accountUsersKey });
|
|
55
64
|
}
|
|
56
65
|
});
|
|
57
66
|
}
|
|
@@ -62,6 +71,7 @@ function useDeleteAccount(options) {
|
|
|
62
71
|
});
|
|
63
72
|
}
|
|
64
73
|
export {
|
|
74
|
+
ACCOUNT_USERS_QUERY_KEY,
|
|
65
75
|
useDeleteAccount,
|
|
66
76
|
useDeleteAccountUser,
|
|
67
77
|
useUpdateAccount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useAccountManagement.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { USER_QUERY_KEY } from '../../auth/hooks/useUserQuery';\nimport { ACCOUNT_QUERY_KEY } from './current-account.hook';\nimport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n DeleteAccountUserResponse,\n DeleteAccountResponse,\n} from '../types';\nimport {\n updateUserAction,\n updateAccountAction,\n updateAccountUserByIdAction,\n deleteAccountUserAction,\n deleteAccountAction,\n} from '../actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { UseMutationOptions } from '@tanstack/react-query';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useAccountManagement.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { USER_QUERY_KEY } from '../../auth/hooks/useUserQuery';\nimport { ACCOUNT_QUERY_KEY } from './current-account.hook';\nimport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n DeleteAccountUserResponse,\n DeleteAccountResponse,\n} from '../types';\nimport {\n updateUserAction,\n updateAccountAction,\n updateAccountUserByIdAction,\n deleteAccountUserAction,\n deleteAccountAction,\n} from '../actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { UseMutationOptions } from '@tanstack/react-query';\nimport { useAuthQueryKey, useWlQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const ACCOUNT_USERS_QUERY_KEY = ['account-users'] as const;\n\nexport function useUpdateAccount() {\n const queryClient = useQueryClient();\n const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);\n const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\n\n return useMutation({\n mutationFn: withAction(updateAccountAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: accountUsersKey });\n queryClient.invalidateQueries({ queryKey: accountKey });\n queryClient.invalidateQueries({ queryKey: userKey });\n },\n });\n}\n\nexport function useUpdateAccountUser() {\n const queryClient = useQueryClient();\n const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);\n const accountKey = useWlQueryKey([...ACCOUNT_QUERY_KEY]);\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\n\n return useMutation({\n mutationFn: withAction(updateUserAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: accountUsersKey });\n queryClient.invalidateQueries({ queryKey: accountKey });\n queryClient.invalidateQueries({ queryKey: userKey });\n },\n });\n}\n\nexport function useUpdateAccountUserById() {\n const queryClient = useQueryClient();\n const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);\n\n return useMutation({\n mutationFn: withAction(({ userId: targetUserId, ...user }: UpdateAccountUserRequest & { userId: number }) =>\n updateAccountUserByIdAction(targetUserId, user)\n ),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: accountUsersKey });\n },\n });\n}\n\nexport function useDeleteAccountUser(\n options?: UseMutationOptions<DeleteAccountUserResponse, Error, number>\n) {\n const queryClient = useQueryClient();\n const accountUsersKey = useAuthQueryKey([...ACCOUNT_USERS_QUERY_KEY]);\n\n return useMutation({\n mutationFn: withAction(deleteAccountUserAction),\n ...options,\n onSuccess: (...params) => {\n options?.onSuccess?.(...params);\n queryClient.invalidateQueries({ queryKey: accountUsersKey });\n },\n });\n}\n\nexport function useDeleteAccount(\n options?: UseMutationOptions<DeleteAccountResponse, Error, void>\n) {\n return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QAAM,kBAAkB,gBAAgB,CAAC,GAAG,uBAAuB,CAAC;AAEpE,SAAO,YAAY;AAAA,IACjB,YAAY;AAAA,MAAW,CAAC,EAAE,QAAQ,cAAc,GAAG,KAAK,MACtD,4BAA4B,cAAc,IAAI;AAAA,IAChD;AAAA,IACA,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,gBAAgB,CAAC;AAAA,IAC7D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,qBACd,SACA;AACA,QAAM,cAAc,eAAe;AACnC,QAAM,kBAAkB,gBAAgB,CAAC,GAAG,uBAAuB,CAAC;AAEpE,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,uBAAuB;AAAA,IAC9C,GAAG;AAAA,IACH,WAAW,IAAI,WAAW;AACxB,eAAS,YAAY,GAAG,MAAM;AAC9B,kBAAY,kBAAkB,EAAE,UAAU,gBAAgB,CAAC;AAAA,IAC7D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,iBACd,SACA;AACA,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,mBAAmB;AAAA,IAC1C,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { listCurrenciesAction } from "../actions/list-currencies.action";
|
|
4
4
|
import { withAction } from "../../../utils/withAction";
|
|
5
|
+
import { useWlQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
6
|
const CURRENCIES_QUERY_KEY = ["currencies"];
|
|
6
7
|
function useCurrencies() {
|
|
8
|
+
const queryKey = useWlQueryKey([...CURRENCIES_QUERY_KEY]);
|
|
7
9
|
return useQuery({
|
|
8
|
-
queryKey
|
|
10
|
+
queryKey,
|
|
9
11
|
queryFn: withAction(listCurrenciesAction),
|
|
10
12
|
staleTime: Infinity
|
|
11
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useCurrencies.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listCurrenciesAction } from '../actions/list-currencies.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const CURRENCIES_QUERY_KEY = ['currencies'];\n\nexport function useCurrencies() {\n return useQuery({\n queryKey
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useCurrencies.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listCurrenciesAction } from '../actions/list-currencies.action';\nimport { withAction } from '../../../utils/withAction';\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const CURRENCIES_QUERY_KEY = ['currencies'] as const;\n\nexport function useCurrencies() {\n const queryKey = useWlQueryKey([...CURRENCIES_QUERY_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: withAction(listCurrenciesAction),\n staleTime: Infinity,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAEvB,MAAM,uBAAuB,CAAC,YAAY;AAE1C,SAAS,gBAAgB;AAC9B,QAAM,WAAW,cAAc,CAAC,GAAG,oBAAoB,CAAC;AAExD,SAAO,SAAS;AAAA,IACd;AAAA,IACA,SAAS,WAAW,oBAAoB;AAAA,IACxC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { listTimezonesAction } from "../actions/list-timezones.action";
|
|
4
4
|
import { withAction } from "../../../utils/withAction";
|
|
5
|
+
import { useWlQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
6
|
const TIMEZONES_QUERY_KEY = ["timezones"];
|
|
6
7
|
function useTimezones() {
|
|
8
|
+
const queryKey = useWlQueryKey([...TIMEZONES_QUERY_KEY]);
|
|
7
9
|
return useQuery({
|
|
8
|
-
queryKey
|
|
10
|
+
queryKey,
|
|
9
11
|
queryFn: withAction(listTimezonesAction),
|
|
10
12
|
staleTime: Infinity
|
|
11
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useTimezones.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listTimezonesAction } from '../actions/list-timezones.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const TIMEZONES_QUERY_KEY = ['timezones'];\n\nexport function useTimezones() {\n return useQuery({\n queryKey
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useTimezones.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listTimezonesAction } from '../actions/list-timezones.action';\nimport { withAction } from '../../../utils/withAction';\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const TIMEZONES_QUERY_KEY = ['timezones'] as const;\n\nexport function useTimezones() {\n const queryKey = useWlQueryKey([...TIMEZONES_QUERY_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: withAction(listTimezonesAction),\n staleTime: Infinity,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AACpC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAEvB,MAAM,sBAAsB,CAAC,WAAW;AAExC,SAAS,eAAe;AAC7B,QAAM,WAAW,cAAc,CAAC,GAAG,mBAAmB,CAAC;AAEvD,SAAO,SAAS;AAAA,IACd;AAAA,IACA,SAAS,WAAW,mBAAmB;AAAA,IACvC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { withAction } from "../../../utils/withAction";
|
|
4
|
+
import { useWlQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
4
5
|
const USER_QUERY_KEY = ["user"];
|
|
6
|
+
const USER_VALIDATE_SESSION_KEY = ["user-validate-session"];
|
|
5
7
|
async function fetchUser() {
|
|
6
8
|
const { findUserById: getUserDataAction } = await import("../../users/action/find-user-by-id.action");
|
|
7
9
|
const result = await getUserDataAction();
|
|
@@ -12,8 +14,9 @@ async function validateUserSession() {
|
|
|
12
14
|
return await validateSessionAction();
|
|
13
15
|
}
|
|
14
16
|
function useUserQuery() {
|
|
17
|
+
const queryKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
15
18
|
return useQuery({
|
|
16
|
-
queryKey
|
|
19
|
+
queryKey,
|
|
17
20
|
queryFn: fetchUser,
|
|
18
21
|
staleTime: 5 * 60 * 1e3,
|
|
19
22
|
gcTime: 10 * 60 * 1e3,
|
|
@@ -21,8 +24,9 @@ function useUserQuery() {
|
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
function useUserValidateSession(options) {
|
|
27
|
+
const queryKey = useWlQueryKey([...USER_VALIDATE_SESSION_KEY]);
|
|
24
28
|
return useQuery({
|
|
25
|
-
queryKey
|
|
29
|
+
queryKey,
|
|
26
30
|
queryFn: validateUserSession,
|
|
27
31
|
retry: false,
|
|
28
32
|
staleTime: 5 * 60 * 1e3,
|
|
@@ -33,27 +37,32 @@ function useUserValidateSession(options) {
|
|
|
33
37
|
}
|
|
34
38
|
function useTwoFactorVerify() {
|
|
35
39
|
const queryClient = useQueryClient();
|
|
40
|
+
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
41
|
+
const twoFactorKey = useWlQueryKey(["two-factor-pending"]);
|
|
36
42
|
return useMutation({
|
|
37
43
|
mutationFn: async ({ cookie, code, window }) => {
|
|
38
44
|
const { verifyTwoFactorAction } = await import("../actions/verify-two-factor.action");
|
|
39
45
|
return withAction(() => verifyTwoFactorAction(cookie, code, window))();
|
|
40
46
|
},
|
|
41
47
|
onSuccess: () => {
|
|
42
|
-
queryClient.invalidateQueries({ queryKey:
|
|
43
|
-
queryClient.invalidateQueries({ queryKey:
|
|
48
|
+
queryClient.invalidateQueries({ queryKey: userKey });
|
|
49
|
+
queryClient.invalidateQueries({ queryKey: twoFactorKey });
|
|
44
50
|
}
|
|
45
51
|
});
|
|
46
52
|
}
|
|
47
53
|
function useInvalidateUser() {
|
|
48
54
|
const queryClient = useQueryClient();
|
|
49
|
-
|
|
55
|
+
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
56
|
+
return () => queryClient.invalidateQueries({ queryKey: userKey });
|
|
50
57
|
}
|
|
51
58
|
function useSetUserData() {
|
|
52
59
|
const queryClient = useQueryClient();
|
|
53
|
-
|
|
60
|
+
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
61
|
+
return (user) => queryClient.setQueryData(userKey, user);
|
|
54
62
|
}
|
|
55
63
|
export {
|
|
56
64
|
USER_QUERY_KEY,
|
|
65
|
+
USER_VALIDATE_SESSION_KEY,
|
|
57
66
|
useInvalidateUser,
|
|
58
67
|
useSetUserData,
|
|
59
68
|
useTwoFactorVerify,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/hooks/useUserQuery.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/auth/hooks/useUserQuery.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query';\nimport { User } from '../../users/schema';\nimport { withAction } from '../../../utils/withAction';\nimport { useWlQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const USER_QUERY_KEY = ['user'] as const;\nexport const USER_VALIDATE_SESSION_KEY = ['user-validate-session'] as const;\n\nasync function fetchUser(): Promise<User | null> {\n const { findUserById: getUserDataAction } = await import('../../users/action/find-user-by-id.action');\n const result = await getUserDataAction();\n return result.success && result.data ? result.data : null;\n}\n\nasync function validateUserSession(): Promise<boolean> {\n const { validateSessionAction } = await import('../actions/validate-session.action');\n return await validateSessionAction();\n}\n\nexport function useUserQuery() {\n const queryKey = useWlQueryKey([...USER_QUERY_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: fetchUser,\n staleTime: 5 * 60 * 1000,\n gcTime: 10 * 60 * 1000,\n retry: false,\n });\n}\n\nexport function useUserValidateSession(options?: UseQueryOptions) {\n const queryKey = useWlQueryKey([...USER_VALIDATE_SESSION_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: validateUserSession,\n retry: false,\n staleTime: 5 * 60 * 1000,\n ...options,\n refetchOnMount: 'always',\n refetchOnWindowFocus: true,\n });\n}\n\nexport function useTwoFactorVerify() {\n const queryClient = useQueryClient();\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\n const twoFactorKey = useWlQueryKey(['two-factor-pending']);\n\n return useMutation({\n mutationFn: async ({ cookie, code, window }: { cookie: string; code: string; window?: number }) => {\n const { verifyTwoFactorAction } = await import('../actions/verify-two-factor.action');\n return withAction(() => verifyTwoFactorAction(cookie, code, window))();\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: userKey });\n queryClient.invalidateQueries({ queryKey: twoFactorKey });\n },\n });\n}\n\nexport function useInvalidateUser() {\n const queryClient = useQueryClient();\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\n return () => queryClient.invalidateQueries({ queryKey: userKey });\n}\n\nexport function useSetUserData() {\n const queryClient = useQueryClient();\n const userKey = useWlQueryKey([...USER_QUERY_KEY]);\n return (user: User | null) => queryClient.setQueryData(userKey, user);\n}\n"],"mappings":";AAEA,SAAS,aAAa,UAAU,sBAAuC;AAEvE,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAEvB,MAAM,iBAAiB,CAAC,MAAM;AAC9B,MAAM,4BAA4B,CAAC,uBAAuB;AAEjE,eAAe,YAAkC;AAC/C,QAAM,EAAE,cAAc,kBAAkB,IAAI,MAAM,OAAO,2CAA2C;AACpG,QAAM,SAAS,MAAM,kBAAkB;AACvC,SAAO,OAAO,WAAW,OAAO,OAAO,OAAO,OAAO;AACvD;AAEA,eAAe,sBAAwC;AACrD,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AAe;AACnC,QAAM,UAAU,cAAc,CAAC,GAAG,cAAc,CAAC;AACjD,SAAO,CAAC,SAAsB,YAAY,aAAa,SAAS,IAAI;AACtE;","names":[]}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { withAction } from "../../../utils/withAction";
|
|
4
4
|
import { listCardsAction } from "../actions/list-cards.action";
|
|
5
|
+
import { useAuthQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
6
|
const CARDS_QUERY_KEY = ["cards"];
|
|
6
7
|
function useCards() {
|
|
8
|
+
const queryKey = useAuthQueryKey([...CARDS_QUERY_KEY]);
|
|
7
9
|
return useQuery({
|
|
8
|
-
queryKey
|
|
10
|
+
queryKey,
|
|
9
11
|
queryFn: withAction(listCardsAction)
|
|
10
12
|
});
|
|
11
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/cards/hooks/cards.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { listCardsAction } from '../actions/list-cards.action';\n\nexport const CARDS_QUERY_KEY = ['cards'];\n\nexport function useCards() {\n return useQuery({\n queryKey
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/cards/hooks/cards.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { listCardsAction } from '../actions/list-cards.action';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const CARDS_QUERY_KEY = ['cards'] as const;\n\nexport function useCards() {\n const queryKey = useAuthQueryKey([...CARDS_QUERY_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: withAction(listCardsAction),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEzB,MAAM,kBAAkB,CAAC,OAAO;AAEhC,SAAS,WAAW;AACzB,QAAM,WAAW,gBAAgB,CAAC,GAAG,eAAe,CAAC;AAErD,SAAO,SAAS;AAAA,IACd;AAAA,IACA,SAAS,WAAW,eAAe;AAAA,EACrC,CAAC;AACH;","names":[]}
|
|
@@ -3,12 +3,14 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
3
3
|
import { withAction } from "../../../utils/withAction";
|
|
4
4
|
import { createCardAction } from "../actions/create-card.action";
|
|
5
5
|
import { CARDS_QUERY_KEY } from "./cards.hook";
|
|
6
|
+
import { useAuthQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
6
7
|
function useCreateCard() {
|
|
7
8
|
const queryClient = useQueryClient();
|
|
9
|
+
const cardsKey = useAuthQueryKey([...CARDS_QUERY_KEY]);
|
|
8
10
|
return useMutation({
|
|
9
11
|
mutationFn: (data) => withAction(createCardAction)(data),
|
|
10
12
|
onSuccess: () => {
|
|
11
|
-
queryClient.invalidateQueries({ queryKey:
|
|
13
|
+
queryClient.invalidateQueries({ queryKey: cardsKey });
|
|
12
14
|
}
|
|
13
15
|
});
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/cards/hooks/create-card.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { createCardAction } from '../actions/create-card.action';\nimport { CreateCardRequest } from '../types';\nimport { CARDS_QUERY_KEY } from './cards.hook';\n\nexport function useCreateCard() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (data: CreateCardRequest) => withAction(createCardAction)(data),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey:
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/cards/hooks/create-card.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { createCardAction } from '../actions/create-card.action';\nimport { CreateCardRequest } from '../types';\nimport { CARDS_QUERY_KEY } from './cards.hook';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport function useCreateCard() {\n const queryClient = useQueryClient();\n const cardsKey = useAuthQueryKey([...CARDS_QUERY_KEY]);\n\n return useMutation({\n mutationFn: (data: CreateCardRequest) => withAction(createCardAction)(data),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: cardsKey });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AAEjC,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEzB,SAAS,gBAAgB;AAC9B,QAAM,cAAc,eAAe;AACnC,QAAM,WAAW,gBAAgB,CAAC,GAAG,eAAe,CAAC;AAErD,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,SAA4B,WAAW,gBAAgB,EAAE,IAAI;AAAA,IAC1E,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,SAAS,CAAC;AAAA,IACtD;AAAA,EACF,CAAC;AACH;","names":[]}
|