@greatapps/common 1.1.24 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/components/account/ConfigurationsMyAccountModal.mjs +121 -0
  2. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -0
  3. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +45 -0
  4. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -0
  5. package/dist/components/account/DisableTwoFactorAuthModal.mjs +67 -0
  6. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -0
  7. package/dist/components/account/TwoFactorAuthModal.mjs +190 -0
  8. package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -0
  9. package/dist/components/account/constants.mjs +32 -0
  10. package/dist/components/account/constants.mjs.map +1 -0
  11. package/dist/components/account/hooks/useChangeEmailForm.mjs +53 -0
  12. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -0
  13. package/dist/components/account/hooks/useChangePasswordForm.mjs +47 -0
  14. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -0
  15. package/dist/components/account/hooks/useChangePhoneForm.mjs +64 -0
  16. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -0
  17. package/dist/components/account/hooks/useConfigurationsModal.mjs +33 -0
  18. package/dist/components/account/hooks/useConfigurationsModal.mjs.map +1 -0
  19. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +54 -0
  20. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -0
  21. package/dist/components/account/hooks/useOtpVerification.mjs +94 -0
  22. package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -0
  23. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +88 -0
  24. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -0
  25. package/dist/components/account/sections/ChangeEmailModal.mjs +180 -0
  26. package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -0
  27. package/dist/components/account/sections/ChangePasswordSection.mjs +64 -0
  28. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -0
  29. package/dist/components/account/sections/ChangePhoneModal.mjs +182 -0
  30. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -0
  31. package/dist/components/account/sections/MyProfileSection.mjs +312 -0
  32. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -0
  33. package/dist/components/account/sections/PreferencesSection.mjs +246 -0
  34. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -0
  35. package/dist/components/account/sections/SecuritySection.mjs +147 -0
  36. package/dist/components/account/sections/SecuritySection.mjs.map +1 -0
  37. package/dist/components/ui/form/ComboboxField.mjs +130 -0
  38. package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
  39. package/dist/components/ui/form/FormField.mjs +103 -0
  40. package/dist/components/ui/form/FormField.mjs.map +1 -0
  41. package/dist/components/ui/form/PhoneInput.mjs +78 -0
  42. package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
  43. package/dist/components/ui/form/SelectField.mjs +80 -0
  44. package/dist/components/ui/form/SelectField.mjs.map +1 -0
  45. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
  46. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
  47. package/dist/components/ui/form/TextAreaField.mjs +56 -0
  48. package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
  49. package/dist/enums/AccountSectionType.mjs +11 -0
  50. package/dist/enums/AccountSectionType.mjs.map +1 -0
  51. package/dist/hooks/useCountdownTimer.mjs +29 -0
  52. package/dist/hooks/useCountdownTimer.mjs.map +1 -0
  53. package/dist/hooks/useIsMobile.mjs +18 -0
  54. package/dist/hooks/useIsMobile.mjs.map +1 -0
  55. package/dist/hooks/usePasswordVisibility.mjs +13 -0
  56. package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
  57. package/dist/index.mjs +80 -0
  58. package/dist/index.mjs.map +1 -1
  59. package/dist/modules/accounts/actions/account-management.action.mjs +163 -0
  60. package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
  61. package/dist/modules/accounts/hooks/useAccountManagement.mjs +64 -0
  62. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
  63. package/dist/modules/accounts/services/account.service.mjs +162 -25
  64. package/dist/modules/accounts/services/account.service.mjs.map +1 -1
  65. package/dist/modules/accounts/services/two-factor.service.mjs +77 -0
  66. package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
  67. package/dist/server.mjs +36 -0
  68. package/dist/server.mjs.map +1 -1
  69. package/dist/utils/browser/clipboard.mjs +36 -0
  70. package/dist/utils/browser/clipboard.mjs.map +1 -0
  71. package/dist/utils/file/index.mjs +9 -0
  72. package/dist/utils/file/index.mjs.map +1 -0
  73. package/dist/utils/format/masks.mjs +56 -0
  74. package/dist/utils/format/masks.mjs.map +1 -0
  75. package/dist/utils/intl/locales.mjs +12 -0
  76. package/dist/utils/intl/locales.mjs.map +1 -0
  77. package/dist/utils/intl/timezones.mjs +41 -0
  78. package/dist/utils/intl/timezones.mjs.map +1 -0
  79. package/dist/utils/validators/account.mjs +26 -0
  80. package/dist/utils/validators/account.mjs.map +1 -0
  81. package/dist/utils/validators/common.mjs +47 -0
  82. package/dist/utils/validators/common.mjs.map +1 -0
  83. package/package.json +5 -1
  84. package/src/components/account/ConfigurationsMyAccountModal.tsx +147 -0
  85. package/src/components/account/ConfirmGlobalPreferencesModal.tsx +66 -0
  86. package/src/components/account/DisableTwoFactorAuthModal.tsx +86 -0
  87. package/src/components/account/TwoFactorAuthModal.tsx +221 -0
  88. package/src/components/account/constants.ts +29 -0
  89. package/src/components/account/hooks/useChangeEmailForm.tsx +56 -0
  90. package/src/components/account/hooks/useChangePasswordForm.tsx +59 -0
  91. package/src/components/account/hooks/useChangePhoneForm.tsx +69 -0
  92. package/src/components/account/hooks/useConfigurationsModal.ts +40 -0
  93. package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +69 -0
  94. package/src/components/account/hooks/useOtpVerification.tsx +116 -0
  95. package/src/components/account/hooks/useTwoFactorAuthForm.tsx +114 -0
  96. package/src/components/account/sections/ChangeEmailModal.tsx +224 -0
  97. package/src/components/account/sections/ChangePasswordSection.tsx +64 -0
  98. package/src/components/account/sections/ChangePhoneModal.tsx +229 -0
  99. package/src/components/account/sections/MyProfileSection.tsx +337 -0
  100. package/src/components/account/sections/PreferencesSection.tsx +277 -0
  101. package/src/components/account/sections/SecuritySection.tsx +160 -0
  102. package/src/components/ui/form/ComboboxField.tsx +154 -0
  103. package/src/components/ui/form/FormField.tsx +130 -0
  104. package/src/components/ui/form/PhoneInput.tsx +98 -0
  105. package/src/components/ui/form/SelectField.tsx +118 -0
  106. package/src/components/ui/form/SwitchOptionFieldWithIcon.tsx +47 -0
  107. package/src/components/ui/form/TextAreaField.tsx +70 -0
  108. package/src/enums/AccountSectionType.ts +6 -0
  109. package/src/hooks/useCountdownTimer.ts +41 -0
  110. package/src/hooks/useIsMobile.ts +19 -0
  111. package/src/hooks/usePasswordVisibility.ts +13 -0
  112. package/src/index.ts +70 -0
  113. package/src/modules/accounts/actions/account-management.action.ts +197 -0
  114. package/src/modules/accounts/hooks/useAccountManagement.ts +79 -0
  115. package/src/modules/accounts/services/account.service.ts +229 -50
  116. package/src/modules/accounts/services/two-factor.service.ts +98 -0
  117. package/src/modules/accounts/types.ts +157 -0
  118. package/src/server.ts +21 -0
  119. package/src/utils/browser/clipboard.ts +34 -0
  120. package/src/utils/file/index.ts +5 -0
  121. package/src/utils/format/masks.ts +52 -0
  122. package/src/utils/intl/locales.ts +15 -0
  123. package/src/utils/intl/timezones.ts +53 -0
  124. package/src/utils/validators/account.ts +36 -0
  125. package/src/utils/validators/common.ts +43 -0
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Lock, Settings2, User, X } from "lucide-react";
4
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
5
+ import { Tabs, TabsList, TabsTrigger, TabsContent } from "../ui/data-display/Tabs";
6
+ import { cn } from "../../infra/utils/clsx";
7
+ import { AccountSectionType } from "../../enums/AccountSectionType";
8
+ import { MyProfileSection } from "./sections/MyProfileSection";
9
+ import { PreferencesSection } from "./sections/PreferencesSection";
10
+ import { ChangePasswordSection } from "./sections/ChangePasswordSection";
11
+ import { SecuritySection } from "./sections/SecuritySection";
12
+ import useConfigurationsModal from "./hooks/useConfigurationsModal";
13
+ import useIsMobile from "../../hooks/useIsMobile";
14
+ function ConfigurationsMyAccountModal({
15
+ open,
16
+ onClose,
17
+ initialSection,
18
+ hasActiveSubscription,
19
+ currencies = [],
20
+ storageUrl,
21
+ onDeleteAccount
22
+ }) {
23
+ const isMobile = useIsMobile();
24
+ const { activeSection, setActiveSection } = useConfigurationsModal({
25
+ isOpen: open,
26
+ initialSection
27
+ });
28
+ const tabTriggerClasses = cn(
29
+ "border-0! px-0 py-0",
30
+ "lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full",
31
+ "lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0",
32
+ "lg:data-[state=active]:bg-gray-50",
33
+ "flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap",
34
+ "border-b-2 border-transparent",
35
+ "data-[state=active]:bg-gray-50 rounded-lg",
36
+ "text-gray-500 data-[state=active]:text-gray-950",
37
+ "hover:text-gray-900 transition-colors"
38
+ );
39
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(
40
+ DialogContent,
41
+ {
42
+ showCloseButton: !isMobile,
43
+ overlayClassName: "bg-black/20 lg:bg-black/50",
44
+ className: "\r\n flex flex-col p-0 gap-0 max-w-full! overflow-x-hidden border-0\r\n rounded-t-2xl rounded-b-none h-[100dvh] top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0!\r\n lg:flex-row lg:w-[892px]! lg:max-w-[892px]! lg:h-[626px]! lg:rounded-lg lg:border\r\n lg:top-[50%]! lg:bottom-auto! lg:left-[50%]! lg:right-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!",
45
+ children: [
46
+ /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Configura\xE7\xF5es" }) }),
47
+ /* @__PURE__ */ jsxs("div", { className: "md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200", children: [
48
+ /* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: "Configura\xE7\xF5es" }),
49
+ /* @__PURE__ */ jsx(
50
+ "button",
51
+ {
52
+ type: "button",
53
+ className: "size-8 flex items-center justify-center text-gray-500 cursor-pointer",
54
+ onClick: onClose,
55
+ children: /* @__PURE__ */ jsx(X, { size: 18 })
56
+ }
57
+ )
58
+ ] }),
59
+ /* @__PURE__ */ jsxs(
60
+ Tabs,
61
+ {
62
+ value: activeSection,
63
+ onValueChange: (value) => setActiveSection(value),
64
+ orientation: "vertical",
65
+ className: "flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0",
66
+ children: [
67
+ /* @__PURE__ */ jsxs(
68
+ TabsList,
69
+ {
70
+ className: cn(
71
+ "flex gap-0 bg-transparent border-b-0",
72
+ "lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60",
73
+ "lg:border-r lg:border-gray-200 lg:pl-5 lg:pr-5 lg:pt-5 lg:gap-5 lg:overflow-x-visible lg:self-stretch",
74
+ "flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0",
75
+ "px-4 py-3",
76
+ "[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]"
77
+ ),
78
+ children: [
79
+ /* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: "Configura\xE7\xF5es" }),
80
+ /* @__PURE__ */ jsxs("div", { className: "lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full", children: [
81
+ /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.MY_PROFILE, className: tabTriggerClasses, children: [
82
+ /* @__PURE__ */ jsx(User, { size: 20, className: "shrink-0" }),
83
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Meu perfil" })
84
+ ] }),
85
+ /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.PREFERENCES, className: tabTriggerClasses, children: [
86
+ /* @__PURE__ */ jsx(Settings2, { size: 20, className: "shrink-0" }),
87
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Prefer\xEAncias" })
88
+ ] }),
89
+ /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.SECURITY, className: tabTriggerClasses, children: [
90
+ /* @__PURE__ */ jsx(Lock, { size: 20, className: "shrink-0" }),
91
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Seguran\xE7a" })
92
+ ] })
93
+ ] })
94
+ ]
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsxs("div", { className: "w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative", children: [
98
+ /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.MY_PROFILE, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(MyProfileSection, { onClose, storageUrl }) }),
99
+ /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.SECURITY, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(
100
+ SecuritySection,
101
+ {
102
+ setActiveSection,
103
+ onClose,
104
+ hasActiveSubscription,
105
+ onDeleteAccount
106
+ }
107
+ ) }),
108
+ /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.CHANGE_PASSWORD, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(ChangePasswordSection, { onBack: () => setActiveSection(AccountSectionType.SECURITY) }) }),
109
+ /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.PREFERENCES, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(PreferencesSection, { onClose, currencies }) })
110
+ ] })
111
+ ]
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ ) });
117
+ }
118
+ export {
119
+ ConfigurationsMyAccountModal as default
120
+ };
121
+ //# sourceMappingURL=ConfigurationsMyAccountModal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { Lock, Settings2, User, X } from 'lucide-react';\r\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\r\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\r\nimport { Button } from '../ui/buttons/Button';\r\nimport { cn } from '../../infra/utils/clsx';\r\nimport { AccountSectionType } from '../../enums/AccountSectionType';\r\nimport { MyProfileSection } from './sections/MyProfileSection';\r\nimport { PreferencesSection } from './sections/PreferencesSection';\r\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\r\nimport { SecuritySection } from './sections/SecuritySection';\r\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\r\nimport useIsMobile from '../../hooks/useIsMobile';\r\nimport type { ComboboxOption } from '../ui/form/ComboboxField';\r\n\r\ninterface ConfigurationsMyAccountModalProps {\r\n open: boolean;\r\n onClose: () => void;\r\n initialSection?: AccountSectionType;\r\n hasActiveSubscription?: boolean;\r\n currencies?: ComboboxOption[];\r\n storageUrl?: string;\r\n onDeleteAccount?: () => void;\r\n}\r\n\r\nexport default function ConfigurationsMyAccountModal({\r\n open,\r\n onClose,\r\n initialSection,\r\n hasActiveSubscription,\r\n currencies = [],\r\n storageUrl,\r\n onDeleteAccount,\r\n}: ConfigurationsMyAccountModalProps) {\r\n const isMobile = useIsMobile();\r\n const { activeSection, setActiveSection } = useConfigurationsModal({\r\n isOpen: open,\r\n initialSection,\r\n });\r\n\r\n const tabTriggerClasses = cn(\r\n 'border-0! px-0 py-0',\r\n\r\n 'lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full',\r\n 'lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0',\r\n 'lg:data-[state=active]:bg-gray-50',\r\n\r\n 'flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap',\r\n 'border-b-2 border-transparent',\r\n 'data-[state=active]:bg-gray-50 rounded-lg',\r\n\r\n 'text-gray-500 data-[state=active]:text-gray-950',\r\n 'hover:text-gray-900 transition-colors'\r\n );\r\n\r\n return (\r\n <Dialog open={open} onOpenChange={onClose}>\r\n <DialogContent\r\n showCloseButton={!isMobile}\r\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\r\n className=\"\r\n flex flex-col p-0 gap-0 max-w-full! overflow-x-hidden border-0\r\n rounded-t-2xl rounded-b-none h-[100dvh] top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0!\r\n lg:flex-row lg:w-[892px]! lg:max-w-[892px]! lg:h-[626px]! lg:rounded-lg lg:border\r\n lg:top-[50%]! lg:bottom-auto! lg:left-[50%]! lg:right-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\"\r\n >\r\n <DialogHeader className=\"sr-only\">\r\n <DialogTitle>Configurações</DialogTitle>\r\n </DialogHeader>\r\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\r\n <span className=\"text-gray-950 paragraph-medium-semibold\">Configurações</span>\r\n <button\r\n type=\"button\"\r\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\r\n onClick={onClose}\r\n >\r\n <X size={18} />\r\n </button>\r\n </div>\r\n <Tabs\r\n value={activeSection}\r\n onValueChange={(value) => setActiveSection(value as AccountSectionType)}\r\n orientation=\"vertical\"\r\n className=\"flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0\"\r\n >\r\n <TabsList\r\n className={cn(\r\n 'flex gap-0 bg-transparent border-b-0',\r\n\r\n 'lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60',\r\n 'lg:border-r lg:border-gray-200 lg:pl-5 lg:pr-5 lg:pt-5 lg:gap-5 lg:overflow-x-visible lg:self-stretch',\r\n\r\n 'flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0',\r\n 'px-4 py-3',\r\n '[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]'\r\n )}\r\n >\r\n <span className=\"hidden lg:block paragraph-medium-semibold text-gray-950 mb-0\">\r\n Configurações\r\n </span>\r\n\r\n <div className=\"lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full\">\r\n <TabsTrigger value={AccountSectionType.MY_PROFILE} className={tabTriggerClasses}>\r\n <User size={20} className=\"shrink-0\" />\r\n <span className=\"paragraph-small-medium\">Meu perfil</span>\r\n </TabsTrigger>\r\n\r\n <TabsTrigger value={AccountSectionType.PREFERENCES} className={tabTriggerClasses}>\r\n <Settings2 size={20} className=\"shrink-0\" />\r\n <span className=\"paragraph-small-medium\">Preferências</span>\r\n </TabsTrigger>\r\n\r\n <TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>\r\n <Lock size={20} className=\"shrink-0\" />\r\n <span className=\"paragraph-small-medium\">Segurança</span>\r\n </TabsTrigger>\r\n </div>\r\n </TabsList>\r\n\r\n <div className=\"w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative\">\r\n <TabsContent value={AccountSectionType.MY_PROFILE} className=\"h-full! relative overflow-hidden\">\r\n <MyProfileSection onClose={onClose} storageUrl={storageUrl} />\r\n </TabsContent>\r\n\r\n <TabsContent value={AccountSectionType.SECURITY} className=\"h-full! relative overflow-hidden\">\r\n <SecuritySection\r\n setActiveSection={setActiveSection}\r\n onClose={onClose}\r\n hasActiveSubscription={hasActiveSubscription}\r\n onDeleteAccount={onDeleteAccount}\r\n />\r\n </TabsContent>\r\n\r\n <TabsContent value={AccountSectionType.CHANGE_PASSWORD} className=\"h-full! relative overflow-hidden\">\r\n <ChangePasswordSection onBack={() => setActiveSection(AccountSectionType.SECURITY)} />\r\n </TabsContent>\r\n\r\n <TabsContent value={AccountSectionType.PREFERENCES} className=\"h-full! relative overflow-hidden\">\r\n <PreferencesSection onClose={onClose} currencies={currencies} />\r\n </TabsContent>\r\n </div>\r\n </Tabs>\r\n </DialogContent>\r\n </Dialog>\r\n );\r\n}\r\n"],"mappings":";AAoEU,cAEF,YAFE;AAlEV,SAAS,MAAM,WAAW,MAAM,SAAS;AACzC,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,MAAM,UAAU,aAAa,mBAAmB;AAEzD,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,OAAO,4BAA4B;AACnC,OAAO,iBAAiB;AAaT,SAAR,6BAA8C;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa,CAAC;AAAA,EACd;AAAA,EACA;AACF,GAAsC;AACpC,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,eAAe,iBAAiB,IAAI,uBAAuB;AAAA,IACjE,QAAQ;AAAA,IACR;AAAA,EACF,CAAC;AAED,QAAM,oBAAoB;AAAA,IACxB;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,EACF;AAEA,SACE,oBAAC,UAAO,MAAY,cAAc,SAChC;AAAA,IAAC;AAAA;AAAA,MACC,iBAAiB,CAAC;AAAA,MAClB,kBAAiB;AAAA,MACjB,WAAU;AAAA,MAMV;AAAA,4BAAC,gBAAa,WAAU,WACtB,8BAAC,eAAY,iCAAa,GAC5B;AAAA,QACA,qBAAC,SAAI,WA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,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,kBAAC;AAAA;AAAA,oBACC;AAAA,oBACA;AAAA,oBACA;AAAA,oBACA;AAAA;AAAA,gBACF,GACF;AAAA,gBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,gBAEA,oBAAC,eAAY,OAAO,mBAAmB,aAAa,WAAU,oCAC5D,8BAAC,sBAAmB,SAAkB,YAAwB,GAChE;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { TriangleAlert } from "lucide-react";
4
+ import { Button } from "../ui/buttons/Button";
5
+ import {
6
+ Dialog,
7
+ DialogContent,
8
+ DialogHeader,
9
+ DialogTitle,
10
+ DialogDescription
11
+ } from "../ui/overlay/Dialog";
12
+ import { Separator } from "../ui/data-display/Separator";
13
+ function ConfirmGlobalPreferencesModal({
14
+ open,
15
+ onConfirm,
16
+ onCancel
17
+ }) {
18
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: onCancel, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 md:w-[386px]! lg:w-[386px]! max-w-[386px]! max-[386px]:w-[calc(100%-32px)]", children: [
19
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "sr-only", children: [
20
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Alterar prefer\xEAncias globais" }),
21
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Confirma\xE7\xE3o de altera\xE7\xE3o de prefer\xEAncias globais da conta" })
22
+ ] }),
23
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-5", children: [
24
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-gray-50 rounded-lg size-10", children: /* @__PURE__ */ jsx(TriangleAlert, { size: 24, className: "text-gray-950" }) }),
25
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
26
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Alterar prefer\xEAncias globais" }),
27
+ /* @__PURE__ */ jsxs("span", { className: "paragraph-small-regular text-gray-600", children: [
28
+ "Voc\xEA est\xE1 alterando configura\xE7\xF5es que impactam",
29
+ " ",
30
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "todos os usu\xE1rios da conta" }),
31
+ ". Deseja confirmar?"
32
+ ] })
33
+ ] })
34
+ ] }),
35
+ /* @__PURE__ */ jsx(Separator, { className: "w-full" }),
36
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-5", children: [
37
+ /* @__PURE__ */ jsx(Button, { onClick: onConfirm, className: "h-10!", children: "Confirmar" }),
38
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onCancel, className: "h-10!", children: "Cancelar" })
39
+ ] })
40
+ ] }) });
41
+ }
42
+ export {
43
+ ConfirmGlobalPreferencesModal as default
44
+ };
45
+ //# sourceMappingURL=ConfirmGlobalPreferencesModal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/account/ConfirmGlobalPreferencesModal.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { TriangleAlert } from 'lucide-react';\r\nimport { Button } from '../ui/buttons/Button';\r\nimport {\r\n Dialog,\r\n DialogContent,\r\n DialogHeader,\r\n DialogTitle,\r\n DialogDescription,\r\n} from '../ui/overlay/Dialog';\r\nimport { Separator } from '../ui/data-display/Separator';\r\n\r\ninterface ConfirmGlobalPreferencesModalProps {\r\n open: boolean;\r\n onConfirm: () => void;\r\n onCancel: () => void;\r\n}\r\n\r\nexport default function ConfirmGlobalPreferencesModal({\r\n open,\r\n onConfirm,\r\n onCancel,\r\n}: ConfirmGlobalPreferencesModalProps) {\r\n return (\r\n <Dialog open={open} onOpenChange={onCancel}>\r\n <DialogContent className=\"flex flex-col p-0 gap-0 md:w-[386px]! lg:w-[386px]! max-w-[386px]! max-[386px]:w-[calc(100%-32px)]\">\r\n <DialogHeader className=\"sr-only\">\r\n <DialogTitle>Alterar preferências globais</DialogTitle>\r\n <DialogDescription>\r\n Confirmação de alteração de preferências globais da conta\r\n </DialogDescription>\r\n </DialogHeader>\r\n\r\n <div className=\"flex flex-col gap-3 p-5\">\r\n <div className=\"flex items-center justify-center bg-gray-50 rounded-lg size-10\">\r\n <TriangleAlert size={24} className=\"text-gray-950\" />\r\n </div>\r\n <div className=\"flex flex-col gap-2\">\r\n <span className=\"paragraph-medium-semibold text-gray-950\">\r\n Alterar preferências globais\r\n </span>\r\n <span className=\"paragraph-small-regular text-gray-600\">\r\n Você está alterando configurações que impactam{' '}\r\n <span className=\"paragraph-small-semibold text-gray-950\">\r\n todos os usuários da conta\r\n </span>\r\n . Deseja confirmar?\r\n </span>\r\n </div>\r\n </div>\r\n\r\n <Separator className=\"w-full\" />\r\n\r\n <div className=\"flex items-center gap-2 p-5\">\r\n <Button onClick={onConfirm} className=\"h-10!\">\r\n Confirmar\r\n </Button>\r\n <Button variant=\"secondary\" onClick={onCancel} className=\"h-10!\">\r\n Cancelar\r\n </Button>\r\n </div>\r\n </DialogContent>\r\n </Dialog>\r\n );\r\n}\r\n"],"mappings":";AA2BQ,SACE,KADF;AAzBR,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAQX,SAAR,8BAA+C;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,GAAuC;AACrC,SACE,oBAAC,UAAO,MAAY,cAAc,UAChC,+BAAC,iBAAc,WAAU,sGACvB;AAAA,yBAAC,gBAAa,WAAU,WACtB;AAAA,0BAAC,eAAY,6CAA4B;AAAA,MACzC,oBAAC,qBAAkB,sFAEnB;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,SAAI,WAAU,kEACb,8BAAC,iBAAc,MAAM,IAAI,WAAU,iBAAgB,GACrD;AAAA,MACA,qBAAC,SAAI,WAAU,uBACb;AAAA,4BAAC,UAAK,WAAU,2CAA0C,6CAE1D;AAAA,QACA,qBAAC,UAAK,WAAU,yCAAwC;AAAA;AAAA,UACP;AAAA,UAC/C,oBAAC,UAAK,WAAU,0CAAyC,2CAEzD;AAAA,UAAO;AAAA,WAET;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,aAAU,WAAU,UAAS;AAAA,IAE9B,qBAAC,SAAI,WAAU,+BACb;AAAA,0BAAC,UAAO,SAAS,WAAW,WAAU,SAAQ,uBAE9C;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,UAAU,WAAU,SAAQ,sBAEjE;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { ShieldCheck } from "lucide-react";
4
+ import { Button } from "../ui/buttons/Button";
5
+ import {
6
+ Dialog,
7
+ DialogContent,
8
+ DialogDescription,
9
+ DialogHeader,
10
+ DialogTitle
11
+ } from "../ui/overlay/Dialog";
12
+ import { InputOTP, InputOTPGroup, InputOTPSlot } from "../ui/form/InputOtp";
13
+ import useDisableTwoFactorAuthForm from "./hooks/useDisableTwoFactorAuthForm";
14
+ function DisableTwoFactorAuthModal({
15
+ open,
16
+ onClose,
17
+ onSuccess
18
+ }) {
19
+ const { code, setCode, isValid, isLoading, handleClose, handleSubmit } = useDisableTwoFactorAuthForm({ onClose, onSuccess });
20
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsx(DialogContent, { className: "flex flex-col p-0 gap-0 max-w-full! border-0 rounded-t-2xl rounded-b-none h-dvh top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0! lg:max-w-117.5! lg:h-auto! lg:rounded-lg lg:border lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!", children: /* @__PURE__ */ jsxs(
21
+ "form",
22
+ {
23
+ onSubmit: (e) => {
24
+ e.preventDefault();
25
+ handleSubmit();
26
+ },
27
+ className: "flex flex-col flex-1 lg:flex-none",
28
+ children: [
29
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none", children: [
30
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2", children: /* @__PURE__ */ jsx(ShieldCheck, { size: 20, className: "text-gray-600" }) }),
31
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "p-0 gap-2", children: [
32
+ /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "Desabilitar autentica\xE7\xE3o 2FA" }),
33
+ /* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-gray-600", children: "Informe o c\xF3digo de 6 d\xEDgitos do seu aplicativo autenticador para confirmar a desativa\xE7\xE3o." })
34
+ ] }),
35
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
36
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children: "C\xF3digo do autenticador" }),
37
+ /* @__PURE__ */ jsx(InputOTP, { maxLength: 6, value: code, onChange: setCode, children: /* @__PURE__ */ jsx(InputOTPGroup, { className: "gap-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(
38
+ InputOTPSlot,
39
+ {
40
+ index: i,
41
+ className: "w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200"
42
+ },
43
+ i
44
+ )) }) })
45
+ ] })
46
+ ] }),
47
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0", children: [
48
+ /* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ? "Desabilitando..." : "Desabilitar 2FA" }),
49
+ /* @__PURE__ */ jsx(
50
+ Button,
51
+ {
52
+ variant: "secondary",
53
+ className: "h-10! flex-1",
54
+ type: "button",
55
+ onClick: handleClose,
56
+ children: "Cancelar"
57
+ }
58
+ )
59
+ ] })
60
+ ]
61
+ }
62
+ ) }) });
63
+ }
64
+ export {
65
+ DisableTwoFactorAuthModal as default
66
+ };
67
+ //# sourceMappingURL=DisableTwoFactorAuthModal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/account/DisableTwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ShieldCheck } from 'lucide-react';\r\nimport { Button } from '../ui/buttons/Button';\r\nimport {\r\n Dialog,\r\n DialogContent,\r\n DialogDescription,\r\n DialogHeader,\r\n DialogTitle,\r\n} from '../ui/overlay/Dialog';\r\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\r\nimport useDisableTwoFactorAuthForm from './hooks/useDisableTwoFactorAuthForm';\r\n\r\ninterface DisableTwoFactorAuthModalProps {\r\n open: boolean;\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function DisableTwoFactorAuthModal({\r\n open,\r\n onClose,\r\n onSuccess,\r\n}: DisableTwoFactorAuthModalProps) {\r\n const { code, setCode, isValid, isLoading, handleClose, handleSubmit } =\r\n useDisableTwoFactorAuthForm({ onClose, onSuccess });\r\n\r\n return (\r\n <Dialog open={open} onOpenChange={handleClose}>\r\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-full! border-0 rounded-t-2xl rounded-b-none h-dvh top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0! lg:max-w-117.5! lg:h-auto! lg:rounded-lg lg:border lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\">\r\n <form\r\n onSubmit={(e) => {\r\n e.preventDefault();\r\n handleSubmit();\r\n }}\r\n className=\"flex flex-col flex-1 lg:flex-none\"\r\n >\r\n <div className=\"flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none\">\r\n <div className=\"flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2\">\r\n <ShieldCheck size={20} className=\"text-gray-600\" />\r\n </div>\r\n <DialogHeader className=\"p-0 gap-2\">\r\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\r\n Desabilitar autenticação 2FA\r\n </DialogTitle>\r\n <DialogDescription className=\"paragraph-small-regular text-gray-600\">\r\n Informe o código de 6 dígitos do seu aplicativo autenticador para confirmar a\r\n desativação.\r\n </DialogDescription>\r\n </DialogHeader>\r\n\r\n <div className=\"flex flex-col gap-2\">\r\n <span className=\"paragraph-small-medium text-gray-700\">Código do autenticador</span>\r\n <InputOTP maxLength={6} value={code} onChange={setCode}>\r\n <InputOTPGroup className=\"gap-2\">\r\n {Array.from({ length: 6 }).map((_, i) => (\r\n <InputOTPSlot\r\n key={i}\r\n index={i}\r\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\r\n />\r\n ))}\r\n </InputOTPGroup>\r\n </InputOTP>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex flex-row items-center gap-2 p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0\">\r\n <Button className=\"h-10! flex-1\" disabled={!isValid || isLoading} type=\"submit\">\r\n {isLoading ? 'Desabilitando...' : 'Desabilitar 2FA'}\r\n </Button>\r\n <Button\r\n variant=\"secondary\"\r\n className=\"h-10! flex-1\"\r\n type=\"button\"\r\n onClick={handleClose}\r\n >\r\n Cancelar\r\n </Button>\r\n </div>\r\n </form>\r\n </DialogContent>\r\n </Dialog>\r\n );\r\n}\r\n"],"mappings":";AAwCc,cAEF,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BAAY,qBAAqB,mBACpC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,MAAK;AAAA,cACL,SAAS;AAAA,cACV;AAAA;AAAA,UAED;AAAA,WACF;AAAA;AAAA;AAAA,EACF,GACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,190 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { ArrowLeft, X, Copy, RefreshCw } from "lucide-react";
4
+ import { Button } from "../ui/buttons/Button";
5
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
6
+ import { Separator } from "../ui/data-display/Separator";
7
+ import { InputOTP, InputOTPGroup, InputOTPSlot } from "../ui/form/InputOtp";
8
+ import useTwoFactorAuthForm from "./hooks/useTwoFactorAuthForm";
9
+ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
10
+ const {
11
+ code,
12
+ setCode,
13
+ isCodeComplete,
14
+ isGenerating,
15
+ isConfirming,
16
+ generateFailed,
17
+ retryGenerate,
18
+ qrcode,
19
+ backupCodes,
20
+ step,
21
+ handleSubmit,
22
+ handleFinalize,
23
+ handleCopyCodes,
24
+ resetForm
25
+ } = useTwoFactorAuthForm({ onSuccess, open });
26
+ const handleClose = () => {
27
+ resetForm();
28
+ onClose();
29
+ };
30
+ if (step === "recovery") {
31
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
32
+ DialogContent,
33
+ {
34
+ showCloseButton: false,
35
+ className: "flex flex-col p-0 gap-0 max-w-full! border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0! lg:max-w-[470px]! lg:h-auto! lg:rounded-lg lg:border lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!",
36
+ children: [
37
+ /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "C\xF3digos de seguran\xE7a" }) }),
38
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
39
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "C\xF3digos de seguran\xE7a" }),
40
+ /* @__PURE__ */ jsx(
41
+ Button,
42
+ {
43
+ type: "button",
44
+ variant: "ghost",
45
+ className: "size-8! p-0 absolute right-4",
46
+ onClick: handleClose,
47
+ children: /* @__PURE__ */ jsx(X, { size: 18 })
48
+ }
49
+ )
50
+ ] }),
51
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none", children: [
52
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
53
+ /* @__PURE__ */ jsx("h3", { className: "paragraph-medium-semibold text-gray-950 max-w-[269px]", children: "Salve estes c\xF3digos de recupera\xE7\xE3o de emerg\xEAncia" }),
54
+ /* @__PURE__ */ jsxs("div", { className: "paragraph-small-regular text-gray-600", children: [
55
+ /* @__PURE__ */ jsx("p", { children: "Se voc\xEA perder acesso ao seu telefone, n\xE3o ser\xE1 poss\xEDvel fazer login em sua conta sem um c\xF3digo de dois fatores." }),
56
+ /* @__PURE__ */ jsx("br", {}),
57
+ /* @__PURE__ */ jsx("p", { children: "Imprima, copie ou escreva em um local seguro os c\xF3digos abaixo." })
58
+ ] })
59
+ ] }),
60
+ /* @__PURE__ */ jsxs("div", { className: "bg-gray-50 rounded-lg p-4 flex flex-col gap-4", children: [
61
+ /* @__PURE__ */ jsx("div", { className: "paragraph-small-medium text-gray-950 whitespace-nowrap", children: backupCodes.map((backupCode, i) => /* @__PURE__ */ jsx("p", { children: backupCode }, i)) }),
62
+ /* @__PURE__ */ jsxs(
63
+ Button,
64
+ {
65
+ type: "button",
66
+ variant: "secondary",
67
+ className: "h-8! w-fit",
68
+ onClick: handleCopyCodes,
69
+ children: [
70
+ /* @__PURE__ */ jsx(Copy, { size: 16 }),
71
+ "Copiar c\xF3digos"
72
+ ]
73
+ }
74
+ )
75
+ ] })
76
+ ] }),
77
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0", children: [
78
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
79
+ /* @__PURE__ */ jsx(Button, { className: "h-10!", type: "button", onClick: handleFinalize, children: "Finalizar" })
80
+ ] })
81
+ ]
82
+ }
83
+ ) });
84
+ }
85
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
86
+ DialogContent,
87
+ {
88
+ showCloseButton: false,
89
+ className: "flex flex-col p-0 gap-0 max-w-full! border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0! lg:max-w-[470px]! lg:h-auto! lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!",
90
+ children: [
91
+ /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Autentica\xE7\xE3o de dois fatores" }) }),
92
+ /* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
93
+ /* @__PURE__ */ jsx(
94
+ Button,
95
+ {
96
+ type: "button",
97
+ variant: "ghost",
98
+ className: "size-8! p-0 absolute left-4",
99
+ onClick: handleClose,
100
+ children: /* @__PURE__ */ jsx(ArrowLeft, { size: 20 })
101
+ }
102
+ ),
103
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "Autentica\xE7\xE3o de dois fatores" }),
104
+ /* @__PURE__ */ jsx(
105
+ Button,
106
+ {
107
+ type: "button",
108
+ variant: "ghost",
109
+ className: "size-8! p-0 absolute right-4",
110
+ onClick: handleClose,
111
+ children: /* @__PURE__ */ jsx(X, { size: 18 })
112
+ }
113
+ )
114
+ ] }),
115
+ /* @__PURE__ */ jsxs(
116
+ "form",
117
+ {
118
+ className: "flex-1 min-h-0 flex flex-col",
119
+ onSubmit: (e) => {
120
+ e.preventDefault();
121
+ if (isCodeComplete) handleSubmit();
122
+ },
123
+ children: [
124
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6", children: [
125
+ /* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]", children: [
126
+ "Instale um aplicativo autenticador no seu celular (ex.:",
127
+ " ",
128
+ /* @__PURE__ */ jsx(
129
+ "a",
130
+ {
131
+ href: "https://support.google.com/accounts/answer/1066447",
132
+ target: "_blank",
133
+ rel: "noopener noreferrer",
134
+ className: "paragraph-small-medium underline",
135
+ children: "Google Authenticator"
136
+ }
137
+ ),
138
+ "), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o c\xF3digo de 6 d\xEDgitos gerado para continuar."
139
+ ] }),
140
+ /* @__PURE__ */ jsx("div", { className: "border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]", children: generateFailed ? /* @__PURE__ */ jsxs(
141
+ "button",
142
+ {
143
+ type: "button",
144
+ onClick: () => retryGenerate(),
145
+ className: "flex flex-col items-center gap-1.5 text-center",
146
+ children: [
147
+ /* @__PURE__ */ jsx(RefreshCw, { size: 20, className: "text-gray-400" }),
148
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500", children: "Tentar novamente" })
149
+ ]
150
+ }
151
+ ) : isGenerating || !qrcode ? /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded bg-gray-100 animate-pulse" }) : (
152
+ // eslint-disable-next-line @next/next/no-img-element
153
+ /* @__PURE__ */ jsx(
154
+ "img",
155
+ {
156
+ src: qrcode,
157
+ alt: "QR Code para autentica\xE7\xE3o de dois fatores",
158
+ className: "w-full h-full"
159
+ }
160
+ )
161
+ ) }),
162
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 w-full", children: [
163
+ /* @__PURE__ */ jsx(Separator, { className: "flex-1" }),
164
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap", children: "Cole os 6 d\xEDgitos abaixo" }),
165
+ /* @__PURE__ */ jsx(Separator, { className: "flex-1" })
166
+ ] }),
167
+ /* @__PURE__ */ jsx("div", { className: "scroll-mt-20", children: /* @__PURE__ */ jsx(InputOTP, { maxLength: 6, value: code, onChange: setCode, children: /* @__PURE__ */ jsx(InputOTPGroup, { className: "gap-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(
168
+ InputOTPSlot,
169
+ {
170
+ index: i,
171
+ className: "w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200"
172
+ },
173
+ i
174
+ )) }) }) })
175
+ ] }) }),
176
+ /* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white", children: [
177
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
178
+ /* @__PURE__ */ jsx(Button, { type: "submit", className: "h-10!", disabled: !isCodeComplete || isConfirming, children: isConfirming ? "Ativando..." : "Ativar autentica\xE7\xE3o" })
179
+ ] })
180
+ ]
181
+ }
182
+ )
183
+ ]
184
+ }
185
+ ) });
186
+ }
187
+ export {
188
+ TwoFactorAuthModal as default
189
+ };
190
+ //# sourceMappingURL=TwoFactorAuthModal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/account/TwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ArrowLeft, X, Copy, RefreshCw } from 'lucide-react';\r\nimport { Button } from '../ui/buttons/Button';\r\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\r\nimport { Separator } from '../ui/data-display/Separator';\r\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\r\nimport useTwoFactorAuthForm from './hooks/useTwoFactorAuthForm';\r\n\r\ninterface TwoFactorAuthModalProps {\r\n open: boolean;\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFactorAuthModalProps) {\r\n const {\r\n code,\r\n setCode,\r\n isCodeComplete,\r\n isGenerating,\r\n isConfirming,\r\n generateFailed,\r\n retryGenerate,\r\n qrcode,\r\n backupCodes,\r\n step,\r\n handleSubmit,\r\n handleFinalize,\r\n handleCopyCodes,\r\n resetForm,\r\n } = useTwoFactorAuthForm({ onSuccess, open });\r\n\r\n const handleClose = () => {\r\n resetForm();\r\n onClose();\r\n };\r\n\r\n if (step === 'recovery') {\r\n return (\r\n <Dialog open={open} onOpenChange={handleClose}>\r\n <DialogContent\r\n showCloseButton={false}\r\n className=\"flex flex-col p-0 gap-0 max-w-full! border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0! lg:max-w-[470px]! lg:h-auto! lg:rounded-lg lg:border lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\"\r\n >\r\n <DialogHeader className=\"sr-only\">\r\n <DialogTitle>Códigos de segurança</DialogTitle>\r\n </DialogHeader>\r\n <div className=\"flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\r\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\r\n Códigos de segurança\r\n </span>\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"size-8! p-0 absolute right-4\"\r\n onClick={handleClose}\r\n >\r\n <X size={18} />\r\n </Button>\r\n </div>\r\n\r\n <div className=\"flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none\">\r\n <div className=\"flex flex-col gap-2\">\r\n <h3 className=\"paragraph-medium-semibold text-gray-950 max-w-[269px]\">\r\n Salve estes códigos de recuperação de emergência\r\n </h3>\r\n <div className=\"paragraph-small-regular text-gray-600\">\r\n <p>\r\n Se você perder acesso ao seu telefone, não será possível fazer login em sua conta\r\n sem um código de dois fatores.\r\n </p>\r\n <br />\r\n <p>Imprima, copie ou escreva em um local seguro os códigos abaixo.</p>\r\n </div>\r\n </div>\r\n\r\n <div className=\"bg-gray-50 rounded-lg p-4 flex flex-col gap-4\">\r\n <div className=\"paragraph-small-medium text-gray-950 whitespace-nowrap\">\r\n {backupCodes.map((backupCode, i) => (\r\n <p key={i}>{backupCode}</p>\r\n ))}\r\n </div>\r\n <Button\r\n type=\"button\"\r\n variant=\"secondary\"\r\n className=\"h-8! w-fit\"\r\n onClick={handleCopyCodes}\r\n >\r\n <Copy size={16} />\r\n Copiar códigos\r\n </Button>\r\n </div>\r\n </div>\r\n\r\n <div className=\"flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0\">\r\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\r\n Cancelar\r\n </Button>\r\n <Button className=\"h-10!\" type=\"button\" onClick={handleFinalize}>\r\n Finalizar\r\n </Button>\r\n </div>\r\n </DialogContent>\r\n </Dialog>\r\n );\r\n }\r\n\r\n return (\r\n <Dialog open={open} onOpenChange={handleClose}>\r\n <DialogContent\r\n showCloseButton={false}\r\n className=\"flex flex-col p-0 gap-0 max-w-full! border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0! bottom-0! left-0! right-0! translate-x-0! translate-y-0! lg:max-w-[470px]! lg:h-auto! lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\"\r\n >\r\n <DialogHeader className=\"sr-only\">\r\n <DialogTitle>Autenticação de dois fatores</DialogTitle>\r\n </DialogHeader>\r\n <div className=\"shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"size-8! p-0 absolute left-4\"\r\n onClick={handleClose}\r\n >\r\n <ArrowLeft size={20} />\r\n </Button>\r\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\r\n Autenticação de dois fatores\r\n </span>\r\n <Button\r\n type=\"button\"\r\n variant=\"ghost\"\r\n className=\"size-8! p-0 absolute right-4\"\r\n onClick={handleClose}\r\n >\r\n <X size={18} />\r\n </Button>\r\n </div>\r\n\r\n <form\r\n className=\"flex-1 min-h-0 flex flex-col\"\r\n onSubmit={(e) => {\r\n e.preventDefault();\r\n if (isCodeComplete) handleSubmit();\r\n }}\r\n >\r\n <div className=\"flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible\">\r\n <div className=\"flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6\">\r\n <p className=\"paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]\">\r\n Instale um aplicativo autenticador no seu celular (ex.:{' '}\r\n <a\r\n href=\"https://support.google.com/accounts/answer/1066447\"\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n className=\"paragraph-small-medium underline\"\r\n >\r\n Google Authenticator\r\n </a>\r\n ), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o\r\n código de 6 dígitos gerado para continuar.\r\n </p>\r\n\r\n <div className=\"border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]\">\r\n {generateFailed ? (\r\n <button\r\n type=\"button\"\r\n onClick={() => retryGenerate()}\r\n className=\"flex flex-col items-center gap-1.5 text-center\"\r\n >\r\n <RefreshCw size={20} className=\"text-gray-400\" />\r\n <span className=\"paragraph-xsmall-medium text-gray-500\">Tentar novamente</span>\r\n </button>\r\n ) : isGenerating || !qrcode ? (\r\n <div className=\"w-full h-full rounded bg-gray-100 animate-pulse\" />\r\n ) : (\r\n // eslint-disable-next-line @next/next/no-img-element\r\n <img\r\n src={qrcode}\r\n alt=\"QR Code para autenticação de dois fatores\"\r\n className=\"w-full h-full\"\r\n />\r\n )}\r\n </div>\r\n\r\n <div className=\"flex items-center gap-3 w-full\">\r\n <Separator className=\"flex-1\" />\r\n <span className=\"paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap\">\r\n Cole os 6 dígitos abaixo\r\n </span>\r\n <Separator className=\"flex-1\" />\r\n </div>\r\n\r\n <div className=\"scroll-mt-20\">\r\n <InputOTP maxLength={6} value={code} onChange={setCode}>\r\n <InputOTPGroup className=\"gap-2\">\r\n {Array.from({ length: 6 }).map((_, i) => (\r\n <InputOTPSlot\r\n key={i}\r\n index={i}\r\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\r\n />\r\n ))}\r\n </InputOTPGroup>\r\n </InputOTP>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white\">\r\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\r\n Cancelar\r\n </Button>\r\n <Button type=\"submit\" className=\"h-10!\" disabled={!isCodeComplete || isConfirming}>\r\n {isConfirming ? 'Ativando...' : 'Ativar autenticação'}\r\n </Button>\r\n </div>\r\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AU;AAAA;AAAA,kBAFL;AAAA,gBAGP,CACD,GACH,GACF,GACF;AAAA,iBACF,GACF;AAAA,cAEA,qBAAC,SAAI,WAAU,iGACb;AAAA,oCAAC,UAAO,SAAQ,aAAY,WAAU,SAAQ,MAAK,UAAS,SAAS,aAAa,sBAElF;AAAA,gBACA,oBAAC,UAAO,MAAK,UAAS,WAAU,SAAQ,UAAU,CAAC,kBAAkB,cAClE,yBAAe,gBAAgB,6BAClC;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,32 @@
1
+ import { buildTimezoneOptions } from "../../utils/intl/timezones";
2
+ import { buildLocaleOptions } from "../../utils/intl/locales";
3
+ const GENDER_OPTIONS = [
4
+ { value: "masculino", label: "Masculino", apiValue: 1 },
5
+ { value: "feminino", label: "Feminino", apiValue: 0 }
6
+ ];
7
+ const LANGUAGE_OPTIONS = buildLocaleOptions();
8
+ const CURRENCY_OPTIONS = [
9
+ { value: "BRL", label: "BRL (R$)", displayValue: "BRL (R$)" },
10
+ { value: "USD", label: "USD ($)", displayValue: "USD ($)" },
11
+ { value: "EUR", label: "EUR (\u20AC)", displayValue: "EUR (\u20AC)" }
12
+ ];
13
+ const TIMEZONE_OPTIONS = buildTimezoneOptions();
14
+ const TIME_FORMAT_OPTIONS = [
15
+ { value: "24h", label: "24 horas", displayValue: "24 horas" },
16
+ { value: "12h", label: "12 horas (AM/PM)", displayValue: "12 horas (AM/PM)" }
17
+ ];
18
+ const NOTIFICATION_TYPES = [
19
+ "Atualiza\xE7\xF5es de projetos",
20
+ "Alertas de seguran\xE7a",
21
+ "Mudan\xE7as no plano ou faturamento",
22
+ "Manuten\xE7\xF5es programadas"
23
+ ];
24
+ export {
25
+ CURRENCY_OPTIONS,
26
+ GENDER_OPTIONS,
27
+ LANGUAGE_OPTIONS,
28
+ NOTIFICATION_TYPES,
29
+ TIMEZONE_OPTIONS,
30
+ TIME_FORMAT_OPTIONS
31
+ };
32
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/account/constants.ts"],"sourcesContent":["import { buildTimezoneOptions } from '../../utils/intl/timezones';\r\nimport { buildLocaleOptions } from '../../utils/intl/locales';\r\n\r\nexport const GENDER_OPTIONS = [\r\n { value: 'masculino', label: 'Masculino', apiValue: 1 },\r\n { value: 'feminino', label: 'Feminino', apiValue: 0 },\r\n];\r\n\r\nexport const LANGUAGE_OPTIONS = buildLocaleOptions();\r\n\r\nexport const CURRENCY_OPTIONS = [\r\n { value: 'BRL', label: 'BRL (R$)', displayValue: 'BRL (R$)' },\r\n { value: 'USD', label: 'USD ($)', displayValue: 'USD ($)' },\r\n { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },\r\n];\r\n\r\nexport const TIMEZONE_OPTIONS = buildTimezoneOptions();\r\n\r\nexport const TIME_FORMAT_OPTIONS = [\r\n { value: '24h', label: '24 horas', displayValue: '24 horas' },\r\n { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },\r\n];\r\n\r\nexport const NOTIFICATION_TYPES = [\r\n 'Atualizações de projetos',\r\n 'Alertas de segurança',\r\n 'Mudanças no plano ou faturamento',\r\n 'Manutenções programadas',\r\n];\r\n"],"mappings":"AAAA,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AAE5B,MAAM,iBAAiB;AAAA,EAC5B,EAAE,OAAO,aAAa,OAAO,aAAa,UAAU,EAAE;AAAA,EACtD,EAAE,OAAO,YAAY,OAAO,YAAY,UAAU,EAAE;AACtD;AAEO,MAAM,mBAAmB,mBAAmB;AAE5C,MAAM,mBAAmB;AAAA,EAC9B,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,WAAW,cAAc,UAAU;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,gBAAW,cAAc,eAAU;AAC5D;AAEO,MAAM,mBAAmB,qBAAqB;AAE9C,MAAM,sBAAsB;AAAA,EACjC,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,oBAAoB,cAAc,mBAAmB;AAC9E;AAEO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState, useCallback } from "react";
4
+ import { useForm } from "react-hook-form";
5
+ import { zodResolver } from "@hookform/resolvers/zod";
6
+ import { toast } from "sonner";
7
+ import { Toast } from "../../ui/feedback/Toast";
8
+ import { changeEmailSchema } from "../../../utils/validators/account";
9
+ import { requestEmailChangeAction } from "../../../modules/accounts/actions/account-management.action";
10
+ function useChangeEmailForm() {
11
+ const [showVerification, setShowVerification] = useState(false);
12
+ const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm({
13
+ resolver: zodResolver(changeEmailSchema),
14
+ mode: "onChange",
15
+ defaultValues: { email: "" }
16
+ });
17
+ const handleContinue = handleSubmit(async (data) => {
18
+ const result = await requestEmailChangeAction(data.email);
19
+ if (!result.success) {
20
+ toast.custom((t) => /* @__PURE__ */ jsx(
21
+ Toast,
22
+ {
23
+ variant: "error",
24
+ message: result.error ?? "E-mail j\xE1 existente ou ocorreu um erro. Tente novamente mais tarde.",
25
+ toastId: t
26
+ }
27
+ ));
28
+ return;
29
+ }
30
+ setShowVerification(true);
31
+ });
32
+ const handleBack = useCallback(() => {
33
+ setShowVerification(false);
34
+ }, []);
35
+ const resetForm = useCallback(() => {
36
+ reset();
37
+ setShowVerification(false);
38
+ }, [reset]);
39
+ return {
40
+ showVerification,
41
+ emailToVerify: watch("email"),
42
+ isSubmitting,
43
+ errors,
44
+ register,
45
+ handleContinue,
46
+ handleBack,
47
+ resetForm
48
+ };
49
+ }
50
+ export {
51
+ useChangeEmailForm as default
52
+ };
53
+ //# sourceMappingURL=useChangeEmailForm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/account/hooks/useChangeEmailForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { changeEmailSchema, type ChangeEmailFormData } from '../../../utils/validators/account';\r\nimport { requestEmailChangeAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\nexport default function useChangeEmailForm() {\r\n const [showVerification, setShowVerification] = useState(false);\r\n\r\n const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm<ChangeEmailFormData>({\r\n resolver: zodResolver(changeEmailSchema),\r\n mode: 'onChange',\r\n defaultValues: { email: '' },\r\n });\r\n\r\n const handleContinue = handleSubmit(async (data) => {\r\n const result = await requestEmailChangeAction(data.email);\r\n\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast\r\n variant=\"error\"\r\n message={result.error ?? 'E-mail já existente ou ocorreu um erro. Tente novamente mais tarde.'}\r\n toastId={t}\r\n />\r\n ));\r\n return;\r\n }\r\n\r\n setShowVerification(true);\r\n });\r\n\r\n const handleBack = useCallback(() => {\r\n setShowVerification(false);\r\n }, []);\r\n\r\n const resetForm = useCallback(() => {\r\n reset();\r\n setShowVerification(false);\r\n }, [reset]);\r\n\r\n return {\r\n showVerification,\r\n emailToVerify: watch('email'),\r\n isSubmitting,\r\n errors,\r\n register,\r\n handleContinue,\r\n handleBack,\r\n resetForm,\r\n };\r\n}\r\n"],"mappings":";AAwBQ;AAtBR,SAAS,UAAU,mBAAmB;AACtC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,yBAAmD;AAC5D,SAAS,gCAAgC;AAE1B,SAAR,qBAAsC;AAC3C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAE9D,QAAM,EAAE,UAAU,cAAc,OAAO,OAAO,WAAW,EAAE,QAAQ,aAAa,EAAE,IAAI,QAA6B;AAAA,IACjH,UAAU,YAAY,iBAAiB;AAAA,IACvC,MAAM;AAAA,IACN,eAAe,EAAE,OAAO,GAAG;AAAA,EAC7B,CAAC;AAED,QAAM,iBAAiB,aAAa,OAAO,SAAS;AAClD,UAAM,SAAS,MAAM,yBAAyB,KAAK,KAAK;AAExD,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,OAAO,CAAC,MACZ;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,OAAO,SAAS;AAAA,UACzB,SAAS;AAAA;AAAA,MACX,CACD;AACD;AAAA,IACF;AAEA,wBAAoB,IAAI;AAAA,EAC1B,CAAC;AAED,QAAM,aAAa,YAAY,MAAM;AACnC,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,YAAY,MAAM;AAClC,UAAM;AACN,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AAAA,IACL;AAAA,IACA,eAAe,MAAM,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}