@greatapps/common 1.1.32 → 1.1.34

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 (40) hide show
  1. package/dist/components/account/AccountModals.mjs +18 -0
  2. package/dist/components/account/AccountModals.mjs.map +1 -0
  3. package/dist/components/account/ConfigurationsMyAccountModal.mjs +26 -15
  4. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
  5. package/dist/components/account/ConfirmDeleteAccountModal.mjs +45 -0
  6. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -0
  7. package/dist/components/account/DeleteAccountModal.mjs +123 -0
  8. package/dist/components/account/DeleteAccountModal.mjs.map +1 -0
  9. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +42 -0
  10. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -0
  11. package/dist/components/layouts/AppMobileNavBar.mjs +55 -0
  12. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
  13. package/dist/components/layouts/AppNavBar.mjs +77 -0
  14. package/dist/components/layouts/AppNavBar.mjs.map +1 -0
  15. package/dist/components/modals/ModalManager.mjs +19 -0
  16. package/dist/components/modals/ModalManager.mjs.map +1 -0
  17. package/dist/components/modals/Modals.mjs +20 -0
  18. package/dist/components/modals/Modals.mjs.map +1 -0
  19. package/dist/index.mjs +14 -2
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +2 -2
  22. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -1
  23. package/dist/store/useAccountModals.mjs +18 -0
  24. package/dist/store/useAccountModals.mjs.map +1 -0
  25. package/dist/store/useModalManager.mjs +75 -0
  26. package/dist/store/useModalManager.mjs.map +1 -0
  27. package/package.json +1 -1
  28. package/src/components/account/AccountModals.tsx +17 -0
  29. package/src/components/account/ConfigurationsMyAccountModal.tsx +29 -26
  30. package/src/components/account/ConfirmDeleteAccountModal.tsx +55 -0
  31. package/src/components/account/DeleteAccountModal.tsx +130 -0
  32. package/src/components/account/IsntPossibleDeleteAccountModal.tsx +49 -0
  33. package/src/components/layouts/AppMobileNavBar.tsx +73 -0
  34. package/src/components/layouts/AppNavBar.tsx +90 -0
  35. package/src/components/modals/ModalManager.tsx +29 -0
  36. package/src/components/modals/Modals.tsx +29 -0
  37. package/src/index.ts +13 -2
  38. package/src/modules/whitelabel/actions/find-whitelabel.action.ts +1 -1
  39. package/src/store/useAccountModals.ts +57 -0
  40. package/src/store/useModalManager.ts +104 -0
package/dist/index.mjs CHANGED
@@ -20,6 +20,8 @@ import { buildQueryParams } from "./infra/utils/params";
20
20
  import { parseSchema, parseResult } from "./infra/utils/parser";
