@greatapps/common 1.1.675 → 1.1.677

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 (240) hide show
  1. package/dist/components/account/ConfigurationsMyAccountModal.mjs +8 -6
  2. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
  3. package/dist/components/account/ConfirmDeleteAccountModal.mjs +20 -19
  4. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
  5. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +10 -11
  6. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -1
  7. package/dist/components/account/DeleteAccountModal.mjs +34 -28
  8. package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
  9. package/dist/components/account/DisableTwoFactorAuthModal.mjs +7 -5
  10. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -1
  11. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +8 -9
  12. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
  13. package/dist/components/account/TwoFactorAuthModal.mjs +22 -23
  14. package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
  15. package/dist/components/account/constants.mjs +4 -4
  16. package/dist/components/account/constants.mjs.map +1 -1
  17. package/dist/components/account/hooks/useChangeEmailForm.mjs +5 -3
  18. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -1
  19. package/dist/components/account/hooks/useChangePasswordForm.mjs +26 -3
  20. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -1
  21. package/dist/components/account/hooks/useChangePhoneForm.mjs +18 -9
  22. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
  23. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +26 -3
  24. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
  25. package/dist/components/account/hooks/useOtpVerification.mjs +19 -3
  26. package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -1
  27. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +27 -4
  28. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
  29. package/dist/components/account/sections/ChangeEmailModal.mjs +25 -28
  30. package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
  31. package/dist/components/account/sections/ChangePasswordSection.mjs +8 -6
  32. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
  33. package/dist/components/account/sections/ChangePhoneModal.mjs +24 -27
  34. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
  35. package/dist/components/account/sections/MyProfileSection.mjs +37 -22
  36. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
  37. package/dist/components/account/sections/PreferencesSection.mjs +48 -24
  38. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
  39. package/dist/components/account/sections/SecuritySection.mjs +11 -9
  40. package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
  41. package/dist/components/account/sections/TokenSection.mjs +24 -8
  42. package/dist/components/account/sections/TokenSection.mjs.map +1 -1
  43. package/dist/components/layouts/AppMobileNavBar.mjs +2 -148
  44. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
  45. package/dist/components/layouts/NavBar.mjs +5 -3
  46. package/dist/components/layouts/NavBar.mjs.map +1 -1
  47. package/dist/components/layouts/NotificationsPopover.mjs +5 -3
  48. package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
  49. package/dist/components/layouts/ProfilePopover.mjs +6 -4
  50. package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
  51. package/dist/components/layouts/UsersSelectorPopover.mjs +9 -7
  52. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
  53. package/dist/components/modals/BuyCreditsModal.mjs +17 -18
  54. package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
  55. package/dist/components/modals/CreditsDisabledModal.mjs +6 -4
  56. package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
  57. package/dist/components/modals/PaidPlanRequiredModal.mjs +5 -3
  58. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
  59. package/dist/components/modals/cards/AddCardModal.mjs +64 -46
  60. package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
  61. package/dist/components/modals/cards/CannotDeleteCardModal.mjs +9 -7
  62. package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
  63. package/dist/components/modals/cards/CardFormFields.mjs +65 -51
  64. package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
  65. package/dist/components/modals/cards/DeleteCardModal.mjs +10 -8
  66. package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
  67. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +4 -2
  68. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
  69. package/dist/components/navigation/OverdueInvoiceBanner.mjs +4 -2
  70. package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
  71. package/dist/components/navigation/PendingCancellationBanner.mjs +4 -6
  72. package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
  73. package/dist/components/navigation/ProjectSelectorPopover.mjs +8 -6
  74. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
  75. package/dist/components/navigation/UpcomingInvoiceBanner.mjs +4 -6
  76. package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
  77. package/dist/components/navigation/subcomponents/BottomLinks.mjs +5 -3
  78. package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
  79. package/dist/components/navigation/subcomponents/CreditsCard.mjs +3 -1
  80. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
  81. package/dist/components/navigation/subcomponents/PlanCard.mjs +3 -1
  82. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
  83. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +5 -3
  84. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
  85. package/dist/components/pages/NotFoundPage.mjs +5 -3
  86. package/dist/components/pages/NotFoundPage.mjs.map +1 -1
  87. package/dist/components/pages/notifications/Notifications.mjs +13 -10
  88. package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
  89. package/dist/components/ui/buttons/CopyButton.mjs +9 -5
  90. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
  91. package/dist/components/ui/data-display/CardItem.mjs +7 -5
  92. package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
  93. package/dist/components/ui/data-display/PaymentInfoCard.mjs +10 -8
  94. package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
  95. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -1
  96. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +3 -1
  97. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
  98. package/dist/components/ui/form/ComboboxField.mjs +11 -6
  99. package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
  100. package/dist/components/ui/form/DatePicker.mjs +5 -2
  101. package/dist/components/ui/form/DatePicker.mjs.map +1 -1
  102. package/dist/components/ui/form/DateRangePicker.mjs +5 -2
  103. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
  104. package/dist/components/ui/form/PhoneInput.mjs +5 -3
  105. package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
  106. package/dist/components/ui/form/SelectField.mjs +6 -3
  107. package/dist/components/ui/form/SelectField.mjs.map +1 -1
  108. package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +11 -18
  109. package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
  110. package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +6 -15
  111. package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
  112. package/dist/i18n/config.mjs +13 -0
  113. package/dist/i18n/config.mjs.map +1 -0
  114. package/dist/i18n/country-language.mjs +74 -0
  115. package/dist/i18n/country-language.mjs.map +1 -0
  116. package/dist/i18n/messages/en-us.mjs +494 -0
  117. package/dist/i18n/messages/en-us.mjs.map +1 -0
  118. package/dist/i18n/messages/es-es.mjs +494 -0
  119. package/dist/i18n/messages/es-es.mjs.map +1 -0
  120. package/dist/i18n/messages/index.mjs +16 -0
  121. package/dist/i18n/messages/index.mjs.map +1 -0
  122. package/dist/i18n/messages/pt-br.mjs +507 -0
  123. package/dist/i18n/messages/pt-br.mjs.map +1 -0
  124. package/dist/i18n/normalize.mjs +12 -0
  125. package/dist/i18n/normalize.mjs.map +1 -0
  126. package/dist/i18n/resolve-locale.mjs +42 -0
  127. package/dist/i18n/resolve-locale.mjs.map +1 -0
  128. package/dist/i18n.mjs +14 -0
  129. package/dist/i18n.mjs.map +1 -0
  130. package/dist/index.mjs +19 -3
  131. package/dist/index.mjs.map +1 -1
  132. package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs +20 -0
  133. package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs.map +1 -0
  134. package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +2 -1
  135. package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
  136. package/dist/modules/images/utils/validate-image.mjs +8 -8
  137. package/dist/modules/images/utils/validate-image.mjs.map +1 -1
  138. package/dist/modules/plans/hooks/list-plans.hook.mjs +2 -2
  139. package/dist/modules/plans/hooks/list-plans.hook.mjs.map +1 -1
  140. package/dist/modules/plans/types/plan.type.mjs +5 -1
  141. package/dist/modules/plans/types/plan.type.mjs.map +1 -1
  142. package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +61 -35
  143. package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
  144. package/dist/modules/projects/services/projects.service.mjs +9 -0
  145. package/dist/modules/projects/services/projects.service.mjs.map +1 -1
  146. package/dist/modules/subscriptions/utils/periodicity.mjs +20 -14
  147. package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
  148. package/dist/providers/auth.provider.mjs +9 -1
  149. package/dist/providers/auth.provider.mjs.map +1 -1
  150. package/dist/server.mjs +2 -0
  151. package/dist/server.mjs.map +1 -1
  152. package/dist/utils/format/currency.mjs +32 -4
  153. package/dist/utils/format/currency.mjs.map +1 -1
  154. package/dist/utils/intl/cookie-domain.mjs +17 -0
  155. package/dist/utils/intl/cookie-domain.mjs.map +1 -0
  156. package/dist/utils/intl/locale-cookie.mjs +13 -0
  157. package/dist/utils/intl/locale-cookie.mjs.map +1 -0
  158. package/dist/utils/intl/locales.mjs +3 -2
  159. package/dist/utils/intl/locales.mjs.map +1 -1
  160. package/package.json +7 -1
  161. package/src/components/account/ConfigurationsMyAccountModal.tsx +10 -6
  162. package/src/components/account/ConfirmDeleteAccountModal.tsx +22 -13
  163. package/src/components/account/ConfirmGlobalPreferencesModal.tsx +12 -10
  164. package/src/components/account/DeleteAccountModal.tsx +34 -24
  165. package/src/components/account/DisableTwoFactorAuthModal.tsx +11 -6
  166. package/src/components/account/IsntPossibleDeleteAccountModal.tsx +8 -6
  167. package/src/components/account/TwoFactorAuthModal.tsx +33 -29
  168. package/src/components/account/constants.ts +8 -5
  169. package/src/components/account/hooks/useChangeEmailForm.tsx +5 -3
  170. package/src/components/account/hooks/useChangePasswordForm.tsx +20 -6
  171. package/src/components/account/hooks/useChangePhoneForm.tsx +16 -10
  172. package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +20 -6
  173. package/src/components/account/hooks/useOtpVerification.tsx +16 -4
  174. package/src/components/account/hooks/useTwoFactorAuthForm.tsx +21 -7
  175. package/src/components/account/sections/ChangeEmailModal.tsx +35 -21
  176. package/src/components/account/sections/ChangePasswordSection.tsx +10 -6
  177. package/src/components/account/sections/ChangePhoneModal.tsx +50 -22
  178. package/src/components/account/sections/MyProfileSection.tsx +37 -23
  179. package/src/components/account/sections/PreferencesSection.tsx +52 -25
  180. package/src/components/account/sections/SecuritySection.tsx +19 -10
  181. package/src/components/account/sections/TokenSection.tsx +22 -10
  182. package/src/components/layouts/AppMobileNavBar.tsx +1 -154
  183. package/src/components/layouts/NavBar.tsx +5 -3
  184. package/src/components/layouts/NotificationsPopover.tsx +5 -3
  185. package/src/components/layouts/ProfilePopover.tsx +6 -4
  186. package/src/components/layouts/UsersSelectorPopover.tsx +9 -7
  187. package/src/components/modals/BuyCreditsModal.tsx +18 -16
  188. package/src/components/modals/CreditsDisabledModal.tsx +6 -6
  189. package/src/components/modals/PaidPlanRequiredModal.tsx +5 -3
  190. package/src/components/modals/cards/AddCardModal.tsx +89 -62
  191. package/src/components/modals/cards/CannotDeleteCardModal.tsx +9 -8
  192. package/src/components/modals/cards/CardFormFields.tsx +93 -75
  193. package/src/components/modals/cards/DeleteCardModal.tsx +10 -8
  194. package/src/components/navigation/CancelledSubscriptionBanner.tsx +4 -2
  195. package/src/components/navigation/OverdueInvoiceBanner.tsx +4 -2
  196. package/src/components/navigation/PendingCancellationBanner.tsx +4 -2
  197. package/src/components/navigation/ProjectSelectorPopover.tsx +8 -6
  198. package/src/components/navigation/UpcomingInvoiceBanner.tsx +4 -2
  199. package/src/components/navigation/subcomponents/BottomLinks.tsx +5 -3
  200. package/src/components/navigation/subcomponents/CreditsCard.tsx +3 -1
  201. package/src/components/navigation/subcomponents/PlanCard.tsx +3 -1
  202. package/src/components/navigation/subcomponents/ProjectSelector.tsx +5 -3
  203. package/src/components/pages/NotFoundPage.tsx +5 -3
  204. package/src/components/pages/notifications/Notifications.tsx +13 -10
  205. package/src/components/ui/buttons/CopyButton.tsx +10 -5
  206. package/src/components/ui/data-display/CardItem.tsx +7 -5
  207. package/src/components/ui/data-display/PaymentInfoCard.tsx +10 -8
  208. package/src/components/ui/feedback/CircularProgress.tsx +4 -0
  209. package/src/components/ui/feedback/DefaultCircularProgress.tsx +3 -1
  210. package/src/components/ui/form/ComboboxField.tsx +11 -6
  211. package/src/components/ui/form/DatePicker.tsx +5 -2
  212. package/src/components/ui/form/DateRangePicker.tsx +5 -2
  213. package/src/components/ui/form/PhoneInput.tsx +5 -3
  214. package/src/components/ui/form/SelectField.tsx +6 -3
  215. package/src/components/widgets/ImageUpload/ImageCropModal.tsx +19 -11
  216. package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +6 -5
  217. package/src/i18n/config.ts +17 -0
  218. package/src/i18n/country-language.ts +60 -0
  219. package/src/i18n/messages/en-us.ts +514 -0
  220. package/src/i18n/messages/es-es.ts +515 -0
  221. package/src/i18n/messages/index.ts +24 -0
  222. package/src/i18n/messages/pt-br.ts +538 -0
  223. package/src/i18n/normalize.ts +15 -0
  224. package/src/i18n/resolve-locale.ts +77 -0
  225. package/src/i18n.ts +10 -0
  226. package/src/index.ts +13 -2
  227. package/src/modules/accounts/hooks/use-currency-formatter.hook.tsx +32 -0
  228. package/src/modules/cards/hooks/handle-delete-card.hook.ts +8 -3
  229. package/src/modules/images/utils/validate-image.ts +23 -8
  230. package/src/modules/plans/hooks/list-plans.hook.ts +2 -2
  231. package/src/modules/plans/types/plan.type.ts +4 -0
  232. package/src/modules/plans/utils/map-api-plan-to-ui.ts +109 -47
  233. package/src/modules/projects/services/projects.service.ts +12 -0
  234. package/src/modules/subscriptions/utils/periodicity.ts +29 -12
  235. package/src/providers/auth.provider.tsx +13 -1
  236. package/src/server.ts +2 -0
  237. package/src/utils/format/currency.ts +62 -7
  238. package/src/utils/intl/cookie-domain.ts +29 -0
  239. package/src/utils/intl/locale-cookie.ts +18 -0
  240. package/src/utils/intl/locales.ts +3 -2
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { IconKey, IconLock, IconSettings2, IconX } from "@tabler/icons-react";
4
+ import { useTranslations } from "next-intl";
4
5
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
5
6
  import { Tabs, TabsList, TabsTrigger, TabsContent } from "../ui/data-display/Tabs";
