@greatapps/common 1.1.429 → 1.1.430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/AccountModals.mjs +18 -0
- package/dist/components/account/AccountModals.mjs.map +1 -0
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +129 -0
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -0
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +45 -0
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +45 -0
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -0
- package/dist/components/account/DeleteAccountModal.mjs +123 -0
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/DisableTwoFactorAuthModal.mjs +67 -0
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -0
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +42 -0
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/TwoFactorAuthModal.mjs +182 -0
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -0
- package/dist/components/account/constants.mjs +29 -0
- package/dist/components/account/constants.mjs.map +1 -0
- package/dist/components/account/hooks/useChangeEmailForm.mjs +53 -0
- package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -0
- package/dist/components/account/hooks/useChangePasswordForm.mjs +47 -0
- package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -0
- package/dist/components/account/hooks/useChangePhoneForm.mjs +91 -0
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -0
- package/dist/components/account/hooks/useConfigurationsModal.mjs +34 -0
- package/dist/components/account/hooks/useConfigurationsModal.mjs.map +1 -0
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +54 -0
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -0
- package/dist/components/account/hooks/useOtpVerification.mjs +94 -0
- package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -0
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +80 -0
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -0
- package/dist/components/account/sections/ChangeEmailModal.mjs +181 -0
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs +64 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -0
- package/dist/components/account/sections/ChangePhoneModal.mjs +192 -0
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -0
- package/dist/components/account/sections/MyProfileSection.mjs +317 -0
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -0
- package/dist/components/account/sections/PreferencesSection.mjs +227 -0
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -0
- package/dist/components/account/sections/SecuritySection.mjs +31 -0
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -0
- package/dist/components/embeds/CrispEmbed.mjs +89 -0
- package/dist/components/embeds/CrispEmbed.mjs.map +1 -0
- package/dist/components/embeds/FrillEmbed.mjs +107 -0
- package/dist/components/embeds/FrillEmbed.mjs.map +1 -0
- package/dist/components/handlers/SearchParamsHandler.mjs +24 -0
- package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -0
- package/dist/components/layouts/AppMobileNavBar.mjs +60 -0
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
- package/dist/components/layouts/AppNavBar.mjs +37 -0
- package/dist/components/layouts/AppNavBar.mjs.map +1 -0
- package/dist/components/layouts/CollapsibleSidebar.mjs +65 -0
- package/dist/components/layouts/CollapsibleSidebar.mjs.map +1 -0
- package/dist/components/layouts/MainLayout.mjs +60 -0
- package/dist/components/layouts/MainLayout.mjs.map +1 -0
- package/dist/components/layouts/MdSideBarNavigation.mjs +54 -0
- package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -0
- package/dist/components/layouts/NavBar.mjs +152 -0
- package/dist/components/layouts/NavBar.mjs.map +1 -0
- package/dist/components/layouts/NavBarItem.mjs +23 -0
- package/dist/components/layouts/NavBarItem.mjs.map +1 -0
- package/dist/components/layouts/NotificationsPopover.mjs +97 -0
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -0
- package/dist/components/layouts/ProfilePopover.mjs +152 -0
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -0
- package/dist/components/layouts/SideBarNavigation.mjs +63 -0
- package/dist/components/layouts/SideBarNavigation.mjs.map +1 -0
- package/dist/components/layouts/UsersSelectorPopover.mjs +210 -0
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -0
- package/dist/components/layouts/WhitelabelCodes.mjs +50 -0
- package/dist/components/layouts/WhitelabelCodes.mjs.map +1 -0
- package/dist/components/modals/BuyCreditsModal.mjs +281 -0
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -0
- package/dist/components/modals/ModalManager.mjs +19 -0
- package/dist/components/modals/ModalManager.mjs.map +1 -0
- package/dist/components/modals/Modals.mjs +20 -0
- package/dist/components/modals/Modals.mjs.map +1 -0
- package/dist/components/modals/PaidPlanRequiredModal.mjs +46 -0
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -0
- package/dist/components/modals/cards/AddCardModal.mjs +215 -0
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -0
- package/dist/components/modals/cards/CardFormFields.mjs +268 -0
- package/dist/components/modals/cards/CardFormFields.mjs.map +1 -0
- package/dist/components/navigation/AppNavigation.mjs +33 -0
- package/dist/components/navigation/AppNavigation.mjs.map +1 -0
- package/dist/components/navigation/AppNavigationContext.mjs +13 -0
- package/dist/components/navigation/AppNavigationContext.mjs.map +1 -0
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +52 -0
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -0
- package/dist/components/navigation/NavItem.mjs +41 -0
- package/dist/components/navigation/NavItem.mjs.map +1 -0
- package/dist/components/navigation/NavItemsContext.mjs +16 -0
- package/dist/components/navigation/NavItemsContext.mjs.map +1 -0
- package/dist/components/navigation/ProjectSelectorPopover.mjs +147 -0
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -0
- package/dist/components/navigation/shells/DesktopShell.mjs +11 -0
- package/dist/components/navigation/shells/DesktopShell.mjs.map +1 -0
- package/dist/components/navigation/shells/MdShell.mjs +11 -0
- package/dist/components/navigation/shells/MdShell.mjs.map +1 -0
- package/dist/components/navigation/shells/MobileShell.mjs +27 -0
- package/dist/components/navigation/shells/MobileShell.mjs.map +1 -0
- package/dist/components/navigation/shells/TabsMobileShell.mjs +61 -0
- package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/BottomLinks.mjs +35 -0
- package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +33 -0
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/NavItems.mjs +25 -0
- package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/PlanCard.mjs +25 -0
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -0
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +145 -0
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -0
- package/dist/components/navigation/types.mjs +1 -0
- package/dist/components/navigation/types.mjs.map +1 -0
- package/dist/components/pages/NotFoundPage.mjs +47 -0
- package/dist/components/pages/NotFoundPage.mjs.map +1 -0
- package/dist/components/pages/notifications/Notifications.mjs +159 -0
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -0
- package/dist/components/ui/buttons/Button.mjs +52 -0
- package/dist/components/ui/buttons/Button.mjs.map +1 -0
- package/dist/components/ui/buttons/CancelButton.mjs +17 -0
- package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
- package/dist/components/ui/buttons/CopyButton.mjs +42 -0
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
- package/dist/components/ui/data-display/Accordion.mjs +76 -0
- package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
- package/dist/components/ui/data-display/Badge.mjs +42 -0
- package/dist/components/ui/data-display/Badge.mjs.map +1 -0
- package/dist/components/ui/data-display/Card.mjs +92 -0
- package/dist/components/ui/data-display/Card.mjs.map +1 -0
- package/dist/components/ui/data-display/CardBrandIcons.mjs +484 -0
- package/dist/components/ui/data-display/CardBrandIcons.mjs.map +1 -0
- package/dist/components/ui/data-display/CardItem.mjs +67 -0
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -0
- package/dist/components/ui/data-display/Pagination.mjs +118 -0
- package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +161 -0
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -0
- package/dist/components/ui/data-display/ScrollArea.mjs +62 -0
- package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
- package/dist/components/ui/data-display/Separator.mjs +28 -0
- package/dist/components/ui/data-display/Separator.mjs.map +1 -0
- package/dist/components/ui/data-display/Table.mjs +116 -0
- package/dist/components/ui/data-display/Table.mjs.map +1 -0
- package/dist/components/ui/data-display/Tabs.mjs +69 -0
- package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
- package/dist/components/ui/data-display/UserAvatar.mjs +49 -0
- package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -0
- package/dist/components/ui/feedback/CircularProgress.mjs +71 -0
- package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +63 -0
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
- package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
- package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
- package/dist/components/ui/feedback/Progress.mjs +37 -0
- package/dist/components/ui/feedback/Progress.mjs.map +1 -0
- package/dist/components/ui/feedback/Skeleton.mjs +9 -0
- package/dist/components/ui/feedback/Skeleton.mjs.map +1 -0
- package/dist/components/ui/feedback/Toast.mjs +77 -0
- package/dist/components/ui/feedback/Toast.mjs.map +1 -0
- package/dist/components/ui/form/Calendar.mjs +204 -0
- package/dist/components/ui/form/Calendar.mjs.map +1 -0
- package/dist/components/ui/form/Checkbox.mjs +33 -0
- package/dist/components/ui/form/Checkbox.mjs.map +1 -0
- package/dist/components/ui/form/ComboboxField.mjs +130 -0
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
- package/dist/components/ui/form/DatePicker.mjs +82 -0
- package/dist/components/ui/form/DatePicker.mjs.map +1 -0
- package/dist/components/ui/form/DateRangePicker.mjs +92 -0
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
- package/dist/components/ui/form/FormField.mjs +103 -0
- package/dist/components/ui/form/FormField.mjs.map +1 -0
- package/dist/components/ui/form/Input.mjs +21 -0
- package/dist/components/ui/form/Input.mjs.map +1 -0
- package/dist/components/ui/form/InputOtp.mjs +70 -0
- package/dist/components/ui/form/InputOtp.mjs.map +1 -0
- package/dist/components/ui/form/PhoneInput.mjs +176 -0
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
- package/dist/components/ui/form/RadioGroup.mjs +37 -0
- package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
- package/dist/components/ui/form/Select.mjs +179 -0
- package/dist/components/ui/form/Select.mjs.map +1 -0
- package/dist/components/ui/form/SelectField.mjs +80 -0
- package/dist/components/ui/form/SelectField.mjs.map +1 -0
- package/dist/components/ui/form/Switch.mjs +33 -0
- package/dist/components/ui/form/Switch.mjs.map +1 -0
- package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
- package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
- package/dist/components/ui/form/TextAreaField.mjs +56 -0
- package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
- package/dist/components/ui/form/Textarea.mjs +20 -0
- package/dist/components/ui/form/Textarea.mjs.map +1 -0
- package/dist/components/ui/overlay/Command.mjs +178 -0
- package/dist/components/ui/overlay/Command.mjs.map +1 -0
- package/dist/components/ui/overlay/Dialog.mjs +142 -0
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
- package/dist/components/ui/overlay/Popover.mjs +46 -0
- package/dist/components/ui/overlay/Popover.mjs.map +1 -0
- package/dist/components/ui/overlay/Sheet.mjs +149 -0
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
- package/dist/components/ui/overlay/Tooltip.mjs +57 -0
- package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
- package/dist/components/widgets/notifications/NotificationCard.mjs +54 -0
- package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -0
- package/dist/enums/AccountSectionType.mjs +11 -0
- package/dist/enums/AccountSectionType.mjs.map +1 -0
- package/dist/hooks/copy-to-clipboard.hook.mjs +52 -0
- package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
- package/dist/hooks/useCountdownTimer.mjs +29 -0
- package/dist/hooks/useCountdownTimer.mjs.map +1 -0
- package/dist/hooks/useDebounce.mjs +19 -0
- package/dist/hooks/useDebounce.mjs.map +1 -0
- package/dist/hooks/useDebounceState.mjs +12 -0
- package/dist/hooks/useDebounceState.mjs.map +1 -0
- package/dist/hooks/useDebouncedEffect.mjs +44 -0
- package/dist/hooks/useDebouncedEffect.mjs.map +1 -0
- package/dist/hooks/useIsMobile.mjs +18 -0
- package/dist/hooks/useIsMobile.mjs.map +1 -0
- package/dist/hooks/usePasswordVisibility.mjs +13 -0
- package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
- package/dist/index.mjs +528 -0
- package/dist/index.mjs.map +1 -0
- package/dist/infra/api/client.mjs +162 -0
- package/dist/infra/api/client.mjs.map +1 -0
- package/dist/infra/api/types.mjs +31 -0
- package/dist/infra/api/types.mjs.map +1 -0
- package/dist/infra/utils/client-info.mjs +27 -0
- package/dist/infra/utils/client-info.mjs.map +1 -0
- package/dist/infra/utils/clsx.mjs +9 -0
- package/dist/infra/utils/clsx.mjs.map +1 -0
- package/dist/infra/utils/date.mjs +11 -0
- package/dist/infra/utils/date.mjs.map +1 -0
- package/dist/infra/utils/params.mjs +21 -0
- package/dist/infra/utils/params.mjs.map +1 -0
- package/dist/infra/utils/parser.mjs +24 -0
- package/dist/infra/utils/parser.mjs.map +1 -0
- package/dist/infra/utils/percentage.mjs +20 -0
- package/dist/infra/utils/percentage.mjs.map +1 -0
- package/dist/middleware.mjs +10 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/middlewares/chain.mjs +37 -0
- package/dist/middlewares/chain.mjs.map +1 -0
- package/dist/middlewares/create-auth-middleware.mjs +32 -0
- package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
- package/dist/middlewares/types.mjs +11 -0
- package/dist/middlewares/types.mjs.map +1 -0
- package/dist/modules/accounts/actions/account-management.action.mjs +98 -0
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
- package/dist/modules/accounts/actions/find-current-account.action.mjs +10 -0
- package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -0
- package/dist/modules/accounts/actions/list-currencies.action.mjs +10 -0
- package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -0
- package/dist/modules/accounts/actions/list-timezones.action.mjs +10 -0
- package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -0
- package/dist/modules/accounts/hooks/current-account.hook.mjs +24 -0
- package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useAccountManagement.mjs +71 -0
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useCurrencies.mjs +17 -0
- package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useTimezones.mjs +17 -0
- package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -0
- package/dist/modules/accounts/hooks/useViaCep.mjs +19 -0
- package/dist/modules/accounts/hooks/useViaCep.mjs.map +1 -0
- package/dist/modules/accounts/services/account.service.mjs +182 -0
- package/dist/modules/accounts/services/account.service.mjs.map +1 -0
- package/dist/modules/accounts/services/currency.service.mjs +24 -0
- package/dist/modules/accounts/services/currency.service.mjs.map +1 -0
- package/dist/modules/accounts/services/timezone.service.mjs +65 -0
- package/dist/modules/accounts/services/timezone.service.mjs.map +1 -0
- package/dist/modules/accounts/services/two-factor.service.mjs +78 -0
- package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
- package/dist/modules/accounts/types.mjs +1 -0
- package/dist/modules/accounts/types.mjs.map +1 -0
- package/dist/modules/auth/actions/login.action.mjs +14 -0
- package/dist/modules/auth/actions/login.action.mjs.map +1 -0
- package/dist/modules/auth/actions/logout.action.mjs +14 -0
- package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
- package/dist/modules/auth/actions/register.action.mjs +14 -0
- package/dist/modules/auth/actions/register.action.mjs.map +1 -0
- package/dist/modules/auth/actions/validate-session.action.mjs +48 -0
- package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
- package/dist/modules/auth/actions/verify-two-factor.action.mjs +17 -0
- package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -0
- package/dist/modules/auth/hooks/login.hook.mjs +13 -0
- package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
- package/dist/modules/auth/hooks/logout.hook.mjs +13 -0
- package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
- package/dist/modules/auth/hooks/register.hook.mjs +13 -0
- package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
- package/dist/modules/auth/hooks/useManagementPermissions.mjs +41 -0
- package/dist/modules/auth/hooks/useManagementPermissions.mjs.map +1 -0
- package/dist/modules/auth/hooks/useUserQuery.mjs +63 -0
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
- package/dist/modules/auth/schema.mjs +1 -0
- package/dist/modules/auth/schema.mjs.map +1 -0
- package/dist/modules/auth/services/auth.service.mjs +341 -0
- package/dist/modules/auth/services/auth.service.mjs.map +1 -0
- package/dist/modules/auth/types/management-permission.type.mjs +1 -0
- package/dist/modules/auth/types/management-permission.type.mjs.map +1 -0
- package/dist/modules/auth/utils/assert-management-permission.mjs +42 -0
- package/dist/modules/auth/utils/assert-management-permission.mjs.map +1 -0
- package/dist/modules/auth/utils/assert-management-subscription.mjs +33 -0
- package/dist/modules/auth/utils/assert-management-subscription.mjs.map +1 -0
- package/dist/modules/auth/utils/assert-paid-subscription.mjs +40 -0
- package/dist/modules/auth/utils/assert-paid-subscription.mjs.map +1 -0
- package/dist/modules/auth/utils/assert-subscription-addon.mjs +35 -0
- package/dist/modules/auth/utils/assert-subscription-addon.mjs.map +1 -0
- package/dist/modules/auth/utils/build-wl-override.mjs +27 -0
- package/dist/modules/auth/utils/build-wl-override.mjs.map +1 -0
- package/dist/modules/auth/utils/get-user-context.mjs +25 -0
- package/dist/modules/auth/utils/get-user-context.mjs.map +1 -0
- package/dist/modules/cards/actions/create-card.action.mjs +10 -0
- package/dist/modules/cards/actions/create-card.action.mjs.map +1 -0
- package/dist/modules/cards/actions/list-cards.action.mjs +10 -0
- package/dist/modules/cards/actions/list-cards.action.mjs.map +1 -0
- package/dist/modules/cards/hooks/cards.hook.mjs +16 -0
- package/dist/modules/cards/hooks/cards.hook.mjs.map +1 -0
- package/dist/modules/cards/hooks/create-card.hook.mjs +18 -0
- package/dist/modules/cards/hooks/create-card.hook.mjs.map +1 -0
- package/dist/modules/cards/services/cards.service.mjs +44 -0
- package/dist/modules/cards/services/cards.service.mjs.map +1 -0
- package/dist/modules/cards/types.mjs +27 -0
- package/dist/modules/cards/types.mjs.map +1 -0
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +10 -0
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -0
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +76 -0
- package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs +31 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -0
- package/dist/modules/ia-credits/types.mjs +25 -0
- package/dist/modules/ia-credits/types.mjs.map +1 -0
- package/dist/modules/plans/actions/find-plan-by-id.action.mjs +10 -0
- package/dist/modules/plans/actions/find-plan-by-id.action.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs +13 -0
- package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs +15 -0
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +1 -0
- package/dist/modules/plans/services/plans.service.mjs +34 -0
- package/dist/modules/plans/services/plans.service.mjs.map +1 -0
- package/dist/modules/plans/types/plan.type.mjs +20 -0
- package/dist/modules/plans/types/plan.type.mjs.map +1 -0
- package/dist/modules/projects/actions/add-project-user.action.mjs +10 -0
- package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -0
- package/dist/modules/projects/actions/list-all-account-users.action.mjs +10 -0
- package/dist/modules/projects/actions/list-all-account-users.action.mjs.map +1 -0
- package/dist/modules/projects/actions/list-available-users.action.mjs +10 -0
- package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -0
- package/dist/modules/projects/actions/list-project-users.action.mjs +10 -0
- package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -0
- package/dist/modules/projects/actions/remove-project-user.action.mjs +10 -0
- package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -0
- package/dist/modules/projects/hooks/add-project-user.hook.mjs +61 -0
- package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +35 -0
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +34 -0
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +34 -0
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs +61 -0
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +1 -0
- package/dist/modules/projects/services/project-users.service.mjs +96 -0
- package/dist/modules/projects/services/project-users.service.mjs.map +1 -0
- package/dist/modules/projects/types.mjs +23 -0
- package/dist/modules/projects/types.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs +12 -0
- package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs +24 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs +5 -0
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs +13 -0
- package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +17 -0
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +17 -0
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs +22 -0
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs +37 -0
- package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs.map +1 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs +75 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -0
- package/dist/modules/subscriptions/types/billing-period.type.mjs +1 -0
- package/dist/modules/subscriptions/types/billing-period.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/calculate-subscription.type.mjs +72 -0
- package/dist/modules/subscriptions/types/calculate-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/subscription.type.mjs +57 -0
- package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/build-plan-extras.mjs +37 -0
- package/dist/modules/subscriptions/utils/build-plan-extras.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/has-subscription-expired.mjs +10 -0
- package/dist/modules/subscriptions/utils/has-subscription-expired.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/periodicity.mjs +48 -0
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs +14 -0
- package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs.map +1 -0
- package/dist/modules/users/action/find-user-by-id.action.mjs +10 -0
- package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
- package/dist/modules/users/action/list-messages.action.mjs +13 -0
- package/dist/modules/users/action/list-messages.action.mjs.map +1 -0
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +10 -0
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -0
- package/dist/modules/users/action/mark-message-as-read.action.mjs +10 -0
- package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -0
- package/dist/modules/users/hooks/messages.hook.mjs +57 -0
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -0
- package/dist/modules/users/schema/messages.schema.mjs +21 -0
- package/dist/modules/users/schema/messages.schema.mjs.map +1 -0
- package/dist/modules/users/schema.mjs +11 -0
- package/dist/modules/users/schema.mjs.map +1 -0
- package/dist/modules/users/services/messages.service.mjs +35 -0
- package/dist/modules/users/services/messages.service.mjs.map +1 -0
- package/dist/modules/users/services/user.service.mjs +52 -0
- package/dist/modules/users/services/user.service.mjs.map +1 -0
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +21 -0
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
- package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs +19 -0
- package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs.map +1 -0
- package/dist/modules/whitelabel/schema.mjs +1 -0
- package/dist/modules/whitelabel/schema.mjs.map +1 -0
- package/dist/modules/whitelabel/services/whitelabel.service.mjs +146 -0
- package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
- package/dist/modules/whitelabel/utils/normalize-hostname.mjs +35 -0
- package/dist/modules/whitelabel/utils/normalize-hostname.mjs.map +1 -0
- package/dist/providers/auth.provider.mjs +114 -0
- package/dist/providers/auth.provider.mjs.map +1 -0
- package/dist/providers/query.provider.mjs +99 -0
- package/dist/providers/query.provider.mjs.map +1 -0
- package/dist/providers/whitelabel.provider.mjs +42 -0
- package/dist/providers/whitelabel.provider.mjs.map +1 -0
- package/dist/server.mjs +111 -0
- package/dist/server.mjs.map +1 -0
- package/dist/store/useAccountModals.mjs +18 -0
- package/dist/store/useAccountModals.mjs.map +1 -0
- package/dist/store/useBuyCreditsModal.mjs +16 -0
- package/dist/store/useBuyCreditsModal.mjs.map +1 -0
- package/dist/store/useDesktopSidebarStore.mjs +39 -0
- package/dist/store/useDesktopSidebarStore.mjs.map +1 -0
- package/dist/store/useMdSidebarStore.mjs +28 -0
- package/dist/store/useMdSidebarStore.mjs.map +1 -0
- package/dist/store/useMobileNavbarSheet.mjs +14 -0
- package/dist/store/useMobileNavbarSheet.mjs.map +1 -0
- package/dist/store/useModalManager.mjs +75 -0
- package/dist/store/useModalManager.mjs.map +1 -0
- package/dist/store/usePaidPlanRequiredModal.mjs +14 -0
- package/dist/store/usePaidPlanRequiredModal.mjs.map +1 -0
- package/dist/utils/browser/clipboard.mjs +36 -0
- package/dist/utils/browser/clipboard.mjs.map +1 -0
- package/dist/utils/constants/br-states.mjs +33 -0
- package/dist/utils/constants/br-states.mjs.map +1 -0
- package/dist/utils/countries.mjs +219 -0
- package/dist/utils/countries.mjs.map +1 -0
- package/dist/utils/file/index.mjs +9 -0
- package/dist/utils/file/index.mjs.map +1 -0
- package/dist/utils/format/masks.mjs +67 -0
- package/dist/utils/format/masks.mjs.map +1 -0
- package/dist/utils/intl/locales.mjs +12 -0
- package/dist/utils/intl/locales.mjs.map +1 -0
- package/dist/utils/safeServerAction.mjs +16 -0
- package/dist/utils/safeServerAction.mjs.map +1 -0
- package/dist/utils/validators/account.mjs +27 -0
- package/dist/utils/validators/account.mjs.map +1 -0
- package/dist/utils/validators/common.mjs +47 -0
- package/dist/utils/validators/common.mjs.map +1 -0
- package/dist/utils/withAction.mjs +13 -0
- package/dist/utils/withAction.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modals/cards/AddCardModal.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useState } from 'react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../ui/overlay/Dialog';\nimport { Button } from '../../ui/buttons/Button';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { useModalManager } from '../../../store/useModalManager';\nimport { useCreateCard } from '../../../modules/cards/hooks/create-card.hook';\nimport { useUpdateAccount } from '../../../modules/accounts/hooks/useAccountManagement';\nimport { CardFormFields, BillingFormFields, cardFormSchema } from './CardFormFields';\nimport type { CardFormData, StripeElementsStatus } from './CardFormFields';\nimport { IconX } from '@tabler/icons-react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { CardNumberElement, useElements, useStripe } from '@stripe/react-stripe-js';\nimport { toast } from 'sonner';\n\nconst INITIAL_STRIPE_STATUS: StripeElementsStatus = {\n cardNumber: false,\n cardExpiry: false,\n cardCvc: false,\n};\n\nexport default function AddCardModal() {\n const { activeModal, modalData, closeModal } = useModalManager();\n const isOpen = activeModal === 'addCardModal';\n const [currentStep, setCurrentStep] = useState(1);\n const [stripeStatus, setStripeStatus] = useState<StripeElementsStatus>(INITIAL_STRIPE_STATUS);\n const [stripeErrors, setStripeErrors] = useState<Record<string, string | undefined>>({});\n\n const onCardAdded = modalData.onCardAdded as ((cardId: string) => void) | undefined;\n\n const createCardMutation = useCreateCard();\n const updateAccountMutation = useUpdateAccount();\n const elements = useElements();\n const stripe = useStripe();\n\n const form = useForm<CardFormData>({\n resolver: zodResolver(cardFormSchema),\n mode: 'onSubmit',\n reValidateMode: 'onChange',\n defaultValues: {\n country: 'BR',\n personType: 'pf',\n },\n });\n\n const handleClose = useCallback(() => {\n form.reset();\n setCurrentStep(1);\n setStripeStatus(INITIAL_STRIPE_STATUS);\n setStripeErrors({});\n closeModal();\n }, [form, closeModal]);\n\n const handleStripeChange = useCallback(\n (field: keyof StripeElementsStatus, complete: boolean) => {\n setStripeStatus((prev) => ({ ...prev, [field]: complete }));\n if (complete) {\n setStripeErrors((prev) => ({ ...prev, [field]: undefined }));\n }\n },\n []\n );\n\n const handleContinue = useCallback(async () => {\n const rhfValid = await form.trigger(['name', 'country', 'personType', 'cpf', 'cnpj']);\n\n const newStripeErrors: Record<string, string | undefined> = {};\n if (!stripeStatus.cardNumber) newStripeErrors.cardNumber = 'Número do cartão é obrigatório';\n if (!stripeStatus.cardExpiry) newStripeErrors.cardExpiry = 'Data de validade é obrigatória';\n if (!stripeStatus.cardCvc) newStripeErrors.cardCvc = 'Código de segurança é obrigatório';\n setStripeErrors(newStripeErrors);\n\n const stripeValid = stripeStatus.cardNumber && stripeStatus.cardExpiry && stripeStatus.cardCvc;\n\n if (rhfValid && stripeValid) {\n form.clearErrors(['fullName', 'cep', 'street', 'streetNumber', 'city', 'state']);\n setCurrentStep(2);\n }\n }, [form, stripeStatus]);\n\n const handleBack = useCallback(() => {\n setCurrentStep(1);\n }, []);\n\n async function handleSubmit(data: CardFormData) {\n if (!stripe || !elements) return;\n\n const cardElement = elements.getElement(CardNumberElement);\n if (!cardElement) return;\n\n const { error, paymentMethod } = await stripe.createPaymentMethod({\n type: 'card',\n card: cardElement,\n billing_details: {\n name: data.fullName,\n address: {\n country: data.country,\n postal_code: data.cep,\n line1: `${data.street}, ${data.streetNumber}`,\n line2: data.complement || undefined,\n city: data.city,\n state: data.state,\n },\n },\n });\n\n if (error) {\n toast.custom(\n (t) => (\n <Toast\n variant=\"error\"\n message=\"Não foi possível adicionar o cartão na Stripe, tente novamente.\"\n toastId={t}\n />\n ),\n { duration: 5000 }\n );\n return;\n }\n\n try {\n const [cardResult] = await Promise.all([\n createCardMutation.mutateAsync({ payment_method_id: paymentMethod.id }),\n updateAccountMutation.mutateAsync({\n financial_document_type: data.personType === 'pf' ? 1 : 2,\n financial_document: data.personType === 'pf' ? data.cpf : data.cnpj,\n financial_name: data.fullName,\n zipcode: data.cep,\n address: data.street,\n address_number: data.streetNumber,\n address_complement: data.complement || '',\n city: data.city,\n state: data.state,\n }),\n ]);\n\n if (cardResult.success && cardResult.data?.id != null) {\n onCardAdded?.(cardResult.data.id.toString());\n }\n\n toast.custom(\n (t) => <Toast variant=\"success\" message=\"Cartão adicionado com sucesso.\" toastId={t} />,\n { duration: 5000 }\n );\n handleClose();\n } catch {\n toast.custom(\n (t) => (\n <Toast\n variant=\"error\"\n message=\"Não foi possível salvar o seu novo cartão, tente novamente.\"\n toastId={t}\n />\n ),\n { duration: 5000 }\n );\n }\n }\n\n const isSubmitting =\n createCardMutation.isPending ||\n updateAccountMutation.isPending ||\n form.formState.isSubmitting;\n\n const watchedValues = form.watch(['name', 'country', 'personType', 'cpf', 'cnpj', 'fullName', 'cep', 'street', 'streetNumber', 'city', 'state']);\n const [name, country, personType, cpf, cnpj, fullName, cep, street, streetNumber, city, state] = watchedValues;\n const isStep1Valid =\n !!name &&\n !!country &&\n !!personType &&\n (personType === 'pf' ? !!cpf && cpf.length >= 14 : !!cnpj && cnpj.length >= 18) &&\n stripeStatus.cardNumber &&\n stripeStatus.cardExpiry &&\n stripeStatus.cardCvc;\n const isStep2Valid =\n !!fullName &&\n !!cep && cep.length >= 9 &&\n !!street &&\n !!streetNumber &&\n !!city &&\n !!state;\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n className=\"flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] overflow-y-auto\"\n >\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center px-4 py-3 relative border-b border-zinc-200 lg:border-b-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950 text-center\">\n {currentStep === 1 ? 'Adicionar cartão' : 'Dados de cobrança'}\n </DialogTitle>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n </DialogHeader>\n\n {/* Progress bar */}\n <div className=\"h-1 bg-zinc-100 w-full\">\n <div\n className=\"h-full bg-cyan-400 transition-all duration-300 ease-in-out\"\n style={{ width: currentStep === 1 ? '50%' : '100%' }}\n />\n </div>\n\n <form\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"flex flex-col flex-1 lg:flex-none\"\n >\n <div className={`flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none ${currentStep !== 1 ? 'hidden' : ''}`}>\n <CardFormFields\n form={form}\n onStripeChange={handleStripeChange}\n stripeErrors={stripeErrors}\n />\n </div>\n <div className={`flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none ${currentStep !== 2 ? 'hidden' : ''}`}>\n <BillingFormFields form={form} />\n </div>\n\n <div className=\"flex justify-between items-center p-4 lg:p-5 border-t border-zinc-200 gap-2 mt-auto lg:mt-0\">\n {currentStep === 1 ? (\n <>\n <Button variant=\"secondary\" type=\"button\" onClick={handleClose} className=\"h-10!\">\n Cancelar\n </Button>\n <Button\n type=\"button\"\n className=\"h-10!\"\n onClick={handleContinue}\n disabled={!isStep1Valid}\n >\n Continuar\n </Button>\n </>\n ) : (\n <>\n <Button variant=\"secondary\" type=\"button\" onClick={handleBack} className=\"h-10!\">\n Voltar\n </Button>\n <Button type=\"submit\" className=\"h-10!\" disabled={isSubmitting || !isStep2Valid}>\n {isSubmitting ? 'Adicionando cartão...' : 'Adicionar cartão'}\n </Button>\n </>\n )}\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA+GU,SAwHI,UAxHJ,KAgFA,YAhFA;AA7GV,SAAS,aAAa,gBAAgB;AACtC,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,mBAAmB,sBAAsB;AAElE,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB,aAAa,iBAAiB;AAC1D,SAAS,aAAa;AAEtB,MAAM,wBAA8C;AAAA,EAClD,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,SAAS;AACX;AAEe,SAAR,eAAgC;AACrC,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAC/D,QAAM,SAAS,gBAAgB;AAC/B,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,CAAC;AAChD,QAAM,CAAC,cAAc,eAAe,IAAI,SAA+B,qBAAqB;AAC5F,QAAM,CAAC,cAAc,eAAe,IAAI,SAA6C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C5C;AAAA,iBACF,GAEJ;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useViaCep } from "../../../modules/accounts/hooks/useViaCep";
|
|
4
|
+
import { FormField } from "../../ui/form/FormField";
|
|
5
|
+
import { SelectField } from "../../ui/form/SelectField";
|
|
6
|
+
import { formatCPF, formatCNPJ, formatPostalCode } from "../../../utils/format/masks";
|
|
7
|
+
import z from "zod";
|
|
8
|
+
import { CardCvcElement, CardExpiryElement, CardNumberElement } from "@stripe/react-stripe-js";
|
|
9
|
+
const stripeElementOptions = {
|
|
10
|
+
style: {
|
|
11
|
+
base: {
|
|
12
|
+
fontSize: "16px",
|
|
13
|
+
color: "#030712",
|
|
14
|
+
fontFamily: "Inter, sans-serif",
|
|
15
|
+
"::placeholder": {
|
|
16
|
+
color: "#9ca3af"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const cardFormSchema = z.object({
|
|
22
|
+
name: z.string().min(1, "Nome \xE9 obrigat\xF3rio"),
|
|
23
|
+
country: z.string().min(1, "Pa\xEDs \xE9 obrigat\xF3rio"),
|
|
24
|
+
personType: z.enum(["pf", "pj"]),
|
|
25
|
+
cpf: z.string().optional(),
|
|
26
|
+
cnpj: z.string().optional(),
|
|
27
|
+
fullName: z.string().min(1, "Nome completo \xE9 obrigat\xF3rio"),
|
|
28
|
+
cep: z.string().min(9, "CEP \xE9 obrigat\xF3rio"),
|
|
29
|
+
street: z.string().min(1, "Endere\xE7o \xE9 obrigat\xF3rio"),
|
|
30
|
+
streetNumber: z.string().min(1, "N\xFAmero \xE9 obrigat\xF3rio"),
|
|
31
|
+
city: z.string().min(1, "Cidade \xE9 obrigat\xF3ria"),
|
|
32
|
+
state: z.string().min(1, "UF \xE9 obrigat\xF3rio"),
|
|
33
|
+
complement: z.string().optional()
|
|
34
|
+
}).refine(
|
|
35
|
+
(data) => {
|
|
36
|
+
if (data.personType === "pf") return !!data.cpf && data.cpf.length >= 14;
|
|
37
|
+
return !!data.cnpj && data.cnpj.length >= 18;
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
message: "Documento \xE9 obrigat\xF3rio",
|
|
41
|
+
path: ["cpf"]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const STEP1_FIELDS = ["name", "country", "personType", "cpf", "cnpj"];
|
|
45
|
+
function CardFormFields({ form, onStripeChange, stripeErrors }) {
|
|
46
|
+
const {
|
|
47
|
+
register,
|
|
48
|
+
watch,
|
|
49
|
+
setValue,
|
|
50
|
+
formState: { errors }
|
|
51
|
+
} = form;
|
|
52
|
+
const personType = watch("personType");
|
|
53
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
FormField,
|
|
56
|
+
{
|
|
57
|
+
label: "Nome impresso no cart\xE3o",
|
|
58
|
+
placeholder: "Digite aqui",
|
|
59
|
+
...register("name"),
|
|
60
|
+
error: !!errors.name,
|
|
61
|
+
errorMessage: errors.name?.message
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
65
|
+
/* @__PURE__ */ jsx("label", { className: "paragraph-xsmall-semibold text-zinc-600", children: "N\xFAmero do cart\xE3o" }),
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400 relative", children: /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
|
|
67
|
+
CardNumberElement,
|
|
68
|
+
{
|
|
69
|
+
options: { ...stripeElementOptions, showIcon: true },
|
|
70
|
+
onChange: (e) => onStripeChange("cardNumber", e.complete)
|
|
71
|
+
}
|
|
72
|
+
) }) }),
|
|
73
|
+
stripeErrors.cardNumber && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-semibold text-red-600", children: stripeErrors.cardNumber })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
76
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-1.5", children: [
|
|
77
|
+
/* @__PURE__ */ jsx("label", { className: "paragraph-xsmall-semibold text-zinc-600", children: "Data de validade" }),
|
|
78
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400", children: /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
|
|
79
|
+
CardExpiryElement,
|
|
80
|
+
{
|
|
81
|
+
options: stripeElementOptions,
|
|
82
|
+
onChange: (e) => onStripeChange("cardExpiry", e.complete)
|
|
83
|
+
}
|
|
84
|
+
) }) }),
|
|
85
|
+
stripeErrors.cardExpiry && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-semibold text-red-600", children: stripeErrors.cardExpiry })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-1.5", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("label", { className: "paragraph-xsmall-semibold text-zinc-600", children: "CVC" }),
|
|
89
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400", children: /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
|
|
90
|
+
CardCvcElement,
|
|
91
|
+
{
|
|
92
|
+
options: stripeElementOptions,
|
|
93
|
+
onChange: (e) => onStripeChange("cardCvc", e.complete)
|
|
94
|
+
}
|
|
95
|
+
) }) }),
|
|
96
|
+
stripeErrors.cardCvc && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-semibold text-red-600", children: stripeErrors.cardCvc })
|
|
97
|
+
] })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
SelectField,
|
|
101
|
+
{
|
|
102
|
+
label: "Pa\xEDs",
|
|
103
|
+
placeholder: "Selecione",
|
|
104
|
+
value: watch("country"),
|
|
105
|
+
onChange: (value) => setValue("country", value),
|
|
106
|
+
options: [
|
|
107
|
+
{ value: "BR", label: "Brasil" },
|
|
108
|
+
{ value: "ES", label: "Espanha" },
|
|
109
|
+
{ value: "US", label: "Estados Unidos" }
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
SelectField,
|
|
116
|
+
{
|
|
117
|
+
label: "Tipo de pessoa",
|
|
118
|
+
placeholder: "Selecione",
|
|
119
|
+
value: personType,
|
|
120
|
+
onChange: (value) => {
|
|
121
|
+
setValue("personType", value);
|
|
122
|
+
setValue("cpf", "");
|
|
123
|
+
setValue("cnpj", "");
|
|
124
|
+
},
|
|
125
|
+
options: [
|
|
126
|
+
{ value: "pf", label: "Pessoa f\xEDsica" },
|
|
127
|
+
{ value: "pj", label: "Pessoa jur\xEDdica" }
|
|
128
|
+
],
|
|
129
|
+
containerClassName: "flex-1"
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: personType === "pj" ? /* @__PURE__ */ jsx(
|
|
133
|
+
FormField,
|
|
134
|
+
{
|
|
135
|
+
label: "CNPJ",
|
|
136
|
+
placeholder: "__.___.___/____-__",
|
|
137
|
+
...register("cnpj", {
|
|
138
|
+
onChange: (e) => {
|
|
139
|
+
setValue("cnpj", formatCNPJ(e.target.value));
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
error: !!errors.cpf,
|
|
143
|
+
errorMessage: errors.cpf?.message
|
|
144
|
+
}
|
|
145
|
+
) : /* @__PURE__ */ jsx(
|
|
146
|
+
FormField,
|
|
147
|
+
{
|
|
148
|
+
label: "CPF",
|
|
149
|
+
placeholder: "___.___.___-__",
|
|
150
|
+
...register("cpf", {
|
|
151
|
+
onChange: (e) => {
|
|
152
|
+
setValue("cpf", formatCPF(e.target.value));
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
error: !!errors.cpf,
|
|
156
|
+
errorMessage: errors.cpf?.message
|
|
157
|
+
}
|
|
158
|
+
) })
|
|
159
|
+
] })
|
|
160
|
+
] });
|
|
161
|
+
}
|
|
162
|
+
function BillingFormFields({ form }) {
|
|
163
|
+
const {
|
|
164
|
+
register,
|
|
165
|
+
setValue,
|
|
166
|
+
formState: { errors }
|
|
167
|
+
} = form;
|
|
168
|
+
const { mutateAsync: lookupCep } = useViaCep();
|
|
169
|
+
const handleCepChange = (rawValue) => {
|
|
170
|
+
const masked = formatPostalCode(rawValue);
|
|
171
|
+
setValue("cep", masked);
|
|
172
|
+
const digits = rawValue.replace(/\D/g, "");
|
|
173
|
+
if (digits.length === 8) {
|
|
174
|
+
lookupCep(digits).then((data) => {
|
|
175
|
+
setValue("street", data.logradouro, { shouldValidate: true });
|
|
176
|
+
setValue("city", data.localidade, { shouldValidate: true });
|
|
177
|
+
setValue("state", data.uf, { shouldValidate: true });
|
|
178
|
+
}).catch(() => {
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
183
|
+
/* @__PURE__ */ jsx(
|
|
184
|
+
FormField,
|
|
185
|
+
{
|
|
186
|
+
label: "Nome completo",
|
|
187
|
+
placeholder: "Digite aqui",
|
|
188
|
+
...register("fullName"),
|
|
189
|
+
error: !!errors.fullName,
|
|
190
|
+
errorMessage: errors.fullName?.message
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ jsx(
|
|
194
|
+
FormField,
|
|
195
|
+
{
|
|
196
|
+
label: "CEP",
|
|
197
|
+
placeholder: "_____-___",
|
|
198
|
+
...register("cep", {
|
|
199
|
+
onChange: (e) => handleCepChange(e.target.value)
|
|
200
|
+
}),
|
|
201
|
+
error: !!errors.cep,
|
|
202
|
+
errorMessage: errors.cep?.message
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
206
|
+
/* @__PURE__ */ jsx("div", { className: "flex-[4]", children: /* @__PURE__ */ jsx(
|
|
207
|
+
FormField,
|
|
208
|
+
{
|
|
209
|
+
label: "Endere\xE7o",
|
|
210
|
+
placeholder: "",
|
|
211
|
+
...register("street"),
|
|
212
|
+
error: !!errors.street,
|
|
213
|
+
errorMessage: errors.street?.message
|
|
214
|
+
}
|
|
215
|
+
) }),
|
|
216
|
+
/* @__PURE__ */ jsx("div", { className: "flex-[1]", children: /* @__PURE__ */ jsx(
|
|
217
|
+
FormField,
|
|
218
|
+
{
|
|
219
|
+
label: "N\xFAmero",
|
|
220
|
+
placeholder: "",
|
|
221
|
+
...register("streetNumber"),
|
|
222
|
+
error: !!errors.streetNumber,
|
|
223
|
+
errorMessage: errors.streetNumber?.message
|
|
224
|
+
}
|
|
225
|
+
) })
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
228
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
229
|
+
FormField,
|
|
230
|
+
{
|
|
231
|
+
label: "Cidade",
|
|
232
|
+
placeholder: "",
|
|
233
|
+
...register("city"),
|
|
234
|
+
error: !!errors.city,
|
|
235
|
+
errorMessage: errors.city?.message
|
|
236
|
+
}
|
|
237
|
+
) }),
|
|
238
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
239
|
+
FormField,
|
|
240
|
+
{
|
|
241
|
+
label: "UF",
|
|
242
|
+
placeholder: "",
|
|
243
|
+
...register("state"),
|
|
244
|
+
error: !!errors.state,
|
|
245
|
+
errorMessage: errors.state?.message
|
|
246
|
+
}
|
|
247
|
+
) })
|
|
248
|
+
] }),
|
|
249
|
+
/* @__PURE__ */ jsx(
|
|
250
|
+
FormField,
|
|
251
|
+
{
|
|
252
|
+
label: "Complemento",
|
|
253
|
+
optional: true,
|
|
254
|
+
placeholder: "",
|
|
255
|
+
...register("complement"),
|
|
256
|
+
error: !!errors.complement,
|
|
257
|
+
errorMessage: errors.complement?.message
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
] });
|
|
261
|
+
}
|
|
262
|
+
export {
|
|
263
|
+
BillingFormFields,
|
|
264
|
+
CardFormFields,
|
|
265
|
+
STEP1_FIELDS,
|
|
266
|
+
cardFormSchema
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=CardFormFields.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modals/cards/CardFormFields.tsx"],"sourcesContent":["'use client';\n\nimport { UseFormReturn } from 'react-hook-form';\nimport { useViaCep } from '../../../modules/accounts/hooks/useViaCep';\nimport { FormField } from '../../ui/form/FormField';\nimport { SelectField } from '../../ui/form/SelectField';\nimport { formatCPF, formatCNPJ, formatPostalCode } from '../../../utils/format/masks';\nimport z from 'zod';\nimport { CardCvcElement, CardExpiryElement, CardNumberElement } from '@stripe/react-stripe-js';\n\nconst stripeElementOptions = {\n style: {\n base: {\n fontSize: '16px',\n color: '#030712',\n fontFamily: 'Inter, sans-serif',\n '::placeholder': {\n color: '#9ca3af',\n },\n },\n },\n};\n\nexport const cardFormSchema = z\n .object({\n name: z.string().min(1, 'Nome é obrigatório'),\n country: z.string().min(1, 'País é obrigatório'),\n personType: z.enum(['pf', 'pj']),\n cpf: z.string().optional(),\n cnpj: z.string().optional(),\n fullName: z.string().min(1, 'Nome completo é obrigatório'),\n cep: z.string().min(9, 'CEP é obrigatório'),\n street: z.string().min(1, 'Endereço é obrigatório'),\n streetNumber: z.string().min(1, 'Número é obrigatório'),\n city: z.string().min(1, 'Cidade é obrigatória'),\n state: z.string().min(1, 'UF é obrigatório'),\n complement: z.string().optional(),\n })\n .refine(\n (data) => {\n if (data.personType === 'pf') return !!data.cpf && data.cpf.length >= 14;\n return !!data.cnpj && data.cnpj.length >= 18;\n },\n {\n message: 'Documento é obrigatório',\n path: ['cpf'],\n }\n );\n\nexport type CardFormData = z.infer<typeof cardFormSchema>;\n\nexport type StripeElementsStatus = {\n cardNumber: boolean;\n cardExpiry: boolean;\n cardCvc: boolean;\n};\n\nexport const STEP1_FIELDS = ['name', 'country', 'personType', 'cpf', 'cnpj'] as const;\n\ntype CardFormFieldsProps = {\n readonly form: UseFormReturn<CardFormData>;\n readonly onStripeChange: (field: keyof StripeElementsStatus, complete: boolean) => void;\n readonly stripeErrors: { cardNumber?: string; cardExpiry?: string; cardCvc?: string };\n};\n\nexport function CardFormFields({ form, onStripeChange, stripeErrors }: CardFormFieldsProps) {\n const {\n register,\n watch,\n setValue,\n formState: { errors },\n } = form;\n\n const personType = watch('personType');\n\n return (\n <div className=\"flex flex-col gap-5\">\n <FormField\n label=\"Nome impresso no cartão\"\n placeholder=\"Digite aqui\"\n {...register('name')}\n error={!!errors.name}\n errorMessage={errors.name?.message}\n />\n\n <div className=\"flex flex-col gap-1.5\">\n <label className=\"paragraph-xsmall-semibold text-zinc-600\">Número do cartão</label>\n <div className=\"h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400 relative\">\n <div className=\"w-full\">\n <CardNumberElement\n options={{ ...stripeElementOptions, showIcon: true }}\n onChange={(e: { complete: boolean }) => onStripeChange('cardNumber', e.complete)}\n />\n </div>\n </div>\n {stripeErrors.cardNumber && (\n <p className=\"paragraph-xsmall-semibold text-red-600\">{stripeErrors.cardNumber}</p>\n )}\n </div>\n\n <div className=\"flex gap-4\">\n <div className=\"flex-1 flex flex-col gap-1.5\">\n <label className=\"paragraph-xsmall-semibold text-zinc-600\">Data de validade</label>\n <div className=\"h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400\">\n <div className=\"w-full\">\n <CardExpiryElement\n options={stripeElementOptions}\n onChange={(e: { complete: boolean }) => onStripeChange('cardExpiry', e.complete)}\n />\n </div>\n </div>\n {stripeErrors.cardExpiry && (\n <p className=\"paragraph-xsmall-semibold text-red-600\">{stripeErrors.cardExpiry}</p>\n )}\n </div>\n\n <div className=\"flex-1 flex flex-col gap-1.5\">\n <label className=\"paragraph-xsmall-semibold text-zinc-600\">CVC</label>\n <div className=\"h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400\">\n <div className=\"w-full\">\n <CardCvcElement\n options={stripeElementOptions}\n onChange={(e: { complete: boolean }) => onStripeChange('cardCvc', e.complete)}\n />\n </div>\n </div>\n {stripeErrors.cardCvc && (\n <p className=\"paragraph-xsmall-semibold text-red-600\">{stripeErrors.cardCvc}</p>\n )}\n </div>\n </div>\n\n <SelectField\n label=\"País\"\n placeholder=\"Selecione\"\n value={watch('country')}\n onChange={(value) => setValue('country', value as string)}\n options={[\n { value: 'BR', label: 'Brasil' },\n { value: 'ES', label: 'Espanha' },\n { value: 'US', label: 'Estados Unidos' },\n ]}\n />\n\n <div className=\"flex gap-4\">\n <SelectField\n label=\"Tipo de pessoa\"\n placeholder=\"Selecione\"\n value={personType}\n onChange={(value) => {\n setValue('personType', value as 'pf' | 'pj');\n setValue('cpf', '');\n setValue('cnpj', '');\n }}\n options={[\n { value: 'pf', label: 'Pessoa física' },\n { value: 'pj', label: 'Pessoa jurídica' },\n ]}\n containerClassName=\"flex-1\"\n />\n <div className=\"flex-1\">\n {personType === 'pj' ? (\n <FormField\n label=\"CNPJ\"\n placeholder=\"__.___.___/____-__\"\n {...register('cnpj', {\n onChange: (e) => {\n setValue('cnpj', formatCNPJ(e.target.value));\n },\n })}\n error={!!errors.cpf}\n errorMessage={errors.cpf?.message}\n />\n ) : (\n <FormField\n label=\"CPF\"\n placeholder=\"___.___.___-__\"\n {...register('cpf', {\n onChange: (e) => {\n setValue('cpf', formatCPF(e.target.value));\n },\n })}\n error={!!errors.cpf}\n errorMessage={errors.cpf?.message}\n />\n )}\n </div>\n </div>\n </div>\n );\n}\n\ntype BillingFormFieldsProps = {\n readonly form: UseFormReturn<CardFormData>;\n};\n\nexport function BillingFormFields({ form }: BillingFormFieldsProps) {\n const {\n register,\n setValue,\n formState: { errors },\n } = form;\n\n const { mutateAsync: lookupCep } = useViaCep();\n\n const handleCepChange = (rawValue: string) => {\n const masked = formatPostalCode(rawValue);\n setValue('cep', masked);\n\n const digits = rawValue.replace(/\\D/g, '');\n if (digits.length === 8) {\n lookupCep(digits).then((data) => {\n setValue('street', data.logradouro, { shouldValidate: true });\n setValue('city', data.localidade, { shouldValidate: true });\n setValue('state', data.uf, { shouldValidate: true });\n }).catch(() => {\n // silently ignore — user can fill manually\n });\n }\n };\n\n return (\n <div className=\"flex flex-col gap-5\">\n <FormField\n label=\"Nome completo\"\n placeholder=\"Digite aqui\"\n {...register('fullName')}\n error={!!errors.fullName}\n errorMessage={errors.fullName?.message}\n />\n\n <FormField\n label=\"CEP\"\n placeholder=\"_____-___\"\n {...register('cep', {\n onChange: (e) => handleCepChange(e.target.value),\n })}\n error={!!errors.cep}\n errorMessage={errors.cep?.message}\n />\n\n <div className=\"flex gap-4\">\n <div className=\"flex-[4]\">\n <FormField\n label=\"Endereço\"\n placeholder=\"\"\n {...register('street')}\n error={!!errors.street}\n errorMessage={errors.street?.message}\n />\n </div>\n <div className=\"flex-[1]\">\n <FormField\n label=\"Número\"\n placeholder=\"\"\n {...register('streetNumber')}\n error={!!errors.streetNumber}\n errorMessage={errors.streetNumber?.message}\n />\n </div>\n </div>\n\n <div className=\"flex gap-4\">\n <div className=\"flex-1\">\n <FormField\n label=\"Cidade\"\n placeholder=\"\"\n {...register('city')}\n error={!!errors.city}\n errorMessage={errors.city?.message}\n />\n </div>\n <div className=\"flex-1\">\n <FormField\n label=\"UF\"\n placeholder=\"\"\n {...register('state')}\n error={!!errors.state}\n errorMessage={errors.state?.message}\n />\n </div>\n </div>\n\n <FormField\n label=\"Complemento\"\n optional\n placeholder=\"\"\n {...register('complement')}\n error={!!errors.complement}\n errorMessage={errors.complement?.message}\n />\n </div>\n );\n}\n"],"mappings":";AA6EM,cAQA,YARA;AA1EN,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,WAAW,YAAY,wBAAwB;AACxD,OAAO,OAAO;AACd,SAAS,gBAAgB,mBAAmB,yBAAyB;AAErE,MAAM,uBAAuB;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,iBAAiB;AAAA,QACf,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,0BAAoB;AAAA,EAC5C,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,6BAAoB;AAAA,EAC/C,YAAY,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;AAAA,EAC/B,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,EACzB,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,UAAU,EAAE,OAAO,EAAE,IAAI,GAAG,mCAA6B;AAAA,EACzD,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,yBAAmB;AAAA,EAC1C,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,iCAAwB;AAAA,EAClD,cAAc,EAAE,OAAO,EAAE,IAAI,GAAG,+BAAsB;AAAA,EACtD,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,4BAAsB;AAAA,EAC9C,OAA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,CAAC,OAAO;AAAA,UAChB,cAAc,OAAO,MAAM;AAAA;AAAA,MAC7B,GACF;AAAA,MACA,oBAAC,SAAI,WAAU,UACb;AAAA,QAAC;AAAA;AAAA,UACC,OAAM;AAAA,UACN,aAAY;AAAA,UACX,GAAG,SAAS,OAAO;AAAA,UACpB,OAAO,CAAC,CAAC,OAAO;AAAA,UAChB,cAAc,OAAO,OAAO;AAAA;AAAA,MAC9B,GACF;AAAA,OACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,UAAQ;AAAA,QACR,aAAY;AAAA,QACX,GAAG,SAAS,YAAY;AAAA,QACzB,OAAO,CAAC,CAAC,OAAO;AAAA,QAChB,cAAc,OAAO,YAAY;AAAA;AAAA,IACnC;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { DesktopShell } from "./shells/DesktopShell";
|
|
5
|
+
import { MdShell } from "./shells/MdShell";
|
|
6
|
+
import { MobileShell } from "./shells/MobileShell";
|
|
7
|
+
import { TabsMobileShell } from "./shells/TabsMobileShell";
|
|
8
|
+
import { NavItems } from "./subcomponents/NavItems";
|
|
9
|
+
import { ProjectSelector } from "./subcomponents/ProjectSelector";
|
|
10
|
+
import { PlanCard } from "./subcomponents/PlanCard";
|
|
11
|
+
import { CreditsCard } from "./subcomponents/CreditsCard";
|
|
12
|
+
import { BottomLinks } from "./subcomponents/BottomLinks";
|
|
13
|
+
import { NavItemsContext } from "./NavItemsContext";
|
|
14
|
+
function AppNavigationRoot({ children, mobileVariant = "sheet", mobileTabsOffset, onCancelledReactivate }) {
|
|
15
|
+
const [navItems, setNavItems] = useState([]);
|
|
16
|
+
return /* @__PURE__ */ jsxs(NavItemsContext.Provider, { value: { navItems, setNavItems, mobileVariant }, children: [
|
|
17
|
+
/* @__PURE__ */ jsx(DesktopShell, { children }),
|
|
18
|
+
/* @__PURE__ */ jsx(MdShell, { children }),
|
|
19
|
+
/* @__PURE__ */ jsx(MobileShell, { children }),
|
|
20
|
+
mobileVariant === "tabs" && /* @__PURE__ */ jsx(TabsMobileShell, { topOffset: mobileTabsOffset, children })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
const AppNavigation = Object.assign(AppNavigationRoot, {
|
|
24
|
+
NavItems,
|
|
25
|
+
ProjectSelector,
|
|
26
|
+
PlanCard,
|
|
27
|
+
CreditsCard,
|
|
28
|
+
BottomLinks
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
AppNavigation
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=AppNavigation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/AppNavigation.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ReactNode, useState } from 'react';\r\nimport { DesktopShell } from './shells/DesktopShell';\r\nimport { MdShell } from './shells/MdShell';\r\nimport { MobileShell } from './shells/MobileShell';\r\nimport { TabsMobileShell } from './shells/TabsMobileShell';\r\nimport { NavItems } from './subcomponents/NavItems';\r\nimport { ProjectSelector } from './subcomponents/ProjectSelector';\r\nimport { PlanCard } from './subcomponents/PlanCard';\r\nimport { CreditsCard } from './subcomponents/CreditsCard';\r\nimport { BottomLinks } from './subcomponents/BottomLinks';\r\nimport { NavItemsContext } from './NavItemsContext';\r\nimport type { NavItemConfig } from './subcomponents/NavItems';\r\n\r\nexport type { NavItemConfig } from './subcomponents/NavItems';\r\nexport type { ProjectSelectorProps } from './subcomponents/ProjectSelector';\r\nexport type { PlanCardProps } from './subcomponents/PlanCard';\r\nexport type { CreditsCardProps } from './subcomponents/CreditsCard';\r\n\r\ninterface AppNavigationProps {\r\n children: ReactNode;\r\n mobileVariant?: 'sheet' | 'tabs';\r\n mobileTabsOffset?: string;\r\n onCancelledReactivate?: () => void;\r\n}\r\n\r\nfunction AppNavigationRoot({ children, mobileVariant = 'sheet', mobileTabsOffset, onCancelledReactivate }: AppNavigationProps) {\r\n const [navItems, setNavItems] = useState<NavItemConfig[]>([]);\r\n\r\n return (\r\n <NavItemsContext.Provider value={{ navItems, setNavItems, mobileVariant }}>\r\n <DesktopShell>{children}</DesktopShell>\r\n <MdShell>{children}</MdShell>\r\n <MobileShell>{children}</MobileShell>\r\n {mobileVariant === 'tabs' && (\r\n <TabsMobileShell topOffset={mobileTabsOffset}>{children}</TabsMobileShell>\r\n )}\r\n </NavItemsContext.Provider>\r\n );\r\n}\r\n\r\nexport const AppNavigation = Object.assign(AppNavigationRoot, {\r\n NavItems,\r\n ProjectSelector,\r\n PlanCard,\r\n CreditsCard,\r\n BottomLinks,\r\n});\r\n"],"mappings":";AA+BI,SACE,KADF;AA7BJ,SAAoB,gBAAgB;AACpC,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAehC,SAAS,kBAAkB,EAAE,UAAU,gBAAgB,SAAS,kBAAkB,sBAAsB,GAAuB;AAC7H,QAAM,CAAC,UAAU,WAAW,IAAI,SAA0B,CAAC,CAAC;AAE5D,SACE,qBAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,UAAU,aAAa,cAAc,GACtE;AAAA,wBAAC,gBAAc,UAAS;AAAA,IACxB,oBAAC,WAAS,UAAS;AAAA,IACnB,oBAAC,eAAa,UAAS;AAAA,IACtB,kBAAkB,UACjB,oBAAC,mBAAgB,WAAW,kBAAmB,UAAS;AAAA,KAE5D;AAEJ;AAEO,MAAM,gBAAgB,OAAO,OAAO,mBAAmB;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const AppNavigationContext = createContext(void 0);
|
|
4
|
+
function useAppNavigationContext() {
|
|
5
|
+
const ctx = useContext(AppNavigationContext);
|
|
6
|
+
if (!ctx) throw new Error("useAppNavigationContext must be used inside AppNavigation");
|
|
7
|
+
return ctx;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
AppNavigationContext,
|
|
11
|
+
useAppNavigationContext
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=AppNavigationContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/AppNavigationContext.ts"],"sourcesContent":["'use client';\r\n\r\nimport { createContext, useContext } from 'react';\r\n\r\nexport type Breakpoint = 'desktop' | 'md' | 'mobile';\r\n\r\ninterface AppNavigationContextValue {\r\n breakpoint: Breakpoint;\r\n}\r\n\r\nexport const AppNavigationContext = createContext<AppNavigationContextValue | undefined>(undefined);\r\n\r\nexport function useAppNavigationContext(): AppNavigationContextValue {\r\n const ctx = useContext(AppNavigationContext);\r\n if (!ctx) throw new Error('useAppNavigationContext must be used inside AppNavigation');\r\n return ctx;\r\n}\r\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAQnC,MAAM,uBAAuB,cAAqD,MAAS;AAE3F,SAAS,0BAAqD;AACnE,QAAM,MAAM,WAAW,oBAAoB;AAC3C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,2DAA2D;AACrF,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useCallback } from "react";
|
|
4
|
+
import { IconAlertOctagon, IconX } from "@tabler/icons-react";
|
|
5
|
+
import { formatShortDate } from "../../infra/utils/date";
|
|
6
|
+
import { useActiveSubscription } from "../../modules/subscriptions/hooks/find-active-subscription.hook";
|
|
7
|
+
function CancelledSubscriptionBanner({ onReactivate }) {
|
|
8
|
+
const { data: { data: [subscription] = [] } = {} } = useActiveSubscription();
|
|
9
|
+
const [visible, setVisible] = useState(true);
|
|
10
|
+
const [animated, setAnimated] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const timer = setTimeout(() => setAnimated(true), 50);
|
|
13
|
+
return () => clearTimeout(timer);
|
|
14
|
+
}, []);
|
|
15
|
+
const dismiss = useCallback(() => setVisible(false), []);
|
|
16
|
+
const dueDate = new Date(subscription?.date_due);
|
|
17
|
+
const today = /* @__PURE__ */ new Date();
|
|
18
|
+
const isPastDue = today >= dueDate;
|
|
19
|
+
const formattedDate = formatShortDate(dueDate);
|
|
20
|
+
const isTrial = subscription?.type === "trial";
|
|
21
|
+
if (!visible) return null;
|
|
22
|
+
if (isTrial && !isPastDue) return null;
|
|
23
|
+
if (!isTrial && (!subscription?.date_cancellation || isPastDue)) return null;
|
|
24
|
+
return /* @__PURE__ */ jsx("div", { className: "fixed top-[80px] md:top-0 lg:left-[273px] left-0 right-0 z-[60] flex justify-center pointer-events-none px-4 lg:px-0", children: /* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: `flex flex-col sm:flex-row items-start sm:items-center justify-between bg-red-500 rounded-lg px-3 py-2 sm:py-1 w-full lg:w-[805px] max-w-full pointer-events-auto transition-transform duration-500 ease-out gap-2 sm:gap-0 ${animated ? "translate-y-0 md:translate-y-9" : "-translate-y-full"}`,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-1 w-full sm:w-auto", children: [
|
|
30
|
+
/* @__PURE__ */ jsx(IconAlertOctagon, { size: 16, className: "text-white shrink-0" }),
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold text-white", children: isPastDue ? "Sua assinatura foi cancelada e suas p\xE1ginas foram retiradas do ar." : `Assinatura cancelada! Suas p\xE1ginas ser\xE3o retiradas do ar no dia ${formattedDate}!` })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 w-full sm:w-auto justify-between sm:justify-start", children: [
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
className: "flex items-center justify-center p-1.5 cursor-pointer",
|
|
39
|
+
onClick: onReactivate,
|
|
40
|
+
children: /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold text-white underline", children: "Reativar assinatura" })
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "cursor-pointer shrink-0", onClick: dismiss, children: /* @__PURE__ */ jsx(IconX, { size: 18, className: "text-red-200" }) })
|
|
44
|
+
] })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
CancelledSubscriptionBanner
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=CancelledSubscriptionBanner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/CancelledSubscriptionBanner.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { IconAlertOctagon, IconX } from '@tabler/icons-react';\nimport { formatShortDate } from '../../infra/utils/date';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\n\ninterface CancelledSubscriptionBannerProps {\n onReactivate?: () => void;\n}\n\nexport function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscriptionBannerProps) {\n const { data: { data: [subscription] = [] } = {} } = useActiveSubscription();\n const [visible, setVisible] = useState(true);\n const [animated, setAnimated] = useState(false);\n\n useEffect(() => {\n const timer = setTimeout(() => setAnimated(true), 50);\n return () => clearTimeout(timer);\n }, []);\n\n const dismiss = useCallback(() => setVisible(false), []);\n const dueDate = new Date(subscription?.date_due);\n const today = new Date();\n const isPastDue = today >= dueDate;\n const formattedDate = formatShortDate(dueDate);\n\n const isTrial = subscription?.type === 'trial';\n\n if (!visible) return null;\n if (isTrial && !isPastDue) return null;\n if (!isTrial && (!subscription?.date_cancellation || isPastDue)) return null;\n\n return (\n <div className=\"fixed top-[80px] md:top-0 lg:left-[273px] left-0 right-0 z-[60] flex justify-center pointer-events-none px-4 lg:px-0\">\n <div\n className={`flex flex-col sm:flex-row items-start sm:items-center justify-between bg-red-500 rounded-lg px-3 py-2 sm:py-1 w-full lg:w-[805px] max-w-full pointer-events-auto transition-transform duration-500 ease-out gap-2 sm:gap-0 ${animated ? 'translate-y-0 md:translate-y-9' : '-translate-y-full'}`}\n >\n <div className=\"flex items-center gap-2 flex-1 w-full sm:w-auto\">\n <IconAlertOctagon size={16} className=\"text-white shrink-0\" />\n <span className=\"paragraph-xsmall-semibold text-white\">\n {isPastDue\n ? 'Sua assinatura foi cancelada e suas páginas foram retiradas do ar.'\n : `Assinatura cancelada! Suas páginas serão retiradas do ar no dia ${formattedDate}!`}\n </span>\n </div>\n <div className=\"flex items-center gap-1.5 w-full sm:w-auto justify-between sm:justify-start\">\n <button\n type=\"button\"\n className=\"flex items-center justify-center p-1.5 cursor-pointer\"\n onClick={onReactivate}\n >\n <span className=\"paragraph-xsmall-semibold text-white underline\">\n Reativar assinatura\n </span>\n </button>\n <button type=\"button\" className=\"cursor-pointer shrink-0\" onClick={dismiss}>\n <IconX size={18} className=\"text-red-200\" />\n </button>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";AAsCQ,SACE,KADF;AApCR,SAAS,UAAU,WAAW,mBAAmB;AACjD,SAAS,kBAAkB,aAAa;AACxC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAM/B,SAAS,4BAA4B,EAAE,aAAa,GAAqC;AAC9F,QAAM,EAAE,MAAM,EAAE,MAAM,CAAC,YAAY,IAAI,C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;","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { useAppNavigationContext } from "./AppNavigationContext";
|
|
5
|
+
import { useMobileNavbarSheet } from "../../store/useMobileNavbarSheet";
|
|
6
|
+
import { useMdSidebarStore } from "../../store/useMdSidebarStore";
|
|
7
|
+
function NavItem({ icon: Icon, label, href, isActive = false }) {
|
|
8
|
+
const { breakpoint } = useAppNavigationContext();
|
|
9
|
+
const { close } = useMobileNavbarSheet();
|
|
10
|
+
const { collapse } = useMdSidebarStore();
|
|
11
|
+
const handleClick = () => {
|
|
12
|
+
if (breakpoint === "mobile") {
|
|
13
|
+
close();
|
|
14
|
+
} else if (breakpoint === "md") {
|
|
15
|
+
collapse();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
Link,
|
|
20
|
+
{
|
|
21
|
+
href,
|
|
22
|
+
prefetch: true,
|
|
23
|
+
className: `rounded-md flex items-center gap-2 p-3 cursor-pointer transition-colors no-underline ${isActive ? "bg-gray-50" : "bg-white hover:bg-gray-100"} active:bg-gray-50`,
|
|
24
|
+
onClick: handleClick,
|
|
25
|
+
children: [
|
|
26
|
+
Icon && /* @__PURE__ */ jsx(
|
|
27
|
+
Icon,
|
|
28
|
+
{
|
|
29
|
+
size: 20,
|
|
30
|
+
className: isActive ? "text-gray-950" : "text-gray-400"
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: `paragraph-small-medium ${isActive ? "text-gray-950" : "text-gray-500"}`, children: label })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
NavItem
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=NavItem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/NavItem.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ElementType } from 'react';\r\nimport Link from 'next/link';\r\nimport { useAppNavigationContext } from './AppNavigationContext';\r\nimport { useMobileNavbarSheet } from '../../store/useMobileNavbarSheet';\r\nimport { useMdSidebarStore } from '../../store/useMdSidebarStore';\r\n\r\ninterface NavItemProps {\r\n icon?: ElementType;\r\n label: string;\r\n href: string;\r\n isActive?: boolean;\r\n}\r\n\r\nexport function NavItem({ icon: Icon, label, href, isActive = false }: NavItemProps) {\r\n const { breakpoint } = useAppNavigationContext();\r\n const { close } = useMobileNavbarSheet();\r\n const { collapse } = useMdSidebarStore();\r\n\r\n const handleClick = () => {\r\n if (breakpoint === 'mobile') {\r\n close();\r\n } else if (breakpoint === 'md') {\r\n collapse();\r\n }\r\n };\r\n\r\n return (\r\n <Link\r\n href={href}\r\n prefetch\r\n className={`rounded-md flex items-center gap-2 p-3 cursor-pointer transition-colors no-underline ${\r\n isActive ? 'bg-gray-50' : 'bg-white hover:bg-gray-100'\r\n } active:bg-gray-50`}\r\n onClick={handleClick}\r\n >\r\n {Icon && (\r\n <Icon\r\n size={20}\r\n className={isActive ? 'text-gray-950' : 'text-gray-400'}\r\n />\r\n )}\r\n <span className={`paragraph-small-medium ${isActive ? 'text-gray-950' : 'text-gray-500'}`}>\r\n {label}\r\n </span>\r\n </Link>\r\n );\r\n}\r\n"],"mappings":";AA6BI,SASI,KATJ;AA1BJ,OAAO,UAAU;AACjB,SAAS,+BAA+B;AACxC,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAS3B,SAAS,QAAQ,EAAE,MAAM,MAAM,OAAO,MAAM,WAAW,MAAM,GAAiB;AACnF,QAAM,EAAE,WAAW,IAAI,wBAAwB;AAC/C,QAAM,EAAE,MAAM,IAAI,qBAAqB;AACvC,QAAM,EAAE,SAAS,IAAI,kBAAkB;AAEvC,QAAM,cAAc,MAAM;AACxB,QAAI,eAAe,UAAU;AAC3B,YAAM;AAAA,IACR,WAAW,eAAe,MAAM;AAC9B,eAAS;AAAA,IACX;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,UAAQ;AAAA,MACR,WAAW,wFACT,WAAW,eAAe,4BAC5B;AAAA,MACA,SAAS;AAAA,MAER;AAAA,gBACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,WAAW,WAAW,kBAAkB;AAAA;AAAA,QAC1C;AAAA,QAEF,oBAAC,UAAK,WAAW,0BAA0B,WAAW,kBAAkB,eAAe,IACpF,iBACH;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const NavItemsContext = createContext({
|
|
4
|
+
navItems: [],
|
|
5
|
+
setNavItems: () => {
|
|
6
|
+
},
|
|
7
|
+
mobileVariant: "sheet"
|
|
8
|
+
});
|
|
9
|
+
function useNavItemsContext() {
|
|
10
|
+
return useContext(NavItemsContext);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
NavItemsContext,
|
|
14
|
+
useNavItemsContext
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=NavItemsContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/navigation/NavItemsContext.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\nimport type { NavItemConfig } from './subcomponents/NavItems';\n\ninterface NavItemsContextValue {\n navItems: NavItemConfig[];\n setNavItems: (items: NavItemConfig[]) => void;\n mobileVariant: 'sheet' | 'tabs';\n}\n\nexport const NavItemsContext = createContext<NavItemsContextValue>({\n navItems: [],\n setNavItems: () => {},\n mobileVariant: 'sheet',\n});\n\nexport function useNavItemsContext(): NavItemsContextValue {\n return useContext(NavItemsContext);\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AASnC,MAAM,kBAAkB,cAAoC;AAAA,EACjE,UAAU,CAAC;AAAA,EACX,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,eAAe;AACjB,CAAC;AAEM,SAAS,qBAA2C;AACzD,SAAO,WAAW,eAAe;AACnC;","names":[]}
|