21
21
  import { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from "./components/layouts/MainLayout";
22
22
  import { NavBar } from "./components/layouts/NavBar";
23
+ import { AppNavBar } from "./components/layouts/AppNavBar";
24
+ import { AppMobileNavBar } from "./components/layouts/AppMobileNavBar";
23
25
  import { SideBarNavigation } from "./components/layouts/SideBarNavigation";
24
26
  import { MdSideBarNavigation } from "./components/layouts/MdSideBarNavigation";
25
27
  import { NotificationItem } from "./components/layouts/NotificationItem";
@@ -59,6 +61,7 @@ import { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from "./compon
59
61
  import { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from "./components/ui/overlay/Sheet";
60
62
  import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./components/ui/overlay/Tooltip";
61
63
  import { useMdSidebarStore } from "./store/useMdSidebarStore";
64
+ import { useModalManager } from "./store/useModalManager";
62
65
  import { AccountSectionType } from "./enums/AccountSectionType";
63
66
  import { default as default5 } from "./hooks/usePasswordVisibility";
64
67
  import { default as default6 } from "./hooks/useCountdownTimer";
@@ -80,7 +83,10 @@ import {
80
83
  useDeleteAccountUser,
81
84
  useDeleteAccount
82
85
  } from "./modules/accounts/hooks/useAccountManagement";
83
- import { default as default10 } from "./components/account/ConfigurationsMyAccountModal";
86
+ import { default as default10 } from "./components/account/AccountModals";
87
+ import { useAccountModals } from "./store/useAccountModals";
88
+ import { ModalManager } from "./components/modals/ModalManager";
89
+ import { Modals } from "./components/modals/Modals";
84
90
  import { default as default11 } from "./components/account/TwoFactorAuthModal";
85
91
  import { default as default12 } from "./components/account/DisableTwoFactorAuthModal";
86
92
  import { default as default13 } from "./components/account/ConfirmGlobalPreferencesModal";
@@ -104,7 +110,10 @@ export {
104
110
  AccordionContent,
105
111
  AccordionItem,
106
112
  AccordionTrigger,
113
+ default10 as AccountModals,
107
114
  AccountSectionType,
115
+ AppMobileNavBar,
116
+ AppNavBar,
108
117
  Badge,
109
118
  Button,
110
119
  CURRENCY_OPTIONS,
@@ -133,7 +142,6 @@ export {
133
142
  CommandList,
134
143
  CommandSeparator,
135
144
  CommandShortcut,
136
- default10 as ConfigurationsMyAccountModal,
137
145
  default13 as ConfirmGlobalPreferencesModal,
138
146
  CopyButton,
139
147
  DatePicker,
@@ -164,6 +172,8 @@ export {
164
172
  MainLayoutMain,
165
173
  MainLayoutSpacer,
166
174
  MdSideBarNavigation,
175
+ ModalManager,
176
+ Modals,
167
177
  MyProfileSection,
168
178
  NOTIFICATION_TYPES,
169
179
  NavBar,
@@ -263,6 +273,7 @@ export {
263
273
  stopChain,
264
274
  toastIconContainerVariants,
265
275
  toastVariants,
276
+ useAccountModals,
266
277
  useActiveSubscription,
267
278
  default6 as useCountdownTimer,
268
279
  useDeleteAccount,
@@ -271,6 +282,7 @@ export {
271
282
  useInvalidateUser,
272
283
  default7 as useIsMobile,
273
284
  useMdSidebarStore,
285
+ useModalManager,
274
286
  default5 as usePasswordVisibility,
275
287
  useSetUserData,
276
288
  useSubscriptions,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from './modules/auth/schema';\nexport * from './modules/users/schema';\nexport * from './modules/whitelabel/schema';\nexport * from './infra/api/types';\n\n// Contexts\nexport * from './providers/query.provider';\nexport * from './providers/auth.provider';\nexport * from './providers/whitelabel.provider';\n\n// Hooks\nexport { useUserQuery, useUserValidateSession, useInvalidateUser, useSetUserData, USER_QUERY_KEY } from './modules/auth/hooks/useUserQuery';\nexport { useSubscriptions, SUBSCRIPTIONS_QUERY_KEY } from './modules/subscriptions/hooks/list-subscriptions.hook';\nexport { useActiveSubscription } from './modules/subscriptions/hooks/find-active-subscription.hook';\nexport { useIaCredits } from './modules/ia-credits/hooks/ia-credits.hook';\nexport type { IaCreditsSummary, IaCreditOperation } from './modules/ia-credits/types';\nexport type { Subscription, SubscriptionItem, FindSubscriptionsParams } from './modules/subscriptions/types';\nexport { SubscriptionSchema, SubscriptionItemSchema } from './modules/subscriptions/types';\nexport { ADDON_IDS } from './modules/subscriptions/constants/addons.constants';\nexport type { AddonKindEnum } from './modules/subscriptions/constants/addons.constants';\n\n// Providers\nexport { QueryProvider } from './providers/query.provider';\n\n// Middleware\nexport { createAuthMiddleware } from './middlewares/create-auth-middleware';\nexport { createMiddlewareChain } from './middlewares/chain';\nexport { continueChain, stopChain } from './middlewares/types';\nexport type { MiddlewareFunction, MiddlewareConfig, MiddlewareResult } from './middlewares/types';\n\n// Utils\nexport { cn } from './infra/utils/clsx';\nexport { buildQueryParams } from './infra/utils/params';\nexport { parseSchema, parseResult } from './infra/utils/parser';\n\n// Layout\nexport { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from './components/layouts/MainLayout';\nexport { NavBar } from './components/layouts/NavBar';\nexport type { NavBarProps } from './components/layouts/NavBar';\nexport { SideBarNavigation } from './components/layouts/SideBarNavigation';\nexport { MdSideBarNavigation } from './components/layouts/MdSideBarNavigation';\nexport { NotificationItem } from './components/layouts/NotificationItem';\nexport type { NotificationItemProps } from './components/layouts/NotificationItem';\nexport { NotificationsPopover } from './components/layouts/NotificationsPopover';\nexport type { NotificationsPopoverProps, NotificationData } from './components/layouts/NotificationsPopover';\nexport { UsersSelectorPopover } from './components/layouts/UsersSelectorPopover';\nexport type { UsersSelectorPopoverProps, UserSelectorItem } from './components/layouts/UsersSelectorPopover';\nexport { ProfilePopover } from './components/layouts/ProfilePopover';\nexport type { ProfilePopoverProps, ProfileMenuItem } from './components/layouts/ProfilePopover';\nexport { NavBarItem } from './components/layouts/NavBarItem';\nexport type { NavBarItemProps } from './components/layouts/NavBarItem';\n\n// UI - Buttons\nexport { Button, buttonVariants } from './components/ui/buttons/Button';\nexport { CopyButton } from './components/ui/buttons/CopyButton';\nexport { default as CancelButton } from './components/ui/buttons/CancelButton';\n\n// UI - Data Display\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/ui/data-display/Accordion';\nexport { Badge, badgeVariants } from './components/ui/data-display/Badge';\nexport { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './components/ui/data-display/Card';\nexport { Pagination, PaginationContent, PaginationLink, PaginationItem, PaginationPrevious, PaginationNext, PaginationEllipsis } from './components/ui/data-display/Pagination';\nexport { ScrollArea, ScrollBar } from './components/ui/data-display/ScrollArea';\nexport { Separator } from './components/ui/data-display/Separator';\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './components/ui/data-display/Table';\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/ui/data-display/Tabs';\nexport { UserAvatar } from './components/ui/data-display/UserAvatar';\nexport type { UserAvatarProps } from './components/ui/data-display/UserAvatar';\n\n// UI - Feedback\nexport { default as CircularProgress } from './components/ui/feedback/CircularProgress';\nexport { default as DefaultCircularProgress } from './components/ui/feedback/DefaultCircularProgress';\nexport { Progress } from './components/ui/feedback/Progress';\nexport { Toast, toastVariants, toastIconContainerVariants } from './components/ui/feedback/Toast';\nexport type { ToastProps } from './components/ui/feedback/Toast';\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from './components/ui/form/Calendar';\nexport { Checkbox } from './components/ui/form/Checkbox';\nexport { DatePicker } from './components/ui/form/DatePicker';\nexport { DateRangePicker } from './components/ui/form/DateRangePicker';\nexport { Input } from './components/ui/form/Input';\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './components/ui/form/InputOtp';\nexport { RadioGroup, RadioGroupItem } from './components/ui/form/RadioGroup';\nexport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/form/Select';\nexport { Switch } from './components/ui/form/Switch';\nexport { Textarea } from './components/ui/form/Textarea';\n\n// UI - Overlay\nexport { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './components/ui/overlay/Command';\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/overlay/Dialog';\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './components/ui/overlay/Popover';\nexport { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from './components/ui/overlay/Sheet';\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/ui/overlay/Tooltip';\n\n// Store\nexport { useMdSidebarStore } from './store/useMdSidebarStore';\n\n// Enums\nexport { AccountSectionType } from './enums/AccountSectionType';\n\n// Hooks\nexport { default as usePasswordVisibility } from './hooks/usePasswordVisibility';\nexport { default as useCountdownTimer } from './hooks/useCountdownTimer';\nexport { default as useIsMobile } from './hooks/useIsMobile';\n\n// Utils\nexport { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';\nexport { buildTimezoneOptions } from './utils/intl/timezones';\nexport type { TimezoneOption } from './utils/intl/timezones';\nexport { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';\nexport type { LocaleOption } from './utils/intl/locales';\nexport { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';\n\n// UI - Form (new widgets)\nexport { FormField } from './components/ui/form/FormField';\nexport { SelectField } from './components/ui/form/SelectField';\nexport { ComboboxField } from './components/ui/form/ComboboxField';\nexport type { ComboboxOption } from './components/ui/form/ComboboxField';\nexport { default as PhoneInput } from './components/ui/form/PhoneInput';\nexport { default as SwitchOptionFieldWithIcon } from './components/ui/form/SwitchOptionFieldWithIcon';\nexport { TextAreaField } from './components/ui/form/TextAreaField';\n\n// Account Module - Hooks\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from './modules/accounts/hooks/useAccountManagement';\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from './modules/accounts/types';\n\n// Account Components\nexport { default as ConfigurationsMyAccountModal } from './components/account/ConfigurationsMyAccountModal';\nexport { default as TwoFactorAuthModal } from './components/account/TwoFactorAuthModal';\nexport { default as DisableTwoFactorAuthModal } from './components/account/DisableTwoFactorAuthModal';\nexport { default as ConfirmGlobalPreferencesModal } from './components/account/ConfirmGlobalPreferencesModal';\nexport { MyProfileSection } from './components/account/sections/MyProfileSection';\nexport { PreferencesSection } from './components/account/sections/PreferencesSection';\nexport { SecuritySection } from './components/account/sections/SecuritySection';\nexport { ChangePasswordSection } from './components/account/sections/ChangePasswordSection';\nexport { ChangeEmailModal } from './components/account/sections/ChangeEmailModal';\nexport { ChangePhoneModal } from './components/account/sections/ChangePhoneModal';\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIMEZONE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from './components/account/constants';\n"],"mappings":"AACA,cAAc;AACd,cAA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,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from './modules/auth/schema';\nexport * from './modules/users/schema';\nexport * from './modules/whitelabel/schema';\nexport * from './infra/api/types';\n\n// Contexts\nexport * from './providers/query.provider';\nexport * from './providers/auth.provider';\nexport * from './providers/whitelabel.provider';\n\n// Hooks\nexport { useUserQuery, useUserValidateSession, useInvalidateUser, useSetUserData, USER_QUERY_KEY } from './modules/auth/hooks/useUserQuery';\nexport { useSubscriptions, SUBSCRIPTIONS_QUERY_KEY } from './modules/subscriptions/hooks/list-subscriptions.hook';\nexport { useActiveSubscription } from './modules/subscriptions/hooks/find-active-subscription.hook';\nexport { useIaCredits } from './modules/ia-credits/hooks/ia-credits.hook';\nexport type { IaCreditsSummary, IaCreditOperation } from './modules/ia-credits/types';\nexport type { Subscription, SubscriptionItem, FindSubscriptionsParams } from './modules/subscriptions/types';\nexport { SubscriptionSchema, SubscriptionItemSchema } from './modules/subscriptions/types';\nexport { ADDON_IDS } from './modules/subscriptions/constants/addons.constants';\nexport type { AddonKindEnum } from './modules/subscriptions/constants/addons.constants';\n\n// Providers\nexport { QueryProvider } from './providers/query.provider';\n\n// Middleware\nexport { createAuthMiddleware } from './middlewares/create-auth-middleware';\nexport { createMiddlewareChain } from './middlewares/chain';\nexport { continueChain, stopChain } from './middlewares/types';\nexport type { MiddlewareFunction, MiddlewareConfig, MiddlewareResult } from './middlewares/types';\n\n// Utils\nexport { cn } from './infra/utils/clsx';\nexport { buildQueryParams } from './infra/utils/params';\nexport { parseSchema, parseResult } from './infra/utils/parser';\n\n// Layout\nexport { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from './components/layouts/MainLayout';\nexport { NavBar } from './components/layouts/NavBar';\nexport type { NavBarProps } from './components/layouts/NavBar';\nexport { AppNavBar } from './components/layouts/AppNavBar';\nexport type { AppNavBarProps } from './components/layouts/AppNavBar';\nexport { AppMobileNavBar } from './components/layouts/AppMobileNavBar';\nexport type { AppMobileNavBarProps } from './components/layouts/AppMobileNavBar';\nexport { SideBarNavigation } from './components/layouts/SideBarNavigation';\nexport { MdSideBarNavigation } from './components/layouts/MdSideBarNavigation';\nexport { NotificationItem } from './components/layouts/NotificationItem';\nexport type { NotificationItemProps } from './components/layouts/NotificationItem';\nexport { NotificationsPopover } from './components/layouts/NotificationsPopover';\nexport type { NotificationsPopoverProps, NotificationData } from './components/layouts/NotificationsPopover';\nexport { UsersSelectorPopover } from './components/layouts/UsersSelectorPopover';\nexport type { UsersSelectorPopoverProps, UserSelectorItem } from './components/layouts/UsersSelectorPopover';\nexport { ProfilePopover } from './components/layouts/ProfilePopover';\nexport type { ProfilePopoverProps, ProfileMenuItem } from './components/layouts/ProfilePopover';\nexport { NavBarItem } from './components/layouts/NavBarItem';\nexport type { NavBarItemProps } from './components/layouts/NavBarItem';\n\n// UI - Buttons\nexport { Button, buttonVariants } from './components/ui/buttons/Button';\nexport { CopyButton } from './components/ui/buttons/CopyButton';\nexport { default as CancelButton } from './components/ui/buttons/CancelButton';\n\n// UI - Data Display\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/ui/data-display/Accordion';\nexport { Badge, badgeVariants } from './components/ui/data-display/Badge';\nexport { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './components/ui/data-display/Card';\nexport { Pagination, PaginationContent, PaginationLink, PaginationItem, PaginationPrevious, PaginationNext, PaginationEllipsis } from './components/ui/data-display/Pagination';\nexport { ScrollArea, ScrollBar } from './components/ui/data-display/ScrollArea';\nexport { Separator } from './components/ui/data-display/Separator';\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './components/ui/data-display/Table';\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/ui/data-display/Tabs';\nexport { UserAvatar } from './components/ui/data-display/UserAvatar';\nexport type { UserAvatarProps } from './components/ui/data-display/UserAvatar';\n\n// UI - Feedback\nexport { default as CircularProgress } from './components/ui/feedback/CircularProgress';\nexport { default as DefaultCircularProgress } from './components/ui/feedback/DefaultCircularProgress';\nexport { Progress } from './components/ui/feedback/Progress';\nexport { Toast, toastVariants, toastIconContainerVariants } from './components/ui/feedback/Toast';\nexport type { ToastProps } from './components/ui/feedback/Toast';\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from './components/ui/form/Calendar';\nexport { Checkbox } from './components/ui/form/Checkbox';\nexport { DatePicker } from './components/ui/form/DatePicker';\nexport { DateRangePicker } from './components/ui/form/DateRangePicker';\nexport { Input } from './components/ui/form/Input';\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './components/ui/form/InputOtp';\nexport { RadioGroup, RadioGroupItem } from './components/ui/form/RadioGroup';\nexport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/form/Select';\nexport { Switch } from './components/ui/form/Switch';\nexport { Textarea } from './components/ui/form/Textarea';\n\n// UI - Overlay\nexport { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './components/ui/overlay/Command';\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/overlay/Dialog';\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './components/ui/overlay/Popover';\nexport { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from './components/ui/overlay/Sheet';\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/ui/overlay/Tooltip';\n\n// Store\nexport { useMdSidebarStore } from './store/useMdSidebarStore';\nexport { useModalManager } from './store/useModalManager';\nexport type { ModalData } from './store/useModalManager';\n\n// Enums\nexport { AccountSectionType } from './enums/AccountSectionType';\n\n// Hooks\nexport { default as usePasswordVisibility } from './hooks/usePasswordVisibility';\nexport { default as useCountdownTimer } from './hooks/useCountdownTimer';\nexport { default as useIsMobile } from './hooks/useIsMobile';\n\n// Utils\nexport { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';\nexport { buildTimezoneOptions } from './utils/intl/timezones';\nexport type { TimezoneOption } from './utils/intl/timezones';\nexport { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';\nexport type { LocaleOption } from './utils/intl/locales';\nexport { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';\n\n// UI - Form (new widgets)\nexport { FormField } from './components/ui/form/FormField';\nexport { SelectField } from './components/ui/form/SelectField';\nexport { ComboboxField } from './components/ui/form/ComboboxField';\nexport type { ComboboxOption } from './components/ui/form/ComboboxField';\nexport { default as PhoneInput } from './components/ui/form/PhoneInput';\nexport { default as SwitchOptionFieldWithIcon } from './components/ui/form/SwitchOptionFieldWithIcon';\nexport { TextAreaField } from './components/ui/form/TextAreaField';\n\n// Account Module - Hooks\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from './modules/accounts/hooks/useAccountManagement';\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from './modules/accounts/types';\n\nexport { default as AccountModals } from './components/account/AccountModals';\nexport { useAccountModals } from './store/useAccountModals';\nexport type { AccountModalsConfig } from './store/useAccountModals';\n\nexport { ModalManager } from './components/modals/ModalManager';\nexport { Modals } from './components/modals/Modals';\n\nexport { default as TwoFactorAuthModal } from './components/account/TwoFactorAuthModal';\nexport { default as DisableTwoFactorAuthModal } from './components/account/DisableTwoFactorAuthModal';\nexport { default as ConfirmGlobalPreferencesModal } from './components/account/ConfirmGlobalPreferencesModal';\nexport { MyProfileSection } from './components/account/sections/MyProfileSection';\nexport { PreferencesSection } from './components/account/sections/PreferencesSection';\nexport { SecuritySection } from './components/account/sections/SecuritySection';\nexport { ChangePasswordSection } from './components/account/sections/ChangePasswordSection';\nexport { ChangeEmailModal } from './components/account/sections/ChangeEmailModal';\nexport { ChangePhoneModal } from './components/account/sections/ChangePhoneModal';\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIMEZONE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from './components/account/constants';\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,cAAc,wBAAwB,mBAAmB,gBAAgB,sBAAsB;AACxG,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,iBAAiB;AAI1B,SAAS,qBAAqB;AAG9B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe,iBAAiB;AAIzC,SAAS,UAAU;AACnB,SAAS,wBAAwB;AACjC,SAAS,aAAa,mBAAmB;AAGzC,SAAS,YAAY,mBAAmB,kBAAkB,sBAAsB;AAChF,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB;AAEhC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB;AAI3B,SAAS,QAAQ,sBAAsB;AACvC,SAAS,kBAAkB;AAC3B,SAAo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B,WAAXA,gBAA8B;AAGvC,SAAS,aAAa,aAAa,gBAAgB,WAAW,wBAAwB;AACtF,SAAS,4BAA4B;AAErC,SAAS,oBAAwC,wBAA+B;AAEhF,SAAS,iBAAiB,yBAAyB;AAGnD,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAA4C;AACrD,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
@@ -2,7 +2,7 @@ import { headers } from "next/headers";
2
2
  import { whitelabelService } from "../services/whitelabel.service";
3
3
  import { ApiError } from "../../../infra/api/types";
4
4
  import { cache } from "react";
5
- const findWhitelabelAction = cache(async () => {
5
+ const findWhitelabel = cache(async () => {
6
6
  const headersList = await headers();
7
7
  const host = headersList.get("host");
8
8
  if (!host) {
@@ -15,6 +15,6 @@ const findWhitelabelAction = cache(async () => {
15
15
  return whitelabel;
16
16
  });
17
17
  export {
18
- findWhitelabelAction
18
+ findWhitelabel
19
19
  };
20
20
  //# sourceMappingURL=find-whitelabel.action.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/whitelabel/actions/find-whitelabel.action.ts"],"sourcesContent":["\nimport { headers } from \"next/headers\";\nimport { whitelabelService } from \"../services/whitelabel.service\";\nimport { ApiError } from \"../../../infra/api/types\";\nimport { cache } from \"react\";\n\nexport const findWhitelabelAction = cache(async () => {\n const headersList = await headers();\n const host = headersList.get('host');\n\n if (!host) {\n throw new ApiError('Host header not found', 'HOST_NOT_FOUND', 400);\n }\n\n const whitelabel = await whitelabelService.getTokenByDomain(host);\n\n if (!whitelabel) {\n throw new ApiError('Whitelabel not found', 'WL_NOT_FOUND', 404);\n }\n\n return whitelabel;\n});"],"mappings":"AACA,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAEf,MAAM,uBAAuB,MAAM,YAAY;AAClD,QAAM,cAAc,MAAM,QAAQ;AAClC,QAAM,OAAO,YAAY,IAAI,MAAM;AAEnC,MAAI,CAAC,MAAM;AACP,UAAM,IAAI,SAAS,yBAAyB,kBAAkB,GAAG;AAAA,EACrE;AAEA,QAAM,aAAa,MAAM,kBAAkB,iBAAiB,IAAI;AAEhE,MAAI,CAAC,YAAY;AACb,UAAM,IAAI,SAAS,wBAAwB,gBAAgB,GAAG;AAAA,EAClE;AAEA,SAAO;AACX,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/modules/whitelabel/actions/find-whitelabel.action.ts"],"sourcesContent":["\nimport { headers } from \"next/headers\";\nimport { whitelabelService } from \"../services/whitelabel.service\";\nimport { ApiError } from \"../../../infra/api/types\";\nimport { cache } from \"react\";\n\nexport const findWhitelabel = cache(async () => {\n const headersList = await headers();\n const host = headersList.get('host');\n\n if (!host) {\n throw new ApiError('Host header not found', 'HOST_NOT_FOUND', 400);\n }\n\n const whitelabel = await whitelabelService.getTokenByDomain(host);\n\n if (!whitelabel) {\n throw new ApiError('Whitelabel not found', 'WL_NOT_FOUND', 404);\n }\n\n return whitelabel;\n});"],"mappings":"AACA,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAEf,MAAM,iBAAiB,MAAM,YAAY;AAC5C,QAAM,cAAc,MAAM,QAAQ;AAClC,QAAM,OAAO,YAAY,IAAI,MAAM;AAEnC,MAAI,CAAC,MAAM;AACP,UAAM,IAAI,SAAS,yBAAyB,kBAAkB,GAAG;AAAA,EACrE;AAEA,QAAM,aAAa,MAAM,kBAAkB,iBAAiB,IAAI;AAEhE,MAAI,CAAC,YAAY;AACb,UAAM,IAAI,SAAS,wBAAwB,gBAAgB,GAAG;AAAA,EAClE;AAEA,SAAO;AACX,CAAC;","names":[]}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { create } from "zustand";
3
+ const useAccountModals = create((set) => ({
4
+ activeModal: null,
5
+ config: {},
6
+ initialSection: void 0,
7
+ pagesCount: 0,
8
+ updateConfig: (config) => set({ config }),
9
+ openConfigurations: (initialSection) => set({ activeModal: "configurations", initialSection }),
10
+ openDeleteAccount: (pagesCount = 0) => set({ activeModal: "deleteAccount", pagesCount }),
11
+ openIsntPossibleDelete: () => set({ activeModal: "isntPossibleDelete" }),
12
+ openConfirmDelete: (pagesCount = 0) => set({ activeModal: "confirmDelete", pagesCount }),
13
+ close: () => set({ activeModal: null, initialSection: void 0 })
14
+ }));
15
+ export {
16
+ useAccountModals
17
+ };
18
+ //# sourceMappingURL=useAccountModals.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { ComboboxOption } from '../components/ui/form/ComboboxField';\nimport type { AccountSectionType } from '../enums/AccountSectionType';\n\ntype AccountModalType =\n | 'configurations'\n | 'deleteAccount'\n | 'isntPossibleDelete'\n | 'confirmDelete';\n\nexport interface AccountModalsConfig {\n hasActiveSubscription?: boolean;\n currencies?: ComboboxOption[];\n onGoToSubscription?: () => void;\n}\n\ninterface AccountModalsState {\n activeModal: AccountModalType | null;\n config: AccountModalsConfig;\n initialSection?: AccountSectionType;\n pagesCount: number;\n\n /** Called by <AccountModals> to keep app-level config in sync */\n updateConfig: (config: AccountModalsConfig) => void;\n\n openConfigurations: (initialSection?: AccountSectionType) => void;\n openDeleteAccount: (pagesCount?: number) => void;\n openIsntPossibleDelete: () => void;\n openConfirmDelete: (pagesCount?: number) => void;\n close: () => void;\n}\n\nexport const useAccountModals = create<AccountModalsState>((set) => ({\n activeModal: null,\n config: {},\n initialSection: undefined,\n pagesCount: 0,\n\n updateConfig: (config) => set({ config }),\n\n openConfigurations: (initialSection) =>\n set({ activeModal: 'configurations', initialSection }),\n\n openDeleteAccount: (pagesCount = 0) =>\n set({ activeModal: 'deleteAccount', pagesCount }),\n\n openIsntPossibleDelete: () =>\n set({ activeModal: 'isntPossibleDelete' }),\n\n openConfirmDelete: (pagesCount = 0) =>\n set({ activeModal: 'confirmDelete', pagesCount }),\n\n close: () =>\n set({ activeModal: null, initialSection: undefined }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAgChB,MAAM,mBAAmB,OAA2B,CAAC,SAAS;AAAA,EACnE,aAAa;AAAA,EACb,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA,EAChB,YAAY;AAAA,EAEZ,cAAc,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EAExC,oBAAoB,CAAC,mBACnB,IAAI,EAAE,aAAa,kBAAkB,eAAe,CAAC;AAAA,EAEvD,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,wBAAwB,MACtB,IAAI,EAAE,aAAa,qBAAqB,CAAC;AAAA,EAE3C,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,OAAO,MACL,IAAI,EAAE,aAAa,MAAM,gBAAgB,OAAU,CAAC;AACxD,EAAE;","names":[]}
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { create } from "zustand";
3
+ const useModalManager = create((set, get) => ({
4
+ modalStack: [],
5
+ activeModal: null,
6
+ modalData: {},
7
+ openModal: (key, data = {}) => {
8
+ set((state) => {
9
+ const existingIndex = state.modalStack.findIndex((item) => item.key === key);
10
+ if (existingIndex !== -1) {
11
+ const newStack2 = [...state.modalStack];
12
+ newStack2[existingIndex] = { key, data };
13
+ return {
14
+ modalStack: newStack2,
15
+ activeModal: newStack2[newStack2.length - 1]?.key ?? null,
16
+ modalData: newStack2[newStack2.length - 1]?.data ?? {}
17
+ };
18
+ }
19
+ const newStack = [...state.modalStack, { key, data }];
20
+ return {
21
+ modalStack: newStack,
22
+ activeModal: key,
23
+ modalData: data
24
+ };
25
+ });
26
+ },
27
+ closeModal: () => {
28
+ set((state) => {
29
+ const newStack = state.modalStack.slice(0, -1);
30
+ const topModal = newStack[newStack.length - 1];
31
+ return {
32
+ modalStack: newStack,
33
+ activeModal: topModal?.key ?? null,
34
+ modalData: topModal?.data ?? {}
35
+ };
36
+ });
37
+ },
38
+ closeModalByKey: (key) => {
39
+ set((state) => {
40
+ const newStack = state.modalStack.filter((item) => item.key !== key);
41
+ const topModal = newStack[newStack.length - 1];
42
+ return {
43
+ modalStack: newStack,
44
+ activeModal: topModal?.key ?? null,
45
+ modalData: topModal?.data ?? {}
46
+ };
47
+ });
48
+ },
49
+ updateModalData: (data) => {
50
+ set((state) => {
51
+ if (state.modalStack.length === 0) return state;
52
+ const newStack = [...state.modalStack];
53
+ const lastIndex = newStack.length - 1;
54
+ newStack[lastIndex] = {
55
+ ...newStack[lastIndex],
56
+ data: { ...newStack[lastIndex].data, ...data }
57
+ };
58
+ return {
59
+ modalStack: newStack,
60
+ modalData: newStack[lastIndex].data
61
+ };
62
+ });
63
+ },
64
+ isModalOpen: (key) => {
65
+ return get().modalStack.some((item) => item.key === key);
66
+ },
67
+ getModalData: (key) => {
68
+ const item = get().modalStack.find((item2) => item2.key === key);
69
+ return item?.data ?? {};
70
+ }
71
+ }));
72
+ export {
73
+ useModalManager
74
+ };
75
+ //# sourceMappingURL=useModalManager.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/store/useModalManager.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ModalData = Record<string, any>;\n\ninterface ModalStackItem {\n key: string;\n data: ModalData;\n}\n\ninterface ModalState {\n modalStack: ModalStackItem[];\n activeModal: string | null;\n modalData: ModalData;\n openModal: (key: string, data?: ModalData) => void;\n /** Closes the top modal in the stack */\n closeModal: () => void;\n /** Closes a specific modal by key */\n closeModalByKey: (key: string) => void;\n updateModalData: (data: ModalData) => void;\n isModalOpen: (key: string) => boolean;\n getModalData: (key: string) => ModalData;\n}\n\nexport const useModalManager = create<ModalState>((set, get) => ({\n modalStack: [],\n activeModal: null,\n modalData: {},\n\n openModal: (key, data = {}) => {\n set((state) => {\n const existingIndex = state.modalStack.findIndex((item) => item.key === key);\n if (existingIndex !== -1) {\n const newStack = [...state.modalStack];\n newStack[existingIndex] = { key, data };\n return {\n modalStack: newStack,\n activeModal: newStack[newStack.length - 1]?.key ?? null,\n modalData: newStack[newStack.length - 1]?.data ?? {},\n };\n }\n\n const newStack = [...state.modalStack, { key, data }];\n return {\n modalStack: newStack,\n activeModal: key,\n modalData: data,\n };\n });\n },\n\n closeModal: () => {\n set((state) => {\n const newStack = state.modalStack.slice(0, -1);\n const topModal = newStack[newStack.length - 1];\n return {\n modalStack: newStack,\n activeModal: topModal?.key ?? null,\n modalData: topModal?.data ?? {},\n };\n });\n },\n\n closeModalByKey: (key: string) => {\n set((state) => {\n const newStack = state.modalStack.filter((item) => item.key !== key);\n const topModal = newStack[newStack.length - 1];\n return {\n modalStack: newStack,\n activeModal: topModal?.key ?? null,\n modalData: topModal?.data ?? {},\n };\n });\n },\n\n updateModalData: (data) => {\n set((state) => {\n if (state.modalStack.length === 0) return state;\n\n const newStack = [...state.modalStack];\n const lastIndex = newStack.length - 1;\n newStack[lastIndex] = {\n ...newStack[lastIndex],\n data: { ...newStack[lastIndex].data, ...data },\n };\n\n return {\n modalStack: newStack,\n modalData: newStack[lastIndex].data,\n };\n });\n },\n\n isModalOpen: (key: string) => {\n return get().modalStack.some((item) => item.key === key);\n },\n\n getModalData: (key: string) => {\n const item = get().modalStack.find((item) => item.key === key);\n return item?.data ?? {};\n },\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAwBhB,MAAM,kBAAkB,OAAmB,CAAC,KAAK,SAAS;AAAA,EAC/D,YAAY,CAAC;AAAA,EACb,aAAa;AAAA,EACb,WAAW,CAAC;AAAA,EAEZ,WAAW,CAAC,KAAK,OAAO,CAAC,MAAM;AAC7B,QAAI,CAAC,UAAU;AACb,YAAM,gBAAgB,MAAM,WAAW,UAAU,CAAC,SAAS,KAAK,QAAQ,GAAG;AAC3E,UAAI,kBAAkB,IAAI;AACxB,cAAMA,YAAW,CAAC,GAAG,MAAM,UAAU;AACrC,QAAAA,UAAS,aAAa,IAAI,EAAE,KAAK,KAAK;AACtC,eAAO;AAAA,UACL,YAAYA;AAAA,UACZ,aAAaA,UAASA,UAAS,SAAS,CAAC,GAAG,OAAO;AAAA,UACnD,WAAWA,UAASA,UAAS,SAAS,CAAC,GAAG,QAAQ,CAAC;AAAA,QACrD;AAAA,MACF;AAEA,YAAM,WAAW,CAAC,GAAG,MAAM,YAAY,EAAE,KAAK,KAAK,CAAC;AACpD,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa;AAAA,QACb,WAAW;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,YAAY,MAAM;AAChB,QAAI,CAAC,UAAU;AACb,YAAM,WAAW,MAAM,WAAW,MAAM,GAAG,EAAE;AAC7C,YAAM,WAAW,SAAS,SAAS,SAAS,CAAC;AAC7C,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa,UAAU,OAAO;AAAA,QAC9B,WAAW,UAAU,QAAQ,CAAC;AAAA,MAChC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,iBAAiB,CAAC,QAAgB;AAChC,QAAI,CAAC,UAAU;AACb,YAAM,WAAW,MAAM,WAAW,OAAO,CAAC,SAAS,KAAK,QAAQ,GAAG;AACnE,YAAM,WAAW,SAAS,SAAS,SAAS,CAAC;AAC7C,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa,UAAU,OAAO;AAAA,QAC9B,WAAW,UAAU,QAAQ,CAAC;AAAA,MAChC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,iBAAiB,CAAC,SAAS;AACzB,QAAI,CAAC,UAAU;AACb,UAAI,MAAM,WAAW,WAAW,EAAG,QAAO;AAE1C,YAAM,WAAW,CAAC,GAAG,MAAM,UAAU;AACrC,YAAM,YAAY,SAAS,SAAS;AACpC,eAAS,SAAS,IAAI;AAAA,QACpB,GAAG,SAAS,SAAS;AAAA,QACrB,MAAM,EAAE,GAAG,SAAS,SAAS,EAAE,MAAM,GAAG,KAAK;AAAA,MAC/C;AAEA,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,WAAW,SAAS,SAAS,EAAE;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,aAAa,CAAC,QAAgB;AAC5B,WAAO,IAAI,EAAE,WAAW,KAAK,CAAC,SAAS,KAAK,QAAQ,GAAG;AAAA,EACzD;AAAA,EAEA,cAAc,CAAC,QAAgB;AAC7B,UAAM,OAAO,IAAI,EAAE,WAAW,KAAK,CAACC,UAASA,MAAK,QAAQ,GAAG;AAC7D,WAAO,MAAM,QAAQ,CAAC;AAAA,EACxB;AACF,EAAE;","names":["newStack","item"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.32",
3
+ "version": "1.1.34",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+ import ConfigurationsMyAccountModal from './ConfigurationsMyAccountModal';
4
+ import DeleteAccountModal from './DeleteAccountModal';
5
+ import IsntPossibleDeleteAccountModal from './IsntPossibleDeleteAccountModal';
6
+ import ConfirmDeleteAccountModal from './ConfirmDeleteAccountModal';
7
+
8
+ export default function AccountModals() {
9
+ return (
10
+ <>
11
+ <ConfigurationsMyAccountModal />
12
+ <DeleteAccountModal />
13
+ <IsntPossibleDeleteAccountModal />
14
+ <ConfirmDeleteAccountModal />
15
+ </>
16
+ );
17
+ }
@@ -12,33 +12,36 @@ import { ChangePasswordSection } from './sections/ChangePasswordSection';
12
12
  import { SecuritySection } from './sections/SecuritySection';
13
13
  import useConfigurationsModal from './hooks/useConfigurationsModal';
14
14
  import useIsMobile from '../../hooks/useIsMobile';
15
- import type { ComboboxOption } from '../ui/form/ComboboxField';
16
-
17
- interface ConfigurationsMyAccountModalProps {
18
- open: boolean;
19
- onClose: () => void;
20
- initialSection?: AccountSectionType;
21
- hasActiveSubscription?: boolean;
22
- currencies?: ComboboxOption[];
23
- storageUrl?: string;
24
- onDeleteAccount?: () => void;
25
- }
15
+ import { useAccountModals } from '../../store/useAccountModals';
16
+
17
+ export default function ConfigurationsMyAccountModal() {
18
+ const {
19
+ activeModal,
20
+ config,
21
+ initialSection,
22
+ openDeleteAccount,
23
+ openIsntPossibleDelete,
24
+ close,
25
+ } = useAccountModals();
26
+
27
+ const open = activeModal === 'configurations';
28
+ const { hasActiveSubscription, currencies = [] } = config;
26
29
 
27
- export default function ConfigurationsMyAccountModal({
28
- open,
29
- onClose,
30
- initialSection,
31
- hasActiveSubscription,
32
- currencies = [],
33
- storageUrl,
34
- onDeleteAccount,
35
- }: ConfigurationsMyAccountModalProps) {
36
30
  const isMobile = useIsMobile();
37
31
  const { activeSection, setActiveSection } = useConfigurationsModal({
38
32
  isOpen: open,
39
33
  initialSection,
40
34
  });
41
35
 
36
+ const handleDeleteAccount = () => {
37
+ close();
38
+ if (hasActiveSubscription) {
39
+ openIsntPossibleDelete();
40
+ } else {
41
+ openDeleteAccount();
42
+ }
43
+ };
44
+
42
45
  const tabTriggerClasses = cn(
43
46
  'border-0! px-0 py-0',
44
47
 
@@ -55,7 +58,7 @@ export default function ConfigurationsMyAccountModal({
55
58
  );
56
59
 
57
60
  return (
58
- <Dialog open={open} onOpenChange={onClose}>
61
+ <Dialog open={open} onOpenChange={close}>
59
62
  <DialogContent
60
63
  showCloseButton={!isMobile}
61
64
  overlayClassName="bg-black/20 lg:bg-black/50"
@@ -73,7 +76,7 @@ export default function ConfigurationsMyAccountModal({
73
76
  <button
74
77
  type="button"
75
78
  className="size-8 flex items-center justify-center text-gray-500 cursor-pointer"
76
- onClick={onClose}
79
+ onClick={close}
77
80
  >
78
81
  <X size={18} />
79
82
  </button>
@@ -120,15 +123,15 @@ export default function ConfigurationsMyAccountModal({
120
123
 
121
124
  <div className="w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative">
122
125
  <TabsContent value={AccountSectionType.MY_PROFILE} className="h-full! relative overflow-hidden">
123
- <MyProfileSection onClose={onClose} storageUrl={storageUrl} />
126
+ <MyProfileSection onClose={close} />
124
127
  </TabsContent>
125
128
 
126
129
  <TabsContent value={AccountSectionType.SECURITY} className="h-full! relative overflow-hidden">
127
130
  <SecuritySection
128
131
  setActiveSection={setActiveSection}
129
- onClose={onClose}
132
+ onClose={close}
130
133
  hasActiveSubscription={hasActiveSubscription}
131
- onDeleteAccount={onDeleteAccount}
134
+ onDeleteAccount={handleDeleteAccount}
132
135
  />
133
136
  </TabsContent>
134
137
 
@@ -137,7 +140,7 @@ export default function ConfigurationsMyAccountModal({
137
140
  </TabsContent>
138
141
 
139
142
  <TabsContent value={AccountSectionType.PREFERENCES} className="h-full! relative overflow-hidden">
140
- <PreferencesSection onClose={onClose} currencies={currencies} />
143
+ <PreferencesSection onClose={close} currencies={currencies} />
141
144
  </TabsContent>
142
145
  </div>
143
146
  </Tabs>
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+
3
+ import { TriangleAlert } from 'lucide-react';
4
+ import { toast } from 'sonner';
5
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
6
+ import { Button } from '../ui/buttons/Button';
7
+ import { Toast } from '../ui/feedback/Toast';
8
+ import { useAccountModals } from '../../store/useAccountModals';
9
+
10
+ export default function ConfirmDeleteAccountModal() {
11
+ const { activeModal, pagesCount, close } = useAccountModals();
12
+ const open = activeModal === 'confirmDelete';
13
+
14
+ const handleConfirm = () => {
15
+ toast.custom((t) => (
16
+ <Toast variant="success" message="Conta excluída com sucesso" toastId={t} />
17
+ ));
18
+ close();
19
+ };
20
+
21
+ return (
22
+ <Dialog open={open} onOpenChange={close}>
23
+ <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%]!">
24
+ <div className="flex flex-col gap-5 p-4 lg:p-5">
25
+ <DialogHeader className="p-0">
26
+ <DialogTitle className="paragraph-medium-semibold text-gray-950">
27
+ Uma pena te ver ir!
28
+ </DialogTitle>
29
+ </DialogHeader>
30
+
31
+ <div className="bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4">
32
+ <TriangleAlert size={20} className="text-red-500 shrink-0" strokeWidth={2} />
33
+ <p className="paragraph-small-regular text-gray-600">
34
+ Todas suas{' '}
35
+ <span className="font-semibold text-gray-950">{pagesCount} páginas</span>{' '}
36
+ serão deletadas permanentemente. Essa ação é{' '}
37
+ <span className="font-semibold text-gray-950">irreversível!</span>
38
+ </p>
39
+ </div>
40
+ </div>
41
+
42
+ <div className="h-px bg-gray-200" />
43
+
44
+ <div className="flex items-center gap-2 p-4 lg:p-5">
45
+ <Button className="h-10 flex-1" onClick={close}>
46
+ Manter minha conta
47
+ </Button>
48
+ <Button variant="secondary" className="h-10! flex-1" onClick={handleConfirm}>
49
+ Excluir mesmo assim
50
+ </Button>
51
+ </div>
52
+ </DialogContent>
53
+ </Dialog>
54
+ );
55
+ }
@@ -0,0 +1,130 @@
1
+ 'use client';
2
+
3
+ import { useState, useCallback } from 'react';
4
+ import { Lock, TriangleAlert } from 'lucide-react';
5
+ import { toast } from 'sonner';
6
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
7
+ import { Button } from '../ui/buttons/Button';
8
+ import { FormField } from '../ui/form/FormField';
9
+ import { SelectField } from '../ui/form/SelectField';
10
+ import { TextAreaField } from '../ui/form/TextAreaField';
11
+ import { Toast } from '../ui/feedback/Toast';
12
+ import usePasswordVisibility from '../../hooks/usePasswordVisibility';
13
+ import { useAccountModals } from '../../store/useAccountModals';
14
+ import { AccountSectionType } from '../../enums/AccountSectionType';
15
+
16
+ const REASON_OPTIONS = [
17
+ { value: 'sem-funcao', label: 'A ferramenta não possui uma função que eu preciso' },
18
+ { value: 'problemas', label: 'Encontrei problemas técnicos ou erros no sistema' },
19
+ { value: 'suporte', label: 'Tive problemas com o suporte ou atendimento' },
20
+ { value: 'demora', label: 'As atualizações demoram mais do que o esperado' },
21
+ { value: 'temporario', label: 'O cancelamento é temporário' },
22
+ { value: 'outro', label: 'Outro motivo' },
23
+ ];
24
+
25
+ export default function DeleteAccountModal() {
26
+ const { activeModal, pagesCount, openConfigurations, openConfirmDelete, close } = useAccountModals();
27
+ const open = activeModal === 'deleteAccount';
28
+
29
+ const [reason, setReason] = useState('');
30
+ const [description, setDescription] = useState('');
31
+ const [password, setPassword] = useState('');
32
+ const { showPassword, togglePassword } = usePasswordVisibility();
33
+
34
+ const isFormValid = Boolean(reason && description && password);
35
+
36
+ const resetForm = useCallback(() => {
37
+ setReason('');
38
+ setDescription('');
39
+ setPassword('');
40
+ }, []);
41
+
42
+ const handleClose = () => {
43
+ resetForm();
44
+ openConfigurations(AccountSectionType.SECURITY);
45
+ };
46
+
47
+ const handleDelete = (e: React.FormEvent) => {
48
+ e.preventDefault();
49
+ if (!isFormValid) {
50
+ toast.custom((t) => (
51
+ <Toast variant="error" message="Preencha todos os campos obrigatórios" toastId={t} />
52
+ ));
53
+ return;
54
+ }
55
+ resetForm();
56
+ openConfirmDelete(pagesCount);
57
+ };
58
+
59
+ return (
60
+ <Dialog open={open} onOpenChange={handleClose}>
61
+ <DialogContent 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-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">
62
+ <form onSubmit={handleDelete} className="flex flex-col flex-1 lg:flex-none">
63
+ <div className="flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none">
64
+ <DialogHeader className="p-0">
65
+ <div className="flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5">
66
+ <TriangleAlert size={20} className="text-red-500" />
67
+ </div>
68
+ <DialogTitle>Excluir conta</DialogTitle>
69
+ <DialogDescription className="paragraph-small-regular">
70
+ Esta ação é <span className="font-semibold text-gray-950">irreversível</span>. Ao
71
+ confirmar, sua conta e todos os seus dados serão excluídos.
72
+ </DialogDescription>
73
+ </DialogHeader>
74
+
75
+ <SelectField
76
+ label="Motivo do cancelamento"
77
+ required
78
+ placeholder="Selecione"
79
+ options={REASON_OPTIONS}
80
+ value={reason}
81
+ onChange={(value) => setReason(value as string)}
82
+ className="h-10!"
83
+ />
84
+
85
+ <div>
86
+ <TextAreaField
87
+ label="Descreva o que levou a tomar essa decisão"
88
+ required
89
+ placeholder="Explique sua decisão..."
90
+ value={description}
91
+ onChange={(e) => setDescription(e.target.value)}
92
+ rows={4}
93
+ maxLength={400}
94
+ />
95
+ <span className="paragraph-xsmall-medium text-gray-600 text-left mt-1 block">
96
+ {description.length}/400 caracteres
97
+ </span>
98
+ </div>
99
+
100
+ <FormField
101
+ className="text-gray-600"
102
+ label="Senha"
103
+ type="password"
104
+ placeholder="Informe sua senha"
105
+ leftIcon={Lock}
106
+ value={password}
107
+ onChange={(e) => setPassword(e.target.value)}
108
+ classnameContainer="h-10!"
109
+ showPassword={showPassword}
110
+ onTogglePassword={togglePassword}
111
+ />
112
+ </div>
113
+
114
+ <div className="flex flex-row items-center gap-2 p-4 lg:p-6 border-t border-gray-200 bg-white mt-auto lg:mt-0">
115
+ <Button
116
+ variant="default"
117
+ className="h-10 flex-1 bg-gray-950 text-white hover:bg-gray-800"
118
+ type="submit"
119
+ >
120
+ Excluir conta
121
+ </Button>
122
+ <Button variant="secondary" className="h-10 flex-1" type="button" onClick={handleClose}>
123
+ Fechar
124
+ </Button>
125
+ </div>
126
+ </form>
127
+ </DialogContent>
128
+ </Dialog>
129
+ );
130
+ }
@@ -0,0 +1,49 @@
1
+ 'use client';
2
+
3
+ import { TriangleAlert } from 'lucide-react';
4
+ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
5
+ import { Button } from '../ui/buttons/Button';
6
+ import { useAccountModals } from '../../store/useAccountModals';
7
+
8
+ export default function IsntPossibleDeleteAccountModal() {
9
+ const { activeModal, close, config } = useAccountModals();
10
+ const { onGoToSubscription } = config;
11
+ const open = activeModal === 'isntPossibleDelete';
12
+
13
+ return (
14
+ <Dialog open={open} onOpenChange={close}>
15
+ <DialogContent className="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%]!">
16
+ <div className="flex flex-col gap-5">
17
+ <div className="flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5">
18
+ <TriangleAlert size={20} className="text-red-500" />
19
+ </div>
20
+ <DialogHeader className="p-0 gap-2">
21
+ <DialogTitle className="paragraph-medium-semibold text-gray-950">
22
+ Não é possível excluir a conta
23
+ </DialogTitle>
24
+ <DialogDescription className="paragraph-small-regular text-gray-600">
25
+ Você tem uma assinatura ativa. Para excluir sua conta,{' '}
26
+ <span className="font-semibold text-gray-950">primeiro cancele a assinatura</span> na
27
+ página Assinatura e depois tente novamente.
28
+ </DialogDescription>
29
+ </DialogHeader>
30
+ </div>
31
+
32
+ <div className="h-px bg-gray-200 -mx-6" />
33
+
34
+ <div className="flex flex-row items-center gap-2">
35
+ <Button className="h-10 flex-1" onClick={close}>
36
+ Ok, entendi
37
+ </Button>
38
+ <Button
39
+ variant="secondary"
40
+ className="h-10 flex-1"
41
+ onClick={onGoToSubscription ?? close}
42
+ >
43
+ Ir para assinatura
44
+ </Button>
45
+ </div>
46
+ </DialogContent>
47
+ </Dialog>
48
+ );
49
+ }