6
7
  import { cn } from "../../infra/utils/clsx";
@@ -18,6 +19,7 @@ import { useActiveSubscription } from "../../modules/subscriptions/hooks/find-ac
18
19
  import { hasSubscriptionExpired } from "../../modules/subscriptions/utils/has-subscription-expired";
19
20
  import { useWhitelabel } from "../../providers/whitelabel.provider";
20
21
  function ConfigurationsMyAccountModal() {
22
+ const translate = useTranslations();
21
23
  const {
22
24
  activeModal,
23
25
  openDeleteAccount,
@@ -62,9 +64,9 @@ function ConfigurationsMyAccountModal() {
62
64
  overlayClassName: "bg-black/20 lg:bg-black/50",
63
65
  className: "\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]",
64
66
  children: [
65
- /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Configura\xE7\xF5es" }) }),
67
+ /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: translate("common.account.configurations.title") }) }),
66
68
  /* @__PURE__ */ jsxs("div", { className: "md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200", children: [
67
- /* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: "Configura\xE7\xF5es" }),
69
+ /* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: translate("common.account.configurations.title") }),
68
70
  /* @__PURE__ */ jsx(
69
71
  "button",
70
72
  {
@@ -95,19 +97,19 @@ function ConfigurationsMyAccountModal() {
95
97
  "[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]"
96
98
  ),
97
99
  children: [
98
- /* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: "Configura\xE7\xF5es" }),
100
+ /* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: translate("common.account.configurations.title") }),
99
101
  /* @__PURE__ */ jsxs("div", { className: "lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full", children: [
100
102
  /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.PREFERENCES, className: tabTriggerClasses, children: [
101
103
  /* @__PURE__ */ jsx(IconSettings2, { size: 20, className: "shrink-0" }),
102
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Prefer\xEAncias" })
104
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: translate("common.preferences.title") })
103
105
  ] }),
104
106
  isOwner && whitelabel?.id === 1 && /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.TOKEN, className: tabTriggerClasses, children: [
105
107
  /* @__PURE__ */ jsx(IconKey, { size: 20, className: "shrink-0" }),
106
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Token da conta" })
108
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: translate("common.account.token.title") })
107
109
  ] }),
108
110
  isOwner && /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.SECURITY, className: tabTriggerClasses, children: [
109
111
  /* @__PURE__ */ jsx(IconLock, { size: 20, className: "shrink-0" }),
110
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Seguran\xE7a" })
112
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: translate("common.account.security.title") })
111
113
  ] })
112
114
  ] })
