@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,114 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useCallback,
|
|
6
|
+
useContext,
|
|
7
|
+
useMemo
|
|
8
|
+
} from "react";
|
|
9
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
10
|
+
import {
|
|
11
|
+
useUserQuery,
|
|
12
|
+
useSetUserData,
|
|
13
|
+
useUserValidateSession
|
|
14
|
+
} from "../modules/auth/hooks/useUserQuery";
|
|
15
|
+
import { useLogin } from "../modules/auth/hooks/login.hook";
|
|
16
|
+
import { useRegister } from "../modules/auth/hooks/register.hook";
|
|
17
|
+
import { useLogout } from "../modules/auth/hooks/logout.hook";
|
|
18
|
+
import {
|
|
19
|
+
useCurrentAccount,
|
|
20
|
+
ACCOUNT_QUERY_KEY
|
|
21
|
+
} from "../modules/accounts/hooks/current-account.hook";
|
|
22
|
+
import { useWhitelabelUrls } from "./whitelabel.provider";
|
|
23
|
+
const AuthContext = createContext(
|
|
24
|
+
void 0
|
|
25
|
+
);
|
|
26
|
+
function AuthProvider({ children }) {
|
|
27
|
+
const { data: user, isLoading: isQueryLoading } = useUserQuery();
|
|
28
|
+
const { data: account, isLoading: isAccountLoading } = useCurrentAccount();
|
|
29
|
+
const { isLoading: isSessionLoading } = useUserValidateSession();
|
|
30
|
+
const queryClient = useQueryClient();
|
|
31
|
+
const setUserData = useSetUserData();
|
|
32
|
+
const { accountsUrl, pagesUrl } = useWhitelabelUrls();
|
|
33
|
+
const { mutateAsync: loginMutate, isPending: isLogging } = useLogin();
|
|
34
|
+
const { mutateAsync: registerMutate, isPending: isRegistering } = useRegister();
|
|
35
|
+
const { mutateAsync: logoutMutate, isPending: isLoggingOut } = useLogout();
|
|
36
|
+
const isAuthenticated = !!user;
|
|
37
|
+
const isLoading = isLogging || isRegistering || isLoggingOut || isQueryLoading || isAccountLoading || isSessionLoading;
|
|
38
|
+
const login = useCallback(
|
|
39
|
+
async (credentials) => {
|
|
40
|
+
try {
|
|
41
|
+
const data = await loginMutate(credentials);
|
|
42
|
+
if (data.result === "two_factor_required") {
|
|
43
|
+
return { result: "two_factor_required", cookie: data.cookie, twoFactorMode: data.twoFactorMode };
|
|
44
|
+
}
|
|
45
|
+
queryClient.clear();
|
|
46
|
+
setUserData(data.user);
|
|
47
|
+
queryClient.setQueryData(ACCOUNT_QUERY_KEY, data.account);
|
|
48
|
+
return { result: "success" };
|
|
49
|
+
} catch (error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : "Ocorreu um erro ao fazer login. Tente novamente.";
|
|
51
|
+
return { result: "error", message };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
[queryClient, setUserData]
|
|
55
|
+
);
|
|
56
|
+
const register = useCallback(
|
|
57
|
+
async (data) => {
|
|
58
|
+
await registerMutate(data, {
|
|
59
|
+
onSuccess: (data2) => {
|
|
60
|
+
queryClient.clear();
|
|
61
|
+
setUserData(data2.user);
|
|
62
|
+
queryClient.setQueryData(ACCOUNT_QUERY_KEY, data2.account);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
[queryClient, setUserData]
|
|
67
|
+
);
|
|
68
|
+
const resolveLogoutRedirect = useCallback(() => {
|
|
69
|
+
try {
|
|
70
|
+
const currentOrigin = window.location.origin;
|
|
71
|
+
const pagesOrigin = pagesUrl ? new URL(pagesUrl).origin : "";
|
|
72
|
+
if (pagesOrigin && currentOrigin === pagesOrigin) {
|
|
73
|
+
return `${accountsUrl}/login?redirect=${encodeURIComponent(pagesUrl)}`;
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
return `${accountsUrl}/login?redirect=${encodeURIComponent(pagesUrl || "/")}`;
|
|
78
|
+
}, [accountsUrl, pagesUrl]);
|
|
79
|
+
const logout = useCallback(async () => {
|
|
80
|
+
try {
|
|
81
|
+
await logoutMutate(void 0);
|
|
82
|
+
} catch {
|
|
83
|
+
} finally {
|
|
84
|
+
queryClient.clear();
|
|
85
|
+
window.location.assign(resolveLogoutRedirect());
|
|
86
|
+
}
|
|
87
|
+
}, [queryClient, logoutMutate, resolveLogoutRedirect]);
|
|
88
|
+
const value = useMemo(
|
|
89
|
+
() => ({
|
|
90
|
+
user: user ?? null,
|
|
91
|
+
account: account ?? null,
|
|
92
|
+
isAuthenticated,
|
|
93
|
+
isLoading,
|
|
94
|
+
login,
|
|
95
|
+
register,
|
|
96
|
+
logout
|
|
97
|
+
}),
|
|
98
|
+
[user, account, isAuthenticated, isLoading, login, register, logout]
|
|
99
|
+
);
|
|
100
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, { value, children });
|
|
101
|
+
}
|
|
102
|
+
function useAuth() {
|
|
103
|
+
const context = useContext(AuthContext);
|
|
104
|
+
if (context === void 0) {
|
|
105
|
+
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
106
|
+
}
|
|
107
|
+
return context;
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
AuthContext,
|
|
111
|
+
AuthProvider,
|
|
112
|
+
useAuth
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=auth.provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/providers/auth.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n createContext,\r\n ReactNode,\r\n useCallback,\r\n useContext,\r\n useMemo,\r\n} from \"react\";\r\nimport { useQueryClient } from \"@tanstack/react-query\";\r\nimport {\r\n useUserQuery,\r\n useSetUserData,\r\n useUserValidateSession,\r\n} from \"../modules/auth/hooks/useUserQuery\";\r\nimport { useLogin } from \"../modules/auth/hooks/login.hook\";\r\nimport { useRegister } from \"../modules/auth/hooks/register.hook\";\r\nimport { useLogout } from \"../modules/auth/hooks/logout.hook\";\r\nimport {\r\n AuthState,\r\n LoginRequest,\r\n RegisterRequest,\r\n} from \"../modules/auth/schema\";\r\n\r\nexport type LoginResult =\r\n | { result: \"success\" }\r\n | { result: \"two_factor_required\"; cookie: string; twoFactorMode: \"verify\" | \"setup\" }\r\n | { result: \"error\"; message: string };\r\nimport {\r\n useCurrentAccount,\r\n ACCOUNT_QUERY_KEY,\r\n} from \"../modules/accounts/hooks/current-account.hook\";\r\nimport { useWhitelabelUrls } from \"./whitelabel.provider\";\r\n\r\ninterface AuthContextProps extends AuthState {\r\n login: (credentials: LoginRequest) => Promise<LoginResult>;\r\n register: (data: RegisterRequest) => Promise<void>;\r\n logout: () => Promise<void>;\r\n}\r\n\r\nexport const AuthContext = createContext<AuthContextProps | undefined>(\r\n undefined,\r\n);\r\n\r\ninterface AuthProviderProps {\r\n children: ReactNode;\r\n}\r\n\r\nexport function AuthProvider({ children }: AuthProviderProps) {\r\n const { data: user, isLoading: isQueryLoading } = useUserQuery();\r\n const { data: account, isLoading: isAccountLoading } = useCurrentAccount();\r\n const { isLoading: isSessionLoading } = useUserValidateSession();\r\n\r\n const queryClient = useQueryClient();\r\n const setUserData = useSetUserData();\r\n const { accountsUrl, pagesUrl } = useWhitelabelUrls();\r\n\r\n const { mutateAsync: loginMutate, isPending: isLogging } = useLogin();\r\n const { mutateAsync: registerMutate, isPending: isRegistering } =\r\n useRegister();\r\n const { mutateAsync: logoutMutate, isPending: isLoggingOut } = useLogout();\r\n\r\n const isAuthenticated = !!user;\r\n const isLoading =\r\n isLogging ||\r\n isRegistering ||\r\n isLoggingOut ||\r\n isQueryLoading ||\r\n isAccountLoading ||\r\n isSessionLoading;\r\n\r\n const login = useCallback(\r\n async (credentials: LoginRequest): Promise<LoginResult> => {\r\n try {\r\n const data = await loginMutate(credentials);\r\n\r\n if (data.result === \"two_factor_required\") {\r\n return { result: \"two_factor_required\", cookie: data.cookie, twoFactorMode: data.twoFactorMode };\r\n }\r\n\r\n queryClient.clear();\r\n setUserData(data.user);\r\n queryClient.setQueryData(ACCOUNT_QUERY_KEY, data.account);\r\n\r\n return { result: \"success\" };\r\n } catch (error) {\r\n const message =\r\n error instanceof Error\r\n ? error.message\r\n : \"Ocorreu um erro ao fazer login. Tente novamente.\";\r\n return { result: \"error\", message };\r\n }\r\n },\r\n [queryClient, setUserData],\r\n );\r\n\r\n const register = useCallback(\r\n async (data: RegisterRequest): Promise<void> => {\r\n await registerMutate(data, {\r\n onSuccess: (data) => {\r\n queryClient.clear();\r\n setUserData(data.user);\r\n queryClient.setQueryData(ACCOUNT_QUERY_KEY, data.account);\r\n },\r\n });\r\n },\r\n [queryClient, setUserData],\r\n );\r\n\r\n const resolveLogoutRedirect = useCallback(() => {\r\n try {\r\n const currentOrigin = window.location.origin;\r\n const pagesOrigin = pagesUrl ? new URL(pagesUrl).origin : \"\";\r\n\r\n if (pagesOrigin && currentOrigin === pagesOrigin) {\r\n return `${accountsUrl}/login?redirect=${encodeURIComponent(pagesUrl)}`;\r\n }\r\n } catch {\r\n // fallback below\r\n }\r\n\r\n return `${accountsUrl}/login?redirect=${encodeURIComponent(pagesUrl || \"/\")}`;\r\n }, [accountsUrl, pagesUrl]);\r\n\r\n const logout = useCallback(async (): Promise<void> => {\r\n try {\r\n await logoutMutate(undefined);\r\n } catch {\r\n // cookie já removido no servidor mesmo se a API falhou\r\n } finally {\r\n queryClient.clear();\r\n window.location.assign(resolveLogoutRedirect());\r\n }\r\n }, [queryClient, logoutMutate, resolveLogoutRedirect]);\r\n\r\n const value: AuthContextProps = useMemo(\r\n () => ({\r\n user: user ?? null,\r\n account: account ?? null,\r\n isAuthenticated,\r\n isLoading,\r\n login,\r\n register,\r\n logout,\r\n }),\r\n [user, account, isAuthenticated, isLoading, login, register, logout],\r\n );\r\n\r\n return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;\r\n}\r\n\r\nexport function useAuth(): AuthContextProps {\r\n const context = useContext(AuthContext);\r\n\r\n if (context === undefined) {\r\n throw new Error(\"useAuth deve ser usado dentro de um AuthProvider\");\r\n }\r\n\r\n return context;\r\n}\r\n"],"mappings":";AAoJS;AAlJT;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAW1B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAQ3B,MAAM,cAAc;AAAA,EACzB;AACF;AAMO,SAAS,aAAa,EAAE,SAAS,GAAsB;AAC5D,QAAM,EAAE,MAAM,MAAM,WAAW,eAAe,IAAI,aAAa;AAC/D,QAAM,EAAE,MAAM,SAAS,WAAW,iBAAiB,IAAI,kBAAkB;AACzE,QAAM,EAAE,WAAW,iBAAiB,IAAI,uBAAuB;AAE/D,QAAM,cAAc,eAAe;AACnC,QAAM,cAAc,eAAe;AACnC,QAAM,EAAE,aAAa,SAAS,IAAI,kBAAkB;AAEpD,QAAM,EAAE,aAAa,aAAa,WAAW,UAAU,IAAI,SAAS;AACpE,QAAM,EAAE,aAAa,gBAAgB,WAAW,cAAc,IAC5D,YAAY;AACd,QAAM,EAAE,aAAa,cAAc,WAAW,aAAa,IAAI,UAAU;AAEzE,QAAM,kBAAkB,CAAC,CAAC;AAC1B,QAAM,YACJ,aACA,iBACA,gBACA,kBACA,oBACA;AAEF,QAAM,QAAQ;AAAA,IACZ,OAAO,gBAAoD;AACzD,UAAI;AACF,cAAM,OAAO,MAAM,YAAY,WAAW;AAE1C,YAAI,KAAK,WAAW,uBAAuB;AACzC,iBAAO,EAAE,QAAQ,uBAAuB,QAAQ,KAAK,QAAQ,eAAe,KAAK,cAAc;AAAA,QACjG;AAEA,oBAAY,MAAM;AAClB,oBAAY,KAAK,IAAI;AACrB,oBAAY,aAAa,mBAAmB,KAAK,OAAO;AAExD,eAAO,EAAE,QAAQ,UAAU;AAAA,MAC7B,SAAS,OAAO;AACd,cAAM,UACJ,iBAAiB,QACb,MAAM,UACN;AACN,eAAO,EAAE,QAAQ,SAAS,QAAQ;AAAA,MACpC;AAAA,IACF;AAAA,IACA,CAAC,aAAa,WAAW;AAAA,EAC3B;AAEA,QAAM,WAAW;AAAA,IACf,OAAO,SAAyC;AAC9C,YAAM,eAAe,MAAM;AAAA,QACzB,WAAW,CAACA,UAAS;AACnB,sBAAY,MAAM;AAClB,sBAAYA,MAAK,IAAI;AACrB,sBAAY,aAAa,mBAAmBA,MAAK,OAAO;AAAA,QAC1D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,aAAa,WAAW;AAAA,EAC3B;AAEA,QAAM,wBAAwB,YAAY,MAAM;AAC9C,QAAI;AACF,YAAM,gBAAgB,OAAO,SAAS;AACtC,YAAM,cAAc,WAAW,IAAI,IAAI,QAAQ,EAAE,SAAS;AAE1D,UAAI,eAAe,kBAAkB,aAAa;AAChD,eAAO,GAAG,WAAW,mBAAmB,mBAAmB,QAAQ,CAAC;AAAA,MACtE;AAAA,IACF,QAAQ;AAAA,IAER;AAEA,WAAO,GAAG,WAAW,mBAAmB,mBAAmB,YAAY,GAAG,CAAC;AAAA,EAC7E,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,QAAM,SAAS,YAAY,YAA2B;AACpD,QAAI;AACF,YAAM,aAAa,MAAS;AAAA,IAC9B,QAAQ;AAAA,IAER,UAAE;AACA,kBAAY,MAAM;AAClB,aAAO,SAAS,OAAO,sBAAsB,CAAC;AAAA,IAChD;AAAA,EACF,GAAG,CAAC,aAAa,cAAc,qBAAqB,CAAC;AAErD,QAAM,QAA0B;AAAA,IAC9B,OAAO;AAAA,MACL,MAAM,QAAQ;AAAA,MACd,SAAS,WAAW;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,MAAM,SAAS,iBAAiB,WAAW,OAAO,UAAU,MAAM;AAAA,EACrE;AAEA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAe,UAAS;AACvD;AAEO,SAAS,UAA4B;AAC1C,QAAM,UAAU,WAAW,WAAW;AAEtC,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AAEA,SAAO;AACT;","names":["data"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
QueryClient
|
|
5
|
+
} from "@tanstack/react-query";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import dynamic from "next/dynamic";
|
|
8
|
+
import {
|
|
9
|
+
PersistQueryClientProvider
|
|
10
|
+
} from "@tanstack/react-query-persist-client";
|
|
11
|
+
import { broadcastQueryClient } from "@tanstack/query-broadcast-client-experimental";
|
|
12
|
+
import { set, get, del } from "idb-keyval";
|
|
13
|
+
const ReactQueryDevtools = process.env.NODE_ENV === "development" ? dynamic(
|
|
14
|
+
() => import("@tanstack/react-query-devtools").then((mod) => ({
|
|
15
|
+
default: mod.ReactQueryDevtools
|
|
16
|
+
})),
|
|
17
|
+
{ ssr: false }
|
|
18
|
+
) : () => null;
|
|
19
|
+
const persister = {
|
|
20
|
+
persistClient: async (client) => {
|
|
21
|
+
try {
|
|
22
|
+
await set("rq-cache", client);
|
|
23
|
+
} catch {
|
|
24
|
+
console.warn("Falha ao persistir cache");
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
restoreClient: async () => {
|
|
28
|
+
try {
|
|
29
|
+
return await get("rq-cache");
|
|
30
|
+
} catch {
|
|
31
|
+
await del("rq-cache").catch(() => {
|
|
32
|
+
});
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
removeClient: async () => {
|
|
37
|
+
try {
|
|
38
|
+
await del("rq-cache");
|
|
39
|
+
} catch {
|
|
40
|
+
console.warn("Falha ao remover cache");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
function QueryProvider({
|
|
45
|
+
children,
|
|
46
|
+
persisterVersion = "v1"
|
|
47
|
+
}) {
|
|
48
|
+
const [queryClient] = useState(
|
|
49
|
+
() => new QueryClient({
|
|
50
|
+
defaultOptions: {
|
|
51
|
+
queries: {
|
|
52
|
+
staleTime: 5 * 60 * 1e3,
|
|
53
|
+
gcTime: 4 * 60 * 60 * 1e3,
|
|
54
|
+
refetchOnWindowFocus: false,
|
|
55
|
+
refetchOnReconnect: true,
|
|
56
|
+
retry: 2,
|
|
57
|
+
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 3e4)
|
|
58
|
+
},
|
|
59
|
+
mutations: {
|
|
60
|
+
retry: false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
broadcastQueryClient({
|
|
67
|
+
queryClient,
|
|
68
|
+
broadcastChannel: "react-query"
|
|
69
|
+
});
|
|
70
|
+
}, [queryClient]);
|
|
71
|
+
return /* @__PURE__ */ jsxs(
|
|
72
|
+
PersistQueryClientProvider,
|
|
73
|
+
{
|
|
74
|
+
client: queryClient,
|
|
75
|
+
persistOptions: {
|
|
76
|
+
persister,
|
|
77
|
+
maxAge: 2 * 60 * 60 * 1e3,
|
|
78
|
+
buster: persisterVersion,
|
|
79
|
+
dehydrateOptions: {
|
|
80
|
+
shouldDehydrateQuery: (query) => {
|
|
81
|
+
if (query.state.status === "error") return false;
|
|
82
|
+
if (query.meta?.persist === false) return false;
|
|
83
|
+
if ((query.state.dataUpdateCount ?? 0) > 10) return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
children: [
|
|
89
|
+
children,
|
|
90
|
+
/* @__PURE__ */ jsx(ReactQueryDevtools, { initialIsOpen: false })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
QueryProvider,
|
|
97
|
+
persister
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=query.provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/providers/query.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n QueryCache,\r\n QueryClient,\r\n QueryClientProvider,\r\n} from \"@tanstack/react-query\";\r\nimport { ReactNode, useEffect, useState } from \"react\";\r\nimport dynamic from \"next/dynamic\";\r\nimport { toast } from \"sonner\";\r\nimport {\r\n PersistedClient,\r\n PersistQueryClientProvider,\r\n} from \"@tanstack/react-query-persist-client\";\r\nimport { broadcastQueryClient } from \"@tanstack/query-broadcast-client-experimental\";\r\nimport { set, get, del } from \"idb-keyval\";\r\n\r\n// React Query Devtools só em desenvolvimento - remove do bundle de produção\r\nconst ReactQueryDevtools =\r\n process.env.NODE_ENV === \"development\"\r\n ? dynamic(\r\n () =>\r\n import(\"@tanstack/react-query-devtools\").then((mod) => ({\r\n default: mod.ReactQueryDevtools,\r\n })),\r\n { ssr: false },\r\n )\r\n : () => null;\r\n\r\nexport const persister = {\r\n persistClient: async (client: PersistedClient) => {\r\n try {\r\n await set(\"rq-cache\", client);\r\n } catch {\r\n console.warn(\"Falha ao persistir cache\");\r\n }\r\n },\r\n restoreClient: async (): Promise<PersistedClient | undefined> => {\r\n try {\r\n return await get(\"rq-cache\");\r\n } catch {\r\n await del(\"rq-cache\").catch(() => {});\r\n return undefined;\r\n }\r\n },\r\n removeClient: async () => {\r\n try {\r\n await del(\"rq-cache\");\r\n } catch {\r\n console.warn(\"Falha ao remover cache\");\r\n }\r\n },\r\n};\r\n\r\ninterface QueryProviderProps {\r\n children: ReactNode;\r\n persisterVersion?: string;\r\n}\r\n\r\nexport function QueryProvider({\r\n children,\r\n persisterVersion = \"v1\",\r\n}: QueryProviderProps) {\r\n const [queryClient] = useState(\r\n () =>\r\n new QueryClient({\r\n defaultOptions: {\r\n queries: {\r\n staleTime: 5 * 60 * 1000,\r\n gcTime: 4 * 60 * 60 * 1000,\r\n refetchOnWindowFocus: false,\r\n refetchOnReconnect: true,\r\n retry: 2,\r\n retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 30000),\r\n },\r\n mutations: {\r\n retry: false,\r\n },\r\n },\r\n }),\r\n );\r\n\r\n useEffect(() => {\r\n broadcastQueryClient({\r\n queryClient,\r\n broadcastChannel: \"react-query\",\r\n });\r\n }, [queryClient]);\r\n\r\n return (\r\n <PersistQueryClientProvider\r\n client={queryClient}\r\n persistOptions={{\r\n persister,\r\n maxAge: 2 * 60 * 60 * 1000,\r\n buster: persisterVersion,\r\n dehydrateOptions: {\r\n shouldDehydrateQuery: (query) => {\r\n if (query.state.status === \"error\") return false;\r\n if (query.meta?.persist === false) return false;\r\n if ((query.state.dataUpdateCount ?? 0) > 10) return false;\r\n return true;\r\n },\r\n },\r\n }}\r\n >\r\n {children}\r\n <ReactQueryDevtools initialIsOpen={false} />\r\n </PersistQueryClientProvider>\r\n );\r\n}\r\n"],"mappings":";AA0FI,SAiBE,KAjBF;AAxFJ;AAAA,EAEE;AAAA,OAEK;AACP,SAAoB,WAAW,gBAAgB;AAC/C,OAAO,aAAa;AAEpB;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,KAAK,KAAK,WAAW;AAG9B,MAAM,qBACJ,QAAQ,IAAI,aAAa,gBACrB;AAAA,EACE,MACE,OAAO,gCAAgC,EAAE,KAAK,CAAC,SAAS;AAAA,IACtD,SAAS,IAAI;AAAA,EACf,EAAE;AAAA,EACJ,EAAE,KAAK,MAAM;AACf,IACA,MAAM;AAEL,MAAM,YAAY;AAAA,EACvB,eAAe,OAAO,WAA4B;AAChD,QAAI;AACF,YAAM,IAAI,YAAY,MAAM;AAAA,IAC9B,QAAQ;AACN,cAAQ,KAAK,0BAA0B;AAAA,IACzC;AAAA,EACF;AAAA,EACA,eAAe,YAAkD;AAC/D,QAAI;AACF,aAAO,MAAM,IAAI,UAAU;AAAA,IAC7B,QAAQ;AACN,YAAM,IAAI,UAAU,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACpC,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,cAAc,YAAY;AACxB,QAAI;AACF,YAAM,IAAI,UAAU;AAAA,IACtB,QAAQ;AACN,cAAQ,KAAK,wBAAwB;AAAA,IACvC;AAAA,EACF;AACF;AAOO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,mBAAmB;AACrB,GAAuB;AACrB,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS;AAAA,UACP,WAAW,IAAI,KAAK;AAAA,UACpB,QAAQ,IAAI,KAAK,KAAK;AAAA,UACtB,sBAAsB;AAAA,UACtB,oBAAoB;AAAA,UACpB,OAAO;AAAA,UACP,YAAY,CAAC,YAAY,KAAK,IAAI,MAAO,KAAK,SAAS,GAAK;AAAA,QAC9D;AAAA,QACA,WAAW;AAAA,UACT,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACL;AAEA,YAAU,MAAM;AACd,yBAAqB;AAAA,MACnB;AAAA,MACA,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,gBAAgB;AAAA,QACd;AAAA,QACA,QAAQ,IAAI,KAAK,KAAK;AAAA,QACtB,QAAQ;AAAA,QACR,kBAAkB;AAAA,UAChB,sBAAsB,CAAC,UAAU;AAC/B,gBAAI,MAAM,MAAM,WAAW,QAAS,QAAO;AAC3C,gBAAI,MAAM,MAAM,YAAY,MAAO,QAAO;AAC1C,iBAAK,MAAM,MAAM,mBAAmB,KAAK,GAAI,QAAO;AACpD,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,QACD,oBAAC,sBAAmB,eAAe,OAAO;AAAA;AAAA;AAAA,EAC5C;AAEJ;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const WhitelabelContext = createContext(void 0);
|
|
5
|
+
function WhitelabelProvider({
|
|
6
|
+
children,
|
|
7
|
+
whitelabel
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(WhitelabelContext.Provider, { value: { whitelabel }, children });
|
|
10
|
+
}
|
|
11
|
+
function useWhitelabel() {
|
|
12
|
+
const context = useContext(WhitelabelContext);
|
|
13
|
+
if (context === void 0) {
|
|
14
|
+
throw new Error("useWhitelabel deve ser usado dentro de um WhitelabelProvider");
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
function useWhitelabelStyles() {
|
|
19
|
+
const { whitelabel } = useWhitelabel();
|
|
20
|
+
return {
|
|
21
|
+
general: whitelabel?.general ?? null,
|
|
22
|
+
signin_page: whitelabel?.signin_page ?? null,
|
|
23
|
+
signup_page: whitelabel?.signup_page ?? null,
|
|
24
|
+
dashboard: whitelabel?.dashboard ?? null
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function useWhitelabelUrls() {
|
|
28
|
+
const { whitelabel } = useWhitelabel();
|
|
29
|
+
return {
|
|
30
|
+
editorUrl: whitelabel?.editor_url ?? "",
|
|
31
|
+
pagesUrl: whitelabel?.pages_url ?? "",
|
|
32
|
+
accountsUrl: whitelabel?.accounts_url ?? "",
|
|
33
|
+
previewUrl: whitelabel?.pages_preview_url ?? ""
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
WhitelabelProvider,
|
|
38
|
+
useWhitelabel,
|
|
39
|
+
useWhitelabelStyles,
|
|
40
|
+
useWhitelabelUrls
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=whitelabel.provider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/providers/whitelabel.provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, ReactNode, useContext } from \"react\";\nimport type { WhitelabelData, GeneralStyleJson, PageStyleJson, DashboardStyleJson } from \"../modules/whitelabel/schema\";\n\ninterface WhitelabelContextProps {\n whitelabel: WhitelabelData | null;\n}\n\nconst WhitelabelContext = createContext<WhitelabelContextProps | undefined>(undefined);\n\ninterface WhitelabelProviderProps {\n children: ReactNode;\n whitelabel: WhitelabelData | null;\n}\n\nexport function WhitelabelProvider({\n children,\n whitelabel,\n}: WhitelabelProviderProps) {\n return (\n <WhitelabelContext.Provider value={{ whitelabel }}>\n {children}\n </WhitelabelContext.Provider>\n );\n}\n\nexport function useWhitelabel(): WhitelabelContextProps {\n const context = useContext(WhitelabelContext);\n if (context === undefined) {\n throw new Error(\"useWhitelabel deve ser usado dentro de um WhitelabelProvider\");\n }\n return context;\n}\n\nexport function useWhitelabelStyles() {\n const { whitelabel } = useWhitelabel();\n return {\n general: whitelabel?.general ?? null,\n signin_page: whitelabel?.signin_page ?? null,\n signup_page: whitelabel?.signup_page ?? null,\n dashboard: whitelabel?.dashboard ?? null,\n };\n}\n\nexport function useWhitelabelUrls() {\n const { whitelabel } = useWhitelabel();\n return {\n editorUrl: whitelabel?.editor_url ?? '',\n pagesUrl: whitelabel?.pages_url ?? '',\n accountsUrl: whitelabel?.accounts_url ?? '',\n previewUrl: whitelabel?.pages_preview_url ?? '',\n };\n}\n"],"mappings":";AAqBI;AAnBJ,SAAS,eAA0B,kBAAkB;AAOrD,MAAM,oBAAoB,cAAkD,MAAS;AAO9E,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAA4B;AAC1B,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,WAAW,GAC7C,UACH;AAEJ;AAEO,SAAS,gBAAwC;AACtD,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACA,SAAO;AACT;AAEO,SAAS,sBAAsB;AACpC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO;AAAA,IACL,SAAS,YAAY,WAAW;AAAA,IAChC,aAAa,YAAY,eAAe;AAAA,IACxC,aAAa,YAAY,eAAe;AAAA,IACxC,WAAW,YAAY,aAAa;AAAA,EACtC;AACF;AAEO,SAAS,oBAAoB;AAClC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO;AAAA,IACL,WAAW,YAAY,cAAc;AAAA,IACrC,UAAU,YAAY,aAAa;AAAA,IACnC,aAAa,YAAY,gBAAgB;AAAA,IACzC,YAAY,YAAY,qBAAqB;AAAA,EAC/C;AACF;","names":[]}
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { ApiClient, api, apiClient } from "./infra/api/client";
|
|
3
|
+
import { authService } from "./modules/auth/services/auth.service";
|
|
4
|
+
import { whitelabelService } from "./modules/whitelabel/services/whitelabel.service";
|
|
5
|
+
import { revalidateWhitelabelAction } from "./modules/whitelabel/actions/revalidate-whitelabel.action";
|
|
6
|
+
import { assertManagementPermission } from "./modules/auth/utils/assert-management-permission";
|
|
7
|
+
import { assertManagementSubscription } from "./modules/auth/utils/assert-management-subscription";
|
|
8
|
+
import { assertSubscriptionAddon } from "./modules/auth/utils/assert-subscription-addon";
|
|
9
|
+
import { assertPaidSubscription } from "./modules/auth/utils/assert-paid-subscription";
|
|
10
|
+
import { subscriptionsService } from "./modules/subscriptions/services/subscriptions.service";
|
|
11
|
+
import { plansService } from "./modules/plans/services/plans.service";
|
|
12
|
+
import { cardsService } from "./modules/cards/services/cards.service";
|
|
13
|
+
import { iaCreditsService } from "./modules/ia-credits/services/ia-credits.service";
|
|
14
|
+
import { findWhitelabel } from "./modules/whitelabel/actions/find-whitelabel.action";
|
|
15
|
+
import { validateSessionAction } from "./modules/auth/actions/validate-session.action";
|
|
16
|
+
import { findUserById } from "./modules/users/action/find-user-by-id.action";
|
|
17
|
+
import { findCurrentAccount } from "./modules/accounts/actions/find-current-account.action";
|
|
18
|
+
import { listSubscriptionsAction } from "./modules/subscriptions/actions/list-subscriptions.action";
|
|
19
|
+
import { findPlanByIdAction } from "./modules/plans/actions/find-plan-by-id.action";
|
|
20
|
+
import { calculateSubscriptionAction } from "./modules/subscriptions/actions/calculate-subscription.action";
|
|
21
|
+
import { updateSubscriptionPlanAction } from "./modules/subscriptions/actions/update-subscription-plan.action";
|
|
22
|
+
import { listCardsAction } from "./modules/cards/actions/list-cards.action";
|
|
23
|
+
import { createCardAction } from "./modules/cards/actions/create-card.action";
|
|
24
|
+
import { resolvePlanExtrasPrices } from "./modules/subscriptions/utils/resolve-plan-extras-prices";
|
|
25
|
+
import { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
|
|
26
|
+
import { listIaCreditsAction } from "./modules/ia-credits/actions/list-ia-credits.action";
|
|
27
|
+
import { projectUsersService } from "./modules/projects/services/project-users.service";
|
|
28
|
+
import { listProjectUsersAction } from "./modules/projects/actions/list-project-users.action";
|
|
29
|
+
import { listAvailableUsersAction } from "./modules/projects/actions/list-available-users.action";
|
|
30
|
+
import { addProjectUserAction } from "./modules/projects/actions/add-project-user.action";
|
|
31
|
+
import { removeProjectUserAction } from "./modules/projects/actions/remove-project-user.action";
|
|
32
|
+
import { accountService } from "./modules/accounts/services/account.service";
|
|
33
|
+
import { twoFactorService } from "./modules/accounts/services/two-factor.service";
|
|
34
|
+
import {
|
|
35
|
+
listAccountUsersAction,
|
|
36
|
+
updateUserAction,
|
|
37
|
+
updateAccountAction,
|
|
38
|
+
updateAccountUserByIdAction,
|
|
39
|
+
deleteAccountUserAction,
|
|
40
|
+
deleteAccountAction,
|
|
41
|
+
createAccountUserAction,
|
|
42
|
+
changePasswordAction,
|
|
43
|
+
requestEmailChangeAction,
|
|
44
|
+
confirmEmailChangeAction,
|
|
45
|
+
requestPhoneChangeAction,
|
|
46
|
+
confirmPhoneChangeAction,
|
|
47
|
+
generateTwoFactorAction,
|
|
48
|
+
confirmTwoFactorAction,
|
|
49
|
+
disableTwoFactorAction
|
|
50
|
+
} from "./modules/accounts/actions/account-management.action";
|
|
51
|
+
import { getClientInfoFromRequest } from "./infra/utils/client-info";
|
|
52
|
+
import { getUserContext } from "./modules/auth/utils/get-user-context";
|
|
53
|
+
import { buildWlOverride, buildWlOverrideFromJwt } from "./modules/auth/utils/build-wl-override";
|
|
54
|
+
import { safeServerAction } from "./utils/safeServerAction";
|
|
55
|
+
export {
|
|
56
|
+
ApiClient,
|
|
57
|
+
accountService,
|
|
58
|
+
addProjectUserAction,
|
|
59
|
+
api,
|
|
60
|
+
apiClient,
|
|
61
|
+
assertManagementPermission,
|
|
62
|
+
assertManagementSubscription,
|
|
63
|
+
assertPaidSubscription,
|
|
64
|
+
assertSubscriptionAddon,
|
|
65
|
+
authService,
|
|
66
|
+
buildWlOverride,
|
|
67
|
+
buildWlOverrideFromJwt,
|
|
68
|
+
calculateSubscriptionAction,
|
|
69
|
+
cardsService,
|
|
70
|
+
changePasswordAction,
|
|
71
|
+
confirmEmailChangeAction,
|
|
72
|
+
confirmPhoneChangeAction,
|
|
73
|
+
confirmTwoFactorAction,
|
|
74
|
+
createAccountUserAction,
|
|
75
|
+
createCardAction,
|
|
76
|
+
deleteAccountAction,
|
|
77
|
+
deleteAccountUserAction,
|
|
78
|
+
disableTwoFactorAction,
|
|
79
|
+
findCurrentAccount,
|
|
80
|
+
findPlanByIdAction,
|
|
81
|
+
findUserById,
|
|
82
|
+
findWhitelabel,
|
|
83
|
+
generateTwoFactorAction,
|
|
84
|
+
getClientInfoFromRequest,
|
|
85
|
+
getUserContext,
|
|
86
|
+
hasSubscriptionExpired,
|
|
87
|
+
iaCreditsService,
|
|
88
|
+
listAccountUsersAction,
|
|
89
|
+
listAvailableUsersAction,
|
|
90
|
+
listCardsAction,
|
|
91
|
+
listIaCreditsAction,
|
|
92
|
+
listProjectUsersAction,
|
|
93
|
+
listSubscriptionsAction,
|
|
94
|
+
plansService,
|
|
95
|
+
projectUsersService,
|
|
96
|
+
removeProjectUserAction,
|
|
97
|
+
requestEmailChangeAction,
|
|
98
|
+
requestPhoneChangeAction,
|
|
99
|
+
resolvePlanExtrasPrices,
|
|
100
|
+
revalidateWhitelabelAction,
|
|
101
|
+
safeServerAction,
|
|
102
|
+
subscriptionsService,
|
|
103
|
+
twoFactorService,
|
|
104
|
+
updateAccountAction,
|
|
105
|
+
updateAccountUserByIdAction,
|
|
106
|
+
updateSubscriptionPlanAction,
|
|
107
|
+
updateUserAction,
|
|
108
|
+
validateSessionAction,
|
|
109
|
+
whitelabelService
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\r\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\r\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\r\nexport { assertSubscriptionAddon } from './modules/auth/utils/assert-subscription-addon';\r\nexport { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscription';\r\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\r\nexport { plansService } from './modules/plans/services/plans.service';\r\nexport { cardsService } from './modules/cards/services/cards.service';\r\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\r\n\r\n// Actions\r\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\r\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\r\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\r\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\r\nexport { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\r\nexport { findPlanByIdAction } from './modules/plans/actions/find-plan-by-id.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { listCardsAction } from './modules/cards/actions/list-cards.action';\r\nexport { createCardAction } from './modules/cards/actions/create-card.action';\r\nexport { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';\r\nexport { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';\r\nexport { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';\r\n\r\n// Project Users Services & Actions (server-only)\r\nexport { projectUsersService } from './modules/projects/services/project-users.service';\r\nexport { listProjectUsersAction } from './modules/projects/actions/list-project-users.action';\r\nexport { listAvailableUsersAction } from './modules/projects/actions/list-available-users.action';\r\nexport { addProjectUserAction } from './modules/projects/actions/add-project-user.action';\r\nexport { removeProjectUserAction } from './modules/projects/actions/remove-project-user.action';\r\n\r\n// Account Services & Actions (server-only)\r\nexport { accountService } from './modules/accounts/services/account.service';\r\nexport { twoFactorService } from './modules/accounts/services/two-factor.service';\r\nexport {\r\n listAccountUsersAction,\r\n updateUserAction,\r\n updateAccountAction,\r\n updateAccountUserByIdAction,\r\n deleteAccountUserAction,\r\n deleteAccountAction,\r\n createAccountUserAction,\r\n changePasswordAction,\r\n requestEmailChangeAction,\r\n confirmEmailChangeAction,\r\n requestPhoneChangeAction,\r\n confirmPhoneChangeAction,\r\n generateTwoFactorAction,\r\n confirmTwoFactorAction,\r\n disableTwoFactorAction,\r\n} from './modules/accounts/actions/account-management.action';\r\n\r\n// Server Utils\r\nexport { getClientInfoFromRequest } from './infra/utils/client-info';\r\nexport { getUserContext } from './modules/auth/utils/get-user-context';\r\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\n"],"mappings":"AAAA,OAAO;AAGP,SAAS,WAAW,KAAK,iBAAiB;AAG1C,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AAGpC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAGxC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB,8BAA8B;AACxD,SAAS,wBAAwB;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useAccountModals = create((set) => ({
|
|
4
|
+
activeModal: null,
|
|
5
|
+
config: {},
|
|
6
|
+
initialSection: void 0,
|
|
7
|
+
pagesCount: 0,
|
|
8
|
+
updateConfig: (config) => set({ config }),
|
|
9
|
+
openConfigurations: (initialSection) => set({ activeModal: "configurations", initialSection }),
|
|
10
|
+
openDeleteAccount: (pagesCount = 0) => set({ activeModal: "deleteAccount", pagesCount }),
|
|
11
|
+
openIsntPossibleDelete: () => set({ activeModal: "isntPossibleDelete" }),
|
|
12
|
+
openConfirmDelete: (pagesCount = 0) => set({ activeModal: "confirmDelete", pagesCount }),
|
|
13
|
+
close: () => set({ activeModal: null, initialSection: void 0 })
|
|
14
|
+
}));
|
|
15
|
+
export {
|
|
16
|
+
useAccountModals
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useAccountModals.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { AccountSectionType } from '../enums/AccountSectionType';\n\ntype AccountModalType =\n | 'configurations'\n | 'deleteAccount'\n | 'isntPossibleDelete'\n | 'confirmDelete';\n\nexport interface AccountModalsConfig {\n hasActiveSubscription?: boolean;\n onGoToSubscription?: () => void;\n}\n\ninterface AccountModalsState {\n activeModal: AccountModalType | null;\n config: AccountModalsConfig;\n initialSection?: AccountSectionType;\n pagesCount: number;\n\n /** Called by <AccountModals> to keep app-level config in sync */\n updateConfig: (config: AccountModalsConfig) => void;\n\n openConfigurations: (initialSection?: AccountSectionType) => void;\n openDeleteAccount: (pagesCount?: number) => void;\n openIsntPossibleDelete: () => void;\n openConfirmDelete: (pagesCount?: number) => void;\n close: () => void;\n}\n\nexport const useAccountModals = create<AccountModalsState>((set) => ({\n activeModal: null,\n config: {},\n initialSection: undefined,\n pagesCount: 0,\n\n updateConfig: (config) => set({ config }),\n\n openConfigurations: (initialSection) =>\n set({ activeModal: 'configurations', initialSection }),\n\n openDeleteAccount: (pagesCount = 0) =>\n set({ activeModal: 'deleteAccount', pagesCount }),\n\n openIsntPossibleDelete: () =>\n set({ activeModal: 'isntPossibleDelete' }),\n\n openConfirmDelete: (pagesCount = 0) =>\n set({ activeModal: 'confirmDelete', pagesCount }),\n\n close: () =>\n set({ activeModal: null, initialSection: undefined }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AA8BhB,MAAM,mBAAmB,OAA2B,CAAC,SAAS;AAAA,EACnE,aAAa;AAAA,EACb,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA,EAChB,YAAY;AAAA,EAEZ,cAAc,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EAExC,oBAAoB,CAAC,mBACnB,IAAI,EAAE,aAAa,kBAAkB,eAAe,CAAC;AAAA,EAEvD,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,wBAAwB,MACtB,IAAI,EAAE,aAAa,qBAAqB,CAAC;AAAA,EAE3C,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,OAAO,MACL,IAAI,EAAE,aAAa,MAAM,gBAAgB,OAAU,CAAC;AACxD,EAAE;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useModalManager } from "./useModalManager";
|
|
2
|
+
const useBuyCreditsModal = () => {
|
|
3
|
+
const { activeModal, modalData, openModal, closeModal } = useModalManager();
|
|
4
|
+
const isOpen = activeModal === "buyCreditsModal";
|
|
5
|
+
const data = modalData;
|
|
6
|
+
return {
|
|
7
|
+
open: isOpen,
|
|
8
|
+
onConfirm: data?.onConfirm,
|
|
9
|
+
openModal: (onConfirm) => openModal("buyCreditsModal", { onConfirm }),
|
|
10
|
+
closeModal
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
useBuyCreditsModal
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useBuyCreditsModal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useBuyCreditsModal.ts"],"sourcesContent":["import { useModalManager } from './useModalManager';\n\ninterface BuyCreditsModalData {\n onConfirm?: (creditAmount: number, price: number) => void;\n}\n\nexport const useBuyCreditsModal = () => {\n const { activeModal, modalData, openModal, closeModal } = useModalManager();\n\n const isOpen = activeModal === 'buyCreditsModal';\n const data = modalData as BuyCreditsModalData;\n\n return {\n open: isOpen,\n onConfirm: data?.onConfirm,\n\n openModal: (onConfirm?: (creditAmount: number, price: number) => void) =>\n openModal('buyCreditsModal', { onConfirm }),\n closeModal,\n };\n};\n"],"mappings":"AAAA,SAAS,uBAAuB;AAMzB,MAAM,qBAAqB,MAAM;AACtC,QAAM,EAAE,aAAa,WAAW,WAAW,WAAW,IAAI,gBAAgB;AAE1E,QAAM,SAAS,gBAAgB;AAC/B,QAAM,OAAO;AAEb,SAAO;AAAA,IACL,MAAM;AAAA,IACN,WAAW,MAAM;AAAA,IAEjB,WAAW,CAAC,cACV,UAAU,mBAAmB,EAAE,UAAU,CAAC;AAAA,IAC5C;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
const STORAGE_KEY = "desktop-sidebar-expanded";
|
|
4
|
+
const useDesktopSidebarStore = create((set) => ({
|
|
5
|
+
isExpanded: true,
|
|
6
|
+
_hydrated: false,
|
|
7
|
+
toggle: () => set((state) => {
|
|
8
|
+
const next = !state.isExpanded;
|
|
9
|
+
localStorage.setItem(STORAGE_KEY, String(next));
|
|
10
|
+
return { isExpanded: next };
|
|
11
|
+
}),
|
|
12
|
+
expand: () => {
|
|
13
|
+
localStorage.setItem(STORAGE_KEY, "true");
|
|
14
|
+
return set({ isExpanded: true });
|
|
15
|
+
},
|
|
16
|
+
collapse: () => {
|
|
17
|
+
localStorage.setItem(STORAGE_KEY, "false");
|
|
18
|
+
return set({ isExpanded: false });
|
|
19
|
+
},
|
|
20
|
+
_hydrate: () => {
|
|
21
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
22
|
+
const value = stored === null ? true : stored === "true";
|
|
23
|
+
set({ isExpanded: value, _hydrated: true });
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
function useDesktopSidebarHydration() {
|
|
27
|
+
const hydrate = useDesktopSidebarStore((s) => s._hydrate);
|
|
28
|
+
const hydrated = useDesktopSidebarStore((s) => s._hydrated);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!hydrated) {
|
|
31
|
+
hydrate();
|
|
32
|
+
}
|
|
33
|
+
}, [hydrate, hydrated]);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
useDesktopSidebarHydration,
|
|
37
|
+
useDesktopSidebarStore
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=useDesktopSidebarStore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useDesktopSidebarStore.ts"],"sourcesContent":["import { create } from \"zustand\";\nimport { useEffect } from \"react\";\n\nconst STORAGE_KEY = \"desktop-sidebar-expanded\";\n\ntype DesktopSidebarStore = {\n isExpanded: boolean;\n _hydrated: boolean;\n toggle: () => void;\n expand: () => void;\n collapse: () => void;\n _hydrate: () => void;\n};\n\nexport const useDesktopSidebarStore = create<DesktopSidebarStore>((set) => ({\n isExpanded: true,\n _hydrated: false,\n toggle: () => set((state) => {\n const next = !state.isExpanded;\n localStorage.setItem(STORAGE_KEY, String(next));\n return { isExpanded: next };\n }),\n expand: () => {\n localStorage.setItem(STORAGE_KEY, \"true\");\n return set({ isExpanded: true });\n },\n collapse: () => {\n localStorage.setItem(STORAGE_KEY, \"false\");\n return set({ isExpanded: false });\n },\n _hydrate: () => {\n const stored = localStorage.getItem(STORAGE_KEY);\n const value = stored === null ? true : stored === \"true\";\n set({ isExpanded: value, _hydrated: true });\n },\n}));\n\nexport function useDesktopSidebarHydration() {\n const hydrate = useDesktopSidebarStore((s) => s._hydrate);\n const hydrated = useDesktopSidebarStore((s) => s._hydrated);\n\n useEffect(() => {\n if (!hydrated) {\n hydrate();\n }\n }, [hydrate, hydrated]);\n}\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAE1B,MAAM,cAAc;AAWb,MAAM,yBAAyB,OAA4B,CAAC,SAAS;AAAA,EACxE,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,QAAQ,MAAM,IAAI,CAAC,UAAU;AACzB,UAAM,OAAO,CAAC,MAAM;AACpB,iBAAa,QAAQ,aAAa,OAAO,IAAI,CAAC;AAC9C,WAAO,EAAE,YAAY,KAAK;AAAA,EAC9B,CAAC;AAAA,EACD,QAAQ,MAAM;AACV,iBAAa,QAAQ,aAAa,MAAM;AACxC,WAAO,IAAI,EAAE,YAAY,KAAK,CAAC;AAAA,EACnC;AAAA,EACA,UAAU,MAAM;AACZ,iBAAa,QAAQ,aAAa,OAAO;AACzC,WAAO,IAAI,EAAE,YAAY,MAAM,CAAC;AAAA,EACpC;AAAA,EACA,UAAU,MAAM;AACZ,UAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,UAAM,QAAQ,WAAW,OAAO,OAAO,WAAW;AAClD,QAAI,EAAE,YAAY,OAAO,WAAW,KAAK,CAAC;AAAA,EAC9C;AACJ,EAAE;AAEK,SAAS,6BAA6B;AACzC,QAAM,UAAU,uBAAuB,CAAC,MAAM,EAAE,QAAQ;AACxD,QAAM,WAAW,uBAAuB,CAAC,MAAM,EAAE,SAAS;AAE1D,YAAU,MAAM;AACZ,QAAI,CAAC,UAAU;AACX,cAAQ;AAAA,IACZ;AAAA,EACJ,GAAG,CAAC,SAAS,QAAQ,CAAC;AAC1B;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
const STORAGE_KEY = "md-sidebar-expanded";
|
|
3
|
+
function getInitialState() {
|
|
4
|
+
if (typeof window === "undefined") return false;
|
|
5
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
6
|
+
if (stored === null) return false;
|
|
7
|
+
return stored === "true";
|
|
8
|
+
}
|
|
9
|
+
const useMdSidebarStore = create((set) => ({
|
|
10
|
+
isExpanded: getInitialState(),
|
|
11
|
+
toggle: () => set((state) => {
|
|
12
|
+
const next = !state.isExpanded;
|
|
13
|
+
localStorage.setItem(STORAGE_KEY, String(next));
|
|
14
|
+
return { isExpanded: next };
|
|
15
|
+
}),
|
|
16
|
+
expand: () => {
|
|
17
|
+
localStorage.setItem(STORAGE_KEY, "true");
|
|
18
|
+
return set({ isExpanded: true });
|
|
19
|
+
},
|
|
20
|
+
collapse: () => {
|
|
21
|
+
localStorage.setItem(STORAGE_KEY, "false");
|
|
22
|
+
return set({ isExpanded: false });
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
export {
|
|
26
|
+
useMdSidebarStore
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=useMdSidebarStore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useMdSidebarStore.ts"],"sourcesContent":["import { create } from \"zustand\";\n\nconst STORAGE_KEY = \"md-sidebar-expanded\";\n\nfunction getInitialState(): boolean {\n if (typeof window === \"undefined\") return false;\n const stored = localStorage.getItem(STORAGE_KEY);\n if (stored === null) return false;\n return stored === \"true\";\n}\n\ntype MdSidebarStore = {\n isExpanded: boolean;\n toggle: () => void;\n expand: () => void;\n collapse: () => void;\n};\n\nexport const useMdSidebarStore = create<MdSidebarStore>((set) => ({\n isExpanded: getInitialState(),\n toggle: () => set((state) => {\n const next = !state.isExpanded;\n localStorage.setItem(STORAGE_KEY, String(next));\n return { isExpanded: next };\n }),\n expand: () => {\n localStorage.setItem(STORAGE_KEY, \"true\");\n return set({ isExpanded: true });\n },\n collapse: () => {\n localStorage.setItem(STORAGE_KEY, \"false\");\n return set({ isExpanded: false });\n },\n}));\n"],"mappings":"AAAA,SAAS,cAAc;AAEvB,MAAM,cAAc;AAEpB,SAAS,kBAA2B;AAChC,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,MAAI,WAAW,KAAM,QAAO;AAC5B,SAAO,WAAW;AACtB;AASO,MAAM,oBAAoB,OAAuB,CAAC,SAAS;AAAA,EAC9D,YAAY,gBAAgB;AAAA,EAC5B,QAAQ,MAAM,IAAI,CAAC,UAAU;AACzB,UAAM,OAAO,CAAC,MAAM;AACpB,iBAAa,QAAQ,aAAa,OAAO,IAAI,CAAC;AAC9C,WAAO,EAAE,YAAY,KAAK;AAAA,EAC9B,CAAC;AAAA,EACD,QAAQ,MAAM;AACV,iBAAa,QAAQ,aAAa,MAAM;AACxC,WAAO,IAAI,EAAE,YAAY,KAAK,CAAC;AAAA,EACnC;AAAA,EACA,UAAU,MAAM;AACZ,iBAAa,QAAQ,aAAa,OAAO;AACzC,WAAO,IAAI,EAAE,YAAY,MAAM,CAAC;AAAA,EACpC;AACJ,EAAE;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
const useMobileNavbarSheet = create((set) => ({
|
|
3
|
+
isOpen: false,
|
|
4
|
+
openProjectList: false,
|
|
5
|
+
open: () => set({ isOpen: true, openProjectList: false }),
|
|
6
|
+
close: () => set({ isOpen: false, openProjectList: false }),
|
|
7
|
+
toggle: () => set((state) => ({ isOpen: !state.isOpen, openProjectList: false })),
|
|
8
|
+
openWithProjectList: () => set({ isOpen: true, openProjectList: true }),
|
|
9
|
+
clearProjectList: () => set({ openProjectList: false })
|
|
10
|
+
}));
|
|
11
|
+
export {
|
|
12
|
+
useMobileNavbarSheet
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useMobileNavbarSheet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useMobileNavbarSheet.ts"],"sourcesContent":["import { create } from 'zustand';\r\n\r\ninterface MobileNavbarSheetStore {\r\n isOpen: boolean;\r\n openProjectList: boolean;\r\n open: () => void;\r\n close: () => void;\r\n toggle: () => void;\r\n openWithProjectList: () => void;\r\n clearProjectList: () => void;\r\n}\r\n\r\nexport const useMobileNavbarSheet = create<MobileNavbarSheetStore>((set) => ({\r\n isOpen: false,\r\n openProjectList: false,\r\n open: () => set({ isOpen: true, openProjectList: false }),\r\n close: () => set({ isOpen: false, openProjectList: false }),\r\n toggle: () => set((state) => ({ isOpen: !state.isOpen, openProjectList: false })),\r\n openWithProjectList: () => set({ isOpen: true, openProjectList: true }),\r\n clearProjectList: () => set({ openProjectList: false }),\r\n}));\r\n"],"mappings":"AAAA,SAAS,cAAc;AAYhB,MAAM,uBAAuB,OAA+B,CAAC,SAAS;AAAA,EAC3E,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,MAAM,MAAM,IAAI,EAAE,QAAQ,MAAM,iBAAiB,MAAM,CAAC;AAAA,EACxD,OAAO,MAAM,IAAI,EAAE,QAAQ,OAAO,iBAAiB,MAAM,CAAC;AAAA,EAC1D,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,QAAQ,iBAAiB,MAAM,EAAE;AAAA,EAChF,qBAAqB,MAAM,IAAI,EAAE,QAAQ,MAAM,iBAAiB,KAAK,CAAC;AAAA,EACtE,kBAAkB,MAAM,IAAI,EAAE,iBAAiB,MAAM,CAAC;AACxD,EAAE;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useModalManager = create((set, get) => ({
|
|
4
|
+
modalStack: [],
|
|
5
|
+
activeModal: null,
|
|
6
|
+
modalData: {},
|
|
7
|
+
openModal: (key, data = {}) => {
|
|
8
|
+
set((state) => {
|
|
9
|
+
const existingIndex = state.modalStack.findIndex((item) => item.key === key);
|
|
10
|
+
if (existingIndex !== -1) {
|
|
11
|
+
const newStack2 = [...state.modalStack];
|
|
12
|
+
newStack2[existingIndex] = { key, data };
|
|
13
|
+
return {
|
|
14
|
+
modalStack: newStack2,
|
|
15
|
+
activeModal: newStack2[newStack2.length - 1]?.key ?? null,
|
|
16
|
+
modalData: newStack2[newStack2.length - 1]?.data ?? {}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const newStack = [...state.modalStack, { key, data }];
|
|
20
|
+
return {
|
|
21
|
+
modalStack: newStack,
|
|
22
|
+
activeModal: key,
|
|
23
|
+
modalData: data
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
closeModal: () => {
|
|
28
|
+
set((state) => {
|
|
29
|
+
const newStack = state.modalStack.slice(0, -1);
|
|
30
|
+
const topModal = newStack[newStack.length - 1];
|
|
31
|
+
return {
|
|
32
|
+
modalStack: newStack,
|
|
33
|
+
activeModal: topModal?.key ?? null,
|
|
34
|
+
modalData: topModal?.data ?? {}
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
closeModalByKey: (key) => {
|
|
39
|
+
set((state) => {
|
|
40
|
+
const newStack = state.modalStack.filter((item) => item.key !== key);
|
|
41
|
+
const topModal = newStack[newStack.length - 1];
|
|
42
|
+
return {
|
|
43
|
+
modalStack: newStack,
|
|
44
|
+
activeModal: topModal?.key ?? null,
|
|
45
|
+
modalData: topModal?.data ?? {}
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
updateModalData: (data) => {
|
|
50
|
+
set((state) => {
|
|
51
|
+
if (state.modalStack.length === 0) return state;
|
|
52
|
+
const newStack = [...state.modalStack];
|
|
53
|
+
const lastIndex = newStack.length - 1;
|
|
54
|
+
newStack[lastIndex] = {
|
|
55
|
+
...newStack[lastIndex],
|
|
56
|
+
data: { ...newStack[lastIndex].data, ...data }
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
modalStack: newStack,
|
|
60
|
+
modalData: newStack[lastIndex].data
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
isModalOpen: (key) => {
|
|
65
|
+
return get().modalStack.some((item) => item.key === key);
|
|
66
|
+
},
|
|
67
|
+
getModalData: (key) => {
|
|
68
|
+
const item = get().modalStack.find((item2) => item2.key === key);
|
|
69
|
+
return item?.data ?? {};
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
export {
|
|
73
|
+
useModalManager
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=useModalManager.mjs.map
|