@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,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const ProjectUserSchema = z.object({
|
|
3
|
+
id_user: z.union([z.number(), z.string()]).transform(Number),
|
|
4
|
+
id_account: z.union([z.number(), z.string()]).transform(Number),
|
|
5
|
+
id_project: z.union([z.number(), z.string()]).transform(Number),
|
|
6
|
+
name: z.string().nullable(),
|
|
7
|
+
email: z.string().nullable(),
|
|
8
|
+
profile: z.string().nullable().optional().default("viewer"),
|
|
9
|
+
photo: z.string().nullable().optional()
|
|
10
|
+
});
|
|
11
|
+
const AccountUserSchema = z.object({
|
|
12
|
+
id: z.union([z.number(), z.string()]).transform(Number),
|
|
13
|
+
name: z.string().nullable(),
|
|
14
|
+
email: z.string().nullable(),
|
|
15
|
+
profile: z.string().nullable().optional().default("viewer"),
|
|
16
|
+
photo: z.string().nullable().optional(),
|
|
17
|
+
in_project: z.boolean().optional()
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
AccountUserSchema,
|
|
21
|
+
ProjectUserSchema
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/modules/projects/types.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport const ProjectUserSchema = z.object({\r\n id_user: z.union([z.number(), z.string()]).transform(Number),\r\n id_account: z.union([z.number(), z.string()]).transform(Number),\r\n id_project: z.union([z.number(), z.string()]).transform(Number),\r\n name: z.string().nullable(),\r\n email: z.string().nullable(),\r\n profile: z.string().nullable().optional().default(\"viewer\"),\r\n photo: z.string().nullable().optional(),\r\n});\r\n\r\nexport type ProjectUser = z.infer<typeof ProjectUserSchema>;\r\n\r\nexport const AccountUserSchema = z.object({\r\n id: z.union([z.number(), z.string()]).transform(Number),\r\n name: z.string().nullable(),\r\n email: z.string().nullable(),\r\n profile: z.string().nullable().optional().default(\"viewer\"),\r\n photo: z.string().nullable().optional(),\r\n in_project: z.boolean().optional(),\r\n});\r\n\r\nexport type AccountUser = z.infer<typeof AccountUserSchema>;\r\n\r\nexport interface AddRemoveProjectUsersParams {\r\n projectId: number;\r\n users: number[];\r\n}\r\n\r\nexport interface ListUsersParams {\r\n search?: string;\r\n page?: number;\r\n limit?: number;\r\n inProject?: number;\r\n}\r\n\r\nexport interface UsersPage<T> {\r\n data: T[];\r\n total: number;\r\n page: number;\r\n}\r\n"],"mappings":"AAAA,SAAS,SAAS;AAEX,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EAC3D,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EAC9D,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EAC9D,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,QAAQ;AAAA,EAC1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;AAIM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EACtD,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,QAAQ;AAAA,EAC1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACtC,YAAY,EAAE,QAAQ,EAAE,SAAS;AACnC,CAAC;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
+
import { subscriptionsService } from "../services/subscriptions.service";
|
|
4
|
+
async function calculateSubscriptionAction(data) {
|
|
5
|
+
return safeServerAction(() => subscriptionsService.calculateSubscription(data));
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
calculateSubscriptionAction
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=calculate-subscription.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/calculate-subscription.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { CalculateSubscriptionRequest } from '../types/calculate-subscription.type';\nimport { subscriptionsService } from '../services/subscriptions.service';\n\nexport async function calculateSubscriptionAction(data: CalculateSubscriptionRequest) {\n return safeServerAction(() => subscriptionsService.calculateSubscription(data));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,eAAsB,4BAA4B,MAAoC;AACpF,SAAO,iBAAiB,MAAM,qBAAqB,sBAAsB,IAAI,CAAC;AAChF;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
+
import { subscriptionsService } from "../services/subscriptions.service";
|
|
4
|
+
async function listSubscriptionsAction(params) {
|
|
5
|
+
return safeServerAction(() => subscriptionsService.listSubscriptions(params));
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
listSubscriptionsAction
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=list-subscriptions.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/list-subscriptions.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { FindSubscriptionsParams } from '../types/subscription.type';\nimport { subscriptionsService } from '../services/subscriptions.service';\n\nexport async function listSubscriptionsAction(params?: Partial<FindSubscriptionsParams>) {\n return safeServerAction(() => subscriptionsService.listSubscriptions(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,eAAsB,wBAAwB,QAA2C;AACvF,SAAO,iBAAiB,MAAM,qBAAqB,kBAAkB,MAAM,CAAC;AAC9E;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
+
import { subscriptionsService } from "../services/subscriptions.service";
|
|
4
|
+
async function updateSubscriptionPlanAction(subscriptionId, data) {
|
|
5
|
+
return safeServerAction(async () => {
|
|
6
|
+
return subscriptionsService.updateSubscriptionPlan(subscriptionId, data);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
updateSubscriptionPlanAction
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=update-subscription-plan.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/update-subscription-plan.action.ts"],"sourcesContent":["\"use server\";\n\nimport { safeServerAction } from \"../../../utils/safeServerAction\";\nimport type { UpdateSubscriptionPlanRequest } from \"../types/calculate-subscription.type\";\nimport { subscriptionsService } from \"../services/subscriptions.service\";\n\nexport async function updateSubscriptionPlanAction(\n subscriptionId: number | string,\n data: UpdateSubscriptionPlanRequest,\n) {\n return safeServerAction(async () => {\n return subscriptionsService.updateSubscriptionPlan(subscriptionId, data);\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,eAAsB,6BACpB,gBACA,MACA;AACA,SAAO,iBAAiB,YAAY;AAClC,WAAO,qBAAqB,uBAAuB,gBAAgB,IAAI;AAAA,EACzE,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const ADDON_IDS = {
|
|
2
|
+
DOMAINS: 1,
|
|
3
|
+
PAGES: 2,
|
|
4
|
+
PROJECTS: 3,
|
|
5
|
+
AB_TEST: 4,
|
|
6
|
+
HEATMAP: 5,
|
|
7
|
+
AI: 6
|
|
8
|
+
};
|
|
9
|
+
const AI_CREDIT_OPTIONS = [
|
|
10
|
+
{ credits: 0, price: 0, priceLabel: "R$ 0,00" },
|
|
11
|
+
{ credits: 250, price: 9.99, priceLabel: "R$ 9,99" },
|
|
12
|
+
{ credits: 500, price: 19.98, priceLabel: "R$ 19,98" },
|
|
13
|
+
{ credits: 1e3, price: 39.96, priceLabel: "R$ 39,96" },
|
|
14
|
+
{ credits: 2500, price: 99.9, priceLabel: "R$ 99,90" },
|
|
15
|
+
{ credits: 5e3, price: 199.8, priceLabel: "R$ 199,80" },
|
|
16
|
+
{ credits: 1e4, price: 399.6, priceLabel: "R$ 399,60" }
|
|
17
|
+
];
|
|
18
|
+
const AI_CREDIT_VALUES = new Set(AI_CREDIT_OPTIONS.map((opt) => opt.credits));
|
|
19
|
+
export {
|
|
20
|
+
ADDON_IDS,
|
|
21
|
+
AI_CREDIT_OPTIONS,
|
|
22
|
+
AI_CREDIT_VALUES
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=addons.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/constants/addons.constants.ts"],"sourcesContent":["export const ADDON_IDS = {\r\n DOMAINS: 1,\r\n PAGES: 2,\r\n PROJECTS: 3,\r\n AB_TEST: 4,\r\n HEATMAP: 5,\r\n AI: 6,\r\n} as const;\r\n\r\nexport type AddonKindEnum = (typeof ADDON_IDS)[keyof typeof ADDON_IDS];\r\n\r\nexport interface AiCreditOption {\r\n credits: number;\r\n price: number;\r\n priceLabel: string;\r\n}\r\n\r\nexport const AI_CREDIT_OPTIONS: AiCreditOption[] = [\r\n { credits: 0, price: 0, priceLabel: 'R$ 0,00' },\r\n { credits: 250, price: 9.99, priceLabel: 'R$ 9,99' },\r\n { credits: 500, price: 19.98, priceLabel: 'R$ 19,98' },\r\n { credits: 1000, price: 39.96, priceLabel: 'R$ 39,96' },\r\n { credits: 2500, price: 99.90, priceLabel: 'R$ 99,90' },\r\n { credits: 5000, price: 199.80, priceLabel: 'R$ 199,80' },\r\n { credits: 10000, price: 399.60, priceLabel: 'R$ 399,60' },\r\n];\r\n\r\nexport const AI_CREDIT_VALUES = new Set(AI_CREDIT_OPTIONS.map((opt) => opt.credits));\r\n"],"mappings":"AAAO,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,IAAI;AACN;AAUO,MAAM,oBAAsC;AAAA,EACjD,EAAE,SAAS,GAAG,OAAO,GAAG,YAAY,UAAU;AAAA,EAC9C,EAAE,SAAS,KAAK,OAAO,MAAM,YAAY,UAAU;AAAA,EACnD,EAAE,SAAS,KAAK,OAAO,OAAO,YAAY,WAAW;AAAA,EACrD,EAAE,SAAS,KAAM,OAAO,OAAO,YAAY,WAAW;AAAA,EACtD,EAAE,SAAS,MAAM,OAAO,MAAO,YAAY,WAAW;AAAA,EACtD,EAAE,SAAS,KAAM,OAAO,OAAQ,YAAY,YAAY;AAAA,EACxD,EAAE,SAAS,KAAO,OAAO,OAAQ,YAAY,YAAY;AAC3D;AAEO,MAAM,mBAAmB,IAAI,IAAI,kBAAkB,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/constants/query-keys.constants.ts"],"sourcesContent":["export const SUBSCRIPTIONS_QUERY_KEY = ['subscriptions'];\n"],"mappings":"AAAO,MAAM,0BAA0B,CAAC,eAAe;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation } from "@tanstack/react-query";
|
|
3
|
+
import { withAction } from "../../../utils/withAction";
|
|
4
|
+
import { calculateSubscriptionAction } from "../actions/calculate-subscription.action";
|
|
5
|
+
function useCalculateSubscription() {
|
|
6
|
+
return useMutation({
|
|
7
|
+
mutationFn: (data) => withAction(calculateSubscriptionAction)(data)
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
useCalculateSubscription
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=calculate-subscription.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/calculate-subscription.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { calculateSubscriptionAction } from '../actions/calculate-subscription.action';\nimport type { CalculateSubscriptionRequest } from '../types/calculate-subscription.type';\n\nexport function useCalculateSubscription() {\n return useMutation({\n mutationFn: (data: CalculateSubscriptionRequest) =>\n withAction(calculateSubscriptionAction)(data),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,mCAAmC;AAGrC,SAAS,2BAA2B;AACzC,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,SACX,WAAW,2BAA2B,EAAE,IAAI;AAAA,EAChD,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { listSubscriptionsAction } from "../actions/list-subscriptions.action";
|
|
4
|
+
import { SUBSCRIPTIONS_QUERY_KEY } from "../constants/query-keys.constants";
|
|
5
|
+
import { withAction } from "../../../utils/withAction";
|
|
6
|
+
function useActiveSubscription() {
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: [...SUBSCRIPTIONS_QUERY_KEY, "active"],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
return await withAction(listSubscriptionsAction)({ limit: 1 });
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
useActiveSubscription
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=find-active-subscription.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/find-active-subscription.hook.ts"],"sourcesContent":["\"use client\";\n\nimport { useQuery } from \"@tanstack/react-query\";\nimport { listSubscriptionsAction } from \"../actions/list-subscriptions.action\";\nimport { SUBSCRIPTIONS_QUERY_KEY } from \"../constants/query-keys.constants\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useActiveSubscription() {\n return useQuery({\n queryKey: [...SUBSCRIPTIONS_QUERY_KEY, \"active\"],\n queryFn: async () => {\n return await withAction(listSubscriptionsAction)({ limit: 1 });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,+BAA+B;AACxC,SAAS,kBAAkB;AAEpB,SAAS,wBAAwB;AACtC,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,yBAAyB,QAAQ;AAAA,IAC/C,SAAS,YAAY;AACnB,aAAO,MAAM,WAAW,uBAAuB,EAAE,EAAE,OAAO,EAAE,CAAC;AAAA,IAC/D;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { listSubscriptionsAction } from "../actions/list-subscriptions.action";
|
|
4
|
+
import { parseResult } from "../../../infra/utils/parser";
|
|
5
|
+
import { SubscriptionSchema } from "../types/subscription.type";
|
|
6
|
+
import { withAction } from "../../../utils/withAction";
|
|
7
|
+
import { SUBSCRIPTIONS_QUERY_KEY } from "../constants/query-keys.constants";
|
|
8
|
+
function useSubscriptions(params) {
|
|
9
|
+
return useQuery({
|
|
10
|
+
queryKey: [...SUBSCRIPTIONS_QUERY_KEY, params],
|
|
11
|
+
queryFn: async () => parseResult(SubscriptionSchema, await withAction(() => listSubscriptionsAction(params))())
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
useSubscriptions
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=list-subscriptions.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/list-subscriptions.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listSubscriptionsAction } from '../actions/list-subscriptions.action';\nimport { parseResult } from '../../../infra/utils/parser';\nimport { SubscriptionSchema, type FindSubscriptionsParams } from '../types/subscription.type';\nimport { withAction } from '../../../utils/withAction';\nimport { SUBSCRIPTIONS_QUERY_KEY } from '../constants/query-keys.constants';\n\nexport function useSubscriptions(params?: Partial<FindSubscriptionsParams>) {\n return useQuery({\n queryKey: [...SUBSCRIPTIONS_QUERY_KEY, params],\n queryFn: async () =>\n parseResult(SubscriptionSchema, await withAction(() => listSubscriptionsAction(params))()),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAAS,0BAAwD;AACjE,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B;AAEjC,SAAS,iBAAiB,QAA2C;AAC1E,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,yBAAyB,MAAM;AAAA,IAC7C,SAAS,YACP,YAAY,oBAAoB,MAAM,WAAW,MAAM,wBAAwB,MAAM,CAAC,EAAE,CAAC;AAAA,EAC7F,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { withAction } from "../../../utils/withAction";
|
|
4
|
+
import { updateSubscriptionPlanAction } from "../actions/update-subscription-plan.action";
|
|
5
|
+
import { SUBSCRIPTIONS_QUERY_KEY } from "../constants/query-keys.constants";
|
|
6
|
+
function useUpdateSubscriptionPlan() {
|
|
7
|
+
const queryClient = useQueryClient();
|
|
8
|
+
return useMutation({
|
|
9
|
+
mutationFn: ({
|
|
10
|
+
subscriptionId,
|
|
11
|
+
data
|
|
12
|
+
}) => withAction(updateSubscriptionPlanAction)(subscriptionId, data),
|
|
13
|
+
onSuccess: () => {
|
|
14
|
+
queryClient.invalidateQueries({ queryKey: SUBSCRIPTIONS_QUERY_KEY });
|
|
15
|
+
queryClient.invalidateQueries({ queryKey: ["charges"] });
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
useUpdateSubscriptionPlan
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=update-subscription-plan.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/update-subscription-plan.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { updateSubscriptionPlanAction } from '../actions/update-subscription-plan.action';\nimport { SUBSCRIPTIONS_QUERY_KEY } from '../constants/query-keys.constants';\nimport type { UpdateSubscriptionPlanRequest } from '../types/calculate-subscription.type';\n\nexport function useUpdateSubscriptionPlan() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: ({\n subscriptionId,\n data,\n }: {\n subscriptionId: number | string;\n data: UpdateSubscriptionPlanRequest;\n }) => withAction(updateSubscriptionPlanAction)(subscriptionId, data),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: SUBSCRIPTIONS_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: ['charges'] });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AAGjC,SAAS,4BAA4B;AAC1C,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGM,WAAW,4BAA4B,EAAE,gBAAgB,IAAI;AAAA,IACnE,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AACnE,kBAAY,kBAAkB,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC;AAAA,IACzD;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { UserProfile } from "../../users/schema";
|
|
4
|
+
import { useAuth } from "../../../providers/auth.provider";
|
|
5
|
+
import { useModalManager } from "../../../store/useModalManager";
|
|
6
|
+
import { useActiveSubscription } from "./find-active-subscription.hook";
|
|
7
|
+
import { hasSubscriptionExpired } from "../utils/has-subscription-expired";
|
|
8
|
+
function useCancelledSubscriptionGuard() {
|
|
9
|
+
const { user } = useAuth();
|
|
10
|
+
const { openModal } = useModalManager();
|
|
11
|
+
const {
|
|
12
|
+
data: { data: [subscription] = [] } = {}
|
|
13
|
+
} = useActiveSubscription();
|
|
14
|
+
const isViewer = user?.profile === UserProfile.viewer;
|
|
15
|
+
const isCancelledSubscription = hasSubscriptionExpired(subscription?.date_due);
|
|
16
|
+
const shouldBlockManagementAction = !isViewer && isCancelledSubscription;
|
|
17
|
+
const guardAction = useCallback(
|
|
18
|
+
(action) => {
|
|
19
|
+
if (shouldBlockManagementAction) {
|
|
20
|
+
openModal("subscriptionExpiredModal");
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
action?.();
|
|
24
|
+
return true;
|
|
25
|
+
},
|
|
26
|
+
[openModal, shouldBlockManagementAction]
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
isCancelledSubscription,
|
|
30
|
+
shouldBlockManagementAction,
|
|
31
|
+
guardAction
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
useCancelledSubscriptionGuard
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=use-cancelled-subscription-guard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/use-cancelled-subscription-guard.ts"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\nimport { UserProfile } from '../../users/schema';\nimport { useAuth } from '../../../providers/auth.provider';\nimport { useModalManager } from '../../../store/useModalManager';\nimport { useActiveSubscription } from './find-active-subscription.hook';\nimport { hasSubscriptionExpired } from '../utils/has-subscription-expired';\n\nexport function useCancelledSubscriptionGuard() {\n const { user } = useAuth();\n const { openModal } = useModalManager();\n const {\n data: { data: [subscription] = [] } = {},\n } = useActiveSubscription();\n\n const isViewer = user?.profile === UserProfile.viewer;\n const isCancelledSubscription = hasSubscriptionExpired(subscription?.date_due);\n const shouldBlockManagementAction = !isViewer && isCancelledSubscription;\n\n const guardAction = useCallback(\n (action?: () => void) => {\n if (shouldBlockManagementAction) {\n openModal('subscriptionExpiredModal');\n return false;\n }\n\n action?.();\n return true;\n },\n [openModal, shouldBlockManagementAction]\n );\n\n return {\n isCancelledSubscription,\n shouldBlockManagementAction,\n guardAction,\n };\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AAEhC,SAAS,gCAAgC;AAC9C,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM;AAAA,IACJ,MAAM,EAAE,MAAM,CAAC,YAAY,IAAI,CAAC,EAAE,IAAI,CAAC;AAAA,EACzC,IAAI,sBAAsB;AAE1B,QAAM,WAAW,MAAM,YAAY,YAAY;AAC/C,QAAM,0BAA0B,uBAAuB,cAAc,QAAQ;AAC7E,QAAM,8BAA8B,CAAC,YAAY;AAEjD,QAAM,cAAc;AAAA,IAClB,CAAC,WAAwB;AACvB,UAAI,6BAA6B;AAC/B,kBAAU,0BAA0B;AACpC,eAAO;AAAA,MACT;AAEA,eAAS;AACT,aAAO;AAAA,IACT;AAAA,IACA,CAAC,WAAW,2BAA2B;AAAA,EACzC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { api } from "../../../infra/api/client";
|
|
3
|
+
import {
|
|
4
|
+
ApiError
|
|
5
|
+
} from "../../../infra/api/types";
|
|
6
|
+
import { buildQueryParams } from "../../../infra/utils/params";
|
|
7
|
+
import { getUserContext } from "../../auth/utils/get-user-context";
|
|
8
|
+
import {
|
|
9
|
+
SubscriptionSchema
|
|
10
|
+
} from "../types/subscription.type";
|
|
11
|
+
import {
|
|
12
|
+
CalculateSubscriptionResponseSchema
|
|
13
|
+
} from "../types/calculate-subscription.type";
|
|
14
|
+
class SubscriptionsService {
|
|
15
|
+
async listSubscriptions(params) {
|
|
16
|
+
const { id_account } = await getUserContext();
|
|
17
|
+
const query = buildQueryParams(
|
|
18
|
+
params
|
|
19
|
+
);
|
|
20
|
+
const url = `/accounts/${id_account}/subscriptions${query ? `?${query}` : ""}`;
|
|
21
|
+
const response = await api.apps.get(url);
|
|
22
|
+
if (response.status === 0) {
|
|
23
|
+
throw new ApiError(
|
|
24
|
+
response.message || "Erro ao listar assinaturas",
|
|
25
|
+
"LIST_SUBSCRIPTIONS_FAILED",
|
|
26
|
+
400
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const data = response.data.map((item) => SubscriptionSchema.parse(item));
|
|
30
|
+
return {
|
|
31
|
+
data,
|
|
32
|
+
total: response.total,
|
|
33
|
+
success: true
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async calculateSubscription(data) {
|
|
37
|
+
const { id_account } = await getUserContext();
|
|
38
|
+
const response = await api.apps.post(`/accounts/${id_account}/subscriptions/action/calculate`, data);
|
|
39
|
+
console.log("Calculate subscription response:", {
|
|
40
|
+
response,
|
|
41
|
+
data: JSON.stringify(data, null, 2)
|
|
42
|
+
});
|
|
43
|
+
if (response.status === 0) {
|
|
44
|
+
throw new ApiError(
|
|
45
|
+
response.message || "Erro ao calcular assinatura",
|
|
46
|
+
"CALCULATE_SUBSCRIPTION_FAILED",
|
|
47
|
+
400
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
success: true,
|
|
52
|
+
data: CalculateSubscriptionResponseSchema.parse(response.data)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async updateSubscriptionPlan(subscriptionId, data) {
|
|
56
|
+
const { id_account } = await getUserContext();
|
|
57
|
+
const response = await api.apps.put(
|
|
58
|
+
`/accounts/${id_account}/subscriptions/${subscriptionId}/action/plan`,
|
|
59
|
+
data
|
|
60
|
+
);
|
|
61
|
+
if (response.status === 0) {
|
|
62
|
+
throw new ApiError(
|
|
63
|
+
response.message || "Erro ao atualizar plano",
|
|
64
|
+
"UPDATE_SUBSCRIPTION_PLAN_FAILED",
|
|
65
|
+
400
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return { success: true };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const subscriptionsService = new SubscriptionsService();
|
|
72
|
+
export {
|
|
73
|
+
subscriptionsService
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=subscriptions.service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/services/subscriptions.service.ts"],"sourcesContent":["import \"server-only\";\r\n\r\nimport { api } from \"../../../infra/api/client\";\r\nimport {\r\n ApiError,\r\n ApiActionResult,\r\n ApiPaginatedActionResult,\r\n PaginatedSuccessResult,\r\n SuccessResult,\r\n} from \"../../../infra/api/types\";\r\nimport { buildQueryParams } from \"../../../infra/utils/params\";\r\nimport { getUserContext } from \"../../auth/utils/get-user-context\";\r\nimport {\r\n Subscription,\r\n SubscriptionSchema,\r\n FindSubscriptionsParams,\r\n} from \"../types/subscription.type\";\r\nimport {\r\n type CalculateSubscriptionRequest,\r\n type CalculateSubscriptionResponse,\r\n type UpdateSubscriptionPlanRequest,\r\n CalculateSubscriptionResponseSchema,\r\n} from \"../types/calculate-subscription.type\";\r\n\r\nclass SubscriptionsService {\r\n async listSubscriptions(\r\n params?: Partial<FindSubscriptionsParams>,\r\n ): Promise<PaginatedSuccessResult<Subscription>> {\r\n const { id_account } = await getUserContext();\r\n\r\n const query = buildQueryParams(\r\n params as Record<string, string | boolean | undefined>,\r\n );\r\n const url = `/accounts/${id_account}/subscriptions${query ? `?${query}` : \"\"}`;\r\n\r\n const response =\r\n await api.apps.get<ApiPaginatedActionResult<Subscription>>(url);\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || \"Erro ao listar assinaturas\",\r\n \"LIST_SUBSCRIPTIONS_FAILED\",\r\n 400,\r\n );\r\n }\r\n\r\n const data = response.data.map((item) => SubscriptionSchema.parse(item));\r\n\r\n return {\r\n data,\r\n total: response.total,\r\n success: true,\r\n } satisfies PaginatedSuccessResult<Subscription>;\r\n }\r\n\r\n async calculateSubscription(\r\n data: CalculateSubscriptionRequest,\r\n ): Promise<SuccessResult<CalculateSubscriptionResponse>> {\r\n const { id_account } = await getUserContext();\r\n\r\n const response = await api.apps.post<\r\n ApiActionResult<CalculateSubscriptionResponse>\r\n >(`/accounts/${id_account}/subscriptions/action/calculate`, data);\r\n\r\n console.log(\"Calculate subscription response:\", {\r\n response,\r\n data: JSON.stringify(data, null, 2),\r\n });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || \"Erro ao calcular assinatura\",\r\n \"CALCULATE_SUBSCRIPTION_FAILED\",\r\n 400,\r\n );\r\n }\r\n\r\n return {\r\n success: true,\r\n data: CalculateSubscriptionResponseSchema.parse(response.data),\r\n };\r\n }\r\n\r\n async updateSubscriptionPlan(\r\n subscriptionId: number | string,\r\n data: UpdateSubscriptionPlanRequest,\r\n ): Promise<SuccessResult<void>> {\r\n const { id_account } = await getUserContext();\r\n\r\n const response = await api.apps.put<ApiActionResult<void>>(\r\n `/accounts/${id_account}/subscriptions/${subscriptionId}/action/plan`,\r\n data,\r\n );\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || \"Erro ao atualizar plano\",\r\n \"UPDATE_SUBSCRIPTION_PLAN_FAILED\",\r\n 400,\r\n );\r\n }\r\n\r\n return { success: true };\r\n }\r\n}\r\n\r\nexport const subscriptionsService = new SubscriptionsService();\r\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,OAKK;AACP,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EAEE;AAAA,OAEK;AACP;AAAA,EAIE;AAAA,OACK;AAEP,MAAM,qBAAqB;AAAA,EACzB,MAAM,kBACJ,QAC+C;AAC/C,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,QAAQ;AAAA,MACZ;AAAA,IACF;AACA,UAAM,MAAM,aAAa,UAAU,iBAAiB,QAAQ,IAAI,KAAK,KAAK,EAAE;AAE5E,UAAM,WACJ,MAAM,IAAI,KAAK,IAA4C,GAAG;AAEhE,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,UAAM,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,mBAAmB,MAAM,IAAI,CAAC;AAEvE,WAAO;AAAA,MACL;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EAEA,MAAM,sBACJ,MACuD;AACvD,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,WAAW,MAAM,IAAI,KAAK,KAE9B,aAAa,UAAU,mCAAmC,IAAI;AAEhE,YAAQ,IAAI,oCAAoC;AAAA,MAC9C;AAAA,MACA,MAAM,KAAK,UAAU,MAAM,MAAM,CAAC;AAAA,IACpC,CAAC;AAED,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM,oCAAoC,MAAM,SAAS,IAAI;AAAA,IAC/D;AAAA,EACF;AAAA,EAEA,MAAM,uBACJ,gBACA,MAC8B;AAC9B,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,kBAAkB,cAAc;AAAA,MACvD;AAAA,IACF;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,EAAE,SAAS,KAAK;AAAA,EACzB;AACF;AAEO,MAAM,uBAAuB,IAAI,qBAAqB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=billing-period.type.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
const CalculateSubscriptionPlanExtraRequestSchema = z.object({
|
|
3
|
+
id_addon: z.number(),
|
|
4
|
+
value: z.number(),
|
|
5
|
+
quantity: z.number(),
|
|
6
|
+
currency: z.string()
|
|
7
|
+
});
|
|
8
|
+
const CalculateSubscriptionRequestSchema = z.object({
|
|
9
|
+
id_product: z.number(),
|
|
10
|
+
id_plan: z.number().optional(),
|
|
11
|
+
id_subscription: z.union([z.number(), z.string()]).optional(),
|
|
12
|
+
id_coupon: z.number().optional(),
|
|
13
|
+
plan_extras: z.array(CalculateSubscriptionPlanExtraRequestSchema.partial({ value: true })).optional()
|
|
14
|
+
});
|
|
15
|
+
const CalculateSubscriptionPlanExtraResponseSchema = z.object({
|
|
16
|
+
id_addon: z.number(),
|
|
17
|
+
value: z.number(),
|
|
18
|
+
value_original: z.number().optional().default(0),
|
|
19
|
+
value_discount: z.number().optional().default(0),
|
|
20
|
+
quantity: z.number(),
|
|
21
|
+
currency: z.string()
|
|
22
|
+
});
|
|
23
|
+
const CalculateSubscriptionResponseSchema = z.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
month: z.number(),
|
|
26
|
+
month_discount: z.number(),
|
|
27
|
+
month_discount_coupom: z.number().optional().default(0),
|
|
28
|
+
month_original: z.number(),
|
|
29
|
+
month_original_discount: z.number().optional().default(0),
|
|
30
|
+
month_original_discount_cupom: z.number().optional().default(0),
|
|
31
|
+
semmester: z.number(),
|
|
32
|
+
semmester_price: z.number().optional().default(0),
|
|
33
|
+
semmester_discount: z.number(),
|
|
34
|
+
semmester_discount_coupom: z.number().optional().default(0),
|
|
35
|
+
semmester_original: z.number(),
|
|
36
|
+
semmester_original_discount: z.number().optional().default(0),
|
|
37
|
+
semmester_original_discount_cupom: z.number().optional().default(0),
|
|
38
|
+
year: z.number(),
|
|
39
|
+
year_discount: z.number(),
|
|
40
|
+
year_discount_coupom: z.number().optional().default(0),
|
|
41
|
+
year_original: z.number(),
|
|
42
|
+
year_original_discount: z.number().optional().default(0),
|
|
43
|
+
year_original_discount_cupom: z.number().optional().default(0),
|
|
44
|
+
plan_extras: z.array(CalculateSubscriptionPlanExtraResponseSchema)
|
|
45
|
+
});
|
|
46
|
+
const UpdateSubscriptionPlanExtraSchema = z.object({
|
|
47
|
+
id_addon: z.number(),
|
|
48
|
+
value: z.number().optional(),
|
|
49
|
+
quantity: z.number(),
|
|
50
|
+
price: z.string().optional(),
|
|
51
|
+
trial: z.boolean().optional(),
|
|
52
|
+
trial_days: z.number().optional()
|
|
53
|
+
});
|
|
54
|
+
const UpdateSubscriptionPlanRequestSchema = z.object({
|
|
55
|
+
id_plan: z.number().optional(),
|
|
56
|
+
id_coupon: z.union([z.number(), z.null()]).optional(),
|
|
57
|
+
date_due: z.string().optional(),
|
|
58
|
+
type: z.string().optional(),
|
|
59
|
+
active: z.boolean().optional(),
|
|
60
|
+
periodicity: z.number().optional(),
|
|
61
|
+
plan_extras: z.array(UpdateSubscriptionPlanExtraSchema).optional(),
|
|
62
|
+
enable_charge: z.boolean().optional()
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
CalculateSubscriptionPlanExtraRequestSchema,
|
|
66
|
+
CalculateSubscriptionPlanExtraResponseSchema,
|
|
67
|
+
CalculateSubscriptionRequestSchema,
|
|
68
|
+
CalculateSubscriptionResponseSchema,
|
|
69
|
+
UpdateSubscriptionPlanExtraSchema,
|
|
70
|
+
UpdateSubscriptionPlanRequestSchema
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=calculate-subscription.type.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/types/calculate-subscription.type.ts"],"sourcesContent":["import z from 'zod';\n\nexport const CalculateSubscriptionPlanExtraRequestSchema = z.object({\n id_addon: z.number(),\n value: z.number(),\n quantity: z.number(),\n currency: z.string(),\n});\n\nexport const CalculateSubscriptionRequestSchema = z.object({\n id_product: z.number(),\n id_plan: z.number().optional(),\n id_subscription: z.union([z.number(), z.string()]).optional(),\n id_coupon: z.number().optional(),\n plan_extras: z.array(CalculateSubscriptionPlanExtraRequestSchema.partial({ value: true })).optional(),\n});\n\nexport type CalculateSubscriptionRequest = z.infer<typeof CalculateSubscriptionRequestSchema>;\n\nexport const CalculateSubscriptionPlanExtraResponseSchema = z.object({\n id_addon: z.number(),\n value: z.number(),\n value_original: z.number().optional().default(0),\n value_discount: z.number().optional().default(0),\n quantity: z.number(),\n currency: z.string(),\n});\n\nexport const CalculateSubscriptionResponseSchema = z.object({\n name: z.string(),\n month: z.number(),\n month_discount: z.number(),\n month_discount_coupom: z.number().optional().default(0),\n month_original: z.number(),\n month_original_discount: z.number().optional().default(0),\n month_original_discount_cupom: z.number().optional().default(0),\n semmester: z.number(),\n semmester_price: z.number().optional().default(0),\n semmester_discount: z.number(),\n semmester_discount_coupom: z.number().optional().default(0),\n semmester_original: z.number(),\n semmester_original_discount: z.number().optional().default(0),\n semmester_original_discount_cupom: z.number().optional().default(0),\n year: z.number(),\n year_discount: z.number(),\n year_discount_coupom: z.number().optional().default(0),\n year_original: z.number(),\n year_original_discount: z.number().optional().default(0),\n year_original_discount_cupom: z.number().optional().default(0),\n plan_extras: z.array(CalculateSubscriptionPlanExtraResponseSchema),\n});\n\nexport type CalculateSubscriptionResponse = z.infer<typeof CalculateSubscriptionResponseSchema>;\n\nexport const UpdateSubscriptionPlanExtraSchema = z.object({\n id_addon: z.number(),\n value: z.number().optional(),\n quantity: z.number(),\n price: z.string().optional(),\n trial: z.boolean().optional(),\n trial_days: z.number().optional(),\n});\n\nexport const UpdateSubscriptionPlanRequestSchema = z.object({\n id_plan: z.number().optional(),\n id_coupon: z.union([z.number(), z.null()]).optional(),\n date_due: z.string().optional(),\n type: z.string().optional(),\n active: z.boolean().optional(),\n periodicity: z.number().optional(),\n plan_extras: z.array(UpdateSubscriptionPlanExtraSchema).optional(),\n enable_charge: z.boolean().optional(),\n});\n\nexport type UpdateSubscriptionPlanRequest = z.infer<typeof UpdateSubscriptionPlanRequestSchema>;\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
const SubscriptionItemSchema = z.object({
|
|
3
|
+
id: z.union([z.number(), z.string()]),
|
|
4
|
+
deleted: z.number(),
|
|
5
|
+
datetime_alt: z.coerce.date().nullable().optional(),
|
|
6
|
+
datetime_del: z.coerce.date().nullable().optional(),
|
|
7
|
+
datetime_add: z.coerce.date(),
|
|
8
|
+
id_wl: z.number(),
|
|
9
|
+
id_subscription: z.union([z.number(), z.string()]),
|
|
10
|
+
id_addon: z.number().nullable(),
|
|
11
|
+
addon_name: z.string().optional(),
|
|
12
|
+
value: z.number(),
|
|
13
|
+
currency: z.string(),
|
|
14
|
+
quantity: z.number(),
|
|
15
|
+
payment_status: z.number(),
|
|
16
|
+
id_charge: z.union([z.number(), z.string()]).nullable(),
|
|
17
|
+
trial: z.boolean(),
|
|
18
|
+
trial_ends_at: z.coerce.date().nullable().optional()
|
|
19
|
+
});
|
|
20
|
+
const SubscriptionSchema = z.object({
|
|
21
|
+
id: z.union([z.number(), z.string()]),
|
|
22
|
+
deleted: z.number(),
|
|
23
|
+
datetime_alt: z.coerce.date().nullable().optional(),
|
|
24
|
+
datetime_del: z.coerce.date().nullable().optional(),
|
|
25
|
+
datetime_add: z.coerce.date(),
|
|
26
|
+
id_wl: z.number(),
|
|
27
|
+
id_account: z.union([z.number(), z.string()]),
|
|
28
|
+
id_card: z.union([z.number(), z.string()]).nullable(),
|
|
29
|
+
id_coupon: z.union([z.number(), z.string()]).nullable(),
|
|
30
|
+
type: z.string(),
|
|
31
|
+
payment_method: z.number().nullable(),
|
|
32
|
+
periodicity: z.coerce.number().nullable(),
|
|
33
|
+
value: z.number().nullable(),
|
|
34
|
+
id_product: z.number(),
|
|
35
|
+
id_plan: z.number(),
|
|
36
|
+
plan_name: z.string().nullable().optional(),
|
|
37
|
+
id_gateway: z.union([z.number(), z.string()]).nullable(),
|
|
38
|
+
gateway_account: z.string().nullable(),
|
|
39
|
+
date_hiring: z.coerce.date().nullable(),
|
|
40
|
+
date_due: z.coerce.date(),
|
|
41
|
+
date_cancellation: z.coerce.date().nullable(),
|
|
42
|
+
date_verification: z.coerce.date().nullable(),
|
|
43
|
+
cancellation_reason: z.string().nullable(),
|
|
44
|
+
cancellation_description: z.string().nullable(),
|
|
45
|
+
active: z.boolean(),
|
|
46
|
+
charged: z.boolean(),
|
|
47
|
+
datetime_last_update_periodicity: z.coerce.date().nullable().optional(),
|
|
48
|
+
card_name: z.string().nullable().optional(),
|
|
49
|
+
card_brand: z.string().nullable().optional(),
|
|
50
|
+
card_number: z.string().nullable().optional(),
|
|
51
|
+
items: z.array(SubscriptionItemSchema)
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
SubscriptionItemSchema,
|
|
55
|
+
SubscriptionSchema
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=subscription.type.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/types/subscription.type.ts"],"sourcesContent":["import z from 'zod';\r\n\r\nexport const SubscriptionItemSchema = z.object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_alt: z.coerce.date().nullable().optional(),\r\n datetime_del: z.coerce.date().nullable().optional(),\r\n datetime_add: z.coerce.date(),\r\n id_wl: z.number(),\r\n id_subscription: z.union([z.number(), z.string()]),\r\n id_addon: z.number().nullable(),\r\n addon_name: z.string().optional(),\r\n value: z.number(),\r\n currency: z.string(),\r\n quantity: z.number(),\r\n payment_status: z.number(),\r\n id_charge: z.union([z.number(), z.string()]).nullable(),\r\n trial: z.boolean(),\r\n trial_ends_at: z.coerce.date().nullable().optional(),\r\n});\r\n\r\nexport type SubscriptionItem = z.infer<typeof SubscriptionItemSchema>;\r\n\r\nexport const SubscriptionSchema = z.object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_alt: z.coerce.date().nullable().optional(),\r\n datetime_del: z.coerce.date().nullable().optional(),\r\n datetime_add: z.coerce.date(),\r\n id_wl: z.number(),\r\n id_account: z.union([z.number(), z.string()]),\r\n id_card: z.union([z.number(), z.string()]).nullable(),\r\n id_coupon: z.union([z.number(), z.string()]).nullable(),\r\n type: z.string(),\r\n payment_method: z.number().nullable(),\r\n periodicity: z.coerce.number().nullable(),\r\n value: z.number().nullable(),\r\n id_product: z.number(),\r\n id_plan: z.number(),\r\n plan_name: z.string().nullable().optional(),\r\n id_gateway: z.union([z.number(), z.string()]).nullable(),\r\n gateway_account: z.string().nullable(),\r\n date_hiring: z.coerce.date().nullable(),\r\n date_due: z.coerce.date(),\r\n date_cancellation: z.coerce.date().nullable(),\r\n date_verification: z.coerce.date().nullable(),\r\n cancellation_reason: z.string().nullable(),\r\n cancellation_description: z.string().nullable(),\r\n active: z.boolean(),\r\n charged: z.boolean(),\r\n datetime_last_update_periodicity: z.coerce.date().nullable().optional(),\r\n card_name: z.string().nullable().optional(),\r\n card_brand: z.string().nullable().optional(),\r\n card_number: z.string().nullable().optional(),\r\n items: z.array(SubscriptionItemSchema),\r\n});\r\n\r\nexport type Subscription = z.infer<typeof SubscriptionSchema>;\r\n\r\nexport interface FindSubscriptionsParams {\r\n active?: boolean;\r\n trial?: boolean;\r\n date_start?: string;\r\n date_end?: string;\r\n date_hiring_start?: string;\r\n date_hiring_end?: string;\r\n limit?: number;\r\n}\r\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function buildPlanExtras(items, overrides) {
|
|
2
|
+
const overrideMap = new Map(overrides.map((o) => [o.id_addon, o]));
|
|
3
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4
|
+
const extras = [];
|
|
5
|
+
for (const item of items) {
|
|
6
|
+
if (item.id_addon == null || seen.has(item.id_addon)) continue;
|
|
7
|
+
seen.add(item.id_addon);
|
|
8
|
+
const override = overrideMap.get(item.id_addon);
|
|
9
|
+
if (override) {
|
|
10
|
+
overrideMap.delete(item.id_addon);
|
|
11
|
+
extras.push({
|
|
12
|
+
id_addon: override.id_addon,
|
|
13
|
+
quantity: override.quantity,
|
|
14
|
+
currency: override.currency
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
extras.push({
|
|
18
|
+
id_addon: item.id_addon,
|
|
19
|
+
value: item.value,
|
|
20
|
+
quantity: item.quantity,
|
|
21
|
+
currency: item.currency
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const override of overrideMap.values()) {
|
|
26
|
+
extras.push({
|
|
27
|
+
id_addon: override.id_addon,
|
|
28
|
+
quantity: override.quantity,
|
|
29
|
+
currency: override.currency
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return extras;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
buildPlanExtras
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=build-plan-extras.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/build-plan-extras.ts"],"sourcesContent":["import type { SubscriptionItem } from '../types/subscription.type';\n\nexport interface PlanExtraOverride {\n id_addon: number;\n quantity: number;\n currency: string;\n}\n\nexport interface PlanExtra {\n id_addon: number;\n value?: number;\n quantity: number;\n currency: string;\n}\n\nexport function buildPlanExtras(\n items: SubscriptionItem[],\n overrides: PlanExtraOverride[]\n): PlanExtra[] {\n const overrideMap = new Map(overrides.map((o) => [o.id_addon, o]));\n const seen = new Set<number>();\n\n const extras: PlanExtra[] = [];\n\n for (const item of items) {\n if (item.id_addon == null || seen.has(item.id_addon)) continue;\n seen.add(item.id_addon);\n\n const override = overrideMap.get(item.id_addon);\n if (override) {\n overrideMap.delete(item.id_addon);\n extras.push({\n id_addon: override.id_addon,\n quantity: override.quantity,\n currency: override.currency,\n });\n } else {\n extras.push({\n id_addon: item.id_addon,\n value: item.value,\n quantity: item.quantity,\n currency: item.currency,\n });\n }\n }\n\n for (const override of overrideMap.values()) {\n extras.push({\n id_addon: override.id_addon,\n quantity: override.quantity,\n currency: override.currency,\n });\n }\n\n return extras;\n}\n"],"mappings":"AAeO,SAAS,gBACd,OACA,WACa;AACb,QAAM,cAAc,IAAI,IAAI,UAAU,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AACjE,QAAM,OAAO,oBAAI,IAAY;AAE7B,QAAM,SAAsB,CAAC;AAE7B,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,YAAY,QAAQ,KAAK,IAAI,KAAK,QAAQ,EAAG;AACtD,SAAK,IAAI,KAAK,QAAQ;AAEtB,UAAM,WAAW,YAAY,IAAI,KAAK,QAAQ;AAC9C,QAAI,UAAU;AACZ,kBAAY,OAAO,KAAK,QAAQ;AAChC,aAAO,KAAK;AAAA,QACV,UAAU,SAAS;AAAA,QACnB,UAAU,SAAS;AAAA,QACnB,UAAU,SAAS;AAAA,MACrB,CAAC;AAAA,IACH,OAAO;AACL,aAAO,KAAK;AAAA,QACV,UAAU,KAAK;AAAA,QACf,OAAO,KAAK;AAAA,QACZ,UAAU,KAAK;AAAA,QACf,UAAU,KAAK;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAEA,aAAW,YAAY,YAAY,OAAO,GAAG;AAC3C,WAAO,KAAK;AAAA,MACV,UAAU,SAAS;AAAA,MACnB,UAAU,SAAS;AAAA,MACnB,UAAU,SAAS;AAAA,IACrB,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function hasSubscriptionExpired(dateDue) {
|
|
2
|
+
if (!dateDue) return false;
|
|
3
|
+
const dueDate = new Date(dateDue);
|
|
4
|
+
dueDate.setHours(23, 59, 59, 999);
|
|
5
|
+
return Date.now() > dueDate.getTime();
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
hasSubscriptionExpired
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=has-subscription-expired.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/has-subscription-expired.ts"],"sourcesContent":["export function hasSubscriptionExpired(dateDue: Date | null | undefined) {\n if (!dateDue) return false;\n\n const dueDate = new Date(dateDue);\n dueDate.setHours(23, 59, 59, 999);\n\n return Date.now() > dueDate.getTime();\n}\n"],"mappings":"AAAO,SAAS,uBAAuB,SAAkC;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,QAAM,UAAU,IAAI,KAAK,OAAO;AAChC,UAAQ,SAAS,IAAI,IAAI,IAAI,GAAG;AAEhC,SAAO,KAAK,IAAI,IAAI,QAAQ,QAAQ;AACtC;","names":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function periodicityToBillingPeriod(periodicity) {
|
|
2
|
+
if (periodicity === 30 || periodicity === 1 || periodicity === "monthly") return "monthly";
|
|
3
|
+
if (periodicity === 180 || periodicity === 3 || periodicity === "semiannual") return "semiannual";
|
|
4
|
+
if (periodicity === 365 || periodicity === 2 || periodicity === "annual") return "annual";
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
function billingPeriodToNumeric(billingPeriod) {
|
|
8
|
+
if (billingPeriod === "semiannual") return 180;
|
|
9
|
+
if (billingPeriod === "annual") return 365;
|
|
10
|
+
return 30;
|
|
11
|
+
}
|
|
12
|
+
function getPeriodicityLabel(periodicity) {
|
|
13
|
+
const period = periodicityToBillingPeriod(periodicity);
|
|
14
|
+
if (period === "semiannual") return "Semestral";
|
|
15
|
+
if (period === "annual") return "Anual";
|
|
16
|
+
return "Mensal";
|
|
17
|
+
}
|
|
18
|
+
function getBillingPeriodSuffix(billingPeriod) {
|
|
19
|
+
if (billingPeriod === "semiannual") return "/semestre";
|
|
20
|
+
if (billingPeriod === "annual") return "/ano";
|
|
21
|
+
return "/m\xEAs";
|
|
22
|
+
}
|
|
23
|
+
function getBillingPeriodLabel(billingPeriod) {
|
|
24
|
+
if (billingPeriod === "semiannual") return "semestral";
|
|
25
|
+
if (billingPeriod === "annual") return "anual";
|
|
26
|
+
return "mensal";
|
|
27
|
+
}
|
|
28
|
+
function getBillingPeriodMonths(billingPeriod) {
|
|
29
|
+
if (billingPeriod === "semiannual") return 6;
|
|
30
|
+
if (billingPeriod === "annual") return 12;
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
function getPriceFromCalculatedData(data, periodicity) {
|
|
34
|
+
const period = periodicityToBillingPeriod(periodicity);
|
|
35
|
+
if (period === "annual") return data.year;
|
|
36
|
+
if (period === "semiannual") return data.semmester;
|
|
37
|
+
return data.month;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
billingPeriodToNumeric,
|
|
41
|
+
getBillingPeriodLabel,
|
|
42
|
+
getBillingPeriodMonths,
|
|
43
|
+
getBillingPeriodSuffix,
|
|
44
|
+
getPeriodicityLabel,
|
|
45
|
+
getPriceFromCalculatedData,
|
|
46
|
+
periodicityToBillingPeriod
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=periodicity.mjs.map
|