113
115
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconKey, IconLock, IconSettings2, IconX } from '@tabler/icons-react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\nimport { cn } from '../../infra/utils/clsx';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\nimport { TokenSection } from './sections/TokenSection';\nimport { SecuritySection } from './sections/SecuritySection';\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { hasSubscriptionExpired } from '../../modules/subscriptions/utils/has-subscription-expired';\nimport { useWhitelabel } from '../../providers/whitelabel.provider';\n\nexport default function ConfigurationsMyAccountModal() {\n const {\n activeModal,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\n const { whitelabel } = useWhitelabel();\n\n const open = activeModal === 'configurations';\n\n const { data: subscriptionData } = useActiveSubscription();\n const subscription = subscriptionData?.data?.[0] ?? null;\n const isPaidSubscriptionType =\n !!subscription &&\n subscription.type !== 'free' &&\n subscription.type !== 'trial';\n const isBlockingSubscription =\n isPaidSubscriptionType &&\n subscription.active === true &&\n !subscription.date_cancellation &&\n !hasSubscriptionExpired(subscription.date_due);\n\n const { user } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const isMobile = useIsMobile();\n const { activeSection, setActiveSection } = useConfigurationsModal({\n isOpen: open,\n });\n\n const handleDeleteAccount = () => {\n close();\n if (isBlockingSubscription) {\n openIsntPossibleDelete();\n } else {\n openDeleteAccount();\n }\n };\n\n const tabTriggerClasses = cn(\n 'border-0! px-0 py-0',\n\n 'lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full',\n 'lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0',\n 'lg:data-[state=active]:bg-gray-50',\n\n 'flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap',\n 'border-b-2 border-transparent',\n 'data-[state=active]:bg-gray-50 rounded-lg',\n\n 'text-gray-500 data-[state=active]:text-gray-950',\n 'hover:text-gray-900 transition-colors'\n );\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent\n showCloseButton={!isMobile}\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\n className=\"\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Configurações</DialogTitle>\n </DialogHeader>\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\n <span className=\"text-gray-950 paragraph-medium-semibold\">Configurações</span>\n <button\n type=\"button\"\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\n onClick={close}\n >\n <IconX size={18} />\n </button>\n </div>\n <Tabs\n value={activeSection}\n onValueChange={(value) => setActiveSection(value as AccountSectionType)}\n orientation=\"vertical\"\n className=\"flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0\"\n >\n <TabsList\n className={cn(\n 'flex gap-0 bg-transparent border-b-0',\n\n 'lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60',\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',\n\n 'flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0',\n 'px-4 py-3',\n '[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]'\n )}\n >\n <span className=\"hidden lg:block paragraph-medium-semibold text-gray-950 mb-0\">\n Configurações\n </span>\n\n <div className=\"lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full\">\n <TabsTrigger value={AccountSectionType.PREFERENCES} className={tabTriggerClasses}>\n <IconSettings2 size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Preferências</span>\n </TabsTrigger>\n\n {isOwner && whitelabel?.id === 1 && (\n <TabsTrigger value={AccountSectionType.TOKEN} className={tabTriggerClasses}>\n <IconKey size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Token da conta</span>\n </TabsTrigger>\n )}\n\n {isOwner && (\n <TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>\n <IconLock size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Segurança</span>\n </TabsTrigger>\n )}\n </div>\n </TabsList>\n\n <div className=\"w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative flex flex-col\">\n <TabsContent value={AccountSectionType.PREFERENCES} className=\"h-full! relative overflow-hidden\">\n <PreferencesSection onClose={close} />\n </TabsContent>\n\n {isOwner && (\n <TabsContent value={AccountSectionType.TOKEN} className=\"h-full! relative overflow-hidden\">\n <TokenSection />\n </TabsContent>\n )}\n\n {isOwner && (\n <>\n <TabsContent value={AccountSectionType.SECURITY} className=\"h-full! relative overflow-hidden\">\n <SecuritySection\n setActiveSection={setActiveSection}\n onClose={close}\n onDeleteAccount={handleDeleteAccount}\n />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.CHANGE_PASSWORD} className=\"h-full! relative overflow-hidden\">\n <ChangePasswordSection onBack={() => setActiveSection(AccountSectionType.SECURITY)} />\n </TabsContent>\n </>\n )}\n </div>\n </Tabs>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAuFU,SAoEI,UApEJ,KAEF,YAFE;AArFV,SAAS,SAAS,UAAU,eAAe,aAAa;AACxD,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,MAAM,UAAU,aAAa,mBAAmB;AACzD,SAAS,UAAU;AACn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AA,cAEA,qBAAC,SAAI,WAAU,8FACb;AAAA,oCAAC,eAAY,OAAO,mBAAmB,aAAa,WAAU,oCAC5D,8BAAC,sBAAmB,SAAS,OAAO,GACtC;AAAA,gBAEC,WACC,oBAAC,eAAY,OAAO,mBAAmB,OAAO,WAAU,oCACtD,8BAAC,gBAAa,GAChB;AAAA,gBAGD,WACC,iCACE;AAAA,sCAAC,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,oBAAC;AAAA;AAAA,sBACC;AAAA,sBACA,SAAS;AAAA,sBACT,iBAAiB;AAAA;AAAA,kBACnB,GACF;AAAA,kBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,mBACF;AAAA,iBAEJ;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconKey, IconLock, IconSettings2, IconX } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\nimport { cn } from '../../infra/utils/clsx';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\nimport { TokenSection } from './sections/TokenSection';\nimport { SecuritySection } from './sections/SecuritySection';\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { hasSubscriptionExpired } from '../../modules/subscriptions/utils/has-subscription-expired';\nimport { useWhitelabel } from '../../providers/whitelabel.provider';\n\nexport default function ConfigurationsMyAccountModal() {\n const translate = useTranslations();\n const {\n activeModal,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\n const { whitelabel } = useWhitelabel();\n\n const open = activeModal === 'configurations';\n\n const { data: subscriptionData } = useActiveSubscription();\n const subscription = subscriptionData?.data?.[0] ?? null;\n const isPaidSubscriptionType =\n !!subscription &&\n subscription.type !== 'free' &&\n subscription.type !== 'trial';\n const isBlockingSubscription =\n isPaidSubscriptionType &&\n subscription.active === true &&\n !subscription.date_cancellation &&\n !hasSubscriptionExpired(subscription.date_due);\n\n const { user } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const isMobile = useIsMobile();\n const { activeSection, setActiveSection } = useConfigurationsModal({\n isOpen: open,\n });\n\n const handleDeleteAccount = () => {\n close();\n if (isBlockingSubscription) {\n openIsntPossibleDelete();\n } else {\n openDeleteAccount();\n }\n };\n\n const tabTriggerClasses = cn(\n 'border-0! px-0 py-0',\n\n 'lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full',\n 'lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0',\n 'lg:data-[state=active]:bg-gray-50',\n\n 'flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap',\n 'border-b-2 border-transparent',\n 'data-[state=active]:bg-gray-50 rounded-lg',\n\n 'text-gray-500 data-[state=active]:text-gray-950',\n 'hover:text-gray-900 transition-colors'\n );\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent\n showCloseButton={!isMobile}\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\n className=\"\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{translate('common.account.configurations.title')}</DialogTitle>\n </DialogHeader>\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\n <span className=\"text-gray-950 paragraph-medium-semibold\">\n {translate('common.account.configurations.title')}\n </span>\n <button\n type=\"button\"\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\n onClick={close}\n >\n <IconX size={18} />\n </button>\n </div>\n <Tabs\n value={activeSection}\n onValueChange={(value) => setActiveSection(value as AccountSectionType)}\n orientation=\"vertical\"\n className=\"flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0\"\n >\n <TabsList\n className={cn(\n 'flex gap-0 bg-transparent border-b-0',\n\n 'lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60',\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',\n\n 'flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0',\n 'px-4 py-3',\n '[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]'\n )}\n >\n <span className=\"hidden lg:block paragraph-medium-semibold text-gray-950 mb-0\">\n {translate('common.account.configurations.title')}\n </span>\n\n <div className=\"lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full\">\n <TabsTrigger value={AccountSectionType.PREFERENCES} className={tabTriggerClasses}>\n <IconSettings2 size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">{translate('common.preferences.title')}</span>\n </TabsTrigger>\n\n {isOwner && whitelabel?.id === 1 && (\n <TabsTrigger value={AccountSectionType.TOKEN} className={tabTriggerClasses}>\n <IconKey size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">{translate('common.account.token.title')}</span>\n </TabsTrigger>\n )}\n\n {isOwner && (\n <TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>\n <IconLock size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">{translate('common.account.security.title')}</span>\n </TabsTrigger>\n )}\n </div>\n </TabsList>\n\n <div className=\"w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative flex flex-col\">\n <TabsContent value={AccountSectionType.PREFERENCES} className=\"h-full! relative overflow-hidden\">\n <PreferencesSection onClose={close} />\n </TabsContent>\n\n {isOwner && (\n <TabsContent value={AccountSectionType.TOKEN} className=\"h-full! relative overflow-hidden\">\n <TokenSection />\n </TabsContent>\n )}\n\n {isOwner && (\n <>\n <TabsContent value={AccountSectionType.SECURITY} className=\"h-full! relative overflow-hidden\">\n <SecuritySection\n setActiveSection={setActiveSection}\n onClose={close}\n onDeleteAccount={handleDeleteAccount}\n />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.CHANGE_PASSWORD} className=\"h-full! relative overflow-hidden\">\n <ChangePasswordSection onBack={() => setActiveSection(AccountSectionType.SECURITY)} />\n </TabsContent>\n </>\n )}\n </div>\n </Tabs>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAyFU,SAsEI,UAtEJ,KAEF,YAFE;AAvFV,SAAS,SAAS,UAAU,eAAe,aAAa;AACxD,SAAS,uBAAuB;AAChC,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,MAAM,UAAU,aAAa,mBAAmB;AACzD,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,OAAO,4BAA4B;AACnC,OAAO,iBAAiB;AACxB,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B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,GACtC;AAAA,gBAEC,WACC,oBAAC,eAAY,OAAO,mBAAmB,OAAO,WAAU,oCACtD,8BAAC,gBAAa,GAChB;AAAA,gBAGD,WACC,iCACE;AAAA,sCAAC,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,oBAAC;AAAA;AAAA,sBACC;AAAA,sBACA,SAAS;AAAA,sBACT,iBAAiB;AAAA;AAAA,kBACnB,GACF;AAAA,kBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,mBACF;AAAA,iBAEJ;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useTranslations } from "next-intl";
3
4
  import { IconAlertTriangle } from "@tabler/icons-react";
4
5
  import { toast } from "sonner";
