@greatapps/common 1.1.133 → 1.1.134
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/MMQ4R4NB-B36VHW65.mjs +61 -0
- package/dist/MMQ4R4NB-B36VHW65.mjs.map +1 -0
- package/dist/V4HPSUGU-6BOE4IPH.mjs +51 -0
- package/dist/V4HPSUGU-6BOE4IPH.mjs.map +1 -0
- package/dist/account-management.action-7QQCACDJ.mjs +40 -0
- package/dist/account.service-XTZDEIPS.mjs +9 -0
- package/dist/{modules/auth/services/auth.service.mjs → chunk-7MBVHKTC.mjs} +46 -13
- package/dist/chunk-7MBVHKTC.mjs.map +1 -0
- package/dist/{modules/users/services/user.service.mjs → chunk-B2W2HK7C.mjs} +13 -8
- package/dist/chunk-B2W2HK7C.mjs.map +1 -0
- package/dist/{modules/auth/actions/validate-session.action.mjs → chunk-EC3T7NF6.mjs} +8 -4
- package/dist/chunk-EC3T7NF6.mjs.map +1 -0
- package/dist/chunk-EKZZ2RWJ.mjs +12701 -0
- package/dist/chunk-EKZZ2RWJ.mjs.map +1 -0
- package/dist/chunk-ICUZDG2N.mjs +283 -0
- package/dist/chunk-ICUZDG2N.mjs.map +1 -0
- package/dist/{utils/safeServerAction.mjs → chunk-JW4XRHLX.mjs} +7 -2
- package/dist/chunk-JW4XRHLX.mjs.map +1 -0
- package/dist/chunk-QEFMNBSY.mjs +165 -0
- package/dist/chunk-QEFMNBSY.mjs.map +1 -0
- package/dist/{infra/api/client.mjs → chunk-RV7ECGIH.mjs} +12 -7
- package/dist/chunk-RV7ECGIH.mjs.map +1 -0
- package/dist/chunk-S53NE5H4.mjs +2928 -0
- package/dist/chunk-S53NE5H4.mjs.map +1 -0
- package/dist/{modules/whitelabel/services/whitelabel.service.mjs → chunk-UEWT6VFS.mjs} +57 -9
- package/dist/chunk-UEWT6VFS.mjs.map +1 -0
- package/dist/chunk-XY4LNPBR.mjs +16 -0
- package/dist/chunk-XY4LNPBR.mjs.map +1 -0
- package/dist/{modules/accounts/services/account.service.mjs → chunk-Z3Q2LLBS.mjs} +64 -9
- package/dist/chunk-Z3Q2LLBS.mjs.map +1 -0
- package/dist/find-user-by-id.action-BUFTU3ZY.mjs +11 -0
- package/dist/index.mjs +9584 -258
- package/dist/index.mjs.map +1 -1
- package/dist/modern-4YXF5ES3.mjs +426 -0
- package/dist/modern-4YXF5ES3.mjs.map +1 -0
- package/dist/server.mjs +140 -36
- package/dist/server.mjs.map +1 -1
- package/dist/user.service-VDR4JKHO.mjs +8 -0
- package/dist/validate-session.action-K7RWN2GE.mjs +11 -0
- package/dist/{modules/auth/actions/verify-two-factor.action.mjs → verify-two-factor.action-V6JQATK2.mjs} +12 -4
- package/dist/verify-two-factor.action-V6JQATK2.mjs.map +1 -0
- package/package.json +1 -1
- 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 -236
- 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/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/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/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/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.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/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.map +0 -1
- package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +0 -1
- package/dist/modules/auth/hooks/login.hook.mjs +0 -18
- 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/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.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/services/whitelabel-styles.service.mjs +0 -76
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +0 -1
- package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +0 -1
- package/dist/modules/whitelabel/styles-schema.mjs +0 -1
- package/dist/providers/auth.provider.mjs +0 -94
- 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/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.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
- /package/dist/{components/navigation/types.mjs.map → account-management.action-7QQCACDJ.mjs.map} +0 -0
- /package/dist/{modules/accounts/types.mjs.map → account.service-XTZDEIPS.mjs.map} +0 -0
- /package/dist/{modules/auth/schema.mjs.map → find-user-by-id.action-BUFTU3ZY.mjs.map} +0 -0
- /package/dist/{modules/whitelabel/schema.mjs.map → user.service-VDR4JKHO.mjs.map} +0 -0
- /package/dist/{modules/whitelabel/styles-schema.mjs.map → validate-session.action-K7RWN2GE.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/client-info.ts"],"sourcesContent":["import { headers } from 'next/headers';\r\nimport { NextRequest } from 'next/server';\r\nimport { ClientInfo } from '../../modules/auth/schema';\r\n\r\nexport async function getClientInfoFromRequest(request?: NextRequest): Promise<ClientInfo> {\r\n let headerStore: Headers;\r\n\r\n if (request) {\r\n // Middleware context\r\n headerStore = request.headers;\r\n } else {\r\n // Server action context\r\n const nextHeaders = await headers();\r\n headerStore = nextHeaders as unknown as Headers;\r\n }\r\n\r\n return {\r\n location: {\r\n continent:\r\n headerStore.get('cf-ipcountry') || headerStore.get('x-vercel-ip-country') || 'Unknown',\r\n country: headerStore.get('x-vercel-ip-country') || 'Unknown',\r\n region: headerStore.get('x-vercel-ip-country-region') || 'Unknown',\r\n city: headerStore.get('x-vercel-ip-city') || 'Unknown',\r\n latitude: headerStore.get('x-vercel-ip-latitude') || '0',\r\n longitude: headerStore.get('x-vercel-ip-longitude') || '0',\r\n },\r\n ip:\r\n headerStore.get('cf-connecting-ip') ||\r\n headerStore.get('x-forwarded-for') ||\r\n headerStore.get('x-real-ip') ||\r\n 'Unknown',\r\n timezone: headerStore.get('cf-timezone') || 'America/Sao_Paulo',\r\n agent: headerStore.get('user-agent') || 'Unknown',\r\n };\r\n}\r\n"],"mappings":"AAAA,SAAS,eAAe;AAIxB,eAAsB,yBAAyB,SAA4C;AACzF,MAAI;AAEJ,MAAI,SAAS;AAEX,kBAAc,QAAQ;AAAA,EACxB,OAAO;AAEL,UAAM,cAAc,MAAM,QAAQ;AAClC,kBAAc;AAAA,EAChB;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,MACR,WACE,YAAY,IAAI,cAAc,KAAK,YAAY,IAAI,qBAAqB,KAAK;AAAA,MAC/E,SAAS,YAAY,IAAI,qBAAqB,KAAK;AAAA,MACnD,QAAQ,YAAY,IAAI,4BAA4B,KAAK;AAAA,MACzD,MAAM,YAAY,IAAI,kBAAkB,KAAK;AAAA,MAC7C,UAAU,YAAY,IAAI,sBAAsB,KAAK;AAAA,MACrD,WAAW,YAAY,IAAI,uBAAuB,KAAK;AAAA,IACzD;AAAA,IACA,IACE,YAAY,IAAI,kBAAkB,KAClC,YAAY,IAAI,iBAAiB,KACjC,YAAY,IAAI,WAAW,KAC3B;AAAA,IACF,UAAU,YAAY,IAAI,aAAa,KAAK;AAAA,IAC5C,OAAO,YAAY,IAAI,YAAY,KAAK;AAAA,EAC1C;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/clsx.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":"AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function buildQueryParams(params) {
|
|
2
|
-
if (!params) {
|
|
3
|
-
return "";
|
|
4
|
-
}
|
|
5
|
-
const queryParams = new URLSearchParams();
|
|
6
|
-
for (const [key, value] of Object.entries(params)) {
|
|
7
|
-
if (value === null || value === void 0 || value === "") {
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
if (Array.isArray(value)) {
|
|
11
|
-
queryParams.set(key, value.join(","));
|
|
12
|
-
} else {
|
|
13
|
-
queryParams.set(key, value.toString());
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return queryParams.toString();
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
buildQueryParams
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=params.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/params.ts"],"sourcesContent":["export function buildQueryParams(\r\n params?: Record<\r\n string,\r\n string | number | boolean | Date | null | undefined | string[] | number[] | boolean[] | Date[]\r\n >\r\n) {\r\n if (!params) {\r\n return '';\r\n }\r\n\r\n const queryParams = new URLSearchParams();\r\n\r\n for (const [key, value] of Object.entries(params)) {\r\n if (value === null || value === undefined || value === '') {\r\n continue;\r\n }\r\n\r\n if (Array.isArray(value)) {\r\n queryParams.set(key, value.join(','));\r\n } else {\r\n\r\n queryParams.set(key, value.toString());\r\n }\r\n }\r\n\r\n return queryParams.toString();\r\n}\r\n"],"mappings":"AAAO,SAAS,iBACd,QAIA;AACA,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AAEA,QAAM,cAAc,IAAI,gBAAgB;AAExC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,UAAU,QAAQ,UAAU,UAAa,UAAU,IAAI;AACzD;AAAA,IACF;AAEA,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,kBAAY,IAAI,KAAK,MAAM,KAAK,GAAG,CAAC;AAAA,IACtC,OAAO;AAEL,kBAAY,IAAI,KAAK,MAAM,SAAS,CAAC;AAAA,IACvC;AAAA,EACF;AAEA,SAAO,YAAY,SAAS;AAC9B;","names":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
function parseSchema(schema, data) {
|
|
2
|
-
if (Array.isArray(data)) {
|
|
3
|
-
return data.map((item) => schema.parse(item));
|
|
4
|
-
}
|
|
5
|
-
return schema.parse(data);
|
|
6
|
-
}
|
|
7
|
-
function parseResult(schema, result) {
|
|
8
|
-
if (!result.data) return result;
|
|
9
|
-
if (Array.isArray(result.data)) {
|
|
10
|
-
return {
|
|
11
|
-
...result,
|
|
12
|
-
data: result.data.map((item) => schema.parse(item))
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
...result,
|
|
17
|
-
data: schema.parse(result.data)
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
parseResult,
|
|
22
|
-
parseSchema
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=parser.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/parser.ts"],"sourcesContent":["import z, { ZodTypeAny } from \"zod\";\nimport { PaginatedSuccessResult, SuccessResult } from \"../api/types\";\n\n/* Overloads */\nexport function parseSchema<T extends ZodTypeAny>(\n schema: T,\n data: unknown[]\n): z.infer<T>[];\n\nexport function parseSchema<T extends ZodTypeAny>(\n schema: T,\n data: unknown\n): z.infer<T>;\n\nexport function parseSchema<T extends ZodTypeAny>(\n schema: T,\n data: unknown | unknown[]\n) {\n if (Array.isArray(data)) {\n return data.map(item => schema.parse(item));\n }\n\n return schema.parse(data);\n}\n\nexport function parseResult<T extends ZodTypeAny>(\n schema: T,\n result: PaginatedSuccessResult<unknown>\n): PaginatedSuccessResult<z.infer<T>>;\n\nexport function parseResult<T extends ZodTypeAny>(\n schema: T,\n result: SuccessResult<unknown>\n): SuccessResult<z.infer<T>>;\n\nexport function parseResult<T extends ZodTypeAny>(\n schema: T,\n result: SuccessResult<unknown> | PaginatedSuccessResult<unknown>\n) {\n if (!result.data) return result;\n\n if (Array.isArray(result.data)) {\n return {\n ...result,\n data: result.data.map(item => schema.parse(item)),\n };\n }\n\n return {\n ...result,\n data: schema.parse(result.data),\n };\n}"],"mappings":"AAcO,SAAS,YACZ,QACA,MACF;AACE,MAAI,MAAM,QAAQ,IAAI,GAAG;AACrB,WAAO,KAAK,IAAI,UAAQ,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9C;AAEA,SAAO,OAAO,MAAM,IAAI;AAC5B;AAYO,SAAS,YACZ,QACA,QACF;AACE,MAAI,CAAC,OAAO,KAAM,QAAO;AAEzB,MAAI,MAAM,QAAQ,OAAO,IAAI,GAAG;AAC5B,WAAO;AAAA,MACH,GAAG;AAAA,MACH,MAAM,OAAO,KAAK,IAAI,UAAQ,OAAO,MAAM,IAAI,CAAC;AAAA,IACpD;AAAA,EACJ;AAEA,SAAO;AAAA,IACH,GAAG;AAAA,IACH,MAAM,OAAO,MAAM,OAAO,IAAI;AAAA,EAClC;AACJ;","names":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const calculatePercentage = (current, total) => {
|
|
2
|
-
if (total === 0) return 0;
|
|
3
|
-
return current / total * 100;
|
|
4
|
-
};
|
|
5
|
-
const calculateCircumference = (radius) => {
|
|
6
|
-
return 2 * Math.PI * radius;
|
|
7
|
-
};
|
|
8
|
-
const calculateCircularProgressOffset = (percentage, circumference) => {
|
|
9
|
-
return circumference - percentage / 100 * circumference;
|
|
10
|
-
};
|
|
11
|
-
const calculateRadius = (size, strokeWidth) => {
|
|
12
|
-
return (size - strokeWidth) / 2;
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
calculateCircularProgressOffset,
|
|
16
|
-
calculateCircumference,
|
|
17
|
-
calculatePercentage,
|
|
18
|
-
calculateRadius
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=percentage.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infra/utils/percentage.ts"],"sourcesContent":["/**\n * Calcula percentual de um valor em relação ao total\n * @param current - Valor atual\n * @param total - Valor total\n * @returns Percentual (0-100)\n */\nexport const calculatePercentage = (current: number, total: number): number => {\n if (total === 0) return 0;\n return (current / total) * 100;\n};\n\n/**\n * Calcula a circunferência de um círculo\n * @param radius - Raio do círculo\n * @returns Circunferência\n */\nexport const calculateCircumference = (radius: number): number => {\n return 2 * Math.PI * radius;\n};\n\n/**\n * Calcula o offset para circular progress\n * @param percentage - Percentual de progresso (0-100)\n * @param circumference - Circunferência do círculo\n * @returns Valor do offset\n */\nexport const calculateCircularProgressOffset = (\n percentage: number,\n circumference: number\n): number => {\n return circumference - (percentage / 100) * circumference;\n};\n\n/**\n * Calcula raio de círculo baseado no tamanho e stroke\n * @param size - Tamanho total\n * @param strokeWidth - Largura do stroke\n * @returns Raio calculado\n */\nexport const calculateRadius = (size: number, strokeWidth: number): number => {\n return (size - strokeWidth) / 2;\n};\n"],"mappings":"AAMO,MAAM,sBAAsB,CAAC,SAAiB,UAA0B;AAC7E,MAAI,UAAU,EAAG,QAAO;AACxB,SAAQ,UAAU,QAAS;AAC7B;AAOO,MAAM,yBAAyB,CAAC,WAA2B;AAChE,SAAO,IAAI,KAAK,KAAK;AACvB;AAQO,MAAM,kCAAkC,CAC7C,YACA,kBACW;AACX,SAAO,gBAAiB,aAAa,MAAO;AAC9C;AAQO,MAAM,kBAAkB,CAAC,MAAc,gBAAgC;AAC5E,UAAQ,OAAO,eAAe;AAChC;","names":[]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from "next/server";
|
|
2
|
-
function shouldProcessPath(pathname, config) {
|
|
3
|
-
const { excludePaths, includePaths } = config;
|
|
4
|
-
if (excludePaths?.length) {
|
|
5
|
-
const isExcluded = excludePaths.some(
|
|
6
|
-
(path) => pathname === path || pathname.startsWith(`${path}/`)
|
|
7
|
-
);
|
|
8
|
-
if (isExcluded) return false;
|
|
9
|
-
}
|
|
10
|
-
if (includePaths?.length) {
|
|
11
|
-
return includePaths.some((path) => pathname === path || pathname.startsWith(`${path}/`));
|
|
12
|
-
}
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
function createMiddlewareChain(middlewares) {
|
|
16
|
-
return async function chainedMiddleware(request) {
|
|
17
|
-
const { pathname } = request.nextUrl;
|
|
18
|
-
let currentRequest = request;
|
|
19
|
-
for (const middleware of middlewares) {
|
|
20
|
-
if (!shouldProcessPath(pathname, middleware)) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const result = await middleware.handler(currentRequest);
|
|
24
|
-
if (result.type === "response") {
|
|
25
|
-
return result.response;
|
|
26
|
-
}
|
|
27
|
-
if (result.request) {
|
|
28
|
-
currentRequest = result.request;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return NextResponse.next();
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
createMiddlewareChain
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=chain.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/middlewares/chain.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\r\n\r\nimport { MiddlewareConfig } from './types';\r\n\r\nfunction shouldProcessPath(pathname: string, config: MiddlewareConfig): boolean {\r\n const { excludePaths, includePaths } = config;\r\n\r\n if (excludePaths?.length) {\r\n const isExcluded = excludePaths.some(\r\n (path) => pathname === path || pathname.startsWith(`${path}/`)\r\n );\r\n if (isExcluded) return false;\r\n }\r\n\r\n if (includePaths?.length) {\r\n return includePaths.some((path) => pathname === path || pathname.startsWith(`${path}/`));\r\n }\r\n\r\n return true;\r\n}\r\n\r\nexport function createMiddlewareChain(middlewares: MiddlewareConfig[]) {\r\n return async function chainedMiddleware(request: NextRequest): Promise<NextResponse> {\r\n const { pathname } = request.nextUrl;\r\n let currentRequest = request;\r\n\r\n for (const middleware of middlewares) {\r\n if (!shouldProcessPath(pathname, middleware)) {\r\n continue;\r\n }\r\n\r\n const result = await middleware.handler(currentRequest);\r\n\r\n if (result.type === 'response') {\r\n return result.response;\r\n }\r\n\r\n if (result.request) {\r\n currentRequest = result.request;\r\n }\r\n }\r\n\r\n return NextResponse.next();\r\n };\r\n}\r\n"],"mappings":"AAAA,SAAsB,oBAAoB;AAI1C,SAAS,kBAAkB,UAAkB,QAAmC;AAC9E,QAAM,EAAE,cAAc,aAAa,IAAI;AAEvC,MAAI,cAAc,QAAQ;AACxB,UAAM,aAAa,aAAa;AAAA,MAC9B,CAAC,SAAS,aAAa,QAAQ,SAAS,WAAW,GAAG,IAAI,GAAG;AAAA,IAC/D;AACA,QAAI,WAAY,QAAO;AAAA,EACzB;AAEA,MAAI,cAAc,QAAQ;AACxB,WAAO,aAAa,KAAK,CAAC,SAAS,aAAa,QAAQ,SAAS,WAAW,GAAG,IAAI,GAAG,CAAC;AAAA,EACzF;AAEA,SAAO;AACT;AAEO,SAAS,sBAAsB,aAAiC;AACrE,SAAO,eAAe,kBAAkB,SAA6C;AACnF,UAAM,EAAE,SAAS,IAAI,QAAQ;AAC7B,QAAI,iBAAiB;AAErB,eAAW,cAAc,aAAa;AACpC,UAAI,CAAC,kBAAkB,UAAU,UAAU,GAAG;AAC5C;AAAA,MACF;AAEA,YAAM,SAAS,MAAM,WAAW,QAAQ,cAAc;AAEtD,UAAI,OAAO,SAAS,YAAY;AAC9B,eAAO,OAAO;AAAA,MAChB;AAEA,UAAI,OAAO,SAAS;AAClB,yBAAiB,OAAO;AAAA,MAC1B;AAAA,IACF;AAEA,WAAO,aAAa,KAAK;AAAA,EAC3B;AACF;","names":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from "next/server";
|
|
2
|
-
import { continueChain, stopChain } from "./types";
|
|
3
|
-
function isRouteEquals(pathname, routes) {
|
|
4
|
-
return routes.some((route) => pathname === route || pathname.startsWith(`${route}/`));
|
|
5
|
-
}
|
|
6
|
-
function createAuthMiddleware(options) {
|
|
7
|
-
return (request) => {
|
|
8
|
-
const { pathname } = request.nextUrl;
|
|
9
|
-
const token = process.env.DUMMY_AUTH_TOKEN || request.cookies.get("greatapps")?.value;
|
|
10
|
-
const isPublicRoute = isRouteEquals(pathname, options?.publicRoutes || []);
|
|
11
|
-
const isAuthRoute = isRouteEquals(pathname, options?.authRoutes || []);
|
|
12
|
-
if (token && isAuthRoute) {
|
|
13
|
-
return stopChain(NextResponse.redirect(new URL("/", request.url)));
|
|
14
|
-
}
|
|
15
|
-
if (!token && !isPublicRoute && !isAuthRoute) {
|
|
16
|
-
const loginUrl = new URL("/login", request.url);
|
|
17
|
-
if (pathname !== "/") {
|
|
18
|
-
loginUrl.searchParams.set("redirect", pathname);
|
|
19
|
-
}
|
|
20
|
-
return stopChain(NextResponse.redirect(loginUrl));
|
|
21
|
-
}
|
|
22
|
-
return continueChain();
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
createAuthMiddleware
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=create-auth-middleware.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/middlewares/create-auth-middleware.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\r\n\r\nimport { continueChain, MiddlewareConfig, MiddlewareFunction, MiddlewareResult, stopChain } from './types';\r\n\r\nfunction isRouteEquals(pathname: string, routes: string[]): boolean {\r\n return routes.some((route) => pathname === route || pathname.startsWith(`${route}/`));\r\n}\r\n\r\ninterface CreateAuthMiddlewareOptions {\r\n publicRoutes?: string[];\r\n authRoutes?: string[];\r\n}\r\n\r\nexport function createAuthMiddleware(options?: CreateAuthMiddlewareOptions): MiddlewareFunction {\r\n return (request: NextRequest) => {\r\n const { pathname } = request.nextUrl;\r\n const token = process.env.DUMMY_AUTH_TOKEN || request.cookies.get('greatapps')?.value;\r\n const isPublicRoute = isRouteEquals(pathname, options?.publicRoutes || []);\r\n const isAuthRoute = isRouteEquals(pathname, options?.authRoutes || []);\r\n\r\n if (token && isAuthRoute) {\r\n return stopChain(NextResponse.redirect(new URL('/', request.url)));\r\n }\r\n\r\n if (!token && !isPublicRoute && !isAuthRoute) {\r\n const loginUrl = new URL('/login', request.url);\r\n\r\n if (pathname !== '/') {\r\n loginUrl.searchParams.set('redirect', pathname);\r\n }\r\n\r\n return stopChain(NextResponse.redirect(loginUrl));\r\n }\r\n\r\n return continueChain();\r\n }\r\n}"],"mappings":"AAAA,SAAsB,oBAAoB;AAE1C,SAAS,eAAuE,iBAAiB;AAEjG,SAAS,cAAc,UAAkB,QAA2B;AAClE,SAAO,OAAO,KAAK,CAAC,UAAU,aAAa,SAAS,SAAS,WAAW,GAAG,KAAK,GAAG,CAAC;AACtF;AAOO,SAAS,qBAAqB,SAA2D;AAC9F,SAAO,CAAC,YAAyB;AAC/B,UAAM,EAAE,SAAS,IAAI,QAAQ;AAC7B,UAAM,QAAQ,QAAQ,IAAI,oBAAoB,QAAQ,QAAQ,IAAI,WAAW,GAAG;AAChF,UAAM,gBAAgB,cAAc,UAAU,SAAS,gBAAgB,CAAC,CAAC;AACzE,UAAM,cAAc,cAAc,UAAU,SAAS,cAAc,CAAC,CAAC;AAErE,QAAI,SAAS,aAAa;AACxB,aAAO,UAAU,aAAa,SAAS,IAAI,IAAI,KAAK,QAAQ,GAAG,CAAC,CAAC;AAAA,IACnE;AAEA,QAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,aAAa;AAC5C,YAAM,WAAW,IAAI,IAAI,UAAU,QAAQ,GAAG;AAE9C,UAAI,aAAa,KAAK;AACpB,iBAAS,aAAa,IAAI,YAAY,QAAQ;AAAA,MAChD;AAEA,aAAO,UAAU,aAAa,SAAS,QAAQ,CAAC;AAAA,IAClD;AAEA,WAAO,cAAc;AAAA,EACvB;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/middlewares/types.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\r\n\r\nexport type MiddlewareResult =\r\n | { type: 'response'; response: NextResponse }\r\n | { type: 'next'; request?: NextRequest };\r\n\r\nexport type MiddlewareFunction = (\r\n request: NextRequest\r\n) => MiddlewareResult | Promise<MiddlewareResult>;\r\n\r\nexport interface MiddlewareConfig {\r\n name: string;\r\n handler: MiddlewareFunction;\r\n excludePaths?: string[];\r\n includePaths?: string[];\r\n}\r\n\r\nexport function continueChain(request?: NextRequest): MiddlewareResult {\r\n return { type: 'next', request };\r\n}\r\n\r\nexport function stopChain(response: NextResponse): MiddlewareResult {\r\n return { type: 'response', response };\r\n}\r\n"],"mappings":"AAiBO,SAAS,cAAc,SAAyC;AACrE,SAAO,EAAE,MAAM,QAAQ,QAAQ;AACjC;AAEO,SAAS,UAAU,UAA0C;AAClE,SAAO,EAAE,MAAM,YAAY,SAAS;AACtC;","names":[]}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { accountService } from "../services/account.service";
|
|
4
|
-
import { twoFactorService } from "../services/two-factor.service";
|
|
5
|
-
async function listAccountUsersAction(params) {
|
|
6
|
-
return safeServerAction(async () => {
|
|
7
|
-
const { users, total } = await accountService.listAccountUsers(params);
|
|
8
|
-
return { data: users, total };
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
async function updateUserAction(user) {
|
|
12
|
-
return safeServerAction(() => accountService.updateAccountUser(user));
|
|
13
|
-
}
|
|
14
|
-
async function updateAccountUserByIdAction(userId, user) {
|
|
15
|
-
return safeServerAction(() => accountService.updateAccountUserById(userId, user));
|
|
16
|
-
}
|
|
17
|
-
async function updateAccountAction(data) {
|
|
18
|
-
return safeServerAction(() => accountService.updateAccount(data));
|
|
19
|
-
}
|
|
20
|
-
async function deleteAccountUserAction(userId) {
|
|
21
|
-
return safeServerAction(() => accountService.deleteAccountUser(userId));
|
|
22
|
-
}
|
|
23
|
-
async function deleteAccountAction() {
|
|
24
|
-
return safeServerAction(() => accountService.deleteAccount());
|
|
25
|
-
}
|
|
26
|
-
async function createAccountUserAction(user) {
|
|
27
|
-
return safeServerAction(() => accountService.createAccountUser(user));
|
|
28
|
-
}
|
|
29
|
-
async function changePasswordAction(data) {
|
|
30
|
-
return safeServerAction(() => accountService.changePassword(data));
|
|
31
|
-
}
|
|
32
|
-
async function requestEmailChangeAction(newEmail) {
|
|
33
|
-
return safeServerAction(() => accountService.requestContactReset("email", newEmail));
|
|
34
|
-
}
|
|
35
|
-
async function confirmEmailChangeAction(token, newEmail) {
|
|
36
|
-
return safeServerAction(() => accountService.confirmContactReset("email", token, newEmail));
|
|
37
|
-
}
|
|
38
|
-
async function requestPhoneChangeAction(newPhone) {
|
|
39
|
-
return safeServerAction(() => accountService.requestContactReset("phone", newPhone));
|
|
40
|
-
}
|
|
41
|
-
async function confirmPhoneChangeAction(token, newPhone) {
|
|
42
|
-
return safeServerAction(() => accountService.confirmContactReset("phone", token, newPhone));
|
|
43
|
-
}
|
|
44
|
-
async function generateTwoFactorAction() {
|
|
45
|
-
return safeServerAction(async () => {
|
|
46
|
-
const result = await twoFactorService.generate();
|
|
47
|
-
return {
|
|
48
|
-
qrcode: result.data.qrcode,
|
|
49
|
-
backupCodes: result.data.backup_codes
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
async function confirmTwoFactorAction(code) {
|
|
54
|
-
return safeServerAction(async () => {
|
|
55
|
-
await twoFactorService.confirm(code);
|
|
56
|
-
await accountService.updateAccountUser({ two_factor_authentication: true });
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async function disableTwoFactorAction(code) {
|
|
60
|
-
return safeServerAction(async () => {
|
|
61
|
-
await twoFactorService.verify(code);
|
|
62
|
-
await twoFactorService.disable();
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
changePasswordAction,
|
|
67
|
-
confirmEmailChangeAction,
|
|
68
|
-
confirmPhoneChangeAction,
|
|
69
|
-
confirmTwoFactorAction,
|
|
70
|
-
createAccountUserAction,
|
|
71
|
-
deleteAccountAction,
|
|
72
|
-
deleteAccountUserAction,
|
|
73
|
-
disableTwoFactorAction,
|
|
74
|
-
generateTwoFactorAction,
|
|
75
|
-
listAccountUsersAction,
|
|
76
|
-
requestEmailChangeAction,
|
|
77
|
-
requestPhoneChangeAction,
|
|
78
|
-
updateAccountAction,
|
|
79
|
-
updateAccountUserByIdAction,
|
|
80
|
-
updateUserAction
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=account-management.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/actions/account-management.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { accountService } from '../services/account.service';\nimport type {\n AccountUsersPaginationParams,\n ChangePasswordRequest,\n CreateAccountUserRequest,\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n} from '../types';\nimport { twoFactorService } from '../services/two-factor.service';\n\nexport async function listAccountUsersAction(params?: AccountUsersPaginationParams) {\n return safeServerAction(async () => {\n const { users, total } = await accountService.listAccountUsers(params);\n return { data: users, total };\n });\n}\n\nexport async function updateUserAction(user: UpdateAccountUserRequest) {\n return safeServerAction(() => accountService.updateAccountUser(user));\n}\n\nexport async function updateAccountUserByIdAction(\n userId: number,\n user: UpdateAccountUserRequest\n) {\n return safeServerAction(() => accountService.updateAccountUserById(userId, user));\n}\n\nexport async function updateAccountAction(data: UpdateAccountRequest) {\n return safeServerAction(() => accountService.updateAccount(data));\n}\n\nexport async function deleteAccountUserAction(userId: number) {\n return safeServerAction(() => accountService.deleteAccountUser(userId));\n}\n\nexport async function deleteAccountAction() {\n return safeServerAction(() => accountService.deleteAccount());\n}\n\nexport async function createAccountUserAction(user: CreateAccountUserRequest) {\n return safeServerAction(() => accountService.createAccountUser(user));\n}\n\nexport async function changePasswordAction(data: ChangePasswordRequest) {\n return safeServerAction(() => accountService.changePassword(data));\n}\n\nexport async function requestEmailChangeAction(newEmail: string) {\n return safeServerAction(() => accountService.requestContactReset('email', newEmail));\n}\n\nexport async function confirmEmailChangeAction(token: string, newEmail: string) {\n return safeServerAction(() => accountService.confirmContactReset('email', token, newEmail));\n}\n\nexport async function requestPhoneChangeAction(newPhone: string) {\n return safeServerAction(() => accountService.requestContactReset('phone', newPhone));\n}\n\nexport async function confirmPhoneChangeAction(token: string, newPhone: string) {\n return safeServerAction(() => accountService.confirmContactReset('phone', token, newPhone));\n}\n\nexport async function generateTwoFactorAction() {\n return safeServerAction(async () => {\n const result = await twoFactorService.generate();\n return {\n qrcode: result.data.qrcode,\n backupCodes: result.data.backup_codes,\n };\n });\n}\n\nexport async function confirmTwoFactorAction(code: string) {\n return safeServerAction(async () => {\n await twoFactorService.confirm(code);\n await accountService.updateAccountUser({ two_factor_authentication: true });\n });\n}\n\nexport async function disableTwoFactorAction(code: string) {\n return safeServerAction(async () => {\n await twoFactorService.verify(code);\n await twoFactorService.disable();\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAQ/B,SAAS,wBAAwB;AAEjC,eAAsB,uBAAuB,QAAuC;AAClF,SAAO,iBAAiB,YAAY;AAClC,UAAM,EAAE,OAAO,MAAM,IAAI,MAAM,eAAe,iBAAiB,MAAM;AACrE,WAAO,EAAE,MAAM,OAAO,MAAM;AAAA,EAC9B,CAAC;AACH;AAEA,eAAsB,iBAAiB,MAAgC;AACrE,SAAO,iBAAiB,MAAM,eAAe,kBAAkB,IAAI,CAAC;AACtE;AAEA,eAAsB,4BACpB,QACA,MACA;AACA,SAAO,iBAAiB,MAAM,eAAe,sBAAsB,QAAQ,IAAI,CAAC;AAClF;AAEA,eAAsB,oBAAoB,MAA4B;AACpE,SAAO,iBAAiB,MAAM,eAAe,cAAc,IAAI,CAAC;AAClE;AAEA,eAAsB,wBAAwB,QAAgB;AAC5D,SAAO,iBAAiB,MAAM,eAAe,kBAAkB,MAAM,CAAC;AACxE;AAEA,eAAsB,sBAAsB;AAC1C,SAAO,iBAAiB,MAAM,eAAe,cAAc,CAAC;AAC9D;AAEA,eAAsB,wBAAwB,MAAgC;AAC5E,SAAO,iBAAiB,MAAM,eAAe,kBAAkB,IAAI,CAAC;AACtE;AAEA,eAAsB,qBAAqB,MAA6B;AACtE,SAAO,iBAAiB,MAAM,eAAe,eAAe,IAAI,CAAC;AACnE;AAEA,eAAsB,yBAAyB,UAAkB;AAC/D,SAAO,iBAAiB,MAAM,eAAe,oBAAoB,SAAS,QAAQ,CAAC;AACrF;AAEA,eAAsB,yBAAyB,OAAe,UAAkB;AAC9E,SAAO,iBAAiB,MAAM,eAAe,oBAAoB,SAAS,OAAO,QAAQ,CAAC;AAC5F;AAEA,eAAsB,yBAAyB,UAAkB;AAC/D,SAAO,iBAAiB,MAAM,eAAe,oBAAoB,SAAS,QAAQ,CAAC;AACrF;AAEA,eAAsB,yBAAyB,OAAe,UAAkB;AAC9E,SAAO,iBAAiB,MAAM,eAAe,oBAAoB,SAAS,OAAO,QAAQ,CAAC;AAC5F;AAEA,eAAsB,0BAA0B;AAC9C,SAAO,iBAAiB,YAAY;AAClC,UAAM,SAAS,MAAM,iBAAiB,SAAS;AAC/C,WAAO;AAAA,MACL,QAAQ,OAAO,KAAK;AAAA,MACpB,aAAa,OAAO,KAAK;AAAA,IAC3B;AAAA,EACF,CAAC;AACH;AAEA,eAAsB,uBAAuB,MAAc;AACzD,SAAO,iBAAiB,YAAY;AAClC,UAAM,iBAAiB,QAAQ,IAAI;AACnC,UAAM,eAAe,kBAAkB,EAAE,2BAA2B,KAAK,CAAC;AAAA,EAC5E,CAAC;AACH;AAEA,eAAsB,uBAAuB,MAAc;AACzD,SAAO,iBAAiB,YAAY;AAClC,UAAM,iBAAiB,OAAO,IAAI;AAClC,UAAM,iBAAiB,QAAQ;AAAA,EACjC,CAAC;AACH;","names":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { accountService } from "../services/account.service";
|
|
4
|
-
async function findCurrentAccount() {
|
|
5
|
-
return safeServerAction(() => accountService.findCurrentAccount());
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
findCurrentAccount
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=find-current-account.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/actions/find-current-account.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { accountService } from '../services/account.service';\nimport type { Account } from '../types';\n\nexport async function findCurrentAccount() {\n return safeServerAction<Account>(() => accountService.findCurrentAccount());\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAG/B,eAAsB,qBAAqB;AACzC,SAAO,iBAA0B,MAAM,eAAe,mBAAmB,CAAC;AAC5E;","names":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { currencyService } from "../services/currency.service";
|
|
4
|
-
async function listCurrenciesAction() {
|
|
5
|
-
return safeServerAction(() => currencyService.fetchOptions());
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
listCurrenciesAction
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=list-currencies.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/actions/list-currencies.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { currencyService } from '../services/currency.service';\n\nexport async function listCurrenciesAction() {\n return safeServerAction(() => currencyService.fetchOptions());\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAEhC,eAAsB,uBAAuB;AAC3C,SAAO,iBAAiB,MAAM,gBAAgB,aAAa,CAAC;AAC9D;","names":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
-
import { timezoneService } from "../services/timezone.service";
|
|
4
|
-
async function listTimezonesAction() {
|
|
5
|
-
return safeServerAction(() => timezoneService.fetchOptions());
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
listTimezonesAction
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=list-timezones.action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/actions/list-timezones.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { timezoneService } from '../services/timezone.service';\n\nexport async function listTimezonesAction() {\n return safeServerAction(() => timezoneService.fetchOptions());\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAEhC,eAAsB,sBAAsB;AAC1C,SAAO,iBAAiB,MAAM,gBAAgB,aAAa,CAAC;AAC9D;","names":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
-
import { findCurrentAccount } from "../actions/find-current-account.action";
|
|
4
|
-
import { withAction } from "../../../utils/withAction";
|
|
5
|
-
const ACCOUNT_QUERY_KEY = ["account"];
|
|
6
|
-
function useCurrentAccount() {
|
|
7
|
-
return useQuery({
|
|
8
|
-
queryKey: ACCOUNT_QUERY_KEY,
|
|
9
|
-
queryFn: withAction(findCurrentAccount),
|
|
10
|
-
staleTime: 0,
|
|
11
|
-
gcTime: 10 * 60 * 1e3,
|
|
12
|
-
retry: false
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function useInvalidateAccount() {
|
|
16
|
-
const queryClient = useQueryClient();
|
|
17
|
-
return () => queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
ACCOUNT_QUERY_KEY,
|
|
21
|
-
useCurrentAccount,
|
|
22
|
-
useInvalidateAccount
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=current-account.hook.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/current-account.hook.tsx"],"sourcesContent":["'use client';\n\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { findCurrentAccount } from '../actions/find-current-account.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const ACCOUNT_QUERY_KEY = ['account'];\n\nexport function useCurrentAccount() {\n return useQuery({\n queryKey: ACCOUNT_QUERY_KEY,\n queryFn: withAction(findCurrentAccount),\n staleTime: 0,\n gcTime: 10 * 60 * 1000,\n retry: false,\n });\n}\n\nexport function useInvalidateAccount() {\n const queryClient = useQueryClient();\n return () => queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });\n}\n"],"mappings":";AAEA,SAAS,UAAU,sBAAsB;AACzC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB;AAEpB,MAAM,oBAAoB,CAAC,SAAS;AAEpC,SAAS,oBAAoB;AAClC,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,WAAW,kBAAkB;AAAA,IACtC,WAAW;AAAA,IACX,QAAQ,KAAK,KAAK;AAAA,IAClB,OAAO;AAAA,EACT,CAAC;AACH;AAEO,SAAS,uBAAuB;AACrC,QAAM,cAAc,eAAe;AACnC,SAAO,MAAM,YAAY,kBAAkB,EAAE,UAAU,kBAAkB,CAAC;AAC5E;","names":[]}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
-
import { USER_QUERY_KEY } from "../../auth/hooks/useUserQuery";
|
|
4
|
-
import { ACCOUNT_QUERY_KEY } from "./current-account.hook";
|
|
5
|
-
import {
|
|
6
|
-
updateUserAction,
|
|
7
|
-
updateAccountAction,
|
|
8
|
-
updateAccountUserByIdAction,
|
|
9
|
-
deleteAccountUserAction,
|
|
10
|
-
deleteAccountAction
|
|
11
|
-
} from "../actions/account-management.action";
|
|
12
|
-
import { withAction } from "../../../utils/withAction";
|
|
13
|
-
const ACCOUNT_USERS_QUERY_KEY = ["account-users"];
|
|
14
|
-
function useUpdateAccount() {
|
|
15
|
-
const queryClient = useQueryClient();
|
|
16
|
-
return useMutation({
|
|
17
|
-
mutationFn: withAction(updateAccountAction),
|
|
18
|
-
onSuccess: () => {
|
|
19
|
-
queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
|
|
20
|
-
queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });
|
|
21
|
-
queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function useUpdateAccountUser() {
|
|
26
|
-
const queryClient = useQueryClient();
|
|
27
|
-
return useMutation({
|
|
28
|
-
mutationFn: withAction(updateUserAction),
|
|
29
|
-
onSuccess: () => {
|
|
30
|
-
queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
|
|
31
|
-
queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });
|
|
32
|
-
queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function useUpdateAccountUserById() {
|
|
37
|
-
const queryClient = useQueryClient();
|
|
38
|
-
return useMutation({
|
|
39
|
-
mutationFn: withAction(
|
|
40
|
-
({ userId, ...user }) => updateAccountUserByIdAction(userId, user)
|
|
41
|
-
),
|
|
42
|
-
onSuccess: () => {
|
|
43
|
-
queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function useDeleteAccountUser(options) {
|
|
48
|
-
const queryClient = useQueryClient();
|
|
49
|
-
return useMutation({
|
|
50
|
-
mutationFn: withAction(deleteAccountUserAction),
|
|
51
|
-
...options,
|
|
52
|
-
onSuccess: (...params) => {
|
|
53
|
-
options?.onSuccess?.(...params);
|
|
54
|
-
queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function useDeleteAccount(options) {
|
|
59
|
-
return useMutation({
|
|
60
|
-
mutationFn: withAction(deleteAccountAction),
|
|
61
|
-
...options
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
useDeleteAccount,
|
|
66
|
-
useDeleteAccountUser,
|
|
67
|
-
useUpdateAccount,
|
|
68
|
-
useUpdateAccountUser,
|
|
69
|
-
useUpdateAccountUserById
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=useAccountManagement.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useAccountManagement.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { USER_QUERY_KEY } from '../../auth/hooks/useUserQuery';\nimport { ACCOUNT_QUERY_KEY } from './current-account.hook';\nimport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n DeleteAccountUserResponse,\n DeleteAccountResponse,\n} from '../types';\nimport {\n updateUserAction,\n updateAccountAction,\n updateAccountUserByIdAction,\n deleteAccountUserAction,\n deleteAccountAction,\n} from '../actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { UseMutationOptions } from '@tanstack/react-query';\n\nconst ACCOUNT_USERS_QUERY_KEY = ['account-users'];\n\nexport function useUpdateAccount() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(updateAccountAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\n },\n });\n}\n\nexport function useUpdateAccountUser() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(updateUserAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\n },\n });\n}\n\nexport function useUpdateAccountUserById() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(({ userId, ...user }: UpdateAccountUserRequest & { userId: number }) =>\n updateAccountUserByIdAction(userId, user)\n ),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n },\n });\n}\n\nexport function useDeleteAccountUser(\n options?: UseMutationOptions<DeleteAccountUserResponse, Error, number>\n) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(deleteAccountUserAction),\n ...options,\n onSuccess: (...params) => {\n options?.onSuccess?.(...params);\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n },\n });\n}\n\nexport function useDeleteAccount(\n options?: UseMutationOptions<DeleteAccountResponse, Error, void>\n) {\n return useMutation({\n mutationFn: withAction(deleteAccountAction),\n ...options,\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAOlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAG3B,MAAM,0BAA0B,CAAC,eAAe;AAEzC,SAAS,mBAAmB;AACjC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,mBAAmB;AAAA,IAC1C,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AACnE,kBAAY,kBAAkB,EAAE,UAAU,kBAAkB,CAAC;AAC7D,kBAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,uBAAuB;AACrC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,gBAAgB;AAAA,IACvC,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AACnE,kBAAY,kBAAkB,EAAE,UAAU,kBAAkB,CAAC;AAC7D,kBAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,2BAA2B;AACzC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY;AAAA,MAAW,CAAC,EAAE,QAAQ,GAAG,KAAK,MACxC,4BAA4B,QAAQ,IAAI;AAAA,IAC1C;AAAA,IACA,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AAAA,IACrE;AAAA,EACF,CAAC;AACH;AAEO,SAAS,qBACd,SACA;AACA,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,uBAAuB;AAAA,IAC9C,GAAG;AAAA,IACH,WAAW,IAAI,WAAW;AACxB,eAAS,YAAY,GAAG,MAAM;AAC9B,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AAAA,IACrE;AAAA,EACF,CAAC;AACH;AAEO,SAAS,iBACd,SACA;AACA,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,mBAAmB;AAAA,IAC1C,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3
|
-
import { listCurrenciesAction } from "../actions/list-currencies.action";
|
|
4
|
-
import { withAction } from "../../../utils/withAction";
|
|
5
|
-
const CURRENCIES_QUERY_KEY = ["currencies"];
|
|
6
|
-
function useCurrencies() {
|
|
7
|
-
return useQuery({
|
|
8
|
-
queryKey: CURRENCIES_QUERY_KEY,
|
|
9
|
-
queryFn: withAction(listCurrenciesAction),
|
|
10
|
-
staleTime: Infinity
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
CURRENCIES_QUERY_KEY,
|
|
15
|
-
useCurrencies
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=useCurrencies.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useCurrencies.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listCurrenciesAction } from '../actions/list-currencies.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const CURRENCIES_QUERY_KEY = ['currencies'];\n\nexport function useCurrencies() {\n return useQuery({\n queryKey: CURRENCIES_QUERY_KEY,\n queryFn: withAction(listCurrenciesAction),\n staleTime: Infinity,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAEpB,MAAM,uBAAuB,CAAC,YAAY;AAE1C,SAAS,gBAAgB;AAC9B,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,WAAW,oBAAoB;AAAA,IACxC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3
|
-
import { listTimezonesAction } from "../actions/list-timezones.action";
|
|
4
|
-
import { withAction } from "../../../utils/withAction";
|
|
5
|
-
const TIMEZONES_QUERY_KEY = ["timezones"];
|
|
6
|
-
function useTimezones() {
|
|
7
|
-
return useQuery({
|
|
8
|
-
queryKey: TIMEZONES_QUERY_KEY,
|
|
9
|
-
queryFn: withAction(listTimezonesAction),
|
|
10
|
-
staleTime: Infinity
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
TIMEZONES_QUERY_KEY,
|
|
15
|
-
useTimezones
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=useTimezones.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/accounts/hooks/useTimezones.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listTimezonesAction } from '../actions/list-timezones.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const TIMEZONES_QUERY_KEY = ['timezones'];\n\nexport function useTimezones() {\n return useQuery({\n queryKey: TIMEZONES_QUERY_KEY,\n queryFn: withAction(listTimezonesAction),\n staleTime: Infinity,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AACpC,SAAS,kBAAkB;AAEpB,MAAM,sBAAsB,CAAC,WAAW;AAExC,SAAS,eAAe;AAC7B,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,WAAW,mBAAmB;AAAA,IACvC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -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,qBAAuC;AAC3C,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,WAAW,MAAM,IAAI,KAAK,IAA4B,aAAa,UAAU,EAAE;AAErF,QAAI,SAAS,WAAW,KAAK,CAAC,SAAS,OAAO,CAAC,GAAG;AAChD,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,SAAS,KAAK,CAAC;AAAA,EACxB;AAAA,EAEA,MAAM,iBAAiB,QAAgD;AACrE,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,cAAc,iBAAiB,MAAM;AAC3C,UAAM,WAAW,aAAa,UAAU,UAAU,WAAW;AAC7D,UAAM,WAAW,MAAM,IAAI,KAAK,IAA8B,QAAQ;AAEtE,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,MACL,OAAO,SAAS,QAAQ,CAAC;AAAA,MACzB,OAAO,SAAS,SAAS;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAM,gBAAgB,QAAgB,OAA+C;AACnF,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,SAAS,MAAM,aAAa,KAAK;AACvC,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,MAAM;AAAA,MACvC,EAAE,MAAM,OAAO;AAAA,IACjB;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,kBAAkB,QAAoD;AAC1E,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,MAAM;AAAA,IACzC;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI,SAAS,SAAS,WAAW,8BAA2B,sBAAsB,GAAG;AAAA,IAC7F;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,gBAAgD;AACpD,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,WAAW,MAAM,IAAI,KAAK,OAA8B,aAAa,UAAU,EAAE;AAEvF,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI,SAAS,SAAS,WAAW,yBAAyB,yBAAyB,GAAG;AAAA,IAC9F;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,kBAAkB,MAAoE;AAC1F,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU;AAAA,MACvB;AAAA,QACE,GAAG;AAAA,QACH,OAAO,KAAK,QAAQ,MAAM,aAAa,KAAK,KAAK,IAAI;AAAA,MACvD;AAAA,IACF;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI,SAAS,SAAS,WAAW,4BAAyB,sBAAsB,GAAG;AAAA,IAC3F;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,kBAAkB,MAAoE;AAClG,QAAI,KAAK,UAAU,OAAW,QAAO,CAAC;AACtC,UAAM,QACJ,KAAK,SAAS,QAAQ,OAAO,KAAK,UAAU,WACxC,MAAM,aAAa,KAAK,KAAK,IAC7B,KAAK;AACX,WAAO,EAAE,MAAM;AAAA,EACjB;AAAA,EAEA,MAAM,kBAAkB,MAAoE;AAC1F,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC,EAAE,GAAG,MAAM,GAAI,MAAM,KAAK,kBAAkB,IAAI,EAAG;AAAA,IACrD;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,sBACJ,QACA,MACoC;AACpC,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,MAAM;AAAA,MACvC,EAAE,GAAG,MAAM,GAAI,MAAM,KAAK,kBAAkB,IAAI,EAAG;AAAA,IACrD;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,cAAc,MAA4D;AAC9E,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,WAAW,MAAM,IAAI,KAAK,IAA2B,aAAa,UAAU,IAAI,IAAI;AAE1F,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,oBAAoB,MAAyB,YAAmC;AACpF,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC,EAAE,MAAM,WAAW;AAAA,IACrB;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,oBAAoB,MAAyB,OAAe,YAAmC;AACnG,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,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":[]}
|