@greatapps/common 1.1.173 → 1.1.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/AccountModals.mjs +18 -0
- package/dist/components/account/AccountModals.mjs.map +1 -0
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +132 -0
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -0
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +45 -0
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +45 -0
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -0
- package/dist/components/account/DeleteAccountModal.mjs +123 -0
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/DisableTwoFactorAuthModal.mjs +67 -0
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -0
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +42 -0
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/TwoFactorAuthModal.mjs +190 -0
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -0
- package/dist/components/account/constants.mjs +29 -0
- package/dist/components/account/constants.mjs.map +1 -0
- package/dist/components/account/hooks/useChangeEmailForm.mjs +53 -0
- package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -0
- package/dist/components/account/hooks/useChangePasswordForm.mjs +47 -0
- package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -0
- package/dist/components/account/hooks/useChangePhoneForm.mjs +72 -0
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -0
- package/dist/components/account/hooks/useConfigurationsModal.mjs +33 -0
- package/dist/components/account/hooks/useConfigurationsModal.mjs.map +1 -0
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +54 -0
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -0
- package/dist/components/account/hooks/useOtpVerification.mjs +94 -0
- package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -0
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +80 -0
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -0
- package/dist/components/account/sections/ChangeEmailModal.mjs +181 -0
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs +64 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -0
- package/dist/components/account/sections/ChangePhoneModal.mjs +187 -0
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -0
- package/dist/components/account/sections/MyProfileSection.mjs +303 -0
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -0
- package/dist/components/account/sections/PreferencesSection.mjs +250 -0
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -0
- package/dist/components/account/sections/SecuritySection.mjs +147 -0
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -0
- package/dist/components/handlers/SearchParamsHandler.mjs +24 -0
- package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -0
- package/dist/components/layouts/AppMobileNavBar.mjs +115 -0
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
- package/dist/components/layouts/AppNavBar.mjs +49 -0
- package/dist/components/layouts/AppNavBar.mjs.map +1 -0
- package/dist/components/layouts/MainLayout.mjs +60 -0
- package/dist/components/layouts/MainLayout.mjs.map +1 -0
- package/dist/components/layouts/MdSideBarNavigation.mjs +54 -0
- package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -0
- package/dist/components/layouts/NavBar.mjs +132 -0
- package/dist/components/layouts/NavBar.mjs.map +1 -0
- package/dist/components/layouts/NavBarItem.mjs +23 -0
- package/dist/components/layouts/NavBarItem.mjs.map +1 -0
- package/dist/components/layouts/NotificationsPopover.mjs +97 -0
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -0
- package/dist/components/layouts/ProfilePopover.mjs +149 -0
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -0
- package/dist/components/layouts/SideBarNavigation.mjs +22 -0
- package/dist/components/layouts/SideBarNavigation.mjs.map +1 -0
- package/dist/components/layouts/UsersSelectorPopover.mjs +230 -0
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -0
- package/dist/components/modals/ModalManager.mjs +19 -0
- package/dist/components/modals/ModalManager.mjs.map +1 -0
- package/dist/components/modals/Modals.mjs +20 -0
- package/dist/components/modals/Modals.mjs.map +1 -0
- package/dist/components/navigation/AppNavigation.mjs +30 -0
- package/dist/components/navigation/AppNavigation.mjs.map +1 -0
- package/dist/components/navigation/AppNavigationContext.mjs +13 -0
- package/dist/components/navigation/AppNavigationContext.mjs.map +1 -0
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +59 -0
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -0
- package/dist/components/navigation/NavItem.mjs +35 -0
- package/dist/components/navigation/NavItem.mjs.map +1 -0
- package/dist/components/navigation/NavItemsContext.mjs +16 -0
- package/dist/components/navigation/NavItemsContext.mjs.map +1 -0
- package/dist/components/navigation/ProjectSelectorPopover.mjs +128 -0
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -0
- package/dist/components/navigation/shells/DesktopShell.mjs +11 -0
- package/dist/components/navigation/shells/DesktopShell.mjs.map +1 -0
- package/dist/components/navigation/shells/MdShell.mjs +11 -0
- package/dist/components/navigation/shells/MdShell.mjs.map +1 -0
- package/dist/components/navigation/shells/MobileShell.mjs +27 -0
- package/dist/components/navigation/shells/MobileShell.mjs.map +1 -0
- package/dist/components/navigation/shells/TabsMobileShell.mjs +59 -0
- package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +30 -0
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/NavItems.mjs +25 -0
- package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/PlanCard.mjs +25 -0
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +130 -0
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -0
- package/dist/components/navigation/types.mjs +1 -0
- package/dist/components/navigation/types.mjs.map +1 -0
- package/dist/components/pages/notifications/Notifications.mjs +156 -0
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -0
- package/dist/components/ui/buttons/Button.mjs +52 -0
- package/dist/components/ui/buttons/Button.mjs.map +1 -0
- package/dist/components/ui/buttons/CancelButton.mjs +17 -0
- package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
- package/dist/components/ui/buttons/CopyButton.mjs +42 -0
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
- package/dist/components/ui/data-display/Accordion.mjs +76 -0
- package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
- package/dist/components/ui/data-display/Badge.mjs +42 -0
- package/dist/components/ui/data-display/Badge.mjs.map +1 -0
- package/dist/components/ui/data-display/Card.mjs +92 -0
- package/dist/components/ui/data-display/Card.mjs.map +1 -0
- package/dist/components/ui/data-display/Pagination.mjs +118 -0
- package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
- package/dist/components/ui/data-display/ScrollArea.mjs +62 -0
- package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
- package/dist/components/ui/data-display/Separator.mjs +28 -0
- package/dist/components/ui/data-display/Separator.mjs.map +1 -0
- package/dist/components/ui/data-display/Table.mjs +116 -0
- package/dist/components/ui/data-display/Table.mjs.map +1 -0
- package/dist/components/ui/data-display/Tabs.mjs +69 -0
- package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
- package/dist/components/ui/data-display/UserAvatar.mjs +49 -0
- package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -0
- package/dist/components/ui/feedback/CircularProgress.mjs +71 -0
- package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +50 -0
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
- package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
- package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
- package/dist/components/ui/feedback/Progress.mjs +37 -0
- package/dist/components/ui/feedback/Progress.mjs.map +1 -0
- package/dist/components/ui/feedback/Toast.mjs +77 -0
- package/dist/components/ui/feedback/Toast.mjs.map +1 -0
- package/dist/components/ui/form/Calendar.mjs +204 -0
- package/dist/components/ui/form/Calendar.mjs.map +1 -0
- package/dist/components/ui/form/Checkbox.mjs +33 -0
- package/dist/components/ui/form/Checkbox.mjs.map +1 -0
- package/dist/components/ui/form/ComboboxField.mjs +130 -0
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
- package/dist/components/ui/form/DatePicker.mjs +82 -0
- package/dist/components/ui/form/DatePicker.mjs.map +1 -0
- package/dist/components/ui/form/DateRangePicker.mjs +92 -0
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
- package/dist/components/ui/form/FormField.mjs +103 -0
- package/dist/components/ui/form/FormField.mjs.map +1 -0
- package/dist/components/ui/form/Input.mjs +21 -0
- package/dist/components/ui/form/Input.mjs.map +1 -0
- package/dist/components/ui/form/InputOtp.mjs +70 -0
- package/dist/components/ui/form/InputOtp.mjs.map +1 -0
- package/dist/components/ui/form/PhoneInput.mjs +119 -0
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
- package/dist/components/ui/form/RadioGroup.mjs +37 -0
- package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
- package/dist/components/ui/form/Select.mjs +179 -0
- package/dist/components/ui/form/Select.mjs.map +1 -0
- package/dist/components/ui/form/SelectField.mjs +80 -0
- package/dist/components/ui/form/SelectField.mjs.map +1 -0
- package/dist/components/ui/form/Switch.mjs +33 -0
- package/dist/components/ui/form/Switch.mjs.map +1 -0
- package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
- package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
- package/dist/components/ui/form/TextAreaField.mjs +56 -0
- package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
- package/dist/components/ui/form/Textarea.mjs +20 -0
- package/dist/components/ui/form/Textarea.mjs.map +1 -0
- package/dist/components/ui/overlay/Command.mjs +178 -0
- package/dist/components/ui/overlay/Command.mjs.map +1 -0
- package/dist/components/ui/overlay/Dialog.mjs +142 -0
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
- package/dist/components/ui/overlay/Popover.mjs +46 -0
- package/dist/components/ui/overlay/Popover.mjs.map +1 -0
- package/dist/components/ui/overlay/Sheet.mjs +142 -0
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
- package/dist/components/ui/overlay/Tooltip.mjs +57 -0
- package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
- package/dist/components/widgets/notifications/NotificationCard.mjs +54 -0
- package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -0
- package/dist/enums/AccountSectionType.mjs +11 -0
- package/dist/enums/AccountSectionType.mjs.map +1 -0
- package/dist/hooks/copy-to-clipboard.hook.mjs +52 -0
- package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
- package/dist/hooks/useCountdownTimer.mjs +29 -0
- package/dist/hooks/useCountdownTimer.mjs.map +1 -0
- package/dist/hooks/useDebounce.mjs +19 -0
- package/dist/hooks/useDebounce.mjs.map +1 -0
- package/dist/hooks/useDebounceState.mjs +12 -0
- package/dist/hooks/useDebounceState.mjs.map +1 -0
- package/dist/hooks/useDebouncedEffect.mjs +44 -0
- package/dist/hooks/useDebouncedEffect.mjs.map +1 -0
- package/dist/hooks/useIsMobile.mjs +18 -0
- package/dist/hooks/useIsMobile.mjs.map +1 -0
- package/dist/hooks/usePasswordVisibility.mjs +13 -0
- package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
- package/dist/index.mjs +457 -0
- package/dist/index.mjs.map +1 -0
- package/dist/infra/api/client.mjs +136 -0
- package/dist/infra/api/client.mjs.map +1 -0
- package/dist/infra/api/types.mjs +31 -0
- package/dist/infra/api/types.mjs.map +1 -0
- package/dist/infra/utils/client-info.mjs +27 -0
- package/dist/infra/utils/client-info.mjs.map +1 -0
- package/dist/infra/utils/clsx.mjs +9 -0
- package/dist/infra/utils/clsx.mjs.map +1 -0
- package/dist/infra/utils/params.mjs +21 -0
- package/dist/infra/utils/params.mjs.map +1 -0
- package/dist/infra/utils/parser.mjs +24 -0
- package/dist/infra/utils/parser.mjs.map +1 -0
- package/dist/infra/utils/percentage.mjs +20 -0
- package/dist/infra/utils/percentage.mjs.map +1 -0
- package/dist/middleware.mjs +10 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/middlewares/chain.mjs +37 -0
- package/dist/middlewares/chain.mjs.map +1 -0
- package/dist/middlewares/create-auth-middleware.mjs +28 -0
- package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
- package/dist/middlewares/types.mjs +11 -0
- package/dist/middlewares/types.mjs.map +1 -0
- package/dist/modules/accounts/actions/account-management.action.mjs +82 -0
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
- package/dist/modules/accounts/actions/find-current-account.action.mjs +10 -0
- package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -0
- package/dist/modules/accounts/actions/list-currencies.action.mjs +10 -0
- package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -0
- package/dist/modules/accounts/actions/list-timezones.action.mjs +10 -0
- package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -0
- package/dist/modules/accounts/hooks/current-account.hook.mjs +24 -0
- package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useAccountManagement.mjs +71 -0
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useCurrencies.mjs +17 -0
- package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useTimezones.mjs +17 -0
- package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -0
- package/dist/modules/accounts/services/account.service.mjs +180 -0
- package/dist/modules/accounts/services/account.service.mjs.map +1 -0
- package/dist/modules/accounts/services/currency.service.mjs +24 -0
- package/dist/modules/accounts/services/currency.service.mjs.map +1 -0
- package/dist/modules/accounts/services/timezone.service.mjs +65 -0
- package/dist/modules/accounts/services/timezone.service.mjs.map +1 -0
- package/dist/modules/accounts/services/two-factor.service.mjs +77 -0
- package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
- package/dist/modules/accounts/types.mjs +1 -0
- package/dist/modules/accounts/types.mjs.map +1 -0
- package/dist/modules/auth/actions/login.action.mjs +14 -0
- package/dist/modules/auth/actions/login.action.mjs.map +1 -0
- package/dist/modules/auth/actions/logout.action.mjs +14 -0
- package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
- package/dist/modules/auth/actions/register.action.mjs +14 -0
- package/dist/modules/auth/actions/register.action.mjs.map +1 -0
- package/dist/modules/auth/actions/validate-session.action.mjs +60 -0
- package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
- package/dist/modules/auth/actions/verify-two-factor.action.mjs +17 -0
- package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -0
- package/dist/modules/auth/hooks/login.hook.mjs +13 -0
- package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
- package/dist/modules/auth/hooks/logout.hook.mjs +13 -0
- package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
- package/dist/modules/auth/hooks/register.hook.mjs +13 -0
- package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
- package/dist/modules/auth/hooks/useUserQuery.mjs +63 -0
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
- package/dist/modules/auth/schema.mjs +1 -0
- package/dist/modules/auth/schema.mjs.map +1 -0
- package/dist/modules/auth/services/auth.service.mjs +294 -0
- package/dist/modules/auth/services/auth.service.mjs.map +1 -0
- package/dist/modules/auth/utils/get-user-context.mjs +24 -0
- package/dist/modules/auth/utils/get-user-context.mjs.map +1 -0
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +10 -0
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -0
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +76 -0
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs +31 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -0
- package/dist/modules/ia-credits/types.mjs +25 -0
- package/dist/modules/ia-credits/types.mjs.map +1 -0
- package/dist/modules/projects/actions/add-project-user.action.mjs +10 -0
- package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -0
- package/dist/modules/projects/actions/list-available-users.action.mjs +10 -0
- package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -0
- package/dist/modules/projects/actions/list-project-users.action.mjs +10 -0
- package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -0
- package/dist/modules/projects/actions/remove-project-user.action.mjs +10 -0
- package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +34 -0
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +34 -0
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/services/project-users.service.mjs +78 -0
- package/dist/modules/projects/services/project-users.service.mjs.map +1 -0
- package/dist/modules/projects/types.mjs +22 -0
- package/dist/modules/projects/types.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs +12 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +20 -0
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +18 -0
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs +32 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -0
- package/dist/modules/subscriptions/types.mjs +57 -0
- package/dist/modules/subscriptions/types.mjs.map +1 -0
- package/dist/modules/users/action/find-user-by-id.action.mjs +10 -0
- package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
- package/dist/modules/users/action/list-messages.action.mjs +13 -0
- package/dist/modules/users/action/list-messages.action.mjs.map +1 -0
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +10 -0
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -0
- package/dist/modules/users/action/mark-message-as-read.action.mjs +10 -0
- package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -0
- package/dist/modules/users/hooks/messages.hook.mjs +57 -0
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -0
- package/dist/modules/users/schema/messages.schema.mjs +21 -0
- package/dist/modules/users/schema/messages.schema.mjs.map +1 -0
- package/dist/modules/users/schema.mjs +11 -0
- package/dist/modules/users/schema.mjs.map +1 -0
- package/dist/modules/users/services/messages.service.mjs +35 -0
- package/dist/modules/users/services/messages.service.mjs.map +1 -0
- package/dist/modules/users/services/user.service.mjs +50 -0
- package/dist/modules/users/services/user.service.mjs.map +1 -0
- package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs +15 -0
- package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs.map +1 -0
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +21 -0
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
- package/dist/modules/whitelabel/schema.mjs +1 -0
- package/dist/modules/whitelabel/schema.mjs.map +1 -0
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs +81 -0
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +1 -0
- package/dist/modules/whitelabel/services/whitelabel.service.mjs +61 -0
- package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
- package/dist/modules/whitelabel/styles-schema.mjs +1 -0
- package/dist/modules/whitelabel/styles-schema.mjs.map +1 -0
- package/dist/providers/auth.provider.mjs +100 -0
- package/dist/providers/auth.provider.mjs.map +1 -0
- package/dist/providers/query.provider.mjs +99 -0
- package/dist/providers/query.provider.mjs.map +1 -0
- package/dist/providers/whitelabel.provider.mjs +31 -0
- package/dist/providers/whitelabel.provider.mjs.map +1 -0
- package/dist/server.mjs +84 -0
- package/dist/server.mjs.map +1 -0
- package/dist/store/useAccountModals.mjs +18 -0
- package/dist/store/useAccountModals.mjs.map +1 -0
- package/dist/store/useMdSidebarStore.mjs +11 -0
- package/dist/store/useMdSidebarStore.mjs.map +1 -0
- package/dist/store/useMobileNavbarSheet.mjs +14 -0
- package/dist/store/useMobileNavbarSheet.mjs.map +1 -0
- package/dist/store/useModalManager.mjs +75 -0
- package/dist/store/useModalManager.mjs.map +1 -0
- package/dist/utils/browser/clipboard.mjs +36 -0
- package/dist/utils/browser/clipboard.mjs.map +1 -0
- package/dist/utils/file/index.mjs +9 -0
- package/dist/utils/file/index.mjs.map +1 -0
- package/dist/utils/format/masks.mjs +56 -0
- package/dist/utils/format/masks.mjs.map +1 -0
- package/dist/utils/intl/locales.mjs +12 -0
- package/dist/utils/intl/locales.mjs.map +1 -0
- package/dist/utils/safeServerAction.mjs +16 -0
- package/dist/utils/safeServerAction.mjs.map +1 -0
- package/dist/utils/validators/account.mjs +26 -0
- package/dist/utils/validators/account.mjs.map +1 -0
- package/dist/utils/validators/common.mjs +47 -0
- package/dist/utils/validators/common.mjs.map +1 -0
- package/dist/utils/withAction.mjs +13 -0
- package/dist/utils/withAction.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/account/hooks/useChangePhoneForm.tsx +78 -69
- package/src/components/account/sections/ChangeEmailModal.tsx +2 -1
- package/src/components/account/sections/ChangePhoneModal.tsx +234 -229
- package/src/components/ui/form/PhoneInput.tsx +148 -98
- package/src/modules/accounts/actions/account-management.action.ts +4 -4
- package/src/modules/accounts/services/account.service.ts +4 -4
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { useForm } from "react-hook-form";
|
|
5
|
+
import { toast } from "sonner";
|
|
6
|
+
import { Lock, Mail, MessageCircle } from "lucide-react";
|
|
7
|
+
import { Button } from "../../ui/buttons/Button";
|
|
8
|
+
import { Separator } from "../../ui/data-display/Separator";
|
|
9
|
+
import { Toast } from "../../ui/feedback/Toast";
|
|
10
|
+
import { ComboboxField } from "../../ui/form/ComboboxField";
|
|
11
|
+
import { SelectField } from "../../ui/form/SelectField";
|
|
12
|
+
import SwitchOptionFieldWithIcon from "../../ui/form/SwitchOptionFieldWithIcon";
|
|
13
|
+
import ConfirmGlobalPreferencesModal from "../ConfirmGlobalPreferencesModal";
|
|
14
|
+
import { useAuth } from "../../../providers/auth.provider";
|
|
15
|
+
import { UserProfile } from "../../../modules/users/schema";
|
|
16
|
+
import {
|
|
17
|
+
useUpdateAccountUser,
|
|
18
|
+
useUpdateAccount
|
|
19
|
+
} from "../../../modules/accounts/hooks/useAccountManagement";
|
|
20
|
+
import {
|
|
21
|
+
LANGUAGE_OPTIONS,
|
|
22
|
+
TIME_FORMAT_OPTIONS,
|
|
23
|
+
NOTIFICATION_TYPES
|
|
24
|
+
} from "../constants";
|
|
25
|
+
import { useTimezones } from "../../../modules/accounts/hooks/useTimezones";
|
|
26
|
+
import { useCurrencies } from "../../../modules/accounts/hooks/useCurrencies";
|
|
27
|
+
function PreferencesSection({ onClose }) {
|
|
28
|
+
const { data: timezones = [] } = useTimezones();
|
|
29
|
+
const { data: currencies = [] } = useCurrencies();
|
|
30
|
+
const { user, account } = useAuth();
|
|
31
|
+
const canEditPreferences = user?.profile === UserProfile.owner || user?.profile === UserProfile.admin;
|
|
32
|
+
const updateAccountUser = useUpdateAccountUser();
|
|
33
|
+
const updateAccount = useUpdateAccount();
|
|
34
|
+
const [confirmGlobalOpen, setConfirmGlobalOpen] = useState(false);
|
|
35
|
+
const [pendingSubmit, setPendingSubmit] = useState(null);
|
|
36
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
37
|
+
const { watch, setValue, handleSubmit, reset, formState: { dirtyFields } } = useForm({
|
|
38
|
+
defaultValues: {
|
|
39
|
+
language: "",
|
|
40
|
+
currency: "",
|
|
41
|
+
timezone: "",
|
|
42
|
+
timeFormat: "24h",
|
|
43
|
+
receive_sms: false,
|
|
44
|
+
receive_email: false
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!user || !account) return;
|
|
49
|
+
reset({
|
|
50
|
+
language: LANGUAGE_OPTIONS.find(
|
|
51
|
+
(o) => o.apiValue === user.language?.toLowerCase()
|
|
52
|
+
)?.value ?? "pt-BR",
|
|
53
|
+
currency: account.currency,
|
|
54
|
+
timezone: account.timezone,
|
|
55
|
+
timeFormat: "24h",
|
|
56
|
+
receive_sms: user.receive_sms ?? false,
|
|
57
|
+
receive_email: user.receive_email ?? false
|
|
58
|
+
});
|
|
59
|
+
}, [user, account, reset]);
|
|
60
|
+
const receiveSms = watch("receive_sms");
|
|
61
|
+
const receiveEmail = watch("receive_email");
|
|
62
|
+
const doSave = async (data, accountFields) => {
|
|
63
|
+
setIsSaving(true);
|
|
64
|
+
try {
|
|
65
|
+
const apiLanguage = LANGUAGE_OPTIONS.find((o) => o.value === data.language)?.apiValue ?? data.language.toLowerCase();
|
|
66
|
+
await updateAccountUser.mutateAsync({
|
|
67
|
+
language: apiLanguage,
|
|
68
|
+
receive_sms: data.receive_sms,
|
|
69
|
+
receive_email: data.receive_email
|
|
70
|
+
});
|
|
71
|
+
if (canEditPreferences && Object.keys(accountFields).length > 0) {
|
|
72
|
+
await updateAccount.mutateAsync(accountFields);
|
|
73
|
+
}
|
|
74
|
+
reset(data);
|
|
75
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Prefer\xEAncias salvas com sucesso", toastId: t }));
|
|
76
|
+
onClose();
|
|
77
|
+
} catch (error) {
|
|
78
|
+
toast.custom((t) => /* @__PURE__ */ jsx(
|
|
79
|
+
Toast,
|
|
80
|
+
{
|
|
81
|
+
variant: "error",
|
|
82
|
+
message: error instanceof Error ? error.message : "Erro ao salvar prefer\xEAncias",
|
|
83
|
+
toastId: t
|
|
84
|
+
}
|
|
85
|
+
));
|
|
86
|
+
} finally {
|
|
87
|
+
setIsSaving(false);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const onSubmit = (data) => {
|
|
91
|
+
const accountFields = {
|
|
92
|
+
...canEditPreferences && dirtyFields.currency && { currency: data.currency },
|
|
93
|
+
...canEditPreferences && dirtyFields.timezone && { timezone: data.timezone }
|
|
94
|
+
};
|
|
95
|
+
const globalFieldChanged = Object.keys(accountFields).length > 0;
|
|
96
|
+
if (globalFieldChanged) {
|
|
97
|
+
setPendingSubmit({ data, accountFields });
|
|
98
|
+
setConfirmGlobalOpen(true);
|
|
99
|
+
} else {
|
|
100
|
+
doSave(data, accountFields);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const handleConfirmGlobal = () => {
|
|
104
|
+
setConfirmGlobalOpen(false);
|
|
105
|
+
if (pendingSubmit) {
|
|
106
|
+
doSave(pendingSubmit.data, pendingSubmit.accountFields);
|
|
107
|
+
setPendingSubmit(null);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const handleCancelGlobal = () => {
|
|
111
|
+
setConfirmGlobalOpen(false);
|
|
112
|
+
setPendingSubmit(null);
|
|
113
|
+
};
|
|
114
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
115
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "lg:h-full lg:flex lg:flex-col", children: [
|
|
116
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute inset-0 overflow-y-auto overscroll-contain px-4 pb-36 lg:p-5 lg:static lg:flex-1 lg:min-h-0 lg:overscroll-auto flex flex-col gap-5 lg:gap-6", children: [
|
|
117
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Prefer\xEAncias" }),
|
|
118
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", children: [
|
|
119
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row items-center gap-3", children: [
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
ComboboxField,
|
|
122
|
+
{
|
|
123
|
+
label: "Idioma",
|
|
124
|
+
placeholder: "Selecione o idioma",
|
|
125
|
+
searchPlaceholder: "Buscar idioma...",
|
|
126
|
+
containerClassName: "w-full",
|
|
127
|
+
options: LANGUAGE_OPTIONS,
|
|
128
|
+
value: watch("language"),
|
|
129
|
+
onChange: (value) => setValue("language", value, { shouldDirty: true })
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
ComboboxField,
|
|
134
|
+
{
|
|
135
|
+
label: "Moeda",
|
|
136
|
+
placeholder: "Selecione a moeda",
|
|
137
|
+
searchPlaceholder: "Buscar moeda...",
|
|
138
|
+
containerClassName: "w-full",
|
|
139
|
+
options: currencies,
|
|
140
|
+
value: watch("currency"),
|
|
141
|
+
onChange: (value) => setValue("currency", value, { shouldDirty: true }),
|
|
142
|
+
icon: !canEditPreferences ? /* @__PURE__ */ jsx(Lock, { className: "size-4 text-gray-400" }) : void 0,
|
|
143
|
+
disabled: !canEditPreferences
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
148
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
149
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-600", children: "Exibi\xE7\xE3o hora" }),
|
|
150
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row items-center gap-3", children: [
|
|
151
|
+
/* @__PURE__ */ jsx(
|
|
152
|
+
ComboboxField,
|
|
153
|
+
{
|
|
154
|
+
label: "Fuso hor\xE1rio",
|
|
155
|
+
placeholder: "Selecione o fuso hor\xE1rio",
|
|
156
|
+
searchPlaceholder: "Buscar fuso hor\xE1rio...",
|
|
157
|
+
containerClassName: "w-full",
|
|
158
|
+
options: timezones,
|
|
159
|
+
value: watch("timezone"),
|
|
160
|
+
onChange: (value) => setValue("timezone", value, { shouldDirty: true }),
|
|
161
|
+
icon: !canEditPreferences ? /* @__PURE__ */ jsx(Lock, { className: "size-4 text-gray-400" }) : void 0,
|
|
162
|
+
disabled: !canEditPreferences
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ jsx(
|
|
166
|
+
SelectField,
|
|
167
|
+
{
|
|
168
|
+
label: "Formato hora",
|
|
169
|
+
placeholder: "Selecione o formato",
|
|
170
|
+
className: "h-10!",
|
|
171
|
+
containerClassName: "w-full",
|
|
172
|
+
options: TIME_FORMAT_OPTIONS,
|
|
173
|
+
value: watch("timeFormat"),
|
|
174
|
+
onChange: (value) => setValue("timeFormat", value, { shouldDirty: true }),
|
|
175
|
+
icon: /* @__PURE__ */ jsx(Lock, { className: "size-4 text-gray-400" }),
|
|
176
|
+
disabled: true
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
] })
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-600", children: "Notifica\xE7\xF5es" }),
|
|
184
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
185
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col border border-gray-200 rounded-lg", children: [
|
|
186
|
+
/* @__PURE__ */ jsx(
|
|
187
|
+
SwitchOptionFieldWithIcon,
|
|
188
|
+
{
|
|
189
|
+
icon: MessageCircle,
|
|
190
|
+
label: "WhatsApp",
|
|
191
|
+
description: "Receber notifica\xE7\xF5es importantes por WhatsApp",
|
|
192
|
+
checked: receiveSms,
|
|
193
|
+
onCheckedChange: (val) => setValue("receive_sms", val, { shouldDirty: true })
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
SwitchOptionFieldWithIcon,
|
|
198
|
+
{
|
|
199
|
+
icon: Mail,
|
|
200
|
+
label: "E-mail",
|
|
201
|
+
description: "Receber notifica\xE7\xF5es e atualiza\xE7\xF5es por email",
|
|
202
|
+
checked: receiveEmail,
|
|
203
|
+
onCheckedChange: (val) => setValue("receive_email", val, { shouldDirty: true }),
|
|
204
|
+
hideBorderBottom: true
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-5 pb-6 rounded-lg bg-gray-50", children: [
|
|
209
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "Tipos de notifica\xE7\xF5es incluem:" }),
|
|
210
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: NOTIFICATION_TYPES.map((type) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
211
|
+
/* @__PURE__ */ jsx("div", { className: "size-1 rounded-full bg-gray-600" }),
|
|
212
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-600", children: type })
|
|
213
|
+
] }, type)) })
|
|
214
|
+
] })
|
|
215
|
+
] })
|
|
216
|
+
] })
|
|
217
|
+
] })
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ jsxs("div", { className: "fixed bottom-0 left-0 right-0 lg:static flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white z-10", children: [
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
variant: "secondary",
|
|
224
|
+
className: "h-10!",
|
|
225
|
+
type: "button",
|
|
226
|
+
disabled: isSaving,
|
|
227
|
+
onClick: () => {
|
|
228
|
+
reset();
|
|
229
|
+
onClose();
|
|
230
|
+
},
|
|
231
|
+
children: "Cancelar"
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10!", type: "submit", disabled: isSaving, children: isSaving ? "Salvando..." : "Salvar altera\xE7\xF5es" })
|
|
235
|
+
] })
|
|
236
|
+
] }),
|
|
237
|
+
/* @__PURE__ */ jsx(
|
|
238
|
+
ConfirmGlobalPreferencesModal,
|
|
239
|
+
{
|
|
240
|
+
open: confirmGlobalOpen,
|
|
241
|
+
onConfirm: handleConfirmGlobal,
|
|
242
|
+
onCancel: handleCancelGlobal
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
] });
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
PreferencesSection
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=PreferencesSection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/sections/PreferencesSection.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useEffect } from 'react';\r\nimport { useForm } from 'react-hook-form';\r\nimport { toast } from 'sonner';\r\nimport { Lock, Mail, MessageCircle } from 'lucide-react';\r\nimport { Button } from '../../ui/buttons/Button';\r\nimport { Separator } from '../../ui/data-display/Separator';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { ComboboxField } from '../../ui/form/ComboboxField';\r\nimport { SelectField } from '../../ui/form/SelectField';\r\nimport SwitchOptionFieldWithIcon from '../../ui/form/SwitchOptionFieldWithIcon';\r\nimport ConfirmGlobalPreferencesModal from '../ConfirmGlobalPreferencesModal';\r\nimport { useAuth } from '../../../providers/auth.provider';\r\nimport { UserProfile } from '../../../modules/users/schema';\r\nimport type { UpdateAccountRequest } from '../../../modules/accounts/types';\r\nimport {\r\n useUpdateAccountUser,\r\n useUpdateAccount,\r\n} from '../../../modules/accounts/hooks/useAccountManagement';\r\nimport {\r\n LANGUAGE_OPTIONS,\r\n TIME_FORMAT_OPTIONS,\r\n NOTIFICATION_TYPES,\r\n} from '../constants';\r\nimport { useTimezones } from '../../../modules/accounts/hooks/useTimezones';\r\nimport { useCurrencies } from '../../../modules/accounts/hooks/useCurrencies';\r\n\r\ninterface PreferencesFormValues {\r\n language: string;\r\n currency: string;\r\n timezone: string;\r\n timeFormat: string;\r\n receive_sms: boolean;\r\n receive_email: boolean;\r\n}\r\n\r\ninterface PreferencesSectionProps {\r\n onClose: () => void;\r\n}\r\n\r\nexport function PreferencesSection({ onClose }: PreferencesSectionProps) {\r\n const { data: timezones = [] } = useTimezones();\r\n const { data: currencies = [] } = useCurrencies();\r\n const { user, account } = useAuth();\r\n const canEditPreferences =\r\n user?.profile === UserProfile.owner || user?.profile === UserProfile.admin;\r\n const updateAccountUser = useUpdateAccountUser();\r\n const updateAccount = useUpdateAccount();\r\n const [confirmGlobalOpen, setConfirmGlobalOpen] = useState(false);\r\n const [pendingSubmit, setPendingSubmit] = useState<{\r\n data: PreferencesFormValues;\r\n accountFields: UpdateAccountRequest;\r\n } | null>(null);\r\n const [isSaving, setIsSaving] = useState(false);\r\n\r\n const { watch, setValue, handleSubmit, reset, formState: { dirtyFields } } =\r\n useForm<PreferencesFormValues>({\r\n defaultValues: {\r\n language: '',\r\n currency: '',\r\n timezone: '',\r\n timeFormat: '24h',\r\n receive_sms: false,\r\n receive_email: false,\r\n },\r\n });\r\n\r\n useEffect(() => {\r\n if (!user || !account) return;\r\n reset({\r\n language: LANGUAGE_OPTIONS.find(\r\n (o) => o.apiValue === user.language?.toLowerCase()\r\n )?.value ?? 'pt-BR',\r\n currency: account.currency,\r\n timezone: account.timezone,\r\n timeFormat: '24h',\r\n receive_sms: user.receive_sms ?? false,\r\n receive_email: user.receive_email ?? false,\r\n });\r\n }, [user, account, reset]);\r\n\r\n const receiveSms = watch('receive_sms');\r\n const receiveEmail = watch('receive_email');\r\n\r\n const doSave = async (data: PreferencesFormValues, accountFields: UpdateAccountRequest) => {\r\n setIsSaving(true);\r\n try {\r\n const apiLanguage = LANGUAGE_OPTIONS.find((o) => o.value === data.language)?.apiValue ?? data.language.toLowerCase();\r\n await updateAccountUser.mutateAsync({\r\n language: apiLanguage,\r\n receive_sms: data.receive_sms,\r\n receive_email: data.receive_email,\r\n });\r\n\r\n if (canEditPreferences && Object.keys(accountFields).length > 0) {\r\n await updateAccount.mutateAsync(accountFields);\r\n }\r\n\r\n reset(data);\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Preferências salvas com sucesso\" toastId={t} />\r\n ));\r\n onClose();\r\n } catch (error) {\r\n toast.custom((t) => (\r\n <Toast\r\n variant=\"error\"\r\n message={error instanceof Error ? error.message : 'Erro ao salvar preferências'}\r\n toastId={t}\r\n />\r\n ));\r\n } finally {\r\n setIsSaving(false);\r\n }\r\n };\r\n\r\n const onSubmit = (data: PreferencesFormValues) => {\r\n const accountFields: UpdateAccountRequest = {\r\n ...(canEditPreferences && dirtyFields.currency && { currency: data.currency }),\r\n ...(canEditPreferences && dirtyFields.timezone && { timezone: data.timezone }),\r\n };\r\n const globalFieldChanged = Object.keys(accountFields).length > 0;\r\n\r\n if (globalFieldChanged) {\r\n setPendingSubmit({ data, accountFields });\r\n setConfirmGlobalOpen(true);\r\n } else {\r\n doSave(data, accountFields);\r\n }\r\n };\r\n\r\n const handleConfirmGlobal = () => {\r\n setConfirmGlobalOpen(false);\r\n if (pendingSubmit) {\r\n doSave(pendingSubmit.data, pendingSubmit.accountFields);\r\n setPendingSubmit(null);\r\n }\r\n };\r\n\r\n const handleCancelGlobal = () => {\r\n setConfirmGlobalOpen(false);\r\n setPendingSubmit(null);\r\n };\r\n\r\n return (\r\n <>\r\n <form onSubmit={handleSubmit(onSubmit)} className=\"lg:h-full lg:flex lg:flex-col\">\r\n <div className=\"absolute inset-0 overflow-y-auto overscroll-contain px-4 pb-36 lg:p-5 lg:static lg:flex-1 lg:min-h-0 lg:overscroll-auto flex flex-col gap-5 lg:gap-6\">\r\n <span className=\"paragraph-medium-semibold text-gray-950\">Preferências</span>\r\n <div className=\"flex flex-col gap-8\">\r\n <div className=\"flex flex-col lg:flex-row items-center gap-3\">\r\n <ComboboxField\r\n label=\"Idioma\"\r\n placeholder=\"Selecione o idioma\"\r\n searchPlaceholder=\"Buscar idioma...\"\r\n containerClassName=\"w-full\"\r\n options={LANGUAGE_OPTIONS}\r\n value={watch('language')}\r\n onChange={(value) => setValue('language', value, { shouldDirty: true })}\r\n />\r\n <ComboboxField\r\n label=\"Moeda\"\r\n placeholder=\"Selecione a moeda\"\r\n searchPlaceholder=\"Buscar moeda...\"\r\n containerClassName=\"w-full\"\r\n options={currencies}\r\n value={watch('currency')}\r\n onChange={(value) => setValue('currency', value, { shouldDirty: true })}\r\n icon={!canEditPreferences ? <Lock className=\"size-4 text-gray-400\" /> : undefined}\r\n disabled={!canEditPreferences}\r\n />\r\n </div>\r\n\r\n <Separator />\r\n\r\n <div className=\"flex flex-col gap-4\">\r\n <span className=\"paragraph-medium-semibold text-gray-600\">Exibição hora</span>\r\n <div className=\"flex flex-col lg:flex-row items-center gap-3\">\r\n <ComboboxField\r\n label=\"Fuso horário\"\r\n placeholder=\"Selecione o fuso horário\"\r\n searchPlaceholder=\"Buscar fuso horário...\"\r\n containerClassName=\"w-full\"\r\n options={timezones}\r\n value={watch('timezone')}\r\n onChange={(value) => setValue('timezone', value, { shouldDirty: true })}\r\n icon={!canEditPreferences ? <Lock className=\"size-4 text-gray-400\" /> : undefined}\r\n disabled={!canEditPreferences}\r\n />\r\n <SelectField\r\n label=\"Formato hora\"\r\n placeholder=\"Selecione o formato\"\r\n className=\"h-10!\"\r\n containerClassName=\"w-full\"\r\n options={TIME_FORMAT_OPTIONS}\r\n value={watch('timeFormat')}\r\n onChange={(value) =>\r\n setValue('timeFormat', value as string, { shouldDirty: true })\r\n }\r\n icon={<Lock className=\"size-4 text-gray-400\" />}\r\n disabled\r\n />\r\n </div>\r\n </div>\r\n\r\n <Separator />\r\n\r\n <div className=\"flex flex-col gap-4\">\r\n <span className=\"paragraph-medium-semibold text-gray-600\">Notificações</span>\r\n <div className=\"flex flex-col gap-3\">\r\n <div className=\"flex flex-col border border-gray-200 rounded-lg\">\r\n <SwitchOptionFieldWithIcon\r\n icon={MessageCircle}\r\n label=\"WhatsApp\"\r\n description=\"Receber notificações importantes por WhatsApp\"\r\n checked={receiveSms}\r\n onCheckedChange={(val: boolean) => setValue('receive_sms', val, { shouldDirty: true })}\r\n />\r\n <SwitchOptionFieldWithIcon\r\n icon={Mail}\r\n label=\"E-mail\"\r\n description=\"Receber notificações e atualizações por email\"\r\n checked={receiveEmail}\r\n onCheckedChange={(val: boolean) => setValue('receive_email', val, { shouldDirty: true })}\r\n hideBorderBottom={true}\r\n />\r\n </div>\r\n <div className=\"flex flex-col gap-4 p-5 pb-6 rounded-lg bg-gray-50\">\r\n <span className=\"paragraph-small-semibold text-gray-950\">\r\n Tipos de notificações incluem:\r\n </span>\r\n <div className=\"flex flex-col\">\r\n {NOTIFICATION_TYPES.map((type) => (\r\n <div key={type} className=\"flex items-center gap-2\">\r\n <div className=\"size-1 rounded-full bg-gray-600\" />\r\n <span className=\"paragraph-small-medium text-gray-600\">{type}</span>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"fixed bottom-0 left-0 right-0 lg:static flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white z-10\">\r\n <Button\r\n variant=\"secondary\"\r\n className=\"h-10!\"\r\n type=\"button\"\r\n disabled={isSaving}\r\n onClick={() => {\r\n reset();\r\n onClose();\r\n }}\r\n >\r\n Cancelar\r\n </Button>\r\n <Button className=\"h-10!\" type=\"submit\" disabled={isSaving}>\r\n {isSaving ? 'Salvando...' : 'Salvar alterações'}\r\n </Button>\r\n </div>\r\n </form>\r\n\r\n <ConfirmGlobalPreferencesModal\r\n open={confirmGlobalOpen}\r\n onConfirm={handleConfirmGlobal}\r\n onCancel={handleCancelGlobal}\r\n />\r\n </>\r\n );\r\n}\r\n"],"mappings":";AAqGQ,SA6CJ,UA7CI,KAkDI,YAlDJ;AAnGR,SAAS,UAAU,iBAAiB;AACpC,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,MAAM,MAAM,qBAAqB;AAC1C,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,OAAO,+BAA+B;AACtC,OAAO,mCAAmC;AAC1C,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAevB,SAAS,mBAAmB,EAAE,QAAQ,GAA4B;AACvE,QAAM,EAAE,MAAM,YAAY,CAAC,EAAE,IAAI,aAAa;AAC9C,QAAM,EAAE,MAAM,aAAa,CAAC,EAAE,IAAI,cAAc;AAChD,QAAM,EAAE,MAAM,QAAQ,IAAI,QAAQ;AAClC,QAAM,qBACJ,MAAM,YAAY,YAAY,SAAS,MAAM,YAAY,YAAY;AACvE,QAAM,oBAAoB,qBAAqB;AAC/C,QAAM,gBAAgB,iBAAiB;AACvC,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAAS,KAAK;AAChE,QAAM,CAAC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,qBAAW,gBAAgB,2BAC9B;AAAA,SACF;AAAA,OACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,WAAW;AAAA,QACX,UAAU;AAAA;AAAA,IACZ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { Lock, Wrench } from "lucide-react";
|
|
5
|
+
import { Badge } from "../../ui/data-display/Badge";
|
|
6
|
+
import { Button } from "../../ui/buttons/Button";
|
|
7
|
+
import { useAuth } from "../../../providers/auth.provider";
|
|
8
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import { USER_QUERY_KEY } from "../../../modules/auth/hooks/useUserQuery";
|
|
10
|
+
import { AccountSectionType } from "../../../enums/AccountSectionType";
|
|
11
|
+
import TwoFactorAuthModal from "../TwoFactorAuthModal";
|
|
12
|
+
import DisableTwoFactorAuthModal from "../DisableTwoFactorAuthModal";
|
|
13
|
+
function SecuritySection({
|
|
14
|
+
setActiveSection,
|
|
15
|
+
onClose,
|
|
16
|
+
hasActiveSubscription,
|
|
17
|
+
onDeleteAccount
|
|
18
|
+
}) {
|
|
19
|
+
const { user } = useAuth();
|
|
20
|
+
const queryClient = useQueryClient();
|
|
21
|
+
const twoFactorAuth = user?.two_factor_authentication ?? false;
|
|
22
|
+
const [twoFactorOpen, setTwoFactorOpen] = useState(false);
|
|
23
|
+
const [disableTwoFactorOpen, setDisableTwoFactorOpen] = useState(false);
|
|
24
|
+
const handleToggleTwoFactor = useCallback(() => {
|
|
25
|
+
if (twoFactorAuth) {
|
|
26
|
+
setDisableTwoFactorOpen(true);
|
|
27
|
+
} else {
|
|
28
|
+
setTwoFactorOpen(true);
|
|
29
|
+
}
|
|
30
|
+
}, [twoFactorAuth]);
|
|
31
|
+
const handleDisableTwoFactorSuccess = useCallback(() => {
|
|
32
|
+
queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
|
|
33
|
+
setDisableTwoFactorOpen(false);
|
|
34
|
+
}, [queryClient]);
|
|
35
|
+
const handleEnableTwoFactorSuccess = useCallback(() => {
|
|
36
|
+
queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
|
|
37
|
+
setTwoFactorOpen(false);
|
|
38
|
+
}, [queryClient]);
|
|
39
|
+
const handleDeleteAccount = useCallback(() => {
|
|
40
|
+
onDeleteAccount?.();
|
|
41
|
+
}, [onDeleteAccount]);
|
|
42
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "h-full overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:pt-5 flex flex-col gap-5 lg:gap-6 lg:pb-31 lg:overscroll-auto", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 hidden lg:block", children: "Seguran\xE7a" }),
|
|
45
|
+
/* @__PURE__ */ jsxs("div", { className: "border border-gray-200 rounded-lg overflow-hidden", children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: "flex flex-col lg:flex-row lg:items-center gap-4 lg:gap-5 p-4 lg:p-5 border-b border-gray-200 cursor-pointer hover:bg-gray-25 transition-colors",
|
|
50
|
+
onClick: handleToggleTwoFactor,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-start lg:items-center gap-4 lg:gap-5", children: [
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: "size-10 rounded-lg bg-gray-50 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx(Wrench, { size: 20, className: "text-gray-950" }) }),
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 flex-1", children: [
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "Autentica\xE7\xE3o de dois fatores" }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Badge,
|
|
59
|
+
{
|
|
60
|
+
className: `paragraph-xsmall-semibold rounded-lg ${twoFactorAuth ? "text-green-600 bg-green-50" : "text-gray-600 bg-gray-50"}`,
|
|
61
|
+
children: twoFactorAuth ? "Habilitado" : "Desabilitado"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-gray-600", children: "Envio de c\xF3digo de seguran\xE7a (e-mail ou sms) para o usu\xE1rio acessar o sistema" })
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Button,
|
|
70
|
+
{
|
|
71
|
+
variant: "secondary",
|
|
72
|
+
className: "h-10! shrink-0 w-full lg:w-auto",
|
|
73
|
+
onClick: (e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
handleToggleTwoFactor();
|
|
76
|
+
},
|
|
77
|
+
children: twoFactorAuth ? "Desabilitar" : "Habilitar"
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsxs(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: "flex flex-col lg:flex-row lg:items-center gap-4 lg:gap-5 p-4 lg:p-5 cursor-pointer hover:bg-gray-25 transition-colors",
|
|
87
|
+
onClick: () => setActiveSection(AccountSectionType.CHANGE_PASSWORD),
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-start lg:items-center gap-4 lg:gap-5", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("div", { className: "size-10 rounded-lg bg-gray-50 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx(Lock, { size: 20, className: "text-gray-950" }) }),
|
|
91
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 flex-1", children: [
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "Alterar senha de acesso" }),
|
|
93
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-gray-600", children: "Atualize sua senha sempre que necess\xE1rio para manter sua conta segura." })
|
|
94
|
+
] })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
Button,
|
|
98
|
+
{
|
|
99
|
+
variant: "secondary",
|
|
100
|
+
className: "h-10! shrink-0 w-full lg:w-auto",
|
|
101
|
+
onClick: (e) => {
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
setActiveSection(AccountSectionType.CHANGE_PASSWORD);
|
|
104
|
+
},
|
|
105
|
+
children: "Alterar senha"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }),
|
|
112
|
+
onDeleteAccount && /* @__PURE__ */ jsx(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
className: "paragraph-small-semibold text-red-600 bg-red-50 rounded-lg px-3 py-2 cursor-pointer hover:bg-red-100 transition-colors w-fit",
|
|
117
|
+
onClick: handleDeleteAccount,
|
|
118
|
+
children: "Excluir minha conta"
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { className: "fixed bottom-0 left-0 right-0 lg:absolute flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white z-10", children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: onClose, children: "Cancelar" }),
|
|
124
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10!", onClick: onClose, children: "Salvar altera\xE7\xF5es" })
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
DisableTwoFactorAuthModal,
|
|
128
|
+
{
|
|
129
|
+
open: disableTwoFactorOpen,
|
|
130
|
+
onClose: () => setDisableTwoFactorOpen(false),
|
|
131
|
+
onSuccess: handleDisableTwoFactorSuccess
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
TwoFactorAuthModal,
|
|
136
|
+
{
|
|
137
|
+
open: twoFactorOpen,
|
|
138
|
+
onClose: () => setTwoFactorOpen(false),
|
|
139
|
+
onSuccess: handleEnableTwoFactorSuccess
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] });
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
SecuritySection
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=SecuritySection.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/sections/SecuritySection.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { Lock, Wrench } from 'lucide-react';\r\nimport { Badge } from '../../ui/data-display/Badge';\r\nimport { Button } from '../../ui/buttons/Button';\r\nimport { useAuth } from '../../../providers/auth.provider';\r\nimport { useQueryClient } from '@tanstack/react-query';\r\nimport { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';\r\nimport { AccountSectionType } from '../../../enums/AccountSectionType';\r\nimport TwoFactorAuthModal from '../TwoFactorAuthModal';\r\nimport DisableTwoFactorAuthModal from '../DisableTwoFactorAuthModal';\r\n\r\ninterface SecuritySectionProps {\r\n setActiveSection: (section: AccountSectionType) => void;\r\n onClose: () => void;\r\n hasActiveSubscription?: boolean;\r\n onDeleteAccount?: () => void;\r\n}\r\n\r\nexport function SecuritySection({\r\n setActiveSection,\r\n onClose,\r\n hasActiveSubscription,\r\n onDeleteAccount,\r\n}: SecuritySectionProps) {\r\n const { user } = useAuth();\r\n const queryClient = useQueryClient();\r\n\r\n const twoFactorAuth = user?.two_factor_authentication ?? false;\r\n const [twoFactorOpen, setTwoFactorOpen] = useState(false);\r\n const [disableTwoFactorOpen, setDisableTwoFactorOpen] = useState(false);\r\n\r\n const handleToggleTwoFactor = useCallback(() => {\r\n if (twoFactorAuth) {\r\n setDisableTwoFactorOpen(true);\r\n } else {\r\n setTwoFactorOpen(true);\r\n }\r\n }, [twoFactorAuth]);\r\n\r\n const handleDisableTwoFactorSuccess = useCallback(() => {\r\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\r\n setDisableTwoFactorOpen(false);\r\n }, [queryClient]);\r\n\r\n const handleEnableTwoFactorSuccess = useCallback(() => {\r\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\r\n setTwoFactorOpen(false);\r\n }, [queryClient]);\r\n\r\n const handleDeleteAccount = useCallback(() => {\r\n onDeleteAccount?.();\r\n }, [onDeleteAccount]);\r\n\r\n return (\r\n <>\r\n <div className=\"h-full overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:pt-5 flex flex-col gap-5 lg:gap-6 lg:pb-31 lg:overscroll-auto\">\r\n <span className=\"paragraph-medium-semibold text-gray-950 hidden lg:block\">Segurança</span>\r\n\r\n <div className=\"border border-gray-200 rounded-lg overflow-hidden\">\r\n <div\r\n className=\"flex flex-col lg:flex-row lg:items-center gap-4 lg:gap-5 p-4 lg:p-5 border-b border-gray-200 cursor-pointer hover:bg-gray-25 transition-colors\"\r\n onClick={handleToggleTwoFactor}\r\n >\r\n <div className=\"flex flex-1 items-start lg:items-center gap-4 lg:gap-5\">\r\n <div className=\"size-10 rounded-lg bg-gray-50 flex items-center justify-center shrink-0\">\r\n <Wrench size={20} className=\"text-gray-950\" />\r\n </div>\r\n <div className=\"flex flex-col gap-1.5 flex-1\">\r\n <div className=\"flex flex-wrap items-center gap-2\">\r\n <span className=\"paragraph-small-semibold text-gray-950\">\r\n Autenticação de dois fatores\r\n </span>\r\n <Badge\r\n className={`paragraph-xsmall-semibold rounded-lg ${twoFactorAuth ? 'text-green-600 bg-green-50' : 'text-gray-600 bg-gray-50'}`}\r\n >\r\n {twoFactorAuth ? 'Habilitado' : 'Desabilitado'}\r\n </Badge>\r\n </div>\r\n <span className=\"paragraph-small-regular text-gray-600\">\r\n Envio de código de segurança (e-mail ou sms) para o usuário acessar o sistema\r\n </span>\r\n </div>\r\n </div>\r\n <Button\r\n variant=\"secondary\"\r\n className=\"h-10! shrink-0 w-full lg:w-auto\"\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n handleToggleTwoFactor();\r\n }}\r\n >\r\n {twoFactorAuth ? 'Desabilitar' : 'Habilitar'}\r\n </Button>\r\n </div>\r\n\r\n <div\r\n className=\"flex flex-col lg:flex-row lg:items-center gap-4 lg:gap-5 p-4 lg:p-5 cursor-pointer hover:bg-gray-25 transition-colors\"\r\n onClick={() => setActiveSection(AccountSectionType.CHANGE_PASSWORD)}\r\n >\r\n <div className=\"flex flex-1 items-start lg:items-center gap-4 lg:gap-5\">\r\n <div className=\"size-10 rounded-lg bg-gray-50 flex items-center justify-center shrink-0\">\r\n <Lock size={20} className=\"text-gray-950\" />\r\n </div>\r\n <div className=\"flex flex-col gap-1.5 flex-1\">\r\n <span className=\"paragraph-small-semibold text-gray-950\">\r\n Alterar senha de acesso\r\n </span>\r\n <span className=\"paragraph-small-regular text-gray-600\">\r\n Atualize sua senha sempre que necessário para manter sua conta segura.\r\n </span>\r\n </div>\r\n </div>\r\n <Button\r\n variant=\"secondary\"\r\n className=\"h-10! shrink-0 w-full lg:w-auto\"\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n setActiveSection(AccountSectionType.CHANGE_PASSWORD);\r\n }}\r\n >\r\n Alterar senha\r\n </Button>\r\n </div>\r\n </div>\r\n\r\n {onDeleteAccount && (\r\n <button\r\n type=\"button\"\r\n className=\"paragraph-small-semibold text-red-600 bg-red-50 rounded-lg px-3 py-2 cursor-pointer hover:bg-red-100 transition-colors w-fit\"\r\n onClick={handleDeleteAccount}\r\n >\r\n Excluir minha conta\r\n </button>\r\n )}\r\n </div>\r\n\r\n <div className=\"fixed bottom-0 left-0 right-0 lg:absolute flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white z-10\">\r\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={onClose}>\r\n Cancelar\r\n </Button>\r\n <Button className=\"h-10!\" onClick={onClose}>\r\n Salvar alterações\r\n </Button>\r\n </div>\r\n\r\n <DisableTwoFactorAuthModal\r\n open={disableTwoFactorOpen}\r\n onClose={() => setDisableTwoFactorOpen(false)}\r\n onSuccess={handleDisableTwoFactorSuccess}\r\n />\r\n <TwoFactorAuthModal\r\n open={twoFactorOpen}\r\n onClose={() => setTwoFactorOpen(false)}\r\n onSuccess={handleEnableTwoFactorSuccess}\r\n />\r\n </>\r\n );\r\n}\r\n"],"mappings":";AAwDI,mBAEI,KAYQ,YAdZ;AAtDJ,SAAS,UAAU,mBAAmB;AACtC,SAAS,MAAM,cAAc;AAC7B,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,OAAO,wBAAwB;AAC/B,OAAO,+BAA+B;AAS/B,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,cAAc,eAAe;AAEnC,QAAM,gBAAgB,MAAM,6BAA6B;AACzD,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,CAAC,sBAAsB,uBAAuB,IAAI,SAAS,KAAK;AAEtE,QAAM,wBAAwB,YAAY,MAAM;AAC9C,QAAI,eAAe;AACjB,8BAAwB,IAAI;AAAA,IAC9B,OAAO;AACL,uBAAiB,IAAI;AAAA,I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
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Suspense, useEffect } from "react";
|
|
4
|
+
import { useSearchParams } from "next/navigation";
|
|
5
|
+
function SearchParamsHandler(options) {
|
|
6
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(SearchParamsHandlerChildren, { ...options }) });
|
|
7
|
+
}
|
|
8
|
+
function SearchParamsHandlerChildren(options) {
|
|
9
|
+
const searchParams = useSearchParams();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
Object.keys(options.handlers).forEach((key) => {
|
|
12
|
+
const value = searchParams.get(key);
|
|
13
|
+
if (value) {
|
|
14
|
+
options.handlers[key]();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}, [searchParams]);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
SearchParamsHandler,
|
|
22
|
+
SearchParamsHandlerChildren
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=SearchParamsHandler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/handlers/SearchParamsHandler.tsx"],"sourcesContent":["\"use client\";\n\nimport { Suspense, useEffect } from \"react\";\nimport { useSearchParams } from \"next/navigation\";\n\ninterface SearchParamsHandlerProps {\n handlers: {\n [key: string]: () => void;\n };\n}\n\n/**\n * SearchParamsHandler\n *\n * Este componente é responsável por ler os parâmetros da URL e executar callbacks\n * correspondentes a cada parâmetro encontrado.\n *\n * Por que precisamos deste componente?\n * - O Next.js 16 exige que useSearchParams() seja envolvido em um <Suspense> boundary\n * - Isso evita erros de prerendering durante o build\n * - Permite que URLs como \"/page?tab=performance\" naveguem diretamente para uma aba específica\n *\n * Exemplo de como funciona\n * 1. Usa useSearchParams() para ler o parâmetro \"tab\" da URL\n * 2. Monitora mudanças nos parâmetros com useEffect\n * 3. Quando encontra um parâmetro \"tab\", chama onTabChange com o valor\n * 4. Retorna null porque não renderiza nada na tela\n *\n * Exemplo de uso:\n * <Suspense fallback={null}>\n * <SearchParamsHandler handlers={{ tab: () => console.log(\"Tab changed\") }} />\n * </Suspense>\n *\n * Exemplos de URL:\n * - /greatpages/123?tab=performance → abre a aba \"performance\"\n * - /greatpages/123?tab=leads → abre a aba \"leads\"\n */\nexport function SearchParamsHandler(options: SearchParamsHandlerProps) {\n return (\n <Suspense fallback={null}>\n <SearchParamsHandlerChildren {...options} />\n </Suspense>\n );\n}\n\nexport function SearchParamsHandlerChildren(options: SearchParamsHandlerProps) {\n const searchParams = useSearchParams();\n\n useEffect(() => {\n Object.keys(options.handlers).forEach((key) => {\n const value = searchParams.get(key);\n\n if (value) {\n options.handlers[key]();\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchParams]);\n\n return null;\n}\n"],"mappings":";AAwCM;AAtCN,SAAS,UAAU,iBAAiB;AACpC,SAAS,uBAAuB;AAkCzB,SAAS,oBAAoB,SAAmC;AACrE,SACE,oBAAC,YAAS,UAAU,MAClB,8BAAC,+BAA6B,GAAG,SAAS,GAC5C;AAEJ;AAEO,SAAS,4BAA4B,SAAmC;AAC7E,QAAM,eAAe,gBAAgB;AAErC,YAAU,MAAM;AACd,WAAO,KAAK,QAAQ,QAAQ,EAAE,QAAQ,CAAC,QAAQ;AAC7C,YAAM,QAAQ,aAAa,IAAI,GAAG;AAElC,UAAI,OAAO;AACT,gBAAQ,SAAS,GAAG,EAAE;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EAEH,GAAG,CAAC,YAAY,CAAC;AAEjB,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Image from "next/image";
|
|
4
|
+
import { ProfilePopover } from "./ProfilePopover";
|
|
5
|
+
import { useAccountModals } from "../../store/useAccountModals";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/overlay/Tooltip";
|
|
7
|
+
function AppMobileNavBar({
|
|
8
|
+
activeApp,
|
|
9
|
+
onLogoClick,
|
|
10
|
+
onAppIconClick,
|
|
11
|
+
extraLeftSlot,
|
|
12
|
+
rightActionSlot,
|
|
13
|
+
menuItems = [],
|
|
14
|
+
onCreditsClick
|
|
15
|
+
}) {
|
|
16
|
+
const { openConfigurations } = useAccountModals();
|
|
17
|
+
const isGpagesActive = activeApp === "gpages";
|
|
18
|
+
const isGappsActive = activeApp === "gapps";
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: "fixed top-0 left-0 right-0 flex md:hidden items-center justify-between p-4 bg-white z-50 border-b border-gray-200", children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
21
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: `relative size-10 flex items-center justify-center rounded-lg transition-colors ${onLogoClick ? "cursor-pointer hover:bg-gray-100" : ""}`,
|
|
26
|
+
onClick: onLogoClick,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx(
|
|
29
|
+
Image,
|
|
30
|
+
{
|
|
31
|
+
src: "/icons/great-icon.svg",
|
|
32
|
+
alt: "GreatApps",
|
|
33
|
+
width: 28,
|
|
34
|
+
height: 28
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
isGappsActive && /* @__PURE__ */ jsx("div", { className: "absolute bottom-[-17px] left-1/2 -translate-x-1/2 w-5 h-[3px] bg-gray-950 rounded-t-xl" })
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: "GreatApps" })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
44
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: isGpagesActive ? /* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "size-10 rounded-xl cursor-pointer p-[2px]",
|
|
49
|
+
style: {
|
|
50
|
+
border: "1.5px solid rgba(153,234,255,0.75)",
|
|
51
|
+
background: "white",
|
|
52
|
+
boxShadow: "0 0 8px rgba(153,234,255,0.5), 0 0 18px rgba(153,234,255,0.2)"
|
|
53
|
+
},
|
|
54
|
+
onClick: onAppIconClick,
|
|
55
|
+
children: /* @__PURE__ */ jsx(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: "w-full h-full rounded-lg flex items-center justify-center",
|
|
59
|
+
style: {
|
|
60
|
+
background: "radial-gradient(circle at center, rgba(255,255,255,0.95) 0%, rgba(153,234,255,0.45) 100%)"
|
|
61
|
+
},
|
|
62
|
+
children: /* @__PURE__ */ jsx(
|
|
63
|
+
Image,
|
|
64
|
+
{
|
|
65
|
+
src: "/icons/icon-navbar.svg",
|
|
66
|
+
alt: "GreatPages",
|
|
67
|
+
width: 24,
|
|
68
|
+
height: 24
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
) : /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: `size-10 flex items-center justify-center rounded-lg transition-colors duration-300 bg-gray-100 ${onAppIconClick ? "cursor-pointer hover:opacity-80" : ""}`,
|
|
78
|
+
onClick: onAppIconClick,
|
|
79
|
+
children: /* @__PURE__ */ jsx(
|
|
80
|
+
Image,
|
|
81
|
+
{
|
|
82
|
+
src: "/icons/icon-navbar.svg",
|
|
83
|
+
alt: "GreatPages",
|
|
84
|
+
width: 24,
|
|
85
|
+
height: 24
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
90
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: "GreatPages" })
|
|
91
|
+
] }),
|
|
92
|
+
isGpagesActive && /* @__PURE__ */ jsx("div", { className: "absolute -bottom-[17px] left-1/2 -translate-x-1/2 w-5 h-[3px] rounded-t-xl", style: { backgroundColor: "#6ADCFF" } })
|
|
93
|
+
] }),
|
|
94
|
+
extraLeftSlot
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
ProfilePopover,
|
|
99
|
+
{
|
|
100
|
+
side: "bottom",
|
|
101
|
+
align: "end",
|
|
102
|
+
contentClassName: "",
|
|
103
|
+
onEditProfile: () => openConfigurations(),
|
|
104
|
+
onCreditsClick,
|
|
105
|
+
menuItems
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
rightActionSlot
|
|
109
|
+
] })
|
|
110
|
+
] });
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
AppMobileNavBar
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=AppMobileNavBar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/layouts/AppMobileNavBar.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode } from \"react\";\nimport Image from \"next/image\";\nimport { ProfilePopover } from \"./ProfilePopover\";\nimport { useAccountModals } from \"../../store/useAccountModals\";\nimport type { ProfileMenuItem } from \"./ProfilePopover\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/overlay/Tooltip\";\n\nexport interface AppMobileNavBarProps {\n /** Which app is currently active — controls which icon gets the indicator */\n activeApp?: \"gapps\" | \"gpages\";\n /** Called when the GreatApps logo is clicked */\n onLogoClick?: () => void;\n /** Called when the app icon (e.g. GreatPages) is clicked */\n onAppIconClick?: () => void;\n /** Extra slot rendered after the app icon (e.g. project selector) */\n extraLeftSlot?: ReactNode;\n /** Required: the right-side action element (toggle button, sheet button, etc.) */\n rightActionSlot: ReactNode;\n menuItems?: ProfileMenuItem[];\n onCreditsClick?: () => void;\n}\n\nexport function AppMobileNavBar({\n activeApp,\n onLogoClick,\n onAppIconClick,\n extraLeftSlot,\n rightActionSlot,\n menuItems = [],\n onCreditsClick,\n}: AppMobileNavBarProps) {\n const { openConfigurations } = useAccountModals();\n\n const isGpagesActive = activeApp === \"gpages\";\n const isGappsActive = activeApp === \"gapps\";\n\n return (\n <div className=\"fixed top-0 left-0 right-0 flex md:hidden items-center justify-between p-4 bg-white z-50 border-b border-gray-200\">\n <div className=\"flex items-center gap-1.5\">\n <Tooltip>\n <TooltipTrigger asChild>\n <div\n className={`relative size-10 flex items-center justify-center rounded-lg transition-colors ${onLogoClick ? \"cursor-pointer hover:bg-gray-100\" : \"\"}`}\n onClick={onLogoClick}\n >\n <Image\n src=\"/icons/great-icon.svg\"\n alt=\"GreatApps\"\n width={28}\n height={28}\n />\n {isGappsActive && (\n <div className=\"absolute bottom-[-17px] left-1/2 -translate-x-1/2 w-5 h-[3px] bg-gray-950 rounded-t-xl\" />\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">GreatApps</TooltipContent>\n </Tooltip>\n <div className=\"relative\">\n <Tooltip>\n <TooltipTrigger asChild>\n {isGpagesActive ? (\n <div\n className=\"size-10 rounded-xl cursor-pointer p-[2px]\"\n style={{\n border: \"1.5px solid rgba(153,234,255,0.75)\",\n background: \"white\",\n boxShadow:\n \"0 0 8px rgba(153,234,255,0.5), 0 0 18px rgba(153,234,255,0.2)\",\n }}\n onClick={onAppIconClick}\n >\n <div\n className=\"w-full h-full rounded-lg flex items-center justify-center\"\n style={{\n background:\n \"radial-gradient(circle at center, rgba(255,255,255,0.95) 0%, rgba(153,234,255,0.45) 100%)\",\n }}\n >\n <Image\n src=\"/icons/icon-navbar.svg\"\n alt=\"GreatPages\"\n width={24}\n height={24}\n />\n </div>\n </div>\n ) : (\n <div\n className={`size-10 flex items-center justify-center rounded-lg transition-colors duration-300 bg-gray-100 ${onAppIconClick ? \"cursor-pointer hover:opacity-80\" : \"\"}`}\n onClick={onAppIconClick}\n >\n <Image\n src=\"/icons/icon-navbar.svg\"\n alt=\"GreatPages\"\n width={24}\n height={24}\n />\n </div>\n )}\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">GreatPages</TooltipContent>\n </Tooltip>\n {isGpagesActive && (\n <div className=\"absolute -bottom-[17px] left-1/2 -translate-x-1/2 w-5 h-[3px] rounded-t-xl\" style={{ backgroundColor: \"#6ADCFF\" }} />\n )}\n </div>\n {extraLeftSlot}\n </div>\n <div className=\"flex items-center gap-1.5\">\n <ProfilePopover\n side=\"bottom\"\n align=\"end\"\n contentClassName=\"\"\n onEditProfile={() => openConfigurations()}\n onCreditsClick={onCreditsClick}\n menuItems={menuItems}\n />\n {rightActionSlot}\n </div>\n </div>\n );\n}\n"],"mappings":";AA2CY,SAIE,KAJF;AAxCZ,OAAO,WAAW;AAClB,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AAEjC,SAAS,SAAS,gBAAgB,sBAAsB;AAiBjD,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,CAAC;AAAA,EACb;AACF,GAAyB;AACvB,QAAM,EAAE,mBAAmB,IAAI,iBAAiB;AAEhD,QAAM,iBAAiB,cAAc;AACrC,QAAM,gBAAgB,cAAc;AAEpC,SACE,qBAAC,SAAI,WAAU,qHACb;AAAA,yBAAC,SAAI,WAAU,6BACb;AAAA,2BAAC,WACC;AAAA,4BAAC,kBAAe,SAAO,MACrB;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,kFAAkF,cAAc,qCAAqC,EAAE;AAAA,YAClJ,SAAS;AAAA,YAET;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACC,KAAI;AAAA,kBACJ,KAAI;AAAA,kBACJ,OAAO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