5
6
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
@@ -14,6 +15,7 @@ import {
14
15
  import { useAuth } from "../../providers/auth.provider";
15
16
  import { UserProfile } from "../../modules/users/schema";
16
17
  function ConfirmDeleteAccountModal() {
18
+ const translate = useTranslations();
17
19
  const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();
18
20
  const open = activeModal === "confirmDelete";
19
21
  const { data: pagesCount = 0 } = useCountPages();
@@ -26,7 +28,7 @@ function ConfirmDeleteAccountModal() {
26
28
  try {
27
29
  if (isOwner) {
28
30
  if (!deleteAccountPayload) {
29
- openDeleteAccount("Sess\xE3o expirada. Preencha os campos novamente.");
31
+ openDeleteAccount(translate("common.account.confirmDelete.sessionExpired"));
30
32
  return;
31
33
  }
32
34
  await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });
@@ -34,39 +36,38 @@ function ConfirmDeleteAccountModal() {
34
36
  await deleteAccountUser.mutateAsync(user.id);
35
37
  }
36
38
  close();
37
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Conta exclu\xEDda com sucesso", toastId: t }));
39
+ toast.custom((toastId) => /* @__PURE__ */ jsx(
40
+ Toast,
41
+ {
42
+ variant: "success",
43
+ message: translate("common.account.confirmDelete.success"),
44
+ toastId
45
+ }
46
+ ));
38
47
  await logout();
39
48
  } catch (error) {
40
- const message = error instanceof Error ? error.message : "Erro ao excluir. Tente novamente.";
49
+ const message = error instanceof Error ? error.message : translate("common.account.confirmDelete.error");
41
50
  if (isOwner) {
42
51
  openDeleteAccount(message);
43
52
  return;
44
53
  }
45
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId: t }));
54
+ toast.custom((toastId) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId }));
46
55
  }
47
56
  };
48
57
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: isDeleting ? void 0 : close, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 max-w-[calc(100%-2rem)]! w-full rounded-lg border sm:max-w-[400px]! lg:max-w-[470px]! lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!", children: [
49
58
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 p-4 lg:p-5", children: [
50
- /* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "Uma pena te ver ir!" }) }),
59
+ /* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: translate("common.account.confirmDelete.title") }) }),
51
60
  /* @__PURE__ */ jsxs("div", { className: "bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4", children: [
52
61
  /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-500 shrink-0", strokeWidth: 2 }),
53
- /* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-600", children: [
54
- "Todas suas",
55
- " ",
56
- /* @__PURE__ */ jsxs("span", { className: "font-semibold text-gray-950", children: [
57
- pagesCount,
58
- " p\xE1ginas"
59
- ] }),
60
- " ",
61
- "ser\xE3o deletadas permanentemente. Essa a\xE7\xE3o \xE9",
62
- " ",
63
- /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: "irrevers\xEDvel!" })
64
- ] })
62
+ /* @__PURE__ */ jsx("p", { className: "paragraph-small-regular text-gray-600", children: translate.rich("common.account.confirmDelete.warning", {
63
+ count: String(pagesCount),
64
+ b: (chunks) => /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: chunks })
65
+ }) })
65
66
  ] })
66
67
  ] }),
67
68
  /* @__PURE__ */ jsx("div", { className: "h-px bg-gray-200" }),
