@greatapps/common 1.1.169 → 1.1.173
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/package.json +1 -1
- package/src/components/layouts/ProfilePopover.tsx +9 -12
- package/src/modules/auth/schema.ts +1 -0
- package/src/modules/auth/services/auth.service.ts +1 -0
- package/dist/components/account/AccountModals.mjs +0 -18
- package/dist/components/account/AccountModals.mjs.map +0 -1
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -132
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +0 -45
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +0 -1
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +0 -45
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +0 -1
- package/dist/components/account/DeleteAccountModal.mjs +0 -123
- package/dist/components/account/DeleteAccountModal.mjs.map +0 -1
- package/dist/components/account/DisableTwoFactorAuthModal.mjs +0 -67
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +0 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +0 -42
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +0 -1
- package/dist/components/account/TwoFactorAuthModal.mjs +0 -190
- package/dist/components/account/TwoFactorAuthModal.mjs.map +0 -1
- package/dist/components/account/constants.mjs +0 -29
- package/dist/components/account/constants.mjs.map +0 -1
- package/dist/components/account/hooks/useChangeEmailForm.mjs +0 -53
- package/dist/components/account/hooks/useChangeEmailForm.mjs.map +0 -1
- package/dist/components/account/hooks/useChangePasswordForm.mjs +0 -47
- package/dist/components/account/hooks/useChangePasswordForm.mjs.map +0 -1
- package/dist/components/account/hooks/useChangePhoneForm.mjs +0 -64
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +0 -1
- package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -33
- package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +0 -54
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +0 -1
- package/dist/components/account/hooks/useOtpVerification.mjs +0 -94
- package/dist/components/account/hooks/useOtpVerification.mjs.map +0 -1
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +0 -80
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +0 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs +0 -180
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +0 -1
- package/dist/components/account/sections/ChangePasswordSection.mjs +0 -64
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +0 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs +0 -182
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +0 -1
- package/dist/components/account/sections/MyProfileSection.mjs +0 -303
- package/dist/components/account/sections/MyProfileSection.mjs.map +0 -1
- package/dist/components/account/sections/PreferencesSection.mjs +0 -250
- package/dist/components/account/sections/PreferencesSection.mjs.map +0 -1
- package/dist/components/account/sections/SecuritySection.mjs +0 -147
- package/dist/components/account/sections/SecuritySection.mjs.map +0 -1
- package/dist/components/handlers/SearchParamsHandler.mjs +0 -24
- package/dist/components/handlers/SearchParamsHandler.mjs.map +0 -1
- package/dist/components/layouts/AppMobileNavBar.mjs +0 -115
- package/dist/components/layouts/AppMobileNavBar.mjs.map +0 -1
- package/dist/components/layouts/AppNavBar.mjs +0 -49
- package/dist/components/layouts/AppNavBar.mjs.map +0 -1
- package/dist/components/layouts/MainLayout.mjs +0 -60
- package/dist/components/layouts/MainLayout.mjs.map +0 -1
- package/dist/components/layouts/MdSideBarNavigation.mjs +0 -54
- package/dist/components/layouts/MdSideBarNavigation.mjs.map +0 -1
- package/dist/components/layouts/NavBar.mjs +0 -132
- package/dist/components/layouts/NavBar.mjs.map +0 -1
- package/dist/components/layouts/NavBarItem.mjs +0 -23
- package/dist/components/layouts/NavBarItem.mjs.map +0 -1
- package/dist/components/layouts/NotificationsPopover.mjs +0 -97
- package/dist/components/layouts/NotificationsPopover.mjs.map +0 -1
- package/dist/components/layouts/ProfilePopover.mjs +0 -150
- package/dist/components/layouts/ProfilePopover.mjs.map +0 -1
- package/dist/components/layouts/SideBarNavigation.mjs +0 -22
- package/dist/components/layouts/SideBarNavigation.mjs.map +0 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +0 -230
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +0 -1
- package/dist/components/modals/ModalManager.mjs +0 -19
- package/dist/components/modals/ModalManager.mjs.map +0 -1
- package/dist/components/modals/Modals.mjs +0 -20
- package/dist/components/modals/Modals.mjs.map +0 -1
- package/dist/components/navigation/AppNavigation.mjs +0 -30
- package/dist/components/navigation/AppNavigation.mjs.map +0 -1
- package/dist/components/navigation/AppNavigationContext.mjs +0 -13
- package/dist/components/navigation/AppNavigationContext.mjs.map +0 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +0 -59
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +0 -1
- package/dist/components/navigation/NavItem.mjs +0 -35
- package/dist/components/navigation/NavItem.mjs.map +0 -1
- package/dist/components/navigation/NavItemsContext.mjs +0 -16
- package/dist/components/navigation/NavItemsContext.mjs.map +0 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +0 -128
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +0 -1
- package/dist/components/navigation/shells/DesktopShell.mjs +0 -11
- package/dist/components/navigation/shells/DesktopShell.mjs.map +0 -1
- package/dist/components/navigation/shells/MdShell.mjs +0 -11
- package/dist/components/navigation/shells/MdShell.mjs.map +0 -1
- package/dist/components/navigation/shells/MobileShell.mjs +0 -27
- package/dist/components/navigation/shells/MobileShell.mjs.map +0 -1
- package/dist/components/navigation/shells/TabsMobileShell.mjs +0 -59
- package/dist/components/navigation/shells/TabsMobileShell.mjs.map +0 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +0 -30
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +0 -1
- package/dist/components/navigation/subcomponents/NavItems.mjs +0 -25
- package/dist/components/navigation/subcomponents/NavItems.mjs.map +0 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs +0 -25
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +0 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +0 -130
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +0 -1
- package/dist/components/navigation/types.mjs +0 -1
- package/dist/components/navigation/types.mjs.map +0 -1
- package/dist/components/pages/notifications/Notifications.mjs +0 -156
- package/dist/components/pages/notifications/Notifications.mjs.map +0 -1
- package/dist/components/ui/buttons/Button.mjs +0 -52
- package/dist/components/ui/buttons/Button.mjs.map +0 -1
- package/dist/components/ui/buttons/CancelButton.mjs +0 -17
- package/dist/components/ui/buttons/CancelButton.mjs.map +0 -1
- package/dist/components/ui/buttons/CopyButton.mjs +0 -42
- package/dist/components/ui/buttons/CopyButton.mjs.map +0 -1
- package/dist/components/ui/data-display/Accordion.mjs +0 -76
- package/dist/components/ui/data-display/Accordion.mjs.map +0 -1
- package/dist/components/ui/data-display/Badge.mjs +0 -42
- package/dist/components/ui/data-display/Badge.mjs.map +0 -1
- package/dist/components/ui/data-display/Card.mjs +0 -92
- package/dist/components/ui/data-display/Card.mjs.map +0 -1
- package/dist/components/ui/data-display/Pagination.mjs +0 -118
- package/dist/components/ui/data-display/Pagination.mjs.map +0 -1
- package/dist/components/ui/data-display/ScrollArea.mjs +0 -62
- package/dist/components/ui/data-display/ScrollArea.mjs.map +0 -1
- package/dist/components/ui/data-display/Separator.mjs +0 -28
- package/dist/components/ui/data-display/Separator.mjs.map +0 -1
- package/dist/components/ui/data-display/Table.mjs +0 -116
- package/dist/components/ui/data-display/Table.mjs.map +0 -1
- package/dist/components/ui/data-display/Tabs.mjs +0 -69
- package/dist/components/ui/data-display/Tabs.mjs.map +0 -1
- package/dist/components/ui/data-display/UserAvatar.mjs +0 -49
- package/dist/components/ui/data-display/UserAvatar.mjs.map +0 -1
- package/dist/components/ui/feedback/CircularProgress.mjs +0 -71
- package/dist/components/ui/feedback/CircularProgress.mjs.map +0 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +0 -50
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +0 -1
- package/dist/components/ui/feedback/LoadingOverlay.mjs +0 -19
- package/dist/components/ui/feedback/LoadingOverlay.mjs.map +0 -1
- package/dist/components/ui/feedback/Progress.mjs +0 -37
- package/dist/components/ui/feedback/Progress.mjs.map +0 -1
- package/dist/components/ui/feedback/Toast.mjs +0 -77
- package/dist/components/ui/feedback/Toast.mjs.map +0 -1
- package/dist/components/ui/form/Calendar.mjs +0 -204
- package/dist/components/ui/form/Calendar.mjs.map +0 -1
- package/dist/components/ui/form/Checkbox.mjs +0 -33
- package/dist/components/ui/form/Checkbox.mjs.map +0 -1
- package/dist/components/ui/form/ComboboxField.mjs +0 -130
- package/dist/components/ui/form/ComboboxField.mjs.map +0 -1
- package/dist/components/ui/form/DatePicker.mjs +0 -82
- package/dist/components/ui/form/DatePicker.mjs.map +0 -1
- package/dist/components/ui/form/DateRangePicker.mjs +0 -92
- package/dist/components/ui/form/DateRangePicker.mjs.map +0 -1
- package/dist/components/ui/form/FormField.mjs +0 -103
- package/dist/components/ui/form/FormField.mjs.map +0 -1
- package/dist/components/ui/form/Input.mjs +0 -21
- package/dist/components/ui/form/Input.mjs.map +0 -1
- package/dist/components/ui/form/InputOtp.mjs +0 -70
- package/dist/components/ui/form/InputOtp.mjs.map +0 -1
- package/dist/components/ui/form/PhoneInput.mjs +0 -78
- package/dist/components/ui/form/PhoneInput.mjs.map +0 -1
- package/dist/components/ui/form/RadioGroup.mjs +0 -37
- package/dist/components/ui/form/RadioGroup.mjs.map +0 -1
- package/dist/components/ui/form/Select.mjs +0 -179
- package/dist/components/ui/form/Select.mjs.map +0 -1
- package/dist/components/ui/form/SelectField.mjs +0 -80
- package/dist/components/ui/form/SelectField.mjs.map +0 -1
- package/dist/components/ui/form/Switch.mjs +0 -33
- package/dist/components/ui/form/Switch.mjs.map +0 -1
- package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +0 -40
- package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +0 -1
- package/dist/components/ui/form/TextAreaField.mjs +0 -56
- package/dist/components/ui/form/TextAreaField.mjs.map +0 -1
- package/dist/components/ui/form/Textarea.mjs +0 -20
- package/dist/components/ui/form/Textarea.mjs.map +0 -1
- package/dist/components/ui/overlay/Command.mjs +0 -178
- package/dist/components/ui/overlay/Command.mjs.map +0 -1
- package/dist/components/ui/overlay/Dialog.mjs +0 -142
- package/dist/components/ui/overlay/Dialog.mjs.map +0 -1
- package/dist/components/ui/overlay/Popover.mjs +0 -46
- package/dist/components/ui/overlay/Popover.mjs.map +0 -1
- package/dist/components/ui/overlay/Sheet.mjs +0 -142
- package/dist/components/ui/overlay/Sheet.mjs.map +0 -1
- package/dist/components/ui/overlay/Tooltip.mjs +0 -57
- package/dist/components/ui/overlay/Tooltip.mjs.map +0 -1
- package/dist/components/widgets/notifications/NotificationCard.mjs +0 -54
- package/dist/components/widgets/notifications/NotificationCard.mjs.map +0 -1
- package/dist/enums/AccountSectionType.mjs +0 -11
- package/dist/enums/AccountSectionType.mjs.map +0 -1
- package/dist/hooks/copy-to-clipboard.hook.mjs +0 -52
- package/dist/hooks/copy-to-clipboard.hook.mjs.map +0 -1
- package/dist/hooks/useCountdownTimer.mjs +0 -29
- package/dist/hooks/useCountdownTimer.mjs.map +0 -1
- package/dist/hooks/useDebounce.mjs +0 -19
- package/dist/hooks/useDebounce.mjs.map +0 -1
- package/dist/hooks/useDebounceState.mjs +0 -12
- package/dist/hooks/useDebounceState.mjs.map +0 -1
- package/dist/hooks/useDebouncedEffect.mjs +0 -44
- package/dist/hooks/useDebouncedEffect.mjs.map +0 -1
- package/dist/hooks/useIsMobile.mjs +0 -18
- package/dist/hooks/useIsMobile.mjs.map +0 -1
- package/dist/hooks/usePasswordVisibility.mjs +0 -13
- package/dist/hooks/usePasswordVisibility.mjs.map +0 -1
- package/dist/index.mjs +0 -457
- package/dist/index.mjs.map +0 -1
- package/dist/infra/api/client.mjs +0 -136
- package/dist/infra/api/client.mjs.map +0 -1
- package/dist/infra/api/types.mjs +0 -31
- package/dist/infra/api/types.mjs.map +0 -1
- package/dist/infra/utils/client-info.mjs +0 -27
- package/dist/infra/utils/client-info.mjs.map +0 -1
- package/dist/infra/utils/clsx.mjs +0 -9
- package/dist/infra/utils/clsx.mjs.map +0 -1
- package/dist/infra/utils/params.mjs +0 -21
- package/dist/infra/utils/params.mjs.map +0 -1
- package/dist/infra/utils/parser.mjs +0 -24
- package/dist/infra/utils/parser.mjs.map +0 -1
- package/dist/infra/utils/percentage.mjs +0 -20
- package/dist/infra/utils/percentage.mjs.map +0 -1
- package/dist/middleware.mjs +0 -10
- package/dist/middleware.mjs.map +0 -1
- package/dist/middlewares/chain.mjs +0 -37
- package/dist/middlewares/chain.mjs.map +0 -1
- package/dist/middlewares/create-auth-middleware.mjs +0 -28
- package/dist/middlewares/create-auth-middleware.mjs.map +0 -1
- package/dist/middlewares/types.mjs +0 -11
- package/dist/middlewares/types.mjs.map +0 -1
- package/dist/modules/accounts/actions/account-management.action.mjs +0 -82
- package/dist/modules/accounts/actions/account-management.action.mjs.map +0 -1
- package/dist/modules/accounts/actions/find-current-account.action.mjs +0 -10
- package/dist/modules/accounts/actions/find-current-account.action.mjs.map +0 -1
- package/dist/modules/accounts/actions/list-currencies.action.mjs +0 -10
- package/dist/modules/accounts/actions/list-currencies.action.mjs.map +0 -1
- package/dist/modules/accounts/actions/list-timezones.action.mjs +0 -10
- package/dist/modules/accounts/actions/list-timezones.action.mjs.map +0 -1
- package/dist/modules/accounts/hooks/current-account.hook.mjs +0 -24
- package/dist/modules/accounts/hooks/current-account.hook.mjs.map +0 -1
- package/dist/modules/accounts/hooks/useAccountManagement.mjs +0 -71
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +0 -1
- package/dist/modules/accounts/hooks/useCurrencies.mjs +0 -17
- package/dist/modules/accounts/hooks/useCurrencies.mjs.map +0 -1
- package/dist/modules/accounts/hooks/useTimezones.mjs +0 -17
- package/dist/modules/accounts/hooks/useTimezones.mjs.map +0 -1
- package/dist/modules/accounts/services/account.service.mjs +0 -180
- package/dist/modules/accounts/services/account.service.mjs.map +0 -1
- package/dist/modules/accounts/services/currency.service.mjs +0 -24
- package/dist/modules/accounts/services/currency.service.mjs.map +0 -1
- package/dist/modules/accounts/services/timezone.service.mjs +0 -65
- package/dist/modules/accounts/services/timezone.service.mjs.map +0 -1
- package/dist/modules/accounts/services/two-factor.service.mjs +0 -77
- package/dist/modules/accounts/services/two-factor.service.mjs.map +0 -1
- package/dist/modules/accounts/types.mjs +0 -1
- package/dist/modules/accounts/types.mjs.map +0 -1
- package/dist/modules/auth/actions/login.action.mjs +0 -14
- package/dist/modules/auth/actions/login.action.mjs.map +0 -1
- package/dist/modules/auth/actions/logout.action.mjs +0 -14
- package/dist/modules/auth/actions/logout.action.mjs.map +0 -1
- package/dist/modules/auth/actions/register.action.mjs +0 -14
- package/dist/modules/auth/actions/register.action.mjs.map +0 -1
- package/dist/modules/auth/actions/validate-session.action.mjs +0 -60
- package/dist/modules/auth/actions/validate-session.action.mjs.map +0 -1
- package/dist/modules/auth/actions/verify-two-factor.action.mjs +0 -17
- package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +0 -1
- package/dist/modules/auth/hooks/login.hook.mjs +0 -13
- package/dist/modules/auth/hooks/login.hook.mjs.map +0 -1
- package/dist/modules/auth/hooks/logout.hook.mjs +0 -13
- package/dist/modules/auth/hooks/logout.hook.mjs.map +0 -1
- package/dist/modules/auth/hooks/register.hook.mjs +0 -13
- package/dist/modules/auth/hooks/register.hook.mjs.map +0 -1
- package/dist/modules/auth/hooks/useUserQuery.mjs +0 -63
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +0 -1
- package/dist/modules/auth/schema.mjs +0 -1
- package/dist/modules/auth/schema.mjs.map +0 -1
- package/dist/modules/auth/services/auth.service.mjs +0 -293
- package/dist/modules/auth/services/auth.service.mjs.map +0 -1
- package/dist/modules/auth/utils/get-user-context.mjs +0 -24
- package/dist/modules/auth/utils/get-user-context.mjs.map +0 -1
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +0 -10
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +0 -1
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +0 -76
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +0 -1
- package/dist/modules/ia-credits/services/ia-credits.service.mjs +0 -31
- package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +0 -1
- package/dist/modules/ia-credits/types.mjs +0 -25
- package/dist/modules/ia-credits/types.mjs.map +0 -1
- package/dist/modules/projects/actions/add-project-user.action.mjs +0 -10
- package/dist/modules/projects/actions/add-project-user.action.mjs.map +0 -1
- package/dist/modules/projects/actions/list-available-users.action.mjs +0 -10
- package/dist/modules/projects/actions/list-available-users.action.mjs.map +0 -1
- package/dist/modules/projects/actions/list-project-users.action.mjs +0 -10
- package/dist/modules/projects/actions/list-project-users.action.mjs.map +0 -1
- package/dist/modules/projects/actions/remove-project-user.action.mjs +0 -10
- package/dist/modules/projects/actions/remove-project-user.action.mjs.map +0 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +0 -34
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +0 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +0 -34
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +0 -1
- package/dist/modules/projects/services/project-users.service.mjs +0 -78
- package/dist/modules/projects/services/project-users.service.mjs.map +0 -1
- package/dist/modules/projects/types.mjs +0 -22
- package/dist/modules/projects/types.mjs.map +0 -1
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +0 -10
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +0 -1
- package/dist/modules/subscriptions/constants/addons.constants.mjs +0 -12
- package/dist/modules/subscriptions/constants/addons.constants.mjs.map +0 -1
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +0 -20
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +0 -1
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +0 -18
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +0 -1
- package/dist/modules/subscriptions/services/subscriptions.service.mjs +0 -32
- package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +0 -1
- package/dist/modules/subscriptions/types.mjs +0 -57
- package/dist/modules/subscriptions/types.mjs.map +0 -1
- package/dist/modules/users/action/find-user-by-id.action.mjs +0 -10
- package/dist/modules/users/action/find-user-by-id.action.mjs.map +0 -1
- package/dist/modules/users/action/list-messages.action.mjs +0 -13
- package/dist/modules/users/action/list-messages.action.mjs.map +0 -1
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +0 -10
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +0 -1
- package/dist/modules/users/action/mark-message-as-read.action.mjs +0 -10
- package/dist/modules/users/action/mark-message-as-read.action.mjs.map +0 -1
- package/dist/modules/users/hooks/messages.hook.mjs +0 -57
- package/dist/modules/users/hooks/messages.hook.mjs.map +0 -1
- package/dist/modules/users/schema/messages.schema.mjs +0 -21
- package/dist/modules/users/schema/messages.schema.mjs.map +0 -1
- package/dist/modules/users/schema.mjs +0 -11
- package/dist/modules/users/schema.mjs.map +0 -1
- package/dist/modules/users/services/messages.service.mjs +0 -35
- package/dist/modules/users/services/messages.service.mjs.map +0 -1
- package/dist/modules/users/services/user.service.mjs +0 -50
- package/dist/modules/users/services/user.service.mjs.map +0 -1
- package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs +0 -15
- package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs.map +0 -1
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +0 -21
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +0 -1
- package/dist/modules/whitelabel/schema.mjs +0 -1
- package/dist/modules/whitelabel/schema.mjs.map +0 -1
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs +0 -81
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +0 -1
- package/dist/modules/whitelabel/services/whitelabel.service.mjs +0 -61
- package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +0 -1
- package/dist/modules/whitelabel/styles-schema.mjs +0 -1
- package/dist/modules/whitelabel/styles-schema.mjs.map +0 -1
- package/dist/providers/auth.provider.mjs +0 -100
- package/dist/providers/auth.provider.mjs.map +0 -1
- package/dist/providers/query.provider.mjs +0 -99
- package/dist/providers/query.provider.mjs.map +0 -1
- package/dist/providers/whitelabel.provider.mjs +0 -31
- package/dist/providers/whitelabel.provider.mjs.map +0 -1
- package/dist/server.mjs +0 -84
- package/dist/server.mjs.map +0 -1
- package/dist/store/useAccountModals.mjs +0 -18
- package/dist/store/useAccountModals.mjs.map +0 -1
- package/dist/store/useMdSidebarStore.mjs +0 -11
- package/dist/store/useMdSidebarStore.mjs.map +0 -1
- package/dist/store/useMobileNavbarSheet.mjs +0 -14
- package/dist/store/useMobileNavbarSheet.mjs.map +0 -1
- package/dist/store/useModalManager.mjs +0 -75
- package/dist/store/useModalManager.mjs.map +0 -1
- package/dist/utils/browser/clipboard.mjs +0 -36
- package/dist/utils/browser/clipboard.mjs.map +0 -1
- package/dist/utils/file/index.mjs +0 -9
- package/dist/utils/file/index.mjs.map +0 -1
- package/dist/utils/format/masks.mjs +0 -56
- package/dist/utils/format/masks.mjs.map +0 -1
- package/dist/utils/intl/locales.mjs +0 -12
- package/dist/utils/intl/locales.mjs.map +0 -1
- package/dist/utils/safeServerAction.mjs +0 -16
- package/dist/utils/safeServerAction.mjs.map +0 -1
- package/dist/utils/validators/account.mjs +0 -26
- package/dist/utils/validators/account.mjs.map +0 -1
- package/dist/utils/validators/common.mjs +0 -47
- package/dist/utils/validators/common.mjs.map +0 -1
- package/dist/utils/withAction.mjs +0 -13
- package/dist/utils/withAction.mjs.map +0 -1
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import "server-only";
|
|
2
|
-
import { api } from "../../../infra/api/client";
|
|
3
|
-
import { ApiError } from "../../../infra/api/types";
|
|
4
|
-
import { buildQueryParams } from "../../../infra/utils/params";
|
|
5
|
-
import { getUserContext } from "../../auth/utils/get-user-context";
|
|
6
|
-
import { fileToBase64 } from "../../../utils/file/index";
|
|
7
|
-
class AccountService {
|
|
8
|
-
async findCurrentAccount() {
|
|
9
|
-
const { id_account } = await getUserContext();
|
|
10
|
-
const response = await api.apps.get(`/accounts/${id_account}`);
|
|
11
|
-
if (response.status === 0 || !response.data?.[0]) {
|
|
12
|
-
throw new ApiError(
|
|
13
|
-
response.message || "Erro ao buscar dados da conta",
|
|
14
|
-
"GET_ACCOUNT_FAILED",
|
|
15
|
-
400
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
return response.data[0];
|
|
19
|
-
}
|
|
20
|
-
async listAccountUsers(params) {
|
|
21
|
-
const { id_account } = await getUserContext();
|
|
22
|
-
const queryParams = buildQueryParams(params);
|
|
23
|
-
const endpoint = `/accounts/${id_account}/users?${queryParams}`;
|
|
24
|
-
const response = await api.apps.get(endpoint);
|
|
25
|
-
if (response.status === 0) {
|
|
26
|
-
throw new ApiError(
|
|
27
|
-
response.message || "Erro ao listar usu\xE1rios",
|
|
28
|
-
"LIST_ACCOUNT_USERS_FAILED",
|
|
29
|
-
400
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
users: response.data || [],
|
|
34
|
-
total: response.total || 0
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
async changeUserPhoto(userId, photo) {
|
|
38
|
-
const { id_account } = await getUserContext();
|
|
39
|
-
const base64 = await fileToBase64(photo);
|
|
40
|
-
const response = await api.apps.put(
|
|
41
|
-
`/accounts/${id_account}/users/${userId}/file/photo`,
|
|
42
|
-
{ file: base64 }
|
|
43
|
-
);
|
|
44
|
-
if (response.status === 0) {
|
|
45
|
-
throw new ApiError(
|
|
46
|
-
response.message || "Erro ao mudar foto do usu\xE1rio",
|
|
47
|
-
"CHANGE_USER_PHOTO_FAILED",
|
|
48
|
-
400
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
return response;
|
|
52
|
-
}
|
|
53
|
-
async deleteAccountUser(userId) {
|
|
54
|
-
const { id_account } = await getUserContext();
|
|
55
|
-
const response = await api.apps.delete(
|
|
56
|
-
`/accounts/${id_account}/users/${userId}`
|
|
57
|
-
);
|
|
58
|
-
if (response.status === 0) {
|
|
59
|
-
throw new ApiError(response.message || "Erro ao deletar usu\xE1rio", "DELETE_USER_FAILED", 400);
|
|
60
|
-
}
|
|
61
|
-
return response;
|
|
62
|
-
}
|
|
63
|
-
async deleteAccount() {
|
|
64
|
-
const { id_account } = await getUserContext();
|
|
65
|
-
const response = await api.apps.delete(`/accounts/${id_account}`);
|
|
66
|
-
if (response.status === 0) {
|
|
67
|
-
throw new ApiError(response.message || "Erro ao deletar conta", "DELETE_ACCOUNT_FAILED", 400);
|
|
68
|
-
}
|
|
69
|
-
return response;
|
|
70
|
-
}
|
|
71
|
-
async createAccountUser(user) {
|
|
72
|
-
const { id_account } = await getUserContext();
|
|
73
|
-
const response = await api.apps.post(
|
|
74
|
-
`/accounts/${id_account}/users`,
|
|
75
|
-
{
|
|
76
|
-
...user,
|
|
77
|
-
photo: user.photo ? await fileToBase64(user.photo) : null
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
if (response.status === 0) {
|
|
81
|
-
throw new ApiError(response.message || "Erro ao criar usu\xE1rio", "CREATE_USER_FAILED", 400);
|
|
82
|
-
}
|
|
83
|
-
return response;
|
|
84
|
-
}
|
|
85
|
-
async resolvePhotoField(user) {
|
|
86
|
-
if (user.photo === void 0) return {};
|
|
87
|
-
const photo = user.photo != null && typeof user.photo !== "string" ? await fileToBase64(user.photo) : user.photo;
|
|
88
|
-
return { photo };
|
|
89
|
-
}
|
|
90
|
-
async updateAccountUser(user) {
|
|
91
|
-
const { id_account, id_user } = await getUserContext();
|
|
92
|
-
const response = await api.apps.put(
|
|
93
|
-
`/accounts/${id_account}/users/${id_user}`,
|
|
94
|
-
{ ...user, ...await this.resolvePhotoField(user) }
|
|
95
|
-
);
|
|
96
|
-
if (response.status === 0) {
|
|
97
|
-
throw new ApiError(
|
|
98
|
-
response.message || "Erro ao atualizar usu\xE1rio",
|
|
99
|
-
"UPDATE_USER_FAILED",
|
|
100
|
-
400
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
return response;
|
|
104
|
-
}
|
|
105
|
-
async updateAccountUserById(userId, user) {
|
|
106
|
-
const { id_account } = await getUserContext();
|
|
107
|
-
const response = await api.apps.put(
|
|
108
|
-
`/accounts/${id_account}/users/${userId}`,
|
|
109
|
-
{ ...user, ...await this.resolvePhotoField(user) }
|
|
110
|
-
);
|
|
111
|
-
if (response.status === 0) {
|
|
112
|
-
throw new ApiError(
|
|
113
|
-
response.message || "Erro ao atualizar usu\xE1rio",
|
|
114
|
-
"UPDATE_USER_FAILED",
|
|
115
|
-
400
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
return response;
|
|
119
|
-
}
|
|
120
|
-
async updateAccount(data) {
|
|
121
|
-
const { id_account } = await getUserContext();
|
|
122
|
-
const response = await api.apps.put(`/accounts/${id_account}`, data);
|
|
123
|
-
if (response.status === 0) {
|
|
124
|
-
throw new ApiError(
|
|
125
|
-
response.message || "Erro ao atualizar conta",
|
|
126
|
-
"UPDATE_ACCOUNT_FAILED",
|
|
127
|
-
400
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
return response;
|
|
131
|
-
}
|
|
132
|
-
async requestContactReset(type, newContact) {
|
|
133
|
-
const { id_account, id_user } = await getUserContext();
|
|
134
|
-
const response = await api.apps.post(
|
|
135
|
-
`/accounts/${id_account}/users/${id_user}/resetContact/request`,
|
|
136
|
-
{ type, newContact }
|
|
137
|
-
);
|
|
138
|
-
if (response.status === 0) {
|
|
139
|
-
throw new ApiError(
|
|
140
|
-
response.message || "Erro ao solicitar altera\xE7\xE3o",
|
|
141
|
-
"REQUEST_CONTACT_RESET_FAILED",
|
|
142
|
-
400
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
async confirmContactReset(type, token, newContact) {
|
|
147
|
-
const { id_account, id_user } = await getUserContext();
|
|
148
|
-
const response = await api.apps.post(
|
|
149
|
-
`/accounts/${id_account}/users/${id_user}/resetContact/confirm`,
|
|
150
|
-
{ type, token, newContact }
|
|
151
|
-
);
|
|
152
|
-
if (response.status === 0) {
|
|
153
|
-
throw new ApiError(
|
|
154
|
-
response.message || "C\xF3digo inv\xE1lido ou expirado",
|
|
155
|
-
"CONFIRM_CONTACT_RESET_FAILED",
|
|
156
|
-
400
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async changePassword(data) {
|
|
161
|
-
const { id_account, id_user } = await getUserContext();
|
|
162
|
-
const response = await api.apps.put(
|
|
163
|
-
`/accounts/${id_account}/users/${id_user}/action/changePassword`,
|
|
164
|
-
data
|
|
165
|
-
);
|
|
166
|
-
if (response.status === 0) {
|
|
167
|
-
throw new ApiError(
|
|
168
|
-
response.message || "Erro ao alterar senha",
|
|
169
|
-
"CHANGE_PASSWORD_FAILED",
|
|
170
|
-
400
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
return response;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
const accountService = new AccountService();
|
|
177
|
-
export {
|
|
178
|
-
accountService
|
|
179
|
-
};
|
|
180
|
-
//# sourceMappingURL=account.service.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/services/account.service.ts"],"sourcesContent":["import 'server-only';\n\nimport { api } from '../../../infra/api/client';\nimport { ApiError } from '../../../infra/api/types';\nimport { buildQueryParams } from '../../../infra/utils/params';\nimport { getUserContext } from '../../auth/utils/get-user-context';\nimport { fileToBase64 } from '../../../utils/file/index';\nimport type {\n Account,\n AccountUsersPaginationParams,\n ChangePasswordRequest,\n ChangePasswordResponse,\n ChangeUserPhotoResponse,\n CreateAccountUserRequest,\n CreateAccountUserResponse,\n DeleteAccountResponse,\n DeleteAccountUserResponse,\n GetAccountDataResponse,\n ListAccountUsersResponse,\n UpdateAccountRequest,\n UpdateAccountResponse,\n UpdateAccountUserRequest,\n UpdateAccountUserResponse,\n} from '../types';\n\nclass AccountService {\n async findCurrentAccount(): Promise<Account> {\n const { id_account } = await getUserContext();\n const response = await api.apps.get<GetAccountDataResponse>(`/accounts/${id_account}`);\n\n if (response.status === 0 || !response.data?.[0]) {\n throw new ApiError(\n response.message || 'Erro ao buscar dados da conta',\n 'GET_ACCOUNT_FAILED',\n 400\n );\n }\n\n return response.data[0];\n }\n\n async listAccountUsers(params?: Partial<AccountUsersPaginationParams>) {\n const { id_account } = await getUserContext();\n const queryParams = buildQueryParams(params);\n const endpoint = `/accounts/${id_account}/users?${queryParams}`;\n const response = await api.apps.get<ListAccountUsersResponse>(endpoint);\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao listar usuários',\n 'LIST_ACCOUNT_USERS_FAILED',\n 400\n );\n }\n\n return {\n users: response.data || [],\n total: response.total || 0,\n };\n }\n\n async changeUserPhoto(userId: number, photo: File): Promise<ChangeUserPhotoResponse> {\n const { id_account } = await getUserContext();\n const base64 = await fileToBase64(photo);\n const response = await api.apps.put<ChangeUserPhotoResponse>(\n `/accounts/${id_account}/users/${userId}/file/photo`,\n { file: base64 }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao mudar foto do usuário',\n 'CHANGE_USER_PHOTO_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async deleteAccountUser(userId: number): Promise<DeleteAccountUserResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.delete<DeleteAccountUserResponse>(\n `/accounts/${id_account}/users/${userId}`\n );\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao deletar usuário', 'DELETE_USER_FAILED', 400);\n }\n\n return response;\n }\n\n async deleteAccount(): Promise<DeleteAccountResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.delete<DeleteAccountResponse>(`/accounts/${id_account}`);\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao deletar conta', 'DELETE_ACCOUNT_FAILED', 400);\n }\n\n return response;\n }\n\n async createAccountUser(user: CreateAccountUserRequest): Promise<CreateAccountUserResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.post<CreateAccountUserResponse>(\n `/accounts/${id_account}/users`,\n {\n ...user,\n photo: user.photo ? await fileToBase64(user.photo) : null,\n }\n );\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao criar usuário', 'CREATE_USER_FAILED', 400);\n }\n\n return response;\n }\n\n private async resolvePhotoField(user: UpdateAccountUserRequest): Promise<{ photo?: string | null }> {\n if (user.photo === undefined) return {};\n const photo =\n user.photo != null && typeof user.photo !== 'string'\n ? await fileToBase64(user.photo)\n : user.photo;\n return { photo };\n }\n\n async updateAccountUser(user: UpdateAccountUserRequest): Promise<UpdateAccountUserResponse> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.put<UpdateAccountUserResponse>(\n `/accounts/${id_account}/users/${id_user}`,\n { ...user, ...(await this.resolvePhotoField(user)) }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao atualizar usuário',\n 'UPDATE_USER_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async updateAccountUserById(\n userId: number,\n user: UpdateAccountUserRequest\n ): Promise<UpdateAccountUserResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.put<UpdateAccountUserResponse>(\n `/accounts/${id_account}/users/${userId}`,\n { ...user, ...(await this.resolvePhotoField(user)) }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao atualizar usuário',\n 'UPDATE_USER_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async updateAccount(data: UpdateAccountRequest): Promise<UpdateAccountResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.put<UpdateAccountResponse>(`/accounts/${id_account}`, data);\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao atualizar conta',\n 'UPDATE_ACCOUNT_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async requestContactReset(type: 'email' | 'phone', newContact: string): Promise<void> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.post<{ status: number; message: string }>(\n `/accounts/${id_account}/users/${id_user}/resetContact/request`,\n { type, newContact }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao solicitar alteração',\n 'REQUEST_CONTACT_RESET_FAILED',\n 400\n );\n }\n }\n\n async confirmContactReset(type: 'email' | 'phone', token: string, newContact: string): Promise<void> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.post<{ status: number; message: string }>(\n `/accounts/${id_account}/users/${id_user}/resetContact/confirm`,\n { type, token, newContact }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Código inválido ou expirado',\n 'CONFIRM_CONTACT_RESET_FAILED',\n 400\n );\n }\n }\n\n async changePassword(data: ChangePasswordRequest): Promise<ChangePasswordResponse> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.put<ChangePasswordResponse>(\n `/accounts/${id_account}/users/${id_user}/action/changePassword`,\n data\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao alterar senha',\n 'CHANGE_PASSWORD_FAILED',\n 400\n );\n }\n\n return response;\n }\n}\n\nexport const accountService = new AccountService();\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAmB7B,MAAM,eAAe;AAAA,EACnB,MAAM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D,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC,EAAE,MAAM,OAAO,WAAW;AAAA,IAC5B;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,eAAe,MAA8D;AACjF,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC;AAAA,IACF;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,iBAAiB,IAAI,eAAe;","names":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { api } from "../../../infra/api/client";
|
|
2
|
-
const FALLBACK_CURRENCIES = [
|
|
3
|
-
{ value: "BRL", label: "Real (R$)" },
|
|
4
|
-
{ value: "USD", label: "D\xF3lar Americano (US$)" },
|
|
5
|
-
{ value: "EUR", label: "Euro (\u20AC)" }
|
|
6
|
-
];
|
|
7
|
-
class CurrencyService {
|
|
8
|
-
async fetchOptions() {
|
|
9
|
-
try {
|
|
10
|
-
const response = await api.apps.get("/accounts/action/currencies");
|
|
11
|
-
return response.data.map((item) => ({
|
|
12
|
-
value: item.value,
|
|
13
|
-
label: item.title["pt-br"] || item.title["en-us"] || item.value
|
|
14
|
-
}));
|
|
15
|
-
} catch {
|
|
16
|
-
return FALLBACK_CURRENCIES;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const currencyService = new CurrencyService();
|
|
21
|
-
export {
|
|
22
|
-
currencyService
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=currency.service.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/services/currency.service.ts"],"sourcesContent":["import { api } from '../../../infra/api/client';\r\nimport type { ComboboxOption } from '../../../components/ui/form/ComboboxField';\r\n\r\ntype CurrencyApiItem = {\r\n value: string;\r\n icon: string;\r\n title: { 'pt-br': string; 'en-us': string };\r\n description: string;\r\n};\r\n\r\ntype CurrencyApiResponse = {\r\n status: number;\r\n message: string;\r\n data: CurrencyApiItem[];\r\n};\r\n\r\nconst FALLBACK_CURRENCIES: ComboboxOption[] = [\r\n { value: 'BRL', label: 'Real (R$)' },\r\n { value: 'USD', label: 'Dólar Americano (US$)' },\r\n { value: 'EUR', label: 'Euro (€)' },\r\n];\r\n\r\nclass CurrencyService {\r\n async fetchOptions(): Promise<ComboboxOption[]> {\r\n try {\r\n const response = await api.apps.get<CurrencyApiResponse>('/accounts/action/currencies');\r\n\r\n return response.data.map((item) => ({\r\n value: item.value,\r\n label: item.title['pt-br'] || item.title['en-us'] || item.value,\r\n }));\r\n } catch {\r\n return FALLBACK_CURRENCIES;\r\n }\r\n }\r\n}\r\n\r\nexport const currencyService = new CurrencyService();\r\n"],"mappings":"AAAA,SAAS,WAAW;AAgBpB,MAAM,sBAAwC;AAAA,EAC5C,EAAE,OAAO,OAAO,OAAO,YAAY;AAAA,EACnC,EAAE,OAAO,OAAO,OAAO,2BAAwB;AAAA,EAC/C,EAAE,OAAO,OAAO,OAAO,gBAAW;AACpC;AAEA,MAAM,gBAAgB;AAAA,EACpB,MAAM,eAA0C;AAC9C,QAAI;AACF,YAAM,WAAW,MAAM,IAAI,KAAK,IAAyB,6BAA6B;AAEtF,aAAO,SAAS,KAAK,IAAI,CAAC,UAAU;AAAA,QAClC,OAAO,KAAK;AAAA,QACZ,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,MAAM,OAAO,KAAK,KAAK;AAAA,MAC5D,EAAE;AAAA,IACJ,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { api } from "../../../infra/api/client";
|
|
2
|
-
function parseOffsetMinutes(offsetStr) {
|
|
3
|
-
const match = offsetStr.match(/GMT([+-])(\d+)(?::(\d+))?/);
|
|
4
|
-
if (!match) return 0;
|
|
5
|
-
const sign = match[1] === "+" ? 1 : -1;
|
|
6
|
-
return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? "0", 10));
|
|
7
|
-
}
|
|
8
|
-
const FALLBACK_TIMEZONES = [
|
|
9
|
-
{ value: "America/Noronha", label: "(GMT-2) America/Noronha", displayValue: "(GMT-2) Noronha" },
|
|
10
|
-
{ value: "America/Sao_Paulo", label: "(GMT-3) America/Sao Paulo", displayValue: "(GMT-3) Sao Paulo" },
|
|
11
|
-
{ value: "America/Manaus", label: "(GMT-4) America/Manaus", displayValue: "(GMT-4) Manaus" },
|
|
12
|
-
{ value: "America/Rio_Branco", label: "(GMT-5) America/Rio Branco", displayValue: "(GMT-5) Rio Branco" },
|
|
13
|
-
{ value: "America/New_York", label: "(GMT-5) America/New York", displayValue: "(GMT-5) New York" },
|
|
14
|
-
{ value: "America/Los_Angeles", label: "(GMT-8) America/Los Angeles", displayValue: "(GMT-8) Los Angeles" },
|
|
15
|
-
{ value: "Europe/London", label: "(GMT+0) Europe/London", displayValue: "(GMT+0) London" },
|
|
16
|
-
{ value: "Europe/Paris", label: "(GMT+1) Europe/Paris", displayValue: "(GMT+1) Paris" },
|
|
17
|
-
{ value: "Asia/Tokyo", label: "(GMT+9) Asia/Tokyo", displayValue: "(GMT+9) Tokyo" }
|
|
18
|
-
];
|
|
19
|
-
class TimezoneService {
|
|
20
|
-
async fetchOptions() {
|
|
21
|
-
try {
|
|
22
|
-
const response = await api.apps.get("/accounts/action/timezones");
|
|
23
|
-
const now = /* @__PURE__ */ new Date();
|
|
24
|
-
const items = response.data.map((item) => {
|
|
25
|
-
const offsetStr = new Intl.DateTimeFormat("en", { timeZone: item.value, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
|
|
26
|
-
const city = item.value.split("/").slice(1).join("/").replace(/_/g, " ") || item.value;
|
|
27
|
-
return {
|
|
28
|
-
value: item.value,
|
|
29
|
-
label: `(${offsetStr}) ${item.value.replace(/_/g, " ")}`,
|
|
30
|
-
displayValue: `(${offsetStr}) ${city}`,
|
|
31
|
-
sort: parseOffsetMinutes(offsetStr)
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
|
|
35
|
-
return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
|
|
36
|
-
} catch {
|
|
37
|
-
return FALLBACK_TIMEZONES;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
buildOptions() {
|
|
41
|
-
try {
|
|
42
|
-
const zones = Intl.supportedValuesOf("timeZone");
|
|
43
|
-
const now = /* @__PURE__ */ new Date();
|
|
44
|
-
const items = zones.map((tz) => {
|
|
45
|
-
const offsetStr = new Intl.DateTimeFormat("en", { timeZone: tz, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
|
|
46
|
-
const city = tz.split("/").slice(1).join("/").replace(/_/g, " ") || tz;
|
|
47
|
-
return {
|
|
48
|
-
value: tz,
|
|
49
|
-
label: `(${offsetStr}) ${tz.replace(/_/g, " ")}`,
|
|
50
|
-
displayValue: `(${offsetStr}) ${city}`,
|
|
51
|
-
sort: parseOffsetMinutes(offsetStr)
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
|
|
55
|
-
return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
|
|
56
|
-
} catch {
|
|
57
|
-
return FALLBACK_TIMEZONES;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const timezoneService = new TimezoneService();
|
|
62
|
-
export {
|
|
63
|
-
timezoneService
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=timezone.service.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/services/timezone.service.ts"],"sourcesContent":["import { api } from '../../../infra/api/client';\r\n\r\nexport type TimezoneOption = {\r\n value: string;\r\n label: string;\r\n displayValue: string;\r\n};\r\n\r\ntype TimezoneApiResponse = {\r\n message: string;\r\n data: { value: string; title: string }[];\r\n};\r\n\r\nfunction parseOffsetMinutes(offsetStr: string): number {\r\n const match = offsetStr.match(/GMT([+-])(\\d+)(?::(\\d+))?/);\r\n if (!match) return 0;\r\n const sign = match[1] === '+' ? 1 : -1;\r\n return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? '0', 10));\r\n}\r\n\r\nconst FALLBACK_TIMEZONES: TimezoneOption[] = [\r\n { value: 'America/Noronha', label: '(GMT-2) America/Noronha', displayValue: '(GMT-2) Noronha' },\r\n { value: 'America/Sao_Paulo', label: '(GMT-3) America/Sao Paulo', displayValue: '(GMT-3) Sao Paulo' },\r\n { value: 'America/Manaus', label: '(GMT-4) America/Manaus', displayValue: '(GMT-4) Manaus' },\r\n { value: 'America/Rio_Branco', label: '(GMT-5) America/Rio Branco', displayValue: '(GMT-5) Rio Branco' },\r\n { value: 'America/New_York', label: '(GMT-5) America/New York', displayValue: '(GMT-5) New York' },\r\n { value: 'America/Los_Angeles', label: '(GMT-8) America/Los Angeles', displayValue: '(GMT-8) Los Angeles' },\r\n { value: 'Europe/London', label: '(GMT+0) Europe/London', displayValue: '(GMT+0) London' },\r\n { value: 'Europe/Paris', label: '(GMT+1) Europe/Paris', displayValue: '(GMT+1) Paris' },\r\n { value: 'Asia/Tokyo', label: '(GMT+9) Asia/Tokyo', displayValue: '(GMT+9) Tokyo' },\r\n];\r\n\r\nclass TimezoneService {\r\n async fetchOptions(): Promise<TimezoneOption[]> {\r\n try {\r\n const response = await api.apps.get<TimezoneApiResponse>('/accounts/action/timezones');\r\n const now = new Date();\r\n\r\n const items = response.data.map((item) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: item.value, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = item.value.split('/').slice(1).join('/').replace(/_/g, ' ') || item.value;\r\n\r\n return {\r\n value: item.value,\r\n label: `(${offsetStr}) ${item.value.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n }\r\n\r\n buildOptions(): TimezoneOption[] {\r\n try {\r\n const zones = Intl.supportedValuesOf('timeZone');\r\n const now = new Date();\r\n\r\n const items = zones.map((tz) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: tz, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = tz.split('/').slice(1).join('/').replace(/_/g, ' ') || tz;\r\n\r\n return {\r\n value: tz,\r\n label: `(${offsetStr}) ${tz.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n }\r\n}\r\n\r\nexport const timezoneService = new TimezoneService();\r\n"],"mappings":"AAAA,SAAS,WAAW;AA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IAAI,CAAC,EAAE,OAAO,OAAO,aAAa,OAAO,EAAE,OAAO,OAAO,aAAa,EAAE;AAAA,IACvF,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import "server-only";
|
|
2
|
-
import { ApiError } from "../../../infra/api/types";
|
|
3
|
-
import { getUserContext } from "../../auth/utils/get-user-context";
|
|
4
|
-
import { findWhitelabel } from "../../whitelabel/actions/find-whitelabel.action";
|
|
5
|
-
const TWO_FA_BASE_URL = process.env.R2_2FA_URL || "https://r2-2fa.greatapps.dev.br";
|
|
6
|
-
class TwoFactorService {
|
|
7
|
-
async request(path, body) {
|
|
8
|
-
const { id, token } = await findWhitelabel();
|
|
9
|
-
const { id_account, id_user } = await getUserContext();
|
|
10
|
-
const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa/${path}`;
|
|
11
|
-
const response = await fetch(url, {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
"Content-Type": "application/json",
|
|
15
|
-
authorization: token
|
|
16
|
-
},
|
|
17
|
-
body: body ? JSON.stringify(body) : void 0
|
|
18
|
-
});
|
|
19
|
-
if (!response.ok) {
|
|
20
|
-
const errorData = await response.json().catch(() => ({}));
|
|
21
|
-
throw new ApiError(
|
|
22
|
-
errorData.message || `HTTP error ${response.status}`,
|
|
23
|
-
"HTTP_ERROR",
|
|
24
|
-
response.status
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
return response.json();
|
|
28
|
-
}
|
|
29
|
-
async generate() {
|
|
30
|
-
const response = await this.request("generate");
|
|
31
|
-
if (response.status === 0) {
|
|
32
|
-
throw new ApiError(response.message || "Erro ao gerar QR Code", "GENERATE_2FA_FAILED", 400);
|
|
33
|
-
}
|
|
34
|
-
return response;
|
|
35
|
-
}
|
|
36
|
-
async confirm(code) {
|
|
37
|
-
const response = await this.request("confirm", { code });
|
|
38
|
-
if (response.status === 0) {
|
|
39
|
-
throw new ApiError(response.message || "C\xF3digo inv\xE1lido", "CONFIRM_2FA_FAILED", 400);
|
|
40
|
-
}
|
|
41
|
-
return response;
|
|
42
|
-
}
|
|
43
|
-
async verify(code) {
|
|
44
|
-
const response = await this.request("verify", { code });
|
|
45
|
-
if (response.status === 0) {
|
|
46
|
-
throw new ApiError(response.message || "C\xF3digo inv\xE1lido", "VERIFY_2FA_FAILED", 400);
|
|
47
|
-
}
|
|
48
|
-
return response;
|
|
49
|
-
}
|
|
50
|
-
async disable() {
|
|
51
|
-
const { id, token } = await findWhitelabel();
|
|
52
|
-
const { id_account, id_user } = await getUserContext();
|
|
53
|
-
const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa`;
|
|
54
|
-
const response = await fetch(url, {
|
|
55
|
-
method: "DELETE",
|
|
56
|
-
headers: { authorization: token }
|
|
57
|
-
});
|
|
58
|
-
if (!response.ok) {
|
|
59
|
-
const errorData = await response.json().catch(() => ({}));
|
|
60
|
-
throw new ApiError(
|
|
61
|
-
errorData.message || `HTTP error ${response.status}`,
|
|
62
|
-
"HTTP_ERROR",
|
|
63
|
-
response.status
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
const data = await response.json();
|
|
67
|
-
if (data.status === 0) {
|
|
68
|
-
throw new ApiError(data.message || "Erro ao desabilitar 2FA", "DISABLE_2FA_FAILED", 400);
|
|
69
|
-
}
|
|
70
|
-
return data;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const twoFactorService = new TwoFactorService();
|
|
74
|
-
export {
|
|
75
|
-
twoFactorService
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=two-factor.service.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/services/two-factor.service.ts"],"sourcesContent":["import 'server-only';\r\n\r\nimport { ApiError } from '../../../infra/api/types';\r\nimport { getUserContext } from '../../auth/utils/get-user-context';\r\nimport { findWhitelabel } from '../../whitelabel/actions/find-whitelabel.action';\r\nimport type { TwoFactorActionResponse, TwoFactorGenerateResponse } from '../types';\r\n\r\nconst TWO_FA_BASE_URL = process.env.R2_2FA_URL || 'https://r2-2fa.greatapps.dev.br';\r\n\r\nclass TwoFactorService {\r\n private async request<T>(path: string, body?: object): Promise<T> {\r\n const { id, token } = await findWhitelabel();\r\n const { id_account, id_user } = await getUserContext();\r\n\r\n const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa/${path}`;\r\n\r\n const response = await fetch(url, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n authorization: token,\r\n },\r\n body: body ? JSON.stringify(body) : undefined,\r\n });\r\n\r\n if (!response.ok) {\r\n const errorData = await response.json().catch(() => ({})) as Record<string, unknown>;\r\n throw new ApiError(\r\n (errorData.message as string) || `HTTP error ${response.status}`,\r\n 'HTTP_ERROR',\r\n response.status\r\n );\r\n }\r\n\r\n return response.json() as Promise<T>;\r\n }\r\n\r\n async generate(): Promise<TwoFactorGenerateResponse> {\r\n const response = await this.request<TwoFactorGenerateResponse>('generate');\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(response.message || 'Erro ao gerar QR Code', 'GENERATE_2FA_FAILED', 400);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n async confirm(code: string): Promise<TwoFactorActionResponse> {\r\n const response = await this.request<TwoFactorActionResponse>('confirm', { code });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(response.message || 'Código inválido', 'CONFIRM_2FA_FAILED', 400);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n async verify(code: string): Promise<TwoFactorActionResponse> {\r\n const response = await this.request<TwoFactorActionResponse>('verify', { code });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(response.message || 'Código inválido', 'VERIFY_2FA_FAILED', 400);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n async disable(): Promise<TwoFactorActionResponse> {\r\n const { id, token } = await findWhitelabel();\r\n const { id_account, id_user } = await getUserContext();\r\n\r\n const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa`;\r\n\r\n const response = await fetch(url, {\r\n method: 'DELETE',\r\n headers: { authorization: token },\r\n });\r\n\r\n if (!response.ok) {\r\n const errorData = await response.json().catch(() => ({})) as Record<string, unknown>;\r\n throw new ApiError(\r\n (errorData.message as string) || `HTTP error ${response.status}`,\r\n 'HTTP_ERROR',\r\n response.status\r\n );\r\n }\r\n\r\n const data = await response.json() as TwoFactorActionResponse;\r\n\r\n if (data.status === 0) {\r\n throw new ApiError(data.message || 'Erro ao desabilitar 2FA', 'DISABLE_2FA_FAILED', 400);\r\n }\r\n\r\n return data;\r\n }\r\n}\r\n\r\nexport const twoFactorService = new TwoFactorService();\r\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAG/B,MAAM,kBAAkB,QAAQ,IAAI,cAAc;AAElD,MAAM,iBAAiB;AAAA,EACrB,MAAc,QAAW,MAAc,MAA2B;AAChE,UAAM,EAAE,IAAI,MAAM,IAAI,MAAM,eAAe;AAC3C,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AAErD,UAAM,MAAM,GAAG,eAAe,OAAO,EAAE,YAAY,UAAU,UAAU,OAAO,QAAQ,IAAI;AAE1F,UAAM,WAAW,MAAM,MAAM,KAAK;AAAA,MAChC,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,eAAe;AAAA,MACjB;AAAA,MACA,MAAM,OAAO,KAAK,UAAU,IAAI,IAAI;AAAA,IACtC,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,YAAY,MAAM,SAAS,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AACxD,YAAM,IAAI;AAAA,QACP,UAAU,WAAsB,cAAc,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AA,IACF;AAEA,UAAM,OAAO,MAAM,SAAS,KAAK;AAEjC,QAAI,KAAK,WAAW,GAAG;AACrB,YAAM,IAAI,SAAS,KAAK,WAAW,2BAA2B,sBAAsB,GAAG;AAAA,IACzF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,mBAAmB,IAAI,iBAAiB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { authService } from "../services/auth.service";
|
|
4
|
-
import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
|
|
5
|
-
async function loginAction(credentials) {
|
|
6
|
-
return safeServerAction(async () => {
|
|
7
|
-
const clientInfo = await getClientInfoFromRequest();
|
|
8
|
-
return authService.login(credentials, clientInfo);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
loginAction
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=login.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/actions/login.action.ts"],"sourcesContent":["\"use server\";\r\n\r\nimport { safeServerAction } from \"../../../utils/safeServerAction\";\r\nimport { authService } from \"../services/auth.service\";\r\nimport { LoginRequest } from \"../schema\";\r\nimport { getClientInfoFromRequest } from \"../../../infra/utils/client-info\";\r\n\r\nexport async function loginAction(credentials: LoginRequest) {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.login(credentials, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAE5B,SAAS,gCAAgC;AAEzC,eAAsB,YAAY,aAA2B;AAC3D,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,MAAM,aAAa,UAAU;AAAA,EAClD,CAAC;AACH;","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
|
|
4
|
-
import { authService } from "../services/auth.service";
|
|
5
|
-
async function logoutAction() {
|
|
6
|
-
return safeServerAction(async () => {
|
|
7
|
-
const clientInfo = await getClientInfoFromRequest();
|
|
8
|
-
return authService.logout(clientInfo);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
logoutAction
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=logout.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/actions/logout.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\nimport { authService } from '../services/auth.service';\r\n\r\nexport async function logoutAction() {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.logout(clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAE5B,eAAsB,eAAe;AACnC,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,OAAO,UAAU;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { authService } from "../services/auth.service";
|
|
4
|
-
import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
|
|
5
|
-
async function registerAction(data) {
|
|
6
|
-
return safeServerAction(async () => {
|
|
7
|
-
const clientInfo = await getClientInfoFromRequest();
|
|
8
|
-
return authService.register(data, clientInfo);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
registerAction
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=register.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/actions/register.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { RegisterRequest } from '../schema';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nexport async function registerAction(data: RegisterRequest) {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.register(data, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAsB,eAAe,MAAuB;AAC1D,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,SAAS,MAAM,UAAU;AAAA,EAC9C,CAAC;AACH;","names":[]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { redirect } from "next/navigation";
|
|
3
|
-
import { cookies, headers } from "next/headers";
|
|
4
|
-
import { authService } from "../services/auth.service";
|
|
5
|
-
import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
|
|
6
|
-
async function redirectToLogin() {
|
|
7
|
-
const h = await headers();
|
|
8
|
-
const referer = h.get("referer");
|
|
9
|
-
const gappsUrl = process.env.NEXT_PUBLIC_GREAT_APPS;
|
|
10
|
-
if (gappsUrl) {
|
|
11
|
-
const loginUrl2 = new URL(`${gappsUrl.replace(/\/$/, "")}/login`);
|
|
12
|
-
if (referer) {
|
|
13
|
-
const refererUrl = new URL(referer);
|
|
14
|
-
if (!["/login", "/register", "/forgot-password"].includes(refererUrl.pathname)) {
|
|
15
|
-
loginUrl2.searchParams.set("redirect", referer);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
redirect(loginUrl2.toString());
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (!referer) {
|
|
22
|
-
redirect("/login");
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const url = new URL(referer);
|
|
26
|
-
if (["/login", "/register", "/forgot-password"].includes(url.pathname)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const loginUrl = new URL("/login", url.origin);
|
|
30
|
-
loginUrl.searchParams.set("redirect", url.pathname + url.search);
|
|
31
|
-
redirect(loginUrl.toString());
|
|
32
|
-
}
|
|
33
|
-
async function validateSessionAction() {
|
|
34
|
-
if (process.env.DUMMY_AUTH_TOKEN) return true;
|
|
35
|
-
const cookieStore = await cookies();
|
|
36
|
-
const cookie = cookieStore.get("greatapps")?.value;
|
|
37
|
-
if (!cookie) {
|
|
38
|
-
await redirectToLogin();
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const clientInfo = await getClientInfoFromRequest();
|
|
43
|
-
const isValid = await authService.validateSession(clientInfo);
|
|
44
|
-
if (!isValid) {
|
|
45
|
-
await authService.removeAuthCookie();
|
|
46
|
-
await redirectToLogin();
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error("[validateSessionAction] Error:", error);
|
|
52
|
-
await authService.removeAuthCookie();
|
|
53
|
-
await redirectToLogin();
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
validateSessionAction
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=validate-session.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/actions/validate-session.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { redirect } from 'next/navigation';\r\nimport { cookies, headers } from 'next/headers';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nasync function redirectToLogin() {\r\n const h = await headers();\r\n const referer = h.get('referer');\r\n const gappsUrl = process.env.NEXT_PUBLIC_GREAT_APPS;\r\n\r\n if (gappsUrl) {\r\n const loginUrl = new URL(`${gappsUrl.replace(/\\/$/, '')}/login`);\r\n if (referer) {\r\n const refererUrl = new URL(referer);\r\n if (!['/login', '/register', '/forgot-password'].includes(refererUrl.pathname)) {\r\n loginUrl.searchParams.set('redirect', referer);\r\n }\r\n }\r\n redirect(loginUrl.toString());\r\n return;\r\n }\r\n\r\n if (!referer) {\r\n redirect('/login');\r\n return;\r\n }\r\n\r\n const url = new URL(referer);\r\n\r\n if (['/login', '/register', '/forgot-password'].includes(url.pathname)) {\r\n return;\r\n }\r\n\r\n const loginUrl = new URL('/login', url.origin);\r\n loginUrl.searchParams.set('redirect', url.pathname + url.search);\r\n redirect(loginUrl.toString());\r\n}\r\n\r\nexport async function validateSessionAction(): Promise<boolean> {\r\n if (process.env.DUMMY_AUTH_TOKEN) return true;\r\n\r\n const cookieStore = await cookies();\r\n const cookie = cookieStore.get('greatapps')?.value;\r\n\r\n if (!cookie) {\r\n await redirectToLogin();\r\n return false;\r\n }\r\n\r\n try {\r\n const clientInfo = await getClientInfoFromRequest();\r\n const isValid = await authService.validateSession(clientInfo);\r\n\r\n if (!isValid) {\r\n await authService.removeAuthCookie();\r\n await redirectToLogin();\r\n return false;\r\n }\r\n\r\n return true;\r\n } catch (error) {\r\n console.error('[validateSessionAction] Error:', error);\r\n await authService.removeAuthCookie();\r\n await redirectToLogin();\r\n return false;\r\n }\r\n}\r\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,SAAS,eAAe;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAe,kB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rD,UAAM,YAAY,iBAAiB;AACnC,UAAM,gBAAgB;AACtB,WAAO;AAAA,EACT;AACF;","names":["loginUrl"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { authService } from "../services/auth.service";
|
|
4
|
-
import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
|
|
5
|
-
async function verifyTwoFactorAction(cookie, code) {
|
|
6
|
-
return safeServerAction(async () => {
|
|
7
|
-
if (!/^\d{6}$/.test(code)) {
|
|
8
|
-
throw new Error("Formato inv\xE1lido");
|
|
9
|
-
}
|
|
10
|
-
const clientInfo = await getClientInfoFromRequest();
|
|
11
|
-
await authService.verifyTwoFactor(cookie, code, clientInfo);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
verifyTwoFactorAction
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=verify-two-factor.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/actions/verify-two-factor.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nexport async function verifyTwoFactorAction(cookie: string, code: string) {\r\n return safeServerAction(async () => {\r\n if (!/^\\d{6}$/.test(code)) {\r\n throw new Error('Formato inválido');\r\n }\r\n const clientInfo = await getClientInfoFromRequest();\r\n await authService.verifyTwoFactor(cookie, code, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAsB,sBAAsB,QAAgB,MAAc;AACxE,SAAO,iBAAiB,YAAY;AAClC,QAAI,CAAC,UAAU,KAAK,IAAI,GAAG;AACzB,YAAM,IAAI,MAAM,qBAAkB;AAAA,IACpC;AACA,UAAM,aAAa,MAAM,yBAAyB;AAClD,UAAM,YAAY,gBAAgB,QAAQ,MAAM,UAAU;AAAA,EAC5D,CAAC;AACH;","names":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useMutation } from "@tanstack/react-query";
|
|
3
|
-
import { loginAction } from "../actions/login.action";
|
|
4
|
-
import { withAction } from "../../../utils/withAction";
|
|
5
|
-
function useLogin() {
|
|
6
|
-
return useMutation({
|
|
7
|
-
mutationFn: (credentials) => withAction(loginAction)(credentials)
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
useLogin
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=login.hook.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/hooks/login.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { loginAction } from \"../actions/login.action\";\nimport { LoginRequest, LoginSuccessResponse } from \"../schema\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useLogin() {\n return useMutation({\n mutationFn: (credentials: LoginRequest) =>\n withAction(loginAction)(credentials) as Promise<LoginSuccessResponse>,\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAE5B,SAAS,kBAAkB;AAEpB,SAAS,WAAW;AACzB,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,gBACX,WAAW,WAAW,EAAE,WAAW;AAAA,EACvC,CAAC;AACH;","names":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useMutation } from "@tanstack/react-query";
|
|
3
|
-
import { logoutAction } from "../actions/logout.action";
|
|
4
|
-
import { withAction } from "../../../utils/withAction";
|
|
5
|
-
function useLogout() {
|
|
6
|
-
return useMutation({
|
|
7
|
-
mutationFn: withAction(logoutAction)
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
useLogout
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=logout.hook.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/hooks/logout.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { logoutAction } from \"../actions/logout.action\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useLogout() {\n return useMutation({\n mutationFn: withAction(logoutAction),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,SAAS,YAAY;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,YAAY;AAAA,EACrC,CAAC;AACH;","names":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useMutation } from "@tanstack/react-query";
|
|
3
|
-
import { registerAction } from "../actions/register.action";
|
|
4
|
-
import { withAction } from "../../../utils/withAction";
|
|
5
|
-
function useRegister() {
|
|
6
|
-
return useMutation({
|
|
7
|
-
mutationFn: withAction(registerAction)
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
useRegister
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=register.hook.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/hooks/register.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { registerAction } from \"../actions/register.action\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useRegister() {\n return useMutation({\n mutationFn: withAction(registerAction),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAEpB,SAAS,cAAc;AAC5B,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,cAAc;AAAA,EACvC,CAAC;AACH;","names":[]}
|