68
69
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-4 lg:p-5", children: [
69
- /* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children: "Manter minha conta" }),
70
+ /* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children: translate("common.account.confirmDelete.keepAccount") }),
70
71
  /* @__PURE__ */ jsx(
71
72
  Button,
72
73
  {
@@ -74,7 +75,7 @@ function ConfirmDeleteAccountModal() {
74
75
  className: "h-10! flex-1",
75
76
  onClick: handleConfirm,
76
77
  disabled: isDeleting,
77
- children: isDeleting ? "Excluindo..." : "Excluir mesmo assim"
78
+ children: isDeleting ? translate("common.account.confirmDelete.deleting") : translate("common.account.confirmDelete.deleteAnyway")
78
79
  }
79
80
  )
80
81
  ] })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/ConfirmDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { Toast } from '../ui/feedback/Toast';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useCountPages } from '../../modules/pages/hooks/count-pages.hook';\nimport {\n useDeleteAccount,\n useDeleteAccountUser,\n} from '../../modules/accounts/hooks/useAccountManagement';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\n\nexport default function ConfirmDeleteAccountModal() {\n const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();\n const open = activeModal === 'confirmDelete';\n\n const { data: pagesCount = 0 } = useCountPages();\n\n const { user, logout } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const deleteAccount = useDeleteAccount();\n const deleteAccountUser = useDeleteAccountUser();\n const isDeleting = deleteAccount.isPending || deleteAccountUser.isPending;\n\n const handleConfirm = async () => {\n try {\n if (isOwner) {\n if (!deleteAccountPayload) {\n // Fluxo quebrado (usuário pulou o primeiro modal ou refresh) — manda\n // de volta pro modal inicial pra re-coletar a senha.\n openDeleteAccount('Sessão expirada. Preencha os campos novamente.');\n return;\n }\n await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });\n } else {\n await deleteAccountUser.mutateAsync(user!.id);\n }\n close();\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Conta excluída com sucesso\" toastId={t} />\n ));\n await logout();\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Erro ao excluir. Tente novamente.';\n if (isOwner) {\n // Falha no delete do owner (ex.: senha inválida) — volta pro primeiro\n // modal com a mensagem do backend pra o usuário corrigir e tentar de novo.\n openDeleteAccount(message);\n return;\n }\n toast.custom((t) => (\n <Toast variant=\"error\" message={message} toastId={t} />\n ));\n }\n };\n\n return (\n <Dialog open={open} onOpenChange={isDeleting ? undefined : close}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-[calc(100%-2rem)]! w-full rounded-lg border sm:max-w-[400px]! lg:max-w-[470px]! lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\">\n <div className=\"flex flex-col gap-5 p-4 lg:p-5\">\n <DialogHeader className=\"p-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Uma pena te ver ir!\n </DialogTitle>\n </DialogHeader>\n\n <div className=\"bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4\">\n <IconAlertTriangle size={20} className=\"text-red-500 shrink-0\" strokeWidth={2} />\n <p className=\"paragraph-small-regular text-gray-600\">\n Todas suas{' '}\n <span className=\"font-semibold text-gray-950\">{pagesCount} páginas</span>{' '}\n serão deletadas permanentemente. Essa ação é{' '}\n <span className=\"font-semibold text-gray-950\">irreversível!</span>\n </p>\n </div>\n </div>\n\n <div className=\"h-px bg-gray-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 flex-1\" onClick={close} disabled={isDeleting}>\n Manter minha conta\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n onClick={handleConfirm}\n disabled={isDeleting}\n >\n {isDeleting ? 'Excluindo...' : 'Excluir mesmo assim'}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA4CQ,cA+BM,YA/BN;AA1CR,SAAS,yBAAyB;AAClC,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAEb,SAAR,4BAA6C;AAClD,QAAM,EAAE,aAAa,sBAAsB,mBAAmB,MAAM,IAAI,iBAAiB;AACzF,QAAM,OAAO,gBAAgB;AAE7B,QAAM,EAAE,MAAM,aAAa,EAAE,IAAI,cAAc;AAE/C,QAAM,EAAE,M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,+BAA8B,8BAAa;AAAA,WAC7D;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,oBAAmB;AAAA,IAElC,qBAAC,SAAI,WAAU,sCACb;AAAA,0BAAC,UAAO,WAAU,eAAc,SAAS,OAAO,UAAU,YAAY,gCAEtE;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS;AAAA,UACT,UAAU;AAAA,UAET,uBAAa,iBAAiB;AAAA;AAAA,MACjC;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/ConfirmDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { Toast } from '../ui/feedback/Toast';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useCountPages } from '../../modules/pages/hooks/count-pages.hook';\nimport {\n useDeleteAccount,\n useDeleteAccountUser,\n} from '../../modules/accounts/hooks/useAccountManagement';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\n\nexport default function ConfirmDeleteAccountModal() {\n const translate = useTranslations();\n const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();\n const open = activeModal === 'confirmDelete';\n\n const { data: pagesCount = 0 } = useCountPages();\n\n const { user, logout } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const deleteAccount = useDeleteAccount();\n const deleteAccountUser = useDeleteAccountUser();\n const isDeleting = deleteAccount.isPending || deleteAccountUser.isPending;\n\n const handleConfirm = async () => {\n try {\n if (isOwner) {\n if (!deleteAccountPayload) {\n // Fluxo quebrado (usuário pulou o primeiro modal ou refresh) — manda\n // de volta pro modal inicial pra re-coletar a senha.\n openDeleteAccount(translate('common.account.confirmDelete.sessionExpired'));\n return;\n }\n await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });\n } else {\n await deleteAccountUser.mutateAsync(user!.id);\n }\n close();\n toast.custom((toastId) => (\n <Toast\n variant=\"success\"\n message={translate('common.account.confirmDelete.success')}\n toastId={toastId}\n />\n ));\n await logout();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : translate('common.account.confirmDelete.error');\n if (isOwner) {\n // Falha no delete do owner (ex.: senha inválida) — volta pro primeiro\n // modal com a mensagem do backend pra o usuário corrigir e tentar de novo.\n openDeleteAccount(message);\n return;\n }\n toast.custom((toastId) => (\n <Toast variant=\"error\" message={message} toastId={toastId} />\n ));\n }\n };\n\n return (\n <Dialog open={open} onOpenChange={isDeleting ? undefined : close}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-[calc(100%-2rem)]! w-full rounded-lg border sm:max-w-[400px]! lg:max-w-[470px]! lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\">\n <div className=\"flex flex-col gap-5 p-4 lg:p-5\">\n <DialogHeader className=\"p-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n {translate('common.account.confirmDelete.title')}\n </DialogTitle>\n </DialogHeader>\n\n <div className=\"bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4\">\n <IconAlertTriangle size={20} className=\"text-red-500 shrink-0\" strokeWidth={2} />\n <p className=\"paragraph-small-regular text-gray-600\">\n {translate.rich('common.account.confirmDelete.warning', {\n count: String(pagesCount),\n b: (chunks) => <span className=\"font-semibold text-gray-950\">{chunks}</span>,\n })}\n </p>\n </div>\n </div>\n\n <div className=\"h-px bg-gray-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 flex-1\" onClick={close} disabled={isDeleting}>\n {translate('common.account.confirmDelete.keepAccount')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n onClick={handleConfirm}\n disabled={isDeleting}\n >\n {isDeleting\n ? translate('common.account.confirmDelete.deleting')\n : translate('common.account.confirmDelete.deleteAnyway')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA8CQ,cAgCE,YAhCF;AA5CR,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAEb,SAAR,4BAA6C;AAClD,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAAE,aAAa,sBAAsB,mBAAmB,MAAM,IAAI,iBAAiB;AACzF,QAAM,OAAO,gBAAgB;AAE7B,QAAM,EAAE,MAAM,aAAa,EAAE,IAAI,cAAc;AAE/C,QAAM,EAAE,MAAM,OAAO,IAAI,QAAQ;AACjC,QAAM,UAAU,MAAM,YAAY,YAAY;AAE9C,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,oBAAoB,qBAAqB;AAC/C,QAAM,aAAa,cAAc,aAAa,kBAAkB;AAEhE,QAAM,gBAAgB,YAAY;AAChC,QAAI;AACF,UAAI,SAAS;AACX,YAAI,CAAC,sBAAsB;AAGzB,4BAAkB,UAAU,6CAA6C,CAAC;AAC1E;AAAA,QACF;AACA,cAAM,cAAc,YAAY,EAAE,UAAU,qBAAqB,SAAS,CAAC;AAAA,MAC7E,OAAO;AACL,cAAM,kBAAkB,YAAY,KAAM,EAAE;AAAA,MAC9C;AACA,YAAM;AACN,YAAM,OAAO,CAAC,YACZ;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,UAAU,sCAAsC;AAAA,UACzD;AAAA;AAAA,MACF,CACD;AACD,YAAM,OAAO;AAAA,IACf,SAAS,OAAO;AACd,YAAM,UACJ,iBAAiB,QAAQ,MAAM,UAAU,UAAU,oCAAoC;AACzF,UAAI,SAAS;AAGX,0BAAkB,OAAO;AACzB;AAAA,MACF;AACA,YAAM,OAAO,CAAC,YACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAkB,SAAkB,CAC5D;AAAA,IACH;AAAA,EACF;AAEA,SACE,oBAAC,UAAO,MAAY,cAAc,aAAa,SAAY,OACzD,+BAAC,iBAAc,WAAU,2NACvB;AAAA,yBAAC,SAAI,WAAU,kCACb;AAAA,0BAAC,gBAAa,WAAU,OACtB,8BAAC,eAAY,WAAU,2CACpB,oBAAU,oCAAoC,GACjD,GACF;AAAA,MAEA,qBAAC,SAAI,WAAU,2DACb;AAAA,4BAAC,qBAAkB,MAAM,IAAI,WAAU,yBAAwB,aAAa,GAAG;AAAA,QAC/E,oBAAC,OAAE,WAAU,yCACV,oBAAU,KAAK,wCAAwC;AAAA,UACtD,OAAO,OAAO,UAAU;AAAA,UACxB,GAAG,CAAC,WAAW,oBAAC,UAAK,WAAU,+BAA+B,kBAAO;AAAA,QACvE,CAAC,GACH;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,oBAAmB;AAAA,IAElC,qBAAC,SAAI,WAAU,sCACb;AAAA,0BAAC,UAAO,WAAU,eAAc,SAAS,OAAO,UAAU,YACvD,oBAAU,0CAA0C,GACvD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS;AAAA,UACT,UAAU;AAAA,UAET,uBACG,UAAU,uCAAuC,IACjD,UAAU,2CAA2C;AAAA;AAAA,MAC3D;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useTranslations } from "next-intl";
3
4
  import { IconAlertTriangle } from "@tabler/icons-react";
4
5
  import { Button } from "../ui/buttons/Button";
5
6
  import {
@@ -15,27 +16,25 @@ function ConfirmGlobalPreferencesModal({
15
16
  onConfirm,
16
17
  onCancel
17
18
  }) {
19
+ const translate = useTranslations();
18
20
  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
21
  /* @__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
+ /* @__PURE__ */ jsx(DialogTitle, { children: translate("common.account.globalPreferences.title") }),
23
+ /* @__PURE__ */ jsx(DialogDescription, { children: translate("common.account.globalPreferences.srDescription") })
22
24
  ] }),
23
25
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-5", children: [
24
26
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-gray-50 rounded-lg size-10", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 24, className: "text-gray-950" }) }),
25
27
  /* @__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
- ] })
28
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: translate("common.account.globalPreferences.title") }),
29
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-gray-600", children: translate.rich("common.account.globalPreferences.warning", {
30
+ b: (chunks) => /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: chunks })
31
+ }) })
33
32
  ] })
34
33
  ] }),
35
34
  /* @__PURE__ */ jsx(Separator, { className: "w-full" }),
36
35
  /* @__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" })
36
+ /* @__PURE__ */ jsx(Button, { onClick: onConfirm, className: "h-10!", children: translate("common.actions.confirm") }),
37
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onCancel, className: "h-10!", children: translate("common.actions.cancel") })
39
38
  ] })
40
39
  ] }) });
41
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/ConfirmGlobalPreferencesModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n} from '../ui/overlay/Dialog';\nimport { Separator } from '../ui/data-display/Separator';\n\ninterface ConfirmGlobalPreferencesModalProps {\n open: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport default function ConfirmGlobalPreferencesModal({\n open,\n onConfirm,\n onCancel,\n}: ConfirmGlobalPreferencesModalProps) {\n return (\n <Dialog open={open} onOpenChange={onCancel}>\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)]\">\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Alterar preferências globais</DialogTitle>\n <DialogDescription>\n Confirmação de alteração de preferências globais da conta\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-3 p-5\">\n <div className=\"flex items-center justify-center bg-gray-50 rounded-lg size-10\">\n <IconAlertTriangle size={24} className=\"text-gray-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-medium-semibold text-gray-950\">\n Alterar preferências globais\n </span>\n <span className=\"paragraph-small-regular text-gray-600\">\n Você está alterando configurações que impactam{' '}\n <span className=\"paragraph-small-semibold text-gray-950\">\n todos os usuários da conta\n </span>\n . Deseja confirmar?\n </span>\n </div>\n </div>\n\n <Separator className=\"w-full\" />\n\n <div className=\"flex items-center gap-2 p-5\">\n <Button onClick={onConfirm} className=\"h-10!\">\n Confirmar\n </Button>\n <Button variant=\"secondary\" onClick={onCancel} className=\"h-10!\">\n Cancelar\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2BQ,SACE,KADF;AAzBR,SAAS,yBAAyB;AAClC,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,qBAAkB,MAAM,IAAI,WAAU,iBAAgB,GACzD;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":[]}
1
+ {"version":3,"sources":["../../../src/components/account/ConfirmGlobalPreferencesModal.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n} from '../ui/overlay/Dialog';\nimport { Separator } from '../ui/data-display/Separator';\n\ninterface ConfirmGlobalPreferencesModalProps {\n open: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport default function ConfirmGlobalPreferencesModal({\n open,\n onConfirm,\n onCancel,\n}: ConfirmGlobalPreferencesModalProps) {\n const translate = useTranslations();\n return (\n <Dialog open={open} onOpenChange={onCancel}>\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)]\">\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{translate('common.account.globalPreferences.title')}</DialogTitle>\n <DialogDescription>\n {translate('common.account.globalPreferences.srDescription')}\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-3 p-5\">\n <div className=\"flex items-center justify-center bg-gray-50 rounded-lg size-10\">\n <IconAlertTriangle size={24} className=\"text-gray-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-medium-semibold text-gray-950\">\n {translate('common.account.globalPreferences.title')}\n </span>\n <span className=\"paragraph-small-regular text-gray-600\">\n {translate.rich('common.account.globalPreferences.warning', {\n b: (chunks) => (\n <span className=\"paragraph-small-semibold text-gray-950\">{chunks}</span>\n ),\n })}\n </span>\n </div>\n </div>\n\n <Separator className=\"w-full\" />\n\n <div className=\"flex items-center gap-2 p-5\">\n <Button onClick={onConfirm} className=\"h-10!\">\n {translate('common.actions.confirm')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel} className=\"h-10!\">\n {translate('common.actions.cancel')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA6BQ,SACE,KADF;AA3BR,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,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,QAAM,YAAY,gBAAgB;AAClC,SACE,oBAAC,UAAO,MAAY,cAAc,UAChC,+BAAC,iBAAc,WAAU,sGACvB;AAAA,yBAAC,gBAAa,WAAU,WACtB;AAAA,0BAAC,eAAa,oBAAU,wCAAwC,GAAE;AAAA,MAClE,oBAAC,qBACE,oBAAU,gDAAgD,GAC7D;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,SAAI,WAAU,kEACb,8BAAC,qBAAkB,MAAM,IAAI,WAAU,iBAAgB,GACzD;AAAA,MACA,qBAAC,SAAI,WAAU,uBACb;AAAA,4BAAC,UAAK,WAAU,2CACb,oBAAU,wCAAwC,GACrD;AAAA,QACA,oBAAC,UAAK,WAAU,yCACb,oBAAU,KAAK,4CAA4C;AAAA,UAC1D,GAAG,CAAC,WACF,oBAAC,UAAK,WAAU,0CAA0C,kBAAO;AAAA,QAErE,CAAC,GACH;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,aAAU,WAAU,UAAS;AAAA,IAE9B,qBAAC,SAAI,WAAU,+BACb;AAAA,0BAAC,UAAO,SAAS,WAAW,WAAU,SACnC,oBAAU,wBAAwB,GACrC;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,UAAU,WAAU,SACtD,oBAAU,uBAAuB,GACpC;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState, useCallback, useEffect } from "react";
4
+ import { useTranslations } from "next-intl";
4
5
  import { IconLock, IconAlertTriangle } from "@tabler/icons-react";
5
6
  import { toast } from "sonner";
6
7
  import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
@@ -12,15 +13,16 @@ import { Toast } from "../ui/feedback/Toast";
12
13
  import usePasswordVisibility from "../../hooks/usePasswordVisibility";
13
14
  import { useAccountModals } from "../../store/useAccountModals";
14
15
  import { AccountSectionType } from "../../enums/AccountSectionType";
15
- const REASON_OPTIONS = [
16
- { value: "sem-funcao", label: "A ferramenta n\xE3o possui uma fun\xE7\xE3o que eu preciso" },
17
- { value: "problemas", label: "Encontrei problemas t\xE9cnicos ou erros no sistema" },
18
- { value: "suporte", label: "Tive problemas com o suporte ou atendimento" },
19
- { value: "demora", label: "As atualiza\xE7\xF5es demoram mais do que o esperado" },
20
- { value: "temporario", label: "O cancelamento \xE9 tempor\xE1rio" },
21
- { value: "outro", label: "Outro motivo" }
22
- ];
23
16
  function DeleteAccountModal() {
17
+ const translate = useTranslations();
18
+ const reasonOptions = [
19
+ { value: "sem-funcao", label: translate("common.account.deleteAccount.reasons.noFeature") },
20
+ { value: "problemas", label: translate("common.account.deleteAccount.reasons.technical") },
21
+ { value: "suporte", label: translate("common.account.deleteAccount.reasons.support") },
22
+ { value: "demora", label: translate("common.account.deleteAccount.reasons.updates") },
23
+ { value: "temporario", label: translate("common.account.deleteAccount.reasons.temporary") },
24
+ { value: "outro", label: translate("common.account.deleteAccount.reasons.other") }
25
+ ];
24
26
  const {
25
27
  activeModal,
26
28
  deleteAccountError,
@@ -51,7 +53,14 @@ function DeleteAccountModal() {
51
53
  const handleDelete = (e) => {
52
54
  e.preventDefault();
53
55
  if (!isFormValid) {
54
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Preencha todos os campos obrigat\xF3rios", toastId: t }));
56
+ toast.custom((toastId) => /* @__PURE__ */ jsx(
57
+ Toast,
58
+ {
59
+ variant: "error",
60
+ message: translate("common.account.deleteAccount.requiredFields"),
61
+ toastId
62
+ }
63
+ ));
55
64
  return;
56
65
  }
57
66
  openConfirmDelete({ password });
@@ -61,20 +70,18 @@ function DeleteAccountModal() {
61
70
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none", children: [
62
71
  /* @__PURE__ */ jsxs(DialogHeader, { className: "p-0", children: [
63
72
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-500" }) }),
64
- /* @__PURE__ */ jsx(DialogTitle, { children: "Excluir conta" }),
65
- /* @__PURE__ */ jsxs(DialogDescription, { className: "paragraph-small-regular", children: [
66
- "Esta a\xE7\xE3o \xE9 ",
67
- /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: "irrevers\xEDvel" }),
68
- ". Ao confirmar, sua conta e todos os seus dados ser\xE3o exclu\xEDdos."
69
- ] })
73
+ /* @__PURE__ */ jsx(DialogTitle, { children: translate("common.account.deleteAccount.title") }),
74
+ /* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular", children: translate.rich("common.account.deleteAccount.description", {
75
+ b: (chunks) => /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: chunks })
76
+ }) })
70
77
  ] }),
71
78
  /* @__PURE__ */ jsx(
72
79
  SelectField,
73
80
  {
74
- label: "Motivo do cancelamento",
81
+ label: translate("common.account.deleteAccount.reasonLabel"),
75
82
  required: true,
76
- placeholder: "Selecione",
77
- options: REASON_OPTIONS,
83
+ placeholder: translate("common.account.deleteAccount.reasonPlaceholder"),
84
+ options: reasonOptions,
78
85
  value: reason,
79
86
  onChange: (value) => setReason(value),
80
87
  className: "h-10!"
@@ -84,27 +91,26 @@ function DeleteAccountModal() {
84
91
  /* @__PURE__ */ jsx(
85
92
  TextAreaField,
86
93
  {
87
- label: "Descreva o que levou a tomar essa decis\xE3o",
94
+ label: translate("common.account.deleteAccount.descriptionLabel"),
88
95
  required: true,
89
- placeholder: "Explique sua decis\xE3o...",
96
+ placeholder: translate("common.account.deleteAccount.descriptionPlaceholder"),
90
97
  value: description,
91
98
  onChange: (e) => setDescription(e.target.value),
92
99
  rows: 4,
93
100
  maxLength: 400
94
101
  }
95
102
  ),
96
- /* @__PURE__ */ jsxs("span", { className: "paragraph-xsmall-medium text-gray-600 text-left mt-1 block", children: [
97
- description.length,
98
- "/400 caracteres"
99
- ] })
103
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-600 text-left mt-1 block", children: translate("common.account.deleteAccount.charactersCount", {
104
+ count: String(description.length)
105
+ }) })
100
106
  ] }),
101
107
  /* @__PURE__ */ jsx(
102
108
  FormField,
103
109
  {
104
110
  className: "text-gray-600",
105
- label: "Senha",
111
+ label: translate("common.account.deleteAccount.passwordLabel"),
106
112
  type: "password",
107
- placeholder: "Informe sua senha",
113
+ placeholder: translate("common.account.deleteAccount.passwordPlaceholder"),
108
114
  leftIcon: IconLock,
109
115
  value: password,
110
116
  onChange: (e) => {
@@ -126,10 +132,10 @@ function DeleteAccountModal() {
126
132
  variant: "default",
127
133
  className: "h-10",
128
134
  type: "submit",
129
- children: "Excluir conta"
135
+ children: translate("common.account.deleteAccount.submit")
130
136
  }
131
137
  ),
132
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10", type: "button", onClick: handleClose, children: "Fechar" })
138
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10", type: "button", onClick: handleClose, children: translate("common.actions.close") })
133
139
  ] })
134
140
  ] }) }) });
135
141
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { IconLock, IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { FormField } from '../ui/form/FormField';\nimport { SelectField } from '../ui/form/SelectField';\nimport { TextAreaField } from '../ui/form/TextAreaField';\nimport { Toast } from '../ui/feedback/Toast';\nimport usePasswordVisibility from '../../hooks/usePasswordVisibility';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\n\nconst REASON_OPTIONS = [\n { value: 'sem-funcao', label: 'A ferramenta não possui uma função que eu preciso' },\n { value: 'problemas', label: 'Encontrei problemas técnicos ou erros no sistema' },\n { value: 'suporte', label: 'Tive problemas com o suporte ou atendimento' },\n { value: 'demora', label: 'As atualizações demoram mais do que o esperado' },\n { value: 'temporario', label: 'O cancelamento é temporário' },\n { value: 'outro', label: 'Outro motivo' },\n];\n\nexport default function DeleteAccountModal() {\n const {\n activeModal,\n deleteAccountError,\n openConfigurations,\n openConfirmDelete,\n clearDeleteAccountError,\n } = useAccountModals();\n const open = activeModal === 'deleteAccount';\n\n const [reason, setReason] = useState('');\n const [description, setDescription] = useState('');\n const [password, setPassword] = useState('');\n const { showPassword, togglePassword } = usePasswordVisibility();\n\n const isFormValid = Boolean(reason && description && password);\n\n const resetForm = useCallback(() => {\n setReason('');\n setDescription('');\n setPassword('');\n }, []);\n\n // Quando o modal deixa de estar aberto, limpa o erro residual do store\n // pra não aparecer numa próxima abertura vinda de fluxo limpo.\n useEffect(() => {\n if (!open) {\n clearDeleteAccountError();\n }\n }, [open, clearDeleteAccountError]);\n\n const handleClose = () => {\n resetForm();\n openConfigurations(AccountSectionType.SECURITY);\n };\n\n const handleDelete = (e: React.FormEvent) => {\n e.preventDefault();\n if (!isFormValid) {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Preencha todos os campos obrigatórios\" toastId={t} />\n ));\n return;\n }\n openConfirmDelete({ password });\n // Campos locais podem ser limpos — o payload já está no store.\n resetForm();\n };\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-full sm: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-lg 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%] overflow-y-auto\">\n <form onSubmit={handleDelete} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none\">\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <DialogTitle>Excluir conta</DialogTitle>\n <DialogDescription className=\"paragraph-small-regular\">\n Esta ação é <span className=\"font-semibold text-gray-950\">irreversível</span>. Ao\n confirmar, sua conta e todos os seus dados serão excluídos.\n </DialogDescription>\n </DialogHeader>\n\n <SelectField\n label=\"Motivo do cancelamento\"\n required\n placeholder=\"Selecione\"\n options={REASON_OPTIONS}\n value={reason}\n onChange={(value) => setReason(value as string)}\n className=\"h-10!\"\n />\n\n <div>\n <TextAreaField\n label=\"Descreva o que levou a tomar essa decisão\"\n required\n placeholder=\"Explique sua decisão...\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={4}\n maxLength={400}\n />\n <span className=\"paragraph-xsmall-medium text-gray-600 text-left mt-1 block\">\n {description.length}/400 caracteres\n </span>\n </div>\n\n <FormField\n className=\"text-gray-600\"\n label=\"Senha\"\n type=\"password\"\n placeholder=\"Informe sua senha\"\n leftIcon={IconLock}\n value={password}\n onChange={(e) => {\n setPassword(e.target.value);\n if (deleteAccountError) clearDeleteAccountError();\n }}\n classnameContainer=\"h-10!\"\n showPassword={showPassword}\n onTogglePassword={togglePassword}\n error={!!deleteAccountError}\n errorMessage={deleteAccountError ?? undefined}\n />\n </div>\n\n <div className=\"flex flex-row items-center justify-start gap-2 p-4 lg:p-6 border-t border-gray-200 bg-white mt-auto lg:mt-0\">\n <Button\n variant=\"default\"\n className=\"h-10\"\n type=\"submit\"\n >\n Excluir conta\n </Button>\n <Button variant=\"secondary\" className=\"h-10\" type=\"button\" onClick={handleClose}>\n Fechar\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAgEQ,cAmBM,YAnBN;AA9DR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,UAAU,yBAAyB;AAC5C,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,mBAAmB,cAAc,mBAAmB;AACpF,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,OAAO,2BAA2B;AAClC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,MAAM,iBAAiB;AAAA,EACrB,EAAE,OAAO,cAAc,OAAO,6DAAoD;AAAA,EAClF,EAAE,OAAO,aAAa,OAAO,sDAAmD;AAAA,EAChF,EAAE,OAAO,WAAW,OAAO,8CAA8C;AAAA,EACzE,EAAE,OAAO,UAAU,OAAO,uDAAiD;AAAA,EAC3E,EAAE,OAAO,cAAc,OAAO,oCAA8B;AAAA,EAC5D,EAAE,OAAO,SAAS,OAAO,eAAe;AAC1C;AAEe,SAAR,qBAAsC;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AACrB,QAAM,OAAO,gBAAgB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,UACC,OAAM;AAAA,UACN,UAAQ;AAAA,UACR,aAAY;AAAA,UACZ,SAAS;AAAA,UACT,OAAO;AAAA,UACP,UAAU,CAAC,UAAU,UAAU,KAAe;AAAA,UAC9C,WAAU;AAAA;AAAA,MACZ;AAAA,MAEA,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,UAAQ;AAAA,YACR,aAAY;AAAA,YACZ,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,YAC9C,MAAM;AAAA,YACN,WAAW;AAAA;AAAA,QACb;AAAA,QACA,qBAAC,UAAK,WAAU,8DACb;AAAA,sBAAY;AAAA,UAAO;AAAA,WACtB;AAAA,SACF;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAM;AAAA,UACN,MAAK;AAAA,UACL,aAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU,CAAC,MAAM;AACf,wBAAY,EAAE,OAAO,KAAK;AAC1B,gBAAI,mBAAoB,yBAAwB;AAAA,UAClD;AAAA,UACA,oBAAmB;AAAA,UACnB;AAAA,UACA,kBAAkB;AAAA,UAClB,OAAO,CAAC,CAAC;AAAA,UACT,cAAc,sBAAsB;AAAA;AAAA,MACtC;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,+GACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,MAAK;AAAA,UACN;AAAA;AAAA,MAED;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,QAAO,MAAK,UAAS,SAAS,aAAa,oBAEjF;AAAA,OACF;AAAA,KACF,GACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { useTranslations } from 'next-intl';\nimport { IconLock, IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { FormField } from '../ui/form/FormField';\nimport { SelectField } from '../ui/form/SelectField';\nimport { TextAreaField } from '../ui/form/TextAreaField';\nimport { Toast } from '../ui/feedback/Toast';\nimport usePasswordVisibility from '../../hooks/usePasswordVisibility';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\n\nexport default function DeleteAccountModal() {\n const translate = useTranslations();\n const reasonOptions = [\n { value: 'sem-funcao', label: translate('common.account.deleteAccount.reasons.noFeature') },\n { value: 'problemas', label: translate('common.account.deleteAccount.reasons.technical') },\n { value: 'suporte', label: translate('common.account.deleteAccount.reasons.support') },\n { value: 'demora', label: translate('common.account.deleteAccount.reasons.updates') },\n { value: 'temporario', label: translate('common.account.deleteAccount.reasons.temporary') },\n { value: 'outro', label: translate('common.account.deleteAccount.reasons.other') },\n ];\n const {\n activeModal,\n deleteAccountError,\n openConfigurations,\n openConfirmDelete,\n clearDeleteAccountError,\n } = useAccountModals();\n const open = activeModal === 'deleteAccount';\n\n const [reason, setReason] = useState('');\n const [description, setDescription] = useState('');\n const [password, setPassword] = useState('');\n const { showPassword, togglePassword } = usePasswordVisibility();\n\n const isFormValid = Boolean(reason && description && password);\n\n const resetForm = useCallback(() => {\n setReason('');\n setDescription('');\n setPassword('');\n }, []);\n\n // Quando o modal deixa de estar aberto, limpa o erro residual do store\n // pra não aparecer numa próxima abertura vinda de fluxo limpo.\n useEffect(() => {\n if (!open) {\n clearDeleteAccountError();\n }\n }, [open, clearDeleteAccountError]);\n\n const handleClose = () => {\n resetForm();\n openConfigurations(AccountSectionType.SECURITY);\n };\n\n const handleDelete = (e: React.FormEvent) => {\n e.preventDefault();\n if (!isFormValid) {\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={translate('common.account.deleteAccount.requiredFields')}\n toastId={toastId}\n />\n ));\n return;\n }\n openConfirmDelete({ password });\n // Campos locais podem ser limpos — o payload já está no store.\n resetForm();\n };\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-full sm: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-lg 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%] overflow-y-auto\">\n <form onSubmit={handleDelete} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none\">\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <DialogTitle>{translate('common.account.deleteAccount.title')}</DialogTitle>\n <DialogDescription className=\"paragraph-small-regular\">\n {translate.rich('common.account.deleteAccount.description', {\n b: (chunks) => (\n <span className=\"font-semibold text-gray-950\">{chunks}</span>\n ),\n })}\n </DialogDescription>\n </DialogHeader>\n\n <SelectField\n label={translate('common.account.deleteAccount.reasonLabel')}\n required\n placeholder={translate('common.account.deleteAccount.reasonPlaceholder')}\n options={reasonOptions}\n value={reason}\n onChange={(value) => setReason(value as string)}\n className=\"h-10!\"\n />\n\n <div>\n <TextAreaField\n label={translate('common.account.deleteAccount.descriptionLabel')}\n required\n placeholder={translate('common.account.deleteAccount.descriptionPlaceholder')}\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={4}\n maxLength={400}\n />\n <span className=\"paragraph-xsmall-medium text-gray-600 text-left mt-1 block\">\n {translate('common.account.deleteAccount.charactersCount', {\n count: String(description.length),\n })}\n </span>\n </div>\n\n <FormField\n className=\"text-gray-600\"\n label={translate('common.account.deleteAccount.passwordLabel')}\n type=\"password\"\n placeholder={translate('common.account.deleteAccount.passwordPlaceholder')}\n leftIcon={IconLock}\n value={password}\n onChange={(e) => {\n setPassword(e.target.value);\n if (deleteAccountError) clearDeleteAccountError();\n }}\n classnameContainer=\"h-10!\"\n showPassword={showPassword}\n onTogglePassword={togglePassword}\n error={!!deleteAccountError}\n errorMessage={deleteAccountError ?? undefined}\n />\n </div>\n\n <div className=\"flex flex-row items-center justify-start gap-2 p-4 lg:p-6 border-t border-gray-200 bg-white mt-auto lg:mt-0\">\n <Button\n variant=\"default\"\n className=\"h-10\"\n type=\"submit\"\n >\n {translate('common.account.deleteAccount.submit')}\n </Button>\n <Button variant=\"secondary\" className=\"h-10\" type=\"button\" onClick={handleClose}>\n {translate('common.actions.close')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAiEQ,cAkBI,YAlBJ;AA/DR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,uBAAuB;AAChC,SAAS,UAAU,yBAAyB;AAC5C,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,mBAAmB,cAAc,mBAAmB;AACpF,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,OAAO,2BAA2B;AAClC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEpB,SAAR,qBAAsC;AAC3C,QAAM,YAAY,gBAAgB;AAClC,QAAM,gBAAgB;AAAA,IACpB,EAAE,OAAO,cAAc,OAAO,UAAU,gDAAgD,EAAE;AAAA,IAC1F,EAAE,OAAO,aAAa,OAAO,UAAU,gDAAgD,EAAE;AAAA,IACzF,EAAE,OAAO,WAAW,OAAO,UAAU,8CAA8C,EAAE;AAAA,IACrF,EAAE,OAAO,UAAU,OAAO,UAAU,8CAA8C,EAAE;AAAA,IACpF,EAAE,OAAO,cAAc,OAAO,UAAU,gDAAgD,EA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C;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,+GACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,MAAK;AAAA,UAEJ,oBAAU,qCAAqC;AAAA;AAAA,MAClD;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,QAAO,MAAK,UAAS,SAAS,aACjE,oBAAU,sBAAsB,GACnC;AAAA,OACF;AAAA,KACF,GACF,GACF;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useTranslations } from "next-intl";
3
4
  import { IconShieldCheck } from "@tabler/icons-react";
4
5
  import { Button } from "../ui/buttons/Button";
5
6
  import {
@@ -17,6 +18,7 @@ function DisableTwoFactorAuthModal({
17
18
  onClose,
18
19
  onSuccess
19
20
  }) {
21
+ const translate = useTranslations();
20
22
  const { code, setCode, isValid, isLoading, handleClose, handleSubmit } = useDisableTwoFactorAuthForm({ onClose, onSuccess });
21
23
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsx(DialogContent, { overlayClassName: "z-[1010]", className: "z-[1011] flex flex-col p-0 gap-0 max-w-full sm: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(
22
24
  "form",
@@ -30,11 +32,11 @@ function DisableTwoFactorAuthModal({
30
32
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none", children: [
31
33
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2", children: /* @__PURE__ */ jsx(IconShieldCheck, { size: 20, className: "text-gray-600" }) }),
32
34
  /* @__PURE__ */ jsxs(DialogHeader, { className: "p-0 gap-2", children: [
33
- /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "Desabilitar autentica\xE7\xE3o 2FA" }),
34
- /* @__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." })
35
+ /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: translate("common.account.twoFactor.disableTitle") }),
36
+ /* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-gray-600", children: translate("common.account.twoFactor.disableDescription") })
35
37
  ] }),
36
38
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
37
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children: "C\xF3digo do autenticador" }),
39
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children: translate("common.account.twoFactor.authenticatorCode") }),
38
40
  /* @__PURE__ */ jsx(InputOTP, { maxLength: 6, pattern: REGEXP_ONLY_DIGITS, value: code, onChange: setCode, children: /* @__PURE__ */ jsx(InputOTPGroup, { className: "gap-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(
39
41
  InputOTPSlot,
40
42
  {
@@ -46,7 +48,7 @@ function DisableTwoFactorAuthModal({
46
48
  ] })
47
49
  ] }),
48
50
  /* @__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: [
49
- /* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ? "Desabilitando..." : "Desabilitar 2FA" }),
51
+ /* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ? translate("common.account.twoFactor.disabling") : translate("common.account.twoFactor.disable") }),
50
52
  /* @__PURE__ */ jsx(
51
53
  Button,
52
54
  {
@@ -54,7 +56,7 @@ function DisableTwoFactorAuthModal({
54
56
  className: "h-10! flex-1",
55
57
  type: "button",
56
58
  onClick: handleClose,
57
- children: "Cancelar"
59
+ children: translate("common.actions.cancel")
58
60
  }
59
61
  )
60
62
  ] })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/DisableTwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconShieldCheck } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\nimport { REGEXP_ONLY_DIGITS } from 'input-otp';\nimport useDisableTwoFactorAuthForm from './hooks/useDisableTwoFactorAuthForm';\n\ninterface DisableTwoFactorAuthModalProps {\n open: boolean;\n onClose: () => void;\n onSuccess?: () => void;\n}\n\nexport default function DisableTwoFactorAuthModal({\n open,\n onClose,\n onSuccess,\n}: DisableTwoFactorAuthModalProps) {\n const { code, setCode, isValid, isLoading, handleClose, handleSubmit } =\n useDisableTwoFactorAuthForm({ onClose, onSuccess });\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent overlayClassName=\"z-[1010]\" className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm: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%]\">\n <form\n onSubmit={(e) => {\n e.preventDefault();\n handleSubmit();\n }}\n className=\"flex flex-col flex-1 lg:flex-none\"\n >\n <div className=\"flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none\">\n <div className=\"flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2\">\n <IconShieldCheck size={20} className=\"text-gray-600\" />\n </div>\n <DialogHeader className=\"p-0 gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Desabilitar autenticação 2FA\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-gray-600\">\n Informe o código de 6 dígitos do seu aplicativo autenticador para confirmar a\n desativação.\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-small-medium text-gray-700\">Código do autenticador</span>\n <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS} value={code} onChange={setCode}>\n <InputOTPGroup className=\"gap-2\">\n {Array.from({ length: 6 }).map((_, i) => (\n <InputOTPSlot\n key={i}\n index={i}\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\n />\n ))}\n </InputOTPGroup>\n </InputOTP>\n </div>\n </div>\n\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\">\n <Button className=\"h-10! flex-1\" disabled={!isValid || isLoading} type=\"submit\">\n {isLoading ? 'Desabilitando...' : 'Desabilitar 2FA'}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n type=\"button\"\n onClick={handleClose}\n >\n Cancelar\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAyCc,cAEF,YAFE;AAvCd,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,0BAA0B;AACnC,OAAO,iCAAiC;AAQzB,SAAR,0BAA2C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AACF,GAAmC;AACjC,QAAM,EAAE,MAAM,SAAS,SAAS,WAAW,aA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al.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport { IconShieldCheck } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\nimport { REGEXP_ONLY_DIGITS } from 'input-otp';\nimport useDisableTwoFactorAuthForm from './hooks/useDisableTwoFactorAuthForm';\n\ninterface DisableTwoFactorAuthModalProps {\n open: boolean;\n onClose: () => void;\n onSuccess?: () => void;\n}\n\nexport default function DisableTwoFactorAuthModal({\n open,\n onClose,\n onSuccess,\n}: DisableTwoFactorAuthModalProps) {\n const translate = useTranslations();\n const { code, setCode, isValid, isLoading, handleClose, handleSubmit } =\n useDisableTwoFactorAuthForm({ onClose, onSuccess });\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent overlayClassName=\"z-[1010]\" className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm: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%]\">\n <form\n onSubmit={(e) => {\n e.preventDefault();\n handleSubmit();\n }}\n className=\"flex flex-col flex-1 lg:flex-none\"\n >\n <div className=\"flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none\">\n <div className=\"flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2\">\n <IconShieldCheck size={20} className=\"text-gray-600\" />\n </div>\n <DialogHeader className=\"p-0 gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n {translate('common.account.twoFactor.disableTitle')}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-gray-600\">\n {translate('common.account.twoFactor.disableDescription')}\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-small-medium text-gray-700\">\n {translate('common.account.twoFactor.authenticatorCode')}\n </span>\n <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS} value={code} onChange={setCode}>\n <InputOTPGroup className=\"gap-2\">\n {Array.from({ length: 6 }).map((_, i) => (\n <InputOTPSlot\n key={i}\n index={i}\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\n />\n ))}\n </InputOTPGroup>\n </InputOTP>\n </div>\n </div>\n\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\">\n <Button className=\"h-10! flex-1\" disabled={!isValid || isLoading} type=\"submit\">\n {isLoading\n ? translate('common.account.twoFactor.disabling')\n : translate('common.account.twoFactor.disable')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n type=\"button\"\n onClick={handleClose}\n >\n {translate('common.actions.cancel')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2Cc,cAEF,YAFE;AAzCd,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,0BAA0B;AACnC,OAAO,iCAAiC;AAQzB,SAAR,0BAA2C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AACF,GAAmC;AACjC,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAAE,MAAM,SAAS,SAAS,WAAW,aAAa,aAAa,IACnE,4BAA4B,EAAE,SAAS,UAAU,CAAC;AAEpD,SACE,oBAAC,UAAO,MAAY,cAAc,aAChC,8BAAC,iBAAc,kBAAiB,YAAW,WAAU,wTACnD;AAAA,IAAC;AAAA;AAAA,MAC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