@greatapps/common 1.1.593 → 1.1.595
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/index.mjs +14 -0
- package/dist/index.mjs.map +1 -1
- package/dist/modules/auth/hooks/useManagementPermissions.mjs +2 -2
- package/dist/modules/auth/hooks/useManagementPermissions.mjs.map +1 -1
- package/dist/modules/auth/utils/assert-management-permission.mjs +2 -2
- package/dist/modules/auth/utils/assert-management-permission.mjs.map +1 -1
- package/dist/modules/charges/actions/charge-action.action.mjs +14 -0
- package/dist/modules/charges/actions/charge-action.action.mjs.map +1 -0
- package/dist/modules/charges/actions/find-charge-by-id.action.mjs +10 -0
- package/dist/modules/charges/actions/find-charge-by-id.action.mjs.map +1 -0
- package/dist/modules/charges/actions/list-charges.action.mjs +10 -0
- package/dist/modules/charges/actions/list-charges.action.mjs.map +1 -0
- package/dist/modules/charges/hooks/charge-action.hook.mjs +23 -0
- package/dist/modules/charges/hooks/charge-action.hook.mjs.map +1 -0
- package/dist/modules/charges/hooks/charge-by-id.hook.mjs +18 -0
- package/dist/modules/charges/hooks/charge-by-id.hook.mjs.map +1 -0
- package/dist/modules/charges/hooks/charges.hook.mjs +18 -0
- package/dist/modules/charges/hooks/charges.hook.mjs.map +1 -0
- package/dist/modules/charges/services/charges.service.mjs +59 -0
- package/dist/modules/charges/services/charges.service.mjs.map +1 -0
- package/dist/modules/charges/types/charge.type.mjs +58 -0
- package/dist/modules/charges/types/charge.type.mjs.map +1 -0
- package/dist/server.mjs +8 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +13 -0
- package/src/modules/auth/hooks/useManagementPermissions.ts +2 -2
- package/src/modules/auth/utils/assert-management-permission.ts +2 -2
- package/src/modules/charges/actions/charge-action.action.ts +13 -0
- package/src/modules/charges/actions/find-charge-by-id.action.ts +8 -0
- package/src/modules/charges/actions/list-charges.action.ts +9 -0
- package/src/modules/charges/hooks/charge-action.hook.ts +24 -0
- package/src/modules/charges/hooks/charge-by-id.hook.ts +17 -0
- package/src/modules/charges/hooks/charges.hook.ts +18 -0
- package/src/modules/charges/services/charges.service.ts +71 -0
- package/src/modules/charges/types/charge.type.ts +67 -0
- package/src/server.ts +4 -0
package/dist/index.mjs
CHANGED
|
@@ -62,6 +62,9 @@ import { useSetDefaultCard } from "./modules/cards/hooks/set-default-card.hook";
|
|
|
62
62
|
import { useDeleteCard } from "./modules/cards/hooks/delete-card.hook";
|
|
63
63
|
import { useDeleteConfirmation } from "./modules/cards/hooks/delete-confirmation.hook";
|
|
64
64
|
import { useHandleDeleteCard } from "./modules/cards/hooks/handle-delete-card.hook";
|
|
65
|
+
import { useCharges } from "./modules/charges/hooks/charges.hook";
|
|
66
|
+
import { useChargeById } from "./modules/charges/hooks/charge-by-id.hook";
|
|
67
|
+
import { useChargeAction } from "./modules/charges/hooks/charge-action.hook";
|
|
65
68
|
import { useIaCredits } from "./modules/ia-credits/hooks/ia-credits.hook";
|
|
66
69
|
import {
|
|
67
70
|
SubscriptionSchema,
|
|
@@ -83,6 +86,11 @@ import {
|
|
|
83
86
|
CreateCardRequestSchema,
|
|
84
87
|
FindCardsParamsSchema
|
|
85
88
|
} from "./modules/cards/types";
|
|
89
|
+
import {
|
|
90
|
+
ChargeSchema,
|
|
91
|
+
FindChargesParamsSchema,
|
|
92
|
+
PayChargeInputSchema
|
|
93
|
+
} from "./modules/charges/types/charge.type";
|
|
86
94
|
import { buildPlanExtras } from "./modules/subscriptions/utils/build-plan-extras";
|
|
87
95
|
import { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
|
|
88
96
|
import {
|
|
@@ -419,6 +427,7 @@ export {
|
|
|
419
427
|
ChangeEmailModal,
|
|
420
428
|
ChangePasswordSection,
|
|
421
429
|
ChangePhoneModal,
|
|
430
|
+
ChargeSchema,
|
|
422
431
|
Checkbox,
|
|
423
432
|
default10 as CircularProgress,
|
|
424
433
|
ClarityEmbed,
|
|
@@ -454,6 +463,7 @@ export {
|
|
|
454
463
|
default19 as DisableTwoFactorAuthModal,
|
|
455
464
|
EmbedWidgets,
|
|
456
465
|
FindCardsParamsSchema,
|
|
466
|
+
FindChargesParamsSchema,
|
|
457
467
|
FormField,
|
|
458
468
|
FrillEmbed,
|
|
459
469
|
GENDER_OPTIONS,
|
|
@@ -504,6 +514,7 @@ export {
|
|
|
504
514
|
PaginationNext,
|
|
505
515
|
PaginationPrevious,
|
|
506
516
|
default4 as PaidPlanRequiredModal,
|
|
517
|
+
PayChargeInputSchema,
|
|
507
518
|
CardSchema as PaymentCardSchema,
|
|
508
519
|
PaymentInfoCard,
|
|
509
520
|
default15 as PhoneInput,
|
|
@@ -625,6 +636,9 @@ export {
|
|
|
625
636
|
useCancelledSubscriptionGuard,
|
|
626
637
|
useCardById,
|
|
627
638
|
useCards,
|
|
639
|
+
useChargeAction,
|
|
640
|
+
useChargeById,
|
|
641
|
+
useCharges,
|
|
628
642
|
default8 as useCopyToClipboard,
|
|
629
643
|
useCountPages,
|
|
630
644
|
default13 as useCountdownTimer,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"./modules/auth/schema\";\nexport * from \"./modules/users/schema\";\nexport * from \"./modules/whitelabel/schema\";\n// Style types now come from whitelabel schema directly\nexport * from \"./infra/api/types\";\n\n// Contexts\nexport * from \"./providers/query.provider\";\nexport * from \"./providers/auth.provider\";\nexport * from \"./providers/whitelabel.provider\";\n\n// Hooks\nexport {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport {\n useListAllAccountUsers,\n LIST_ALL_ACCOUNT_USERS_QUERY_KEY,\n LIST_ALL_ACCOUNT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-all-account-users.hook\";\nexport {\n useProjects,\n PROJECTS_BASE_KEY,\n PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-projects.hook\";\nexport {\n useInfiniteProjects,\n INFINITE_PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-infinite-projects.hook\";\nexport { useProject } from \"./modules/projects/hooks/find-project.hook\";\nexport { useCreateProject } from \"./modules/projects/hooks/create-project.hook\";\nexport { useUpdateProject } from \"./modules/projects/hooks/update-project.hook\";\nexport { useDeleteProject } from \"./modules/projects/hooks/delete-project.hook\";\nexport type {\n Project,\n ProjectsPage,\n CreateProjectRequest,\n UpdateProjectRequest,\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport { ProjectSchema } from \"./modules/projects/types\";\nexport type { ListProjectsActionParams } from \"./modules/projects/actions/list-projects.action\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useManagementPermissions } from \"./modules/auth/hooks/useManagementPermissions\";\nexport type { ManagementPermission } from \"./modules/auth/types/management-permission.type\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport {\n SUBSCRIPTIONS_QUERY_KEY,\n CHARGES_QUERY_KEY,\n} from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { useCancelledSubscriptionGuard } from \"./modules/subscriptions/hooks/use-cancelled-subscription-guard\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useUpdateSubscriptionPayment } from \"./modules/subscriptions/hooks/update-subscription-payment.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useCardById } from \"./modules/cards/hooks/card-by-id.hook\";\nexport { useCreateCard } from \"./modules/cards/hooks/create-card.hook\";\nexport { useSetDefaultCard } from \"./modules/cards/hooks/set-default-card.hook\";\nexport { useDeleteCard } from \"./modules/cards/hooks/delete-card.hook\";\nexport { useDeleteConfirmation } from \"./modules/cards/hooks/delete-confirmation.hook\";\nexport type { DeleteConfirmationFormData } from \"./modules/cards/hooks/delete-confirmation.hook\";\nexport { useHandleDeleteCard } from \"./modules/cards/hooks/handle-delete-card.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n ADDON_IDS,\n AI_CREDIT_OPTIONS,\n AI_CREDIT_VALUES,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n AddonKindEnum,\n AiCreditOption,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n Plan,\n PlanItem,\n UiPlan,\n PlanFeature,\n PlanMainFeatures,\n PlanPricingByPeriod,\n PlanTooltips,\n} from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport { mapApiPlanToUiPlan } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport type { PlanBillingPeriod } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport {\n usePlans,\n PLANS_QUERY_KEY,\n} from \"./modules/plans/hooks/list-plans.hook\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type {\n Card as PaymentCard,\n CreateCardRequest,\n FindCardsParams,\n} from \"./modules/cards/types\";\nexport {\n CardSchema as PaymentCardSchema,\n CreateCardRequestSchema,\n FindCardsParamsSchema,\n} from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { hasSubscriptionExpired } from \"./modules/subscriptions/utils/has-subscription-expired\";\nexport {\n useCountPages,\n COUNT_PAGES_QUERY_KEY,\n} from \"./modules/pages/hooks/count-pages.hook\";\nexport { PAGES_QUERY_KEY } from \"./modules/pages/constants/query-keys.constants\";\nexport {\n getPriceFromCalculatedData,\n getOriginalPriceFromCalculatedData,\n periodicityToBillingPeriod,\n} from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { useCreditsDisabledModal } from \"./store/useCreditsDisabledModal\";\nexport { usePaidPlanRequiredModal } from \"./store/usePaidPlanRequiredModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { default as CreditsDisabledModal } from \"./components/modals/CreditsDisabledModal\";\nexport { default as PaidPlanRequiredModal } from \"./components/modals/PaidPlanRequiredModal\";\nexport { default as AddCardModal } from \"./components/modals/cards/AddCardModal\";\nexport { DeleteCardModal } from \"./components/modals/cards/DeleteCardModal\";\nexport { CannotDeleteCardModal } from \"./components/modals/cards/CannotDeleteCardModal\";\nexport {\n CardFormFields,\n cardFormSchema,\n} from \"./components/modals/cards/CardFormFields\";\nexport type { CardFormData } from \"./components/modals/cards/CardFormFields\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\n\n// Providers\nexport { QueryProvider } from \"./providers/query.provider\";\n\n// Middleware\nexport { createAuthMiddleware } from \"./middlewares/create-auth-middleware\";\nexport { createMiddlewareChain } from \"./middlewares/chain\";\nexport { continueChain, stopChain } from \"./middlewares/types\";\nexport type {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { formatShortDate, formatDateTime } from \"./infra/utils/date\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} from \"./components/layouts/MainLayout\";\nexport { NavBar } from \"./components/layouts/NavBar\";\nexport type { NavBarProps } from \"./components/layouts/NavBar\";\nexport { AppNavBar } from \"./components/layouts/AppNavBar\";\nexport type { AppNavBarProps } from \"./components/layouts/AppNavBar\";\nexport { AppMobileNavBar } from \"./components/layouts/AppMobileNavBar\";\nexport type { AppMobileNavBarProps } from \"./components/layouts/AppMobileNavBar\";\nexport { SideBarNavigation } from \"./components/layouts/SideBarNavigation\";\nexport { MdSideBarNavigation } from \"./components/layouts/MdSideBarNavigation\";\nexport { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { NotFoundPage } from \"./components/pages/NotFoundPage\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { default as WhitelabelCodes } from \"./components/layouts/WhitelabelCodes\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from \"./components/navigation/AppNavigation\";\nexport { CancelledSubscriptionBanner } from \"./components/navigation/CancelledSubscriptionBanner\";\nexport { SubscriptionBanner } from \"./components/navigation/SubscriptionBanner\";\nexport { OverdueInvoiceBanner } from \"./components/navigation/OverdueInvoiceBanner\";\nexport type { NavItemConfig } from \"./components/navigation/subcomponents/NavItems\";\nexport { useMobileNavbarSheet } from \"./store/useMobileNavbarSheet\";\n\n// Auth Query Key Utilities\nexport {\n useAuthQueryKey,\n useWlQueryKey,\n useWlId,\n} from \"./hooks/useAuthQueryKey\";\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\n\n// UI - Buttons\nexport { Button, buttonVariants } from \"./components/ui/buttons/Button\";\nexport { CopyButton } from \"./components/ui/buttons/CopyButton\";\nexport { default as CancelButton } from \"./components/ui/buttons/CancelButton\";\n\n// UI - Data Display\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} from \"./components/ui/data-display/Tabs\";\nexport { UserAvatar } from \"./components/ui/data-display/UserAvatar\";\nexport type { UserAvatarProps } from \"./components/ui/data-display/UserAvatar\";\n\n// UI - Feedback\nexport { default as CircularProgress } from \"./components/ui/feedback/CircularProgress\";\nexport { default as DefaultCircularProgress } from \"./components/ui/feedback/DefaultCircularProgress\";\nexport { Progress } from \"./components/ui/feedback/Progress\";\nexport { LoadingOverlay } from \"./components/ui/feedback/LoadingOverlay\";\nexport {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} from \"./components/ui/feedback/Toast\";\nexport type { ToastProps } from \"./components/ui/feedback/Toast\";\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from \"./components/ui/form/Calendar\";\nexport { Checkbox } from \"./components/ui/form/Checkbox\";\nexport { DatePicker } from \"./components/ui/form/DatePicker\";\nexport { DateRangePicker } from \"./components/ui/form/DateRangePicker\";\nexport { Input } from \"./components/ui/form/Input\";\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport {\n CrispEmbed,\n openCrispHelpdesk,\n hideCrisp,\n showCrisp,\n updateCrispUser,\n} from \"./components/embeds/CrispEmbed\";\nexport { EmbedWidgets } from \"./components/embeds/EmbedWidgets\";\nexport { ClarityEmbed } from \"./components/embeds/ClarityEmbed\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useDesktopSidebarStore } from \"./store/useDesktopSidebarStore\";\nexport { useModalManager } from \"./store/useModalManager\";\nexport type { ModalData } from \"./store/useModalManager\";\n\n// Enums\nexport { AccountSectionType } from \"./enums/AccountSectionType\";\n\n// Hooks\nexport { default as usePasswordVisibility } from \"./hooks/usePasswordVisibility\";\nexport { default as useCountdownTimer } from \"./hooks/useCountdownTimer\";\nexport { default as useIsMobile } from \"./hooks/useIsMobile\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCNPJ,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport { formatCurrencyNumber } from \"./utils/format/currency\";\nexport { BR_STATE_OPTIONS } from \"./utils/constants/br-states\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} from \"./utils/intl/locales\";\nexport type { LocaleOption } from \"./utils/intl/locales\";\nexport { copyToClipboard, readFromClipboard } from \"./utils/browser/clipboard\";\n\n// UI - Form (new widgets)\nexport { FormField } from \"./components/ui/form/FormField\";\nexport { SelectField } from \"./components/ui/form/SelectField\";\nexport { ComboboxField } from \"./components/ui/form/ComboboxField\";\nexport type { ComboboxOption } from \"./components/ui/form/ComboboxField\";\nexport { default as PhoneInput } from \"./components/ui/form/PhoneInput\";\nexport { default as SwitchOptionFieldWithIcon } from \"./components/ui/form/SwitchOptionFieldWithIcon\";\nexport { TextAreaField } from \"./components/ui/form/TextAreaField\";\n\n// Account Module - Hooks\nexport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n ACCOUNT_USERS_QUERY_KEY,\n} from \"./modules/accounts/hooks/useAccountManagement\";\nexport { useViaCep } from \"./modules/accounts/hooks/useViaCep\";\nexport { useAccountToken } from \"./modules/accounts/hooks/use-account-token.hook\";\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from \"./modules/accounts/types\";\n\nexport { default as AccountModals } from \"./components/account/AccountModals\";\nexport { useAccountModals } from \"./store/useAccountModals\";\nexport type { AccountModalsConfig } from \"./store/useAccountModals\";\n\nexport { ModalManager } from \"./components/modals/ModalManager\";\nexport { Modals } from \"./components/modals/Modals\";\n\nexport { default as TwoFactorAuthModal } from \"./components/account/TwoFactorAuthModal\";\nexport { default as DisableTwoFactorAuthModal } from \"./components/account/DisableTwoFactorAuthModal\";\nexport { default as ConfirmGlobalPreferencesModal } from \"./components/account/ConfirmGlobalPreferencesModal\";\nexport { MyProfileSection } from \"./components/account/sections/MyProfileSection\";\nexport { PreferencesSection } from \"./components/account/sections/PreferencesSection\";\nexport { SecuritySection } from \"./components/account/sections/SecuritySection\";\nexport { ChangePasswordSection } from \"./components/account/sections/ChangePasswordSection\";\nexport { ChangeEmailModal } from \"./components/account/sections/ChangeEmailModal\";\nexport { ChangePhoneModal } from \"./components/account/sections/ChangePhoneModal\";\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n\n// Image Upload\nexport {\n ImageUpload,\n ImageCropModal,\n ImageTooSmallModal,\n} from \"./components/widgets/ImageUpload\";\nexport {\n useImageUpload,\n type ImageTooSmallError,\n} from \"./modules/images/hooks/use-image-upload.hook\";\nexport {\n ACCEPTED_IMAGE_FORMATS,\n ACCEPTED_IMAGE_FORMATS_STRING,\n MAX_FILE_SIZE_MB,\n} from \"./modules/images/constants/image.constants\";\nexport type {\n ImageConfig,\n CropArea,\n ProcessedImage,\n CompressImageOptions,\n} from \"./modules/images/types/image.type\";\nexport { compressImage } from \"./modules/images/utils/compress-image\";\nexport { cropImageToCanvas } from \"./modules/images/utils/crop-image\";\nexport { base64ToFile, fileToBase64 } from \"./modules/images/utils/base64\";\nexport {\n validateImage,\n validateImageFormat,\n validateImageSize,\n getImageDimensions,\n} from \"./modules/images/utils/validate-image\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAA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,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"./modules/auth/schema\";\nexport * from \"./modules/users/schema\";\nexport * from \"./modules/whitelabel/schema\";\n// Style types now come from whitelabel schema directly\nexport * from \"./infra/api/types\";\n\n// Contexts\nexport * from \"./providers/query.provider\";\nexport * from \"./providers/auth.provider\";\nexport * from \"./providers/whitelabel.provider\";\n\n// Hooks\nexport {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport {\n useListAllAccountUsers,\n LIST_ALL_ACCOUNT_USERS_QUERY_KEY,\n LIST_ALL_ACCOUNT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-all-account-users.hook\";\nexport {\n useProjects,\n PROJECTS_BASE_KEY,\n PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-projects.hook\";\nexport {\n useInfiniteProjects,\n INFINITE_PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-infinite-projects.hook\";\nexport { useProject } from \"./modules/projects/hooks/find-project.hook\";\nexport { useCreateProject } from \"./modules/projects/hooks/create-project.hook\";\nexport { useUpdateProject } from \"./modules/projects/hooks/update-project.hook\";\nexport { useDeleteProject } from \"./modules/projects/hooks/delete-project.hook\";\nexport type {\n Project,\n ProjectsPage,\n CreateProjectRequest,\n UpdateProjectRequest,\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport { ProjectSchema } from \"./modules/projects/types\";\nexport type { ListProjectsActionParams } from \"./modules/projects/actions/list-projects.action\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useManagementPermissions } from \"./modules/auth/hooks/useManagementPermissions\";\nexport type { ManagementPermission } from \"./modules/auth/types/management-permission.type\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport {\n SUBSCRIPTIONS_QUERY_KEY,\n CHARGES_QUERY_KEY,\n} from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { useCancelledSubscriptionGuard } from \"./modules/subscriptions/hooks/use-cancelled-subscription-guard\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useUpdateSubscriptionPayment } from \"./modules/subscriptions/hooks/update-subscription-payment.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useCardById } from \"./modules/cards/hooks/card-by-id.hook\";\nexport { useCreateCard } from \"./modules/cards/hooks/create-card.hook\";\nexport { useSetDefaultCard } from \"./modules/cards/hooks/set-default-card.hook\";\nexport { useDeleteCard } from \"./modules/cards/hooks/delete-card.hook\";\nexport { useDeleteConfirmation } from \"./modules/cards/hooks/delete-confirmation.hook\";\nexport type { DeleteConfirmationFormData } from \"./modules/cards/hooks/delete-confirmation.hook\";\nexport { useHandleDeleteCard } from \"./modules/cards/hooks/handle-delete-card.hook\";\nexport { useCharges } from \"./modules/charges/hooks/charges.hook\";\nexport { useChargeById } from \"./modules/charges/hooks/charge-by-id.hook\";\nexport { useChargeAction } from \"./modules/charges/hooks/charge-action.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n ADDON_IDS,\n AI_CREDIT_OPTIONS,\n AI_CREDIT_VALUES,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n AddonKindEnum,\n AiCreditOption,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n Plan,\n PlanItem,\n UiPlan,\n PlanFeature,\n PlanMainFeatures,\n PlanPricingByPeriod,\n PlanTooltips,\n} from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport { mapApiPlanToUiPlan } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport type { PlanBillingPeriod } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport {\n usePlans,\n PLANS_QUERY_KEY,\n} from \"./modules/plans/hooks/list-plans.hook\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type {\n Card as PaymentCard,\n CreateCardRequest,\n FindCardsParams,\n} from \"./modules/cards/types\";\nexport {\n CardSchema as PaymentCardSchema,\n CreateCardRequestSchema,\n FindCardsParamsSchema,\n} from \"./modules/cards/types\";\nexport type {\n Charge,\n FindChargesParams,\n PayChargeInput,\n} from \"./modules/charges/types/charge.type\";\nexport {\n ChargeSchema,\n FindChargesParamsSchema,\n PayChargeInputSchema,\n} from \"./modules/charges/types/charge.type\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { hasSubscriptionExpired } from \"./modules/subscriptions/utils/has-subscription-expired\";\nexport {\n useCountPages,\n COUNT_PAGES_QUERY_KEY,\n} from \"./modules/pages/hooks/count-pages.hook\";\nexport { PAGES_QUERY_KEY } from \"./modules/pages/constants/query-keys.constants\";\nexport {\n getPriceFromCalculatedData,\n getOriginalPriceFromCalculatedData,\n periodicityToBillingPeriod,\n} from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { useCreditsDisabledModal } from \"./store/useCreditsDisabledModal\";\nexport { usePaidPlanRequiredModal } from \"./store/usePaidPlanRequiredModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { default as CreditsDisabledModal } from \"./components/modals/CreditsDisabledModal\";\nexport { default as PaidPlanRequiredModal } from \"./components/modals/PaidPlanRequiredModal\";\nexport { default as AddCardModal } from \"./components/modals/cards/AddCardModal\";\nexport { DeleteCardModal } from \"./components/modals/cards/DeleteCardModal\";\nexport { CannotDeleteCardModal } from \"./components/modals/cards/CannotDeleteCardModal\";\nexport {\n CardFormFields,\n cardFormSchema,\n} from \"./components/modals/cards/CardFormFields\";\nexport type { CardFormData } from \"./components/modals/cards/CardFormFields\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\n\n// Providers\nexport { QueryProvider } from \"./providers/query.provider\";\n\n// Middleware\nexport { createAuthMiddleware } from \"./middlewares/create-auth-middleware\";\nexport { createMiddlewareChain } from \"./middlewares/chain\";\nexport { continueChain, stopChain } from \"./middlewares/types\";\nexport type {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { formatShortDate, formatDateTime } from \"./infra/utils/date\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} from \"./components/layouts/MainLayout\";\nexport { NavBar } from \"./components/layouts/NavBar\";\nexport type { NavBarProps } from \"./components/layouts/NavBar\";\nexport { AppNavBar } from \"./components/layouts/AppNavBar\";\nexport type { AppNavBarProps } from \"./components/layouts/AppNavBar\";\nexport { AppMobileNavBar } from \"./components/layouts/AppMobileNavBar\";\nexport type { AppMobileNavBarProps } from \"./components/layouts/AppMobileNavBar\";\nexport { SideBarNavigation } from \"./components/layouts/SideBarNavigation\";\nexport { MdSideBarNavigation } from \"./components/layouts/MdSideBarNavigation\";\nexport { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { NotFoundPage } from \"./components/pages/NotFoundPage\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { default as WhitelabelCodes } from \"./components/layouts/WhitelabelCodes\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from \"./components/navigation/AppNavigation\";\nexport { CancelledSubscriptionBanner } from \"./components/navigation/CancelledSubscriptionBanner\";\nexport { SubscriptionBanner } from \"./components/navigation/SubscriptionBanner\";\nexport { OverdueInvoiceBanner } from \"./components/navigation/OverdueInvoiceBanner\";\nexport type { NavItemConfig } from \"./components/navigation/subcomponents/NavItems\";\nexport { useMobileNavbarSheet } from \"./store/useMobileNavbarSheet\";\n\n// Auth Query Key Utilities\nexport {\n useAuthQueryKey,\n useWlQueryKey,\n useWlId,\n} from \"./hooks/useAuthQueryKey\";\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\n\n// UI - Buttons\nexport { Button, buttonVariants } from \"./components/ui/buttons/Button\";\nexport { CopyButton } from \"./components/ui/buttons/CopyButton\";\nexport { default as CancelButton } from \"./components/ui/buttons/CancelButton\";\n\n// UI - Data Display\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} from \"./components/ui/data-display/Tabs\";\nexport { UserAvatar } from \"./components/ui/data-display/UserAvatar\";\nexport type { UserAvatarProps } from \"./components/ui/data-display/UserAvatar\";\n\n// UI - Feedback\nexport { default as CircularProgress } from \"./components/ui/feedback/CircularProgress\";\nexport { default as DefaultCircularProgress } from \"./components/ui/feedback/DefaultCircularProgress\";\nexport { Progress } from \"./components/ui/feedback/Progress\";\nexport { LoadingOverlay } from \"./components/ui/feedback/LoadingOverlay\";\nexport {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} from \"./components/ui/feedback/Toast\";\nexport type { ToastProps } from \"./components/ui/feedback/Toast\";\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from \"./components/ui/form/Calendar\";\nexport { Checkbox } from \"./components/ui/form/Checkbox\";\nexport { DatePicker } from \"./components/ui/form/DatePicker\";\nexport { DateRangePicker } from \"./components/ui/form/DateRangePicker\";\nexport { Input } from \"./components/ui/form/Input\";\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport {\n CrispEmbed,\n openCrispHelpdesk,\n hideCrisp,\n showCrisp,\n updateCrispUser,\n} from \"./components/embeds/CrispEmbed\";\nexport { EmbedWidgets } from \"./components/embeds/EmbedWidgets\";\nexport { ClarityEmbed } from \"./components/embeds/ClarityEmbed\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useDesktopSidebarStore } from \"./store/useDesktopSidebarStore\";\nexport { useModalManager } from \"./store/useModalManager\";\nexport type { ModalData } from \"./store/useModalManager\";\n\n// Enums\nexport { AccountSectionType } from \"./enums/AccountSectionType\";\n\n// Hooks\nexport { default as usePasswordVisibility } from \"./hooks/usePasswordVisibility\";\nexport { default as useCountdownTimer } from \"./hooks/useCountdownTimer\";\nexport { default as useIsMobile } from \"./hooks/useIsMobile\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCNPJ,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport { formatCurrencyNumber } from \"./utils/format/currency\";\nexport { BR_STATE_OPTIONS } from \"./utils/constants/br-states\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} from \"./utils/intl/locales\";\nexport type { LocaleOption } from \"./utils/intl/locales\";\nexport { copyToClipboard, readFromClipboard } from \"./utils/browser/clipboard\";\n\n// UI - Form (new widgets)\nexport { FormField } from \"./components/ui/form/FormField\";\nexport { SelectField } from \"./components/ui/form/SelectField\";\nexport { ComboboxField } from \"./components/ui/form/ComboboxField\";\nexport type { ComboboxOption } from \"./components/ui/form/ComboboxField\";\nexport { default as PhoneInput } from \"./components/ui/form/PhoneInput\";\nexport { default as SwitchOptionFieldWithIcon } from \"./components/ui/form/SwitchOptionFieldWithIcon\";\nexport { TextAreaField } from \"./components/ui/form/TextAreaField\";\n\n// Account Module - Hooks\nexport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n ACCOUNT_USERS_QUERY_KEY,\n} from \"./modules/accounts/hooks/useAccountManagement\";\nexport { useViaCep } from \"./modules/accounts/hooks/useViaCep\";\nexport { useAccountToken } from \"./modules/accounts/hooks/use-account-token.hook\";\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from \"./modules/accounts/types\";\n\nexport { default as AccountModals } from \"./components/account/AccountModals\";\nexport { useAccountModals } from \"./store/useAccountModals\";\nexport type { AccountModalsConfig } from \"./store/useAccountModals\";\n\nexport { ModalManager } from \"./components/modals/ModalManager\";\nexport { Modals } from \"./components/modals/Modals\";\n\nexport { default as TwoFactorAuthModal } from \"./components/account/TwoFactorAuthModal\";\nexport { default as DisableTwoFactorAuthModal } from \"./components/account/DisableTwoFactorAuthModal\";\nexport { default as ConfirmGlobalPreferencesModal } from \"./components/account/ConfirmGlobalPreferencesModal\";\nexport { MyProfileSection } from \"./components/account/sections/MyProfileSection\";\nexport { PreferencesSection } from \"./components/account/sections/PreferencesSection\";\nexport { SecuritySection } from \"./components/account/sections/SecuritySection\";\nexport { ChangePasswordSection } from \"./components/account/sections/ChangePasswordSection\";\nexport { ChangeEmailModal } from \"./components/account/sections/ChangeEmailModal\";\nexport { ChangePhoneModal } from \"./components/account/sections/ChangePhoneModal\";\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n\n// Image Upload\nexport {\n ImageUpload,\n ImageCropModal,\n ImageTooSmallModal,\n} from \"./components/widgets/ImageUpload\";\nexport {\n useImageUpload,\n type ImageTooSmallError,\n} from \"./modules/images/hooks/use-image-upload.hook\";\nexport {\n ACCEPTED_IMAGE_FORMATS,\n ACCEPTED_IMAGE_FORMATS_STRING,\n MAX_FILE_SIZE_MB,\n} from \"./modules/images/constants/image.constants\";\nexport type {\n ImageConfig,\n CropArea,\n ProcessedImage,\n CompressImageOptions,\n} from \"./modules/images/types/image.type\";\nexport { compressImage } from \"./modules/images/utils/compress-image\";\nexport { cropImageToCanvas } from \"./modules/images/utils/crop-image\";\nexport { base64ToFile, fileToBase64 } from \"./modules/images/utils/base64\";\nexport {\n validateImage,\n validateImageFormat,\n validateImageSize,\n getImageDimensions,\n} from \"./modules/images/utils/validate-image\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAYjC,SAAS,qBAAqB;AAE9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP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B;AAClC,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
@@ -17,10 +17,10 @@ function useManagementPermissions() {
|
|
|
17
17
|
case "manage_domains":
|
|
18
18
|
case "manage_ab_tests":
|
|
19
19
|
case "restore_pages":
|
|
20
|
-
return !isViewer;
|
|
21
|
-
case "manage_projects":
|
|
22
20
|
case "create_pages":
|
|
23
21
|
case "update_pages":
|
|
22
|
+
return !isViewer;
|
|
23
|
+
case "manage_projects":
|
|
24
24
|
case "delete_pages":
|
|
25
25
|
case "delete_leads":
|
|
26
26
|
case "view_cards":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/hooks/useManagementPermissions.ts"],"sourcesContent":["'use client';\n\nimport { UserProfile } from '../../users/schema';\nimport { useAuth } from '../../../providers/auth.provider';\nimport type { ManagementPermission } from '../types/management-permission.type';\n\nexport { type ManagementPermission } from '../types/management-permission.type';\n\nexport function useManagementPermissions() {\n const { user } = useAuth();\n const profile = user?.profile;\n\n const isAdmin = profile === UserProfile.admin;\n const isOwner = profile === UserProfile.owner;\n const isOwnerOrAdmin = isOwner || isAdmin;\n const isViewer = profile === UserProfile.viewer;\n const isCollaborator = profile === UserProfile.collaborator;\n const canManage = !isViewer;\n\n const hasPermission = (permission: ManagementPermission) => {\n switch (permission) {\n case 'manage_pages':\n case 'manage_redirects':\n case 'manage_domains':\n case 'manage_ab_tests':\n case 'restore_pages':\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/auth/hooks/useManagementPermissions.ts"],"sourcesContent":["'use client';\n\nimport { UserProfile } from '../../users/schema';\nimport { useAuth } from '../../../providers/auth.provider';\nimport type { ManagementPermission } from '../types/management-permission.type';\n\nexport { type ManagementPermission } from '../types/management-permission.type';\n\nexport function useManagementPermissions() {\n const { user } = useAuth();\n const profile = user?.profile;\n\n const isAdmin = profile === UserProfile.admin;\n const isOwner = profile === UserProfile.owner;\n const isOwnerOrAdmin = isOwner || isAdmin;\n const isViewer = profile === UserProfile.viewer;\n const isCollaborator = profile === UserProfile.collaborator;\n const canManage = !isViewer;\n\n const hasPermission = (permission: ManagementPermission) => {\n switch (permission) {\n case 'manage_pages':\n case 'manage_redirects':\n case 'manage_domains':\n case 'manage_ab_tests':\n case 'restore_pages':\n case 'create_pages':\n case 'update_pages':\n return !isViewer;\n case 'manage_projects':\n case 'delete_pages':\n case 'delete_leads':\n case 'view_cards':\n case 'manage_cards':\n case 'manage_subscriptions':\n return isOwnerOrAdmin;\n default:\n return false;\n }\n };\n\n return {\n profile,\n isAdmin,\n isOwner,\n isOwnerOrAdmin,\n isViewer,\n isCollaborator,\n canManage,\n hasPermission,\n };\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAKjB,SAAS,2BAA2B;AACzC,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,UAAU,MAAM;AAEtB,QAAM,UAAU,YAAY,YAAY;AACxC,QAAM,UAAU,YAAY,YAAY;AACxC,QAAM,iBAAiB,WAAW;AAClC,QAAM,WAAW,YAAY,YAAY;AACzC,QAAM,iBAAiB,YAAY,YAAY;AAC/C,QAAM,YAAY,CAAC;AAEnB,QAAM,gBAAgB,CAAC,eAAqC;AAC1D,YAAQ,YAAY;AAAA,MAClB,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,CAAC;AAAA,MACV,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -22,13 +22,13 @@ async function assertManagementPermission(permission) {
|
|
|
22
22
|
case "manage_domains":
|
|
23
23
|
case "manage_ab_tests":
|
|
24
24
|
case "restore_pages":
|
|
25
|
+
case "create_pages":
|
|
26
|
+
case "update_pages":
|
|
25
27
|
if (profile === UserProfile.viewer) {
|
|
26
28
|
throw new ApiError("Voc\xEA n\xE3o tem permiss\xE3o para executar esta a\xE7\xE3o", "FORBIDDEN", 403);
|
|
27
29
|
}
|
|
28
30
|
break;
|
|
29
31
|
case "manage_projects":
|
|
30
|
-
case "create_pages":
|
|
31
|
-
case "update_pages":
|
|
32
32
|
case "delete_pages":
|
|
33
33
|
case "delete_leads":
|
|
34
34
|
case "view_cards":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/utils/assert-management-permission.ts"],"sourcesContent":["import 'server-only';\n\nimport { UserProfile } from '../../users/schema';\nimport { findUserById } from '../../users/action/find-user-by-id.action';\nimport { ApiError } from '../../../infra/api/types';\nimport { assertManagementSubscription } from './assert-management-subscription';\nimport type { ManagementPermission } from '../types/management-permission.type';\n\nasync function getCurrentUserProfile() {\n const result = await findUserById();\n\n if (!result.success || !result.data) {\n throw new ApiError(\n ('error' in result && result.error) || 'Não foi possível identificar o usuário autenticado',\n 'USER_CONTEXT_FAILED',\n 403\n );\n }\n\n return result.data.profile;\n}\n\nexport async function assertManagementPermission(permission: ManagementPermission) {\n const profile = await getCurrentUserProfile();\n\n switch (permission) {\n case 'manage_pages':\n case 'manage_redirects':\n case 'manage_domains':\n case 'manage_ab_tests':\n case 'restore_pages':\n if (profile === UserProfile.viewer) {\n throw new ApiError('Você não tem permissão para executar esta ação', 'FORBIDDEN', 403);\n }\n break;\n case 'manage_projects':\n case '
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/auth/utils/assert-management-permission.ts"],"sourcesContent":["import 'server-only';\n\nimport { UserProfile } from '../../users/schema';\nimport { findUserById } from '../../users/action/find-user-by-id.action';\nimport { ApiError } from '../../../infra/api/types';\nimport { assertManagementSubscription } from './assert-management-subscription';\nimport type { ManagementPermission } from '../types/management-permission.type';\n\nasync function getCurrentUserProfile() {\n const result = await findUserById();\n\n if (!result.success || !result.data) {\n throw new ApiError(\n ('error' in result && result.error) || 'Não foi possível identificar o usuário autenticado',\n 'USER_CONTEXT_FAILED',\n 403\n );\n }\n\n return result.data.profile;\n}\n\nexport async function assertManagementPermission(permission: ManagementPermission) {\n const profile = await getCurrentUserProfile();\n\n switch (permission) {\n case 'manage_pages':\n case 'manage_redirects':\n case 'manage_domains':\n case 'manage_ab_tests':\n case 'restore_pages':\n case 'create_pages':\n case 'update_pages':\n if (profile === UserProfile.viewer) {\n throw new ApiError('Você não tem permissão para executar esta ação', 'FORBIDDEN', 403);\n }\n break;\n case 'manage_projects':\n case 'delete_pages':\n case 'delete_leads':\n case 'view_cards':\n case 'manage_cards':\n case 'manage_subscriptions':\n if (profile !== UserProfile.owner && profile !== UserProfile.admin) {\n throw new ApiError('Você não tem permissão para executar esta ação', 'FORBIDDEN', 403);\n }\n break;\n default:\n throw new ApiError('Permissão inválida', 'INVALID_PERMISSION', 500);\n }\n\n const skipSubscriptionCheck: ManagementPermission[] = ['manage_subscriptions', 'manage_cards', 'view_cards'];\n if (!skipSubscriptionCheck.includes(permission)) {\n await assertManagementSubscription();\n }\n}\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,oCAAoC;AAG7C,eAAe,wBAAwB;AACrC,QAAM,SAAS,MAAM,aAAa;AAElC,MAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM;AACnC,UAAM,IAAI;AAAA,MACP,WAAW,UAAU,OAAO,SAAU;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,KAAK;AACrB;AAEA,eAAsB,2BAA2B,YAAkC;AACjF,QAAM,UAAU,MAAM,sBAAsB;AAE5C,UAAQ,YAAY;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,UAAI,YAAY,YAAY,QAAQ;AAClC,cAAM,IAAI,SAAS,iEAAkD,aAAa,GAAG;AAAA,MACvF;AACA;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,UAAI,YAAY,YAAY,SAAS,YAAY,YAAY,OAAO;AAClE,cAAM,IAAI,SAAS,iEAAkD,aAAa,GAAG;AAAA,MACvF;AACA;AAAA,IACF;AACE,YAAM,IAAI,SAAS,4BAAsB,sBAAsB,GAAG;AAAA,EACtE;AAEA,QAAM,wBAAgD,CAAC,wBAAwB,gBAAgB,YAAY;AAC3G,MAAI,CAAC,sBAAsB,SAAS,UAAU,GAAG;AAC/C,UAAM,6BAA6B;AAAA,EACrC;AACF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { safeMutationAction } from "../../../utils/safeMutationAction";
|
|
3
|
+
import { assertManagementPermission } from "../../auth/utils/assert-management-permission";
|
|
4
|
+
import { chargesService } from "../services/charges.service";
|
|
5
|
+
async function chargeActionAction(data) {
|
|
6
|
+
return safeMutationAction(async () => {
|
|
7
|
+
await assertManagementPermission("manage_subscriptions");
|
|
8
|
+
return chargesService.chargeAction(data);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
chargeActionAction
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=charge-action.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/actions/charge-action.action.ts"],"sourcesContent":["'use server';\n\nimport { safeMutationAction } from '../../../utils/safeMutationAction';\nimport { assertManagementPermission } from '../../auth/utils/assert-management-permission';\nimport { chargesService } from '../services/charges.service';\nimport { PayChargeInput } from '../types/charge.type';\n\nexport async function chargeActionAction(data: PayChargeInput) {\n return safeMutationAction(async () => {\n await assertManagementPermission('manage_subscriptions');\n return chargesService.chargeAction(data);\n });\n}\n"],"mappings":";AAEA,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AAC3C,SAAS,sBAAsB;AAG/B,eAAsB,mBAAmB,MAAsB;AAC7D,SAAO,mBAAmB,YAAY;AACpC,UAAM,2BAA2B,sBAAsB;AACvD,WAAO,eAAe,aAAa,IAAI;AAAA,EACzC,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
+
import { chargesService } from "../services/charges.service";
|
|
4
|
+
async function findChargeByIdAction(chargeId) {
|
|
5
|
+
return safeServerAction(() => chargesService.findChargeById(chargeId));
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
findChargeByIdAction
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=find-charge-by-id.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/actions/find-charge-by-id.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { chargesService } from '../services/charges.service';\n\nexport async function findChargeByIdAction(chargeId: string | number) {\n return safeServerAction(() => chargesService.findChargeById(chargeId));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAE/B,eAAsB,qBAAqB,UAA2B;AACpE,SAAO,iBAAiB,MAAM,eAAe,eAAe,QAAQ,CAAC;AACvE;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
3
|
+
import { chargesService } from "../services/charges.service";
|
|
4
|
+
async function listChargesAction(params) {
|
|
5
|
+
return safeServerAction(() => chargesService.listCharges(params));
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
listChargesAction
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=list-charges.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/actions/list-charges.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { FindChargesParams } from '../types/charge.type';\nimport { chargesService } from '../services/charges.service';\n\nexport async function listChargesAction(params?: Partial<FindChargesParams>) {\n return safeServerAction(() => chargesService.listCharges(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,sBAAsB;AAE/B,eAAsB,kBAAkB,QAAqC;AAC3E,SAAO,iBAAiB,MAAM,eAAe,YAAY,MAAM,CAAC;AAClE;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { withAction } from "../../../utils/withAction";
|
|
4
|
+
import { useAuthQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
|
+
import { chargeActionAction } from "../actions/charge-action.action";
|
|
6
|
+
import { CHARGES_QUERY_KEY } from "../../subscriptions/constants/query-keys.constants";
|
|
7
|
+
import { SUBSCRIPTIONS_QUERY_KEY } from "../../subscriptions/constants/query-keys.constants";
|
|
8
|
+
function useChargeAction() {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY]);
|
|
11
|
+
const subsKey = useAuthQueryKey([...SUBSCRIPTIONS_QUERY_KEY]);
|
|
12
|
+
return useMutation({
|
|
13
|
+
mutationFn: (data) => withAction(chargeActionAction)(data),
|
|
14
|
+
onSuccess: () => {
|
|
15
|
+
queryClient.invalidateQueries({ queryKey: chargesKey });
|
|
16
|
+
queryClient.invalidateQueries({ queryKey: subsKey });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
useChargeAction
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=charge-action.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/hooks/charge-action.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\nimport { chargeActionAction } from '../actions/charge-action.action';\nimport { PayChargeInput } from '../types/charge.type';\nimport { CHARGES_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';\nimport { SUBSCRIPTIONS_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';\n\nexport function useChargeAction() {\n const queryClient = useQueryClient();\n const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY]);\n const subsKey = useAuthQueryKey([...SUBSCRIPTIONS_QUERY_KEY]);\n\n return useMutation({\n mutationFn: (data: PayChargeInput) =>\n withAction(chargeActionAction)(data),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: chargesKey });\n queryClient.invalidateQueries({ queryKey: subsKey });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AAEnC,SAAS,yBAAyB;AAClC,SAAS,+BAA+B;AAEjC,SAAS,kBAAkB;AAChC,QAAM,cAAc,eAAe;AACnC,QAAM,aAAa,gBAAgB,CAAC,GAAG,iBAAiB,CAAC;AACzD,QAAM,UAAU,gBAAgB,CAAC,GAAG,uBAAuB,CAAC;AAE5D,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,SACX,WAAW,kBAAkB,EAAE,IAAI;AAAA,IACrC,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,WAAW,CAAC;AACtD,kBAAY,kBAAkB,EAAE,UAAU,QAAQ,CAAC;AAAA,IACrD;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { withAction } from "../../../utils/withAction";
|
|
4
|
+
import { useAuthQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
|
+
import { findChargeByIdAction } from "../actions/find-charge-by-id.action";
|
|
6
|
+
import { CHARGES_QUERY_KEY } from "../../subscriptions/constants/query-keys.constants";
|
|
7
|
+
function useChargeById(chargeId) {
|
|
8
|
+
const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY, chargeId]);
|
|
9
|
+
return useQuery({
|
|
10
|
+
queryKey: chargesKey,
|
|
11
|
+
queryFn: () => withAction(findChargeByIdAction)(chargeId),
|
|
12
|
+
enabled: !!chargeId
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useChargeById
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=charge-by-id.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/hooks/charge-by-id.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\nimport { findChargeByIdAction } from '../actions/find-charge-by-id.action';\nimport { CHARGES_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';\n\nexport function useChargeById(chargeId: string | number | null | undefined) {\n const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY, chargeId]);\n\n return useQuery({\n queryKey: chargesKey,\n queryFn: () => withAction(findChargeByIdAction)(chargeId!),\n enabled: !!chargeId,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAE3B,SAAS,cAAc,UAA8C;AAC1E,QAAM,aAAa,gBAAgB,CAAC,GAAG,mBAAmB,QAAQ,CAAC;AAEnE,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,MAAM,WAAW,oBAAoB,EAAE,QAAS;AAAA,IACzD,SAAS,CAAC,CAAC;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { withAction } from "../../../utils/withAction";
|
|
4
|
+
import { useAuthQueryKey } from "../../../hooks/useAuthQueryKey";
|
|
5
|
+
import { listChargesAction } from "../actions/list-charges.action";
|
|
6
|
+
import { CHARGES_QUERY_KEY } from "../../subscriptions/constants/query-keys.constants";
|
|
7
|
+
function useCharges(params) {
|
|
8
|
+
const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY, params]);
|
|
9
|
+
return useQuery({
|
|
10
|
+
queryKey: chargesKey,
|
|
11
|
+
queryFn: () => withAction(listChargesAction)(params),
|
|
12
|
+
staleTime: 1e4
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useCharges
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=charges.hook.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/hooks/charges.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\nimport { listChargesAction } from '../actions/list-charges.action';\nimport { FindChargesParams } from '../types/charge.type';\nimport { CHARGES_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';\n\nexport function useCharges(params?: Partial<FindChargesParams>) {\n const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY, params]);\n\n return useQuery({\n queryKey: chargesKey,\n queryFn: () => withAction(listChargesAction)(params),\n staleTime: 10_000,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAElC,SAAS,yBAAyB;AAE3B,SAAS,WAAW,QAAqC;AAC9D,QAAM,aAAa,gBAAgB,CAAC,GAAG,mBAAmB,MAAM,CAAC;AAEjE,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,MAAM,WAAW,iBAAiB,EAAE,MAAM;AAAA,IACnD,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { api } from "../../../infra/api/client";
|
|
3
|
+
import { ApiError } from "../../../infra/api/types";
|
|
4
|
+
import { buildQueryParams } from "../../../infra/utils/params";
|
|
5
|
+
import { getUserContext } from "../../auth/utils/get-user-context";
|
|
6
|
+
import { ChargeSchema } from "../types/charge.type";
|
|
7
|
+
class ChargesService {
|
|
8
|
+
async listCharges(params) {
|
|
9
|
+
const { id_account } = await getUserContext();
|
|
10
|
+
const query = buildQueryParams({ ...params, id_account });
|
|
11
|
+
const response = await api.apps.get(`/charges?${query}`);
|
|
12
|
+
if (response.status === 0) {
|
|
13
|
+
throw new ApiError(
|
|
14
|
+
response.message || "Erro ao listar cobran\xE7as",
|
|
15
|
+
"LIST_CHARGES_FAILED",
|
|
16
|
+
400
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
const data = response.data.reduce((acc, item) => {
|
|
20
|
+
const result = ChargeSchema.safeParse(item);
|
|
21
|
+
if (result.success) acc.push(result.data);
|
|
22
|
+
return acc;
|
|
23
|
+
}, []);
|
|
24
|
+
return { data, total: response.total, success: true };
|
|
25
|
+
}
|
|
26
|
+
async chargeAction(data) {
|
|
27
|
+
const response = await api.apps.put(
|
|
28
|
+
`/charges/${data.chargeId}/action/charge`,
|
|
29
|
+
{
|
|
30
|
+
payment_method: data.paymentMethod,
|
|
31
|
+
payment_method_id: data.paymentMethodId
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
if (response.status === 0) {
|
|
35
|
+
throw new ApiError(
|
|
36
|
+
response.message || "Erro ao processar cobran\xE7a",
|
|
37
|
+
"CHARGE_ACTION_FAILED",
|
|
38
|
+
400
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return { success: true, data: void 0 };
|
|
42
|
+
}
|
|
43
|
+
async findChargeById(chargeId) {
|
|
44
|
+
const { id_account } = await getUserContext();
|
|
45
|
+
const response = await api.apps.get(
|
|
46
|
+
`/charges/${chargeId}?id_account=${id_account}`
|
|
47
|
+
);
|
|
48
|
+
if (response.status === 0) {
|
|
49
|
+
throw new ApiError(response.message || "Erro ao buscar cobran\xE7a", "FIND_CHARGE_FAILED", 400);
|
|
50
|
+
}
|
|
51
|
+
const data = ChargeSchema.parse(response.data[0]);
|
|
52
|
+
return { data, success: true };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const chargesService = new ChargesService();
|
|
56
|
+
export {
|
|
57
|
+
chargesService
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=charges.service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/services/charges.service.ts"],"sourcesContent":["import 'server-only';\n\nimport { api } from '../../../infra/api/client';\nimport { ApiError, ApiActionResult, ApiPaginatedActionResult, PaginatedSuccessResult, SuccessResult } from '../../../infra/api/types';\nimport { buildQueryParams } from '../../../infra/utils/params';\nimport { getUserContext } from '../../auth/utils/get-user-context';\nimport { Charge, ChargeSchema, FindChargesParams, PayChargeInput } from '../types/charge.type';\n\nclass ChargesService {\n async listCharges(params?: Partial<FindChargesParams>): Promise<PaginatedSuccessResult<Charge>> {\n const { id_account } = await getUserContext();\n\n const query = buildQueryParams({ ...params, id_account });\n\n const response = await api.apps.get<ApiPaginatedActionResult<Charge>>(`/charges?${query}`);\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao listar cobranças',\n 'LIST_CHARGES_FAILED',\n 400\n );\n }\n\n const data = response.data.reduce<Charge[]>((acc, item) => {\n const result = ChargeSchema.safeParse(item);\n if (result.success) acc.push(result.data);\n return acc;\n }, []);\n\n return { data, total: response.total, success: true };\n }\n\n async chargeAction(data: PayChargeInput): Promise<SuccessResult<void>> {\n const response = await api.apps.put<ApiActionResult<void>>(\n `/charges/${data.chargeId}/action/charge`,\n {\n payment_method: data.paymentMethod,\n payment_method_id: data.paymentMethodId,\n }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao processar cobrança',\n 'CHARGE_ACTION_FAILED',\n 400\n );\n }\n\n return { success: true, data: undefined };\n }\n\n async findChargeById(chargeId: string | number): Promise<SuccessResult<Charge>> {\n const { id_account } = await getUserContext();\n\n const response = await api.apps.get<ApiPaginatedActionResult<Charge>>(\n `/charges/${chargeId}?id_account=${id_account}`\n );\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao buscar cobrança', 'FIND_CHARGE_FAILED', 400);\n }\n\n const data = ChargeSchema.parse(response.data[0]);\n\n return { data, success: true };\n }\n}\n\nexport const chargesService = new ChargesService();\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAAkG;AAC3G,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAiB,oBAAuD;AAExE,MAAM,eAAe;AAAA,EACnB,MAAM,YAAY,QAA8E;AAC9F,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,QAAQ,iBAAiB,EAAE,GAAG,QAAQ,WAAW,CAAC;AAExD,UAAM,WAAW,MAAM,IAAI,KAAK,IAAsC,YAAY,KAAK,EAAE;AAEzF,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,UAAM,OAAO,SAAS,KAAK,OAAiB,CAAC,KAAK,SAAS;AACzD,YAAM,SAAS,aAAa,UAAU,IAAI;AAC1C,UAAI,OAAO,QAAS,KAAI,KAAK,OAAO,IAAI;AACxC,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAEL,WAAO,EAAE,MAAM,OAAO,SAAS,OAAO,SAAS,KAAK;AAAA,EACtD;AAAA,EAEA,MAAM,aAAa,MAAoD;AACrE,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,YAAY,KAAK,QAAQ;AAAA,MACzB;AAAA,QACE,gBAAgB,KAAK;AAAA,QACrB,mBAAmB,KAAK;AAAA,MAC1B;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,MAAM,MAAM,OAAU;AAAA,EAC1C;AAAA,EAEA,MAAM,eAAe,UAA2D;AAC9E,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,YAAY,QAAQ,eAAe,UAAU;AAAA,IAC/C;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI,SAAS,SAAS,WAAW,8BAA2B,sBAAsB,GAAG;AAAA,IAC7F;AAEA,UAAM,OAAO,aAAa,MAAM,SAAS,KAAK,CAAC,CAAC;AAEhD,WAAO,EAAE,MAAM,SAAS,KAAK;AAAA,EAC/B;AACF;AAEO,MAAM,iBAAiB,IAAI,eAAe;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PaginationParamsSchema, SearchParamsSchema, SortParamsSchema } from "../../../infra/api/types";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
const BoletoPaymentDetailsSchema = z.object({
|
|
4
|
+
type: z.literal("boleto"),
|
|
5
|
+
barcode: z.string().nullable().optional(),
|
|
6
|
+
expiration_date: z.number().nullable().optional(),
|
|
7
|
+
hosted_voucher_url: z.string().nullable().optional(),
|
|
8
|
+
pdf: z.string().nullable().optional()
|
|
9
|
+
});
|
|
10
|
+
const PaymentDetailsSchema = z.union([BoletoPaymentDetailsSchema, z.record(z.string(), z.unknown())]).nullable().optional();
|
|
11
|
+
const ChargeSchema = z.object({
|
|
12
|
+
id: z.coerce.number(),
|
|
13
|
+
id_wl: z.number(),
|
|
14
|
+
id_product: z.number().nullable().optional(),
|
|
15
|
+
title: z.string().nullable().optional(),
|
|
16
|
+
id_subscription: z.union([z.number(), z.string()]).nullable().optional(),
|
|
17
|
+
id_account: z.coerce.number(),
|
|
18
|
+
status: z.number().nullable().optional().default(0),
|
|
19
|
+
description: z.string().nullable().optional(),
|
|
20
|
+
date_due: z.coerce.date().nullable().optional(),
|
|
21
|
+
date_payment: z.coerce.date().nullable().optional(),
|
|
22
|
+
payment_method: z.number().nullable().optional(),
|
|
23
|
+
value: z.number().nullable().optional().default(0),
|
|
24
|
+
type: z.number().nullable().optional(),
|
|
25
|
+
periodicity: z.number().nullable().optional(),
|
|
26
|
+
id_gateway: z.number().nullable().optional(),
|
|
27
|
+
gateway_invoice: z.string().nullable().optional(),
|
|
28
|
+
gateway_billet: z.string().nullable().optional(),
|
|
29
|
+
invoice_id: z.string().nullable().optional(),
|
|
30
|
+
invoice_service: z.string().nullable().optional(),
|
|
31
|
+
invoice_url: z.string().nullable().optional(),
|
|
32
|
+
invoice_pdf: z.string().nullable().optional(),
|
|
33
|
+
date_created: z.coerce.date().nullable().optional(),
|
|
34
|
+
deleted: z.number().transform((val) => val === 1).nullable().optional().default(false),
|
|
35
|
+
datetime_alt: z.coerce.date().nullable().optional(),
|
|
36
|
+
datetime_del: z.coerce.date().nullable().optional(),
|
|
37
|
+
datetime_add: z.coerce.date().nullable().optional(),
|
|
38
|
+
line_descriptions: z.array(z.string()).nullable().optional().default([]),
|
|
39
|
+
payment_details: PaymentDetailsSchema
|
|
40
|
+
});
|
|
41
|
+
const FindChargesParamsSchema = z.object({
|
|
42
|
+
date_start: z.date(),
|
|
43
|
+
date_end: z.date(),
|
|
44
|
+
date_payment_start: z.date(),
|
|
45
|
+
date_payment_end: z.date(),
|
|
46
|
+
status: z.array(z.number()).optional()
|
|
47
|
+
}).extend(PaginationParamsSchema.shape).extend(SortParamsSchema.shape).extend(SearchParamsSchema.shape);
|
|
48
|
+
const PayChargeInputSchema = z.object({
|
|
49
|
+
chargeId: z.union([z.number(), z.string()]),
|
|
50
|
+
paymentMethod: z.number(),
|
|
51
|
+
paymentMethodId: z.string().optional()
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
ChargeSchema,
|
|
55
|
+
FindChargesParamsSchema,
|
|
56
|
+
PayChargeInputSchema
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=charge.type.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/charges/types/charge.type.ts"],"sourcesContent":["import { PaginationParamsSchema, SearchParamsSchema, SortParamsSchema } from '../../../infra/api/types';\nimport z from 'zod';\n\nconst BoletoPaymentDetailsSchema = z.object({\n type: z.literal('boleto'),\n barcode: z.string().nullable().optional(),\n expiration_date: z.number().nullable().optional(),\n hosted_voucher_url: z.string().nullable().optional(),\n pdf: z.string().nullable().optional(),\n});\n\nconst PaymentDetailsSchema = z.union([BoletoPaymentDetailsSchema, z.record(z.string(), z.unknown())]).nullable().optional();\n\nexport const ChargeSchema = z.object({\n id: z.coerce.number(),\n id_wl: z.number(),\n id_product: z.number().nullable().optional(),\n title: z.string().nullable().optional(),\n id_subscription: z.union([z.number(), z.string()]).nullable().optional(),\n id_account: z.coerce.number(),\n status: z.number().nullable().optional().default(0),\n description: z.string().nullable().optional(),\n date_due: z.coerce.date().nullable().optional(),\n date_payment: z.coerce.date().nullable().optional(),\n payment_method: z.number().nullable().optional(),\n value: z.number().nullable().optional().default(0),\n type: z.number().nullable().optional(),\n periodicity: z.number().nullable().optional(),\n id_gateway: z.number().nullable().optional(),\n gateway_invoice: z.string().nullable().optional(),\n gateway_billet: z.string().nullable().optional(),\n invoice_id: z.string().nullable().optional(),\n invoice_service: z.string().nullable().optional(),\n invoice_url: z.string().nullable().optional(),\n invoice_pdf: z.string().nullable().optional(),\n date_created: z.coerce.date().nullable().optional(),\n deleted: z.number().transform((val) => val === 1).nullable().optional().default(false),\n datetime_alt: z.coerce.date().nullable().optional(),\n datetime_del: z.coerce.date().nullable().optional(),\n datetime_add: z.coerce.date().nullable().optional(),\n line_descriptions: z.array(z.string()).nullable().optional().default([]),\n payment_details: PaymentDetailsSchema,\n});\n\nexport type Charge = z.infer<typeof ChargeSchema>;\n\nexport const FindChargesParamsSchema = z\n .object({\n date_start: z.date(),\n date_end: z.date(),\n date_payment_start: z.date(),\n date_payment_end: z.date(),\n status: z.array(z.number()).optional(),\n })\n .extend(PaginationParamsSchema.shape)\n .extend(SortParamsSchema.shape)\n .extend(SearchParamsSchema.shape);\n\nexport const PayChargeInputSchema = z.object({\n chargeId: z.union([z.number(), z.string()]),\n paymentMethod: z.number(),\n paymentMethodId: z.string().optional(),\n});\n\nexport type PayChargeInput = z.infer<typeof PayChargeInputSchema>;\n\nexport type FindChargesParams = z.infer<typeof FindChargesParamsSchema>;\n"],"mappings":"AAAA,SAAS,wBAAwB,oBAAoB,wBAAwB;AAC7E,OAAO,OAAO;AAEd,MAAM,6BAA6B,EAAE,OAAO;AAAA,EAC1C,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACxB,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACxC,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAChD,oBAAoB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACnD,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACtC,CAAC;AAED,MAAM,uBAAuB,EAAE,MAAM,CAAC,4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,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC5C,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC5C,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,QAAQ,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,KAAK;AAAA,EACrF,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,mBAAmB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EACvE,iBAAiB;AACnB,CAAC;AAIM,MAAM,0BAA0B,EACpC,OAAO;AAAA,EACN,YAAY,EAAE,KAAK;AAAA,EACnB,UAAU,EAAE,KAAK;AAAA,EACjB,oBAAoB,EAAE,KAAK;AAAA,EAC3B,kBAAkB,EAAE,KAAK;AAAA,EACzB,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AACvC,CAAC,EACA,OAAO,uBAAuB,KAAK,EACnC,OAAO,iBAAiB,KAAK,EAC7B,OAAO,mBAAmB,KAAK;AAE3B,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,EAC1C,eAAe,EAAE,OAAO;AAAA,EACxB,iBAAiB,EAAE,OAAO,EAAE,SAAS;AACvC,CAAC;","names":[]}
|
package/dist/server.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { assertPaidSubscription } from "./modules/auth/utils/assert-paid-subscri
|
|
|
10
10
|
import { subscriptionsService } from "./modules/subscriptions/services/subscriptions.service";
|
|
11
11
|
import { plansService } from "./modules/plans/services/plans.service";
|
|
12
12
|
import { cardsService } from "./modules/cards/services/cards.service";
|
|
13
|
+
import { chargesService } from "./modules/charges/services/charges.service";
|
|
13
14
|
import { iaCreditsService } from "./modules/ia-credits/services/ia-credits.service";
|
|
14
15
|
import { findWhitelabel } from "./modules/whitelabel/actions/find-whitelabel.action";
|
|
15
16
|
import { validateSessionAction } from "./modules/auth/actions/validate-session.action";
|
|
@@ -24,6 +25,9 @@ import { updateSubscriptionPlanAction } from "./modules/subscriptions/actions/up
|
|
|
24
25
|
import { updateSubscriptionPaymentAction } from "./modules/subscriptions/actions/update-subscription-payment.action";
|
|
25
26
|
import { listCardsAction } from "./modules/cards/actions/list-cards.action";
|
|
26
27
|
import { createCardAction } from "./modules/cards/actions/create-card.action";
|
|
28
|
+
import { listChargesAction } from "./modules/charges/actions/list-charges.action";
|
|
29
|
+
import { findChargeByIdAction } from "./modules/charges/actions/find-charge-by-id.action";
|
|
30
|
+
import { chargeActionAction } from "./modules/charges/actions/charge-action.action";
|
|
27
31
|
import { resolvePlanExtrasPrices } from "./modules/subscriptions/utils/resolve-plan-extras-prices";
|
|
28
32
|
import { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
|
|
29
33
|
import { listIaCreditsAction } from "./modules/ia-credits/actions/list-ia-credits.action";
|
|
@@ -83,6 +87,8 @@ export {
|
|
|
83
87
|
calculateSubscriptionAction,
|
|
84
88
|
cardsService,
|
|
85
89
|
changePasswordAction,
|
|
90
|
+
chargeActionAction,
|
|
91
|
+
chargesService,
|
|
86
92
|
confirmEmailChangeAction,
|
|
87
93
|
confirmPhoneChangeAction,
|
|
88
94
|
confirmTwoFactorAction,
|
|
@@ -94,6 +100,7 @@ export {
|
|
|
94
100
|
deleteAccountUserAction,
|
|
95
101
|
deleteProjectAction,
|
|
96
102
|
disableTwoFactorAction,
|
|
103
|
+
findChargeByIdAction,
|
|
97
104
|
findCurrentAccount,
|
|
98
105
|
findPlanByIdAction,
|
|
99
106
|
findProjectAction,
|
|
@@ -108,6 +115,7 @@ export {
|
|
|
108
115
|
listAccountUsersAction,
|
|
109
116
|
listAvailableUsersAction,
|
|
110
117
|
listCardsAction,
|
|
118
|
+
listChargesAction,
|
|
111
119
|
listIaCreditsAction,
|
|
112
120
|
listPlansAction,
|
|
113
121
|
listProjectUsersAction,
|
package/dist/server.mjs.map
CHANGED
|
@@ -1 +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 { getAccountTokenAction } from './modules/accounts/actions/get-account-token.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 { listPlansAction } from './modules/plans/actions/list-plans.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { updateSubscriptionPaymentAction } from './modules/subscriptions/actions/update-subscription-payment.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\nexport { countPagesAction } from './modules/pages/actions/count-pages.action';\r\n\r\n// Project Services & Actions (server-only)\r\nexport { projectsService } from './modules/projects/services/projects.service';\r\nexport { listProjectsAction } from './modules/projects/actions/list-projects.action';\r\nexport { findProjectAction } from './modules/projects/actions/find-project.action';\r\nexport { createProjectAction } from './modules/projects/actions/create-project.action';\r\nexport { updateProjectAction } from './modules/projects/actions/update-project.action';\r\nexport { deleteProjectAction } from './modules/projects/actions/delete-project.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 { requireValidSession } from './modules/auth/utils/require-valid-session';\r\nexport { requireTokenNotExpired } from './modules/auth/utils/require-token-not-expired';\r\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\nexport { safeMutationAction } from './utils/safeMutationAction';\r\n\r\n// Image Processing (server-side)\r\nexport { processImageAction } from './modules/images/actions/process-image.action';\r\nexport { processImage } from './modules/images/services/image-processing.service';\r\nexport type {\r\n ProcessImageInput,\r\n ProcessImageOutput,\r\n ProcessImageActionInput,\r\n ProcessImageActionOutput,\r\n} from './modules/images/types/image.type';\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,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AAGjC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AACpC,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,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,iBAAiB,8BAA8B;AACxD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAGnC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;","names":[]}
|
|
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 { chargesService } from './modules/charges/services/charges.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 { getAccountTokenAction } from './modules/accounts/actions/get-account-token.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 { listPlansAction } from './modules/plans/actions/list-plans.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { updateSubscriptionPaymentAction } from './modules/subscriptions/actions/update-subscription-payment.action';\r\nexport { listCardsAction } from './modules/cards/actions/list-cards.action';\r\nexport { createCardAction } from './modules/cards/actions/create-card.action';\r\nexport { listChargesAction } from './modules/charges/actions/list-charges.action';\r\nexport { findChargeByIdAction } from './modules/charges/actions/find-charge-by-id.action';\r\nexport { chargeActionAction } from './modules/charges/actions/charge-action.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\nexport { countPagesAction } from './modules/pages/actions/count-pages.action';\r\n\r\n// Project Services & Actions (server-only)\r\nexport { projectsService } from './modules/projects/services/projects.service';\r\nexport { listProjectsAction } from './modules/projects/actions/list-projects.action';\r\nexport { findProjectAction } from './modules/projects/actions/find-project.action';\r\nexport { createProjectAction } from './modules/projects/actions/create-project.action';\r\nexport { updateProjectAction } from './modules/projects/actions/update-project.action';\r\nexport { deleteProjectAction } from './modules/projects/actions/delete-project.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 { requireValidSession } from './modules/auth/utils/require-valid-session';\r\nexport { requireTokenNotExpired } from './modules/auth/utils/require-token-not-expired';\r\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\nexport { safeMutationAction } from './utils/safeMutationAction';\r\n\r\n// Image Processing (server-side)\r\nexport { processImageAction } from './modules/images/actions/process-image.action';\r\nexport { processImage } from './modules/images/services/image-processing.service';\r\nexport type {\r\n ProcessImageInput,\r\n ProcessImageOutput,\r\n ProcessImageActionInput,\r\n ProcessImageActionOutput,\r\n} from './modules/images/types/image.type';\r\n"],"mappings":"AAAA,OAAO;AAGP,SAAS,WAAW,KAAK,iBAAiB;AAG1C,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,oCAAo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GED
package/src/index.ts
CHANGED
|
@@ -82,6 +82,9 @@ export { useDeleteCard } from "./modules/cards/hooks/delete-card.hook";
|
|
|
82
82
|
export { useDeleteConfirmation } from "./modules/cards/hooks/delete-confirmation.hook";
|
|
83
83
|
export type { DeleteConfirmationFormData } from "./modules/cards/hooks/delete-confirmation.hook";
|
|
84
84
|
export { useHandleDeleteCard } from "./modules/cards/hooks/handle-delete-card.hook";
|
|
85
|
+
export { useCharges } from "./modules/charges/hooks/charges.hook";
|
|
86
|
+
export { useChargeById } from "./modules/charges/hooks/charge-by-id.hook";
|
|
87
|
+
export { useChargeAction } from "./modules/charges/hooks/charge-action.hook";
|
|
85
88
|
export { useIaCredits } from "./modules/ia-credits/hooks/ia-credits.hook";
|
|
86
89
|
export type {
|
|
87
90
|
IaCreditsSummary,
|
|
@@ -137,6 +140,16 @@ export {
|
|
|
137
140
|
CreateCardRequestSchema,
|
|
138
141
|
FindCardsParamsSchema,
|
|
139
142
|
} from "./modules/cards/types";
|
|
143
|
+
export type {
|
|
144
|
+
Charge,
|
|
145
|
+
FindChargesParams,
|
|
146
|
+
PayChargeInput,
|
|
147
|
+
} from "./modules/charges/types/charge.type";
|
|
148
|
+
export {
|
|
149
|
+
ChargeSchema,
|
|
150
|
+
FindChargesParamsSchema,
|
|
151
|
+
PayChargeInputSchema,
|
|
152
|
+
} from "./modules/charges/types/charge.type";
|
|
140
153
|
export { buildPlanExtras } from "./modules/subscriptions/utils/build-plan-extras";
|
|
141
154
|
export { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
|
|
142
155
|
export {
|
|
@@ -24,10 +24,10 @@ export function useManagementPermissions() {
|
|
|
24
24
|
case 'manage_domains':
|
|
25
25
|
case 'manage_ab_tests':
|
|
26
26
|
case 'restore_pages':
|
|
27
|
-
return !isViewer;
|
|
28
|
-
case 'manage_projects':
|
|
29
27
|
case 'create_pages':
|
|
30
28
|
case 'update_pages':
|
|
29
|
+
return !isViewer;
|
|
30
|
+
case 'manage_projects':
|
|
31
31
|
case 'delete_pages':
|
|
32
32
|
case 'delete_leads':
|
|
33
33
|
case 'view_cards':
|
|
@@ -29,13 +29,13 @@ export async function assertManagementPermission(permission: ManagementPermissio
|
|
|
29
29
|
case 'manage_domains':
|
|
30
30
|
case 'manage_ab_tests':
|
|
31
31
|
case 'restore_pages':
|
|
32
|
+
case 'create_pages':
|
|
33
|
+
case 'update_pages':
|
|
32
34
|
if (profile === UserProfile.viewer) {
|
|
33
35
|
throw new ApiError('Você não tem permissão para executar esta ação', 'FORBIDDEN', 403);
|
|
34
36
|
}
|
|
35
37
|
break;
|
|
36
38
|
case 'manage_projects':
|
|
37
|
-
case 'create_pages':
|
|
38
|
-
case 'update_pages':
|
|
39
39
|
case 'delete_pages':
|
|
40
40
|
case 'delete_leads':
|
|
41
41
|
case 'view_cards':
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { safeMutationAction } from '../../../utils/safeMutationAction';
|
|
4
|
+
import { assertManagementPermission } from '../../auth/utils/assert-management-permission';
|
|
5
|
+
import { chargesService } from '../services/charges.service';
|
|
6
|
+
import { PayChargeInput } from '../types/charge.type';
|
|
7
|
+
|
|
8
|
+
export async function chargeActionAction(data: PayChargeInput) {
|
|
9
|
+
return safeMutationAction(async () => {
|
|
10
|
+
await assertManagementPermission('manage_subscriptions');
|
|
11
|
+
return chargesService.chargeAction(data);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { safeServerAction } from '../../../utils/safeServerAction';
|
|
4
|
+
import { chargesService } from '../services/charges.service';
|
|
5
|
+
|
|
6
|
+
export async function findChargeByIdAction(chargeId: string | number) {
|
|
7
|
+
return safeServerAction(() => chargesService.findChargeById(chargeId));
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { safeServerAction } from '../../../utils/safeServerAction';
|
|
4
|
+
import type { FindChargesParams } from '../types/charge.type';
|
|
5
|
+
import { chargesService } from '../services/charges.service';
|
|
6
|
+
|
|
7
|
+
export async function listChargesAction(params?: Partial<FindChargesParams>) {
|
|
8
|
+
return safeServerAction(() => chargesService.listCharges(params));
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
4
|
+
import { withAction } from '../../../utils/withAction';
|
|
5
|
+
import { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';
|
|
6
|
+
import { chargeActionAction } from '../actions/charge-action.action';
|
|
7
|
+
import { PayChargeInput } from '../types/charge.type';
|
|
8
|
+
import { CHARGES_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';
|
|
9
|
+
import { SUBSCRIPTIONS_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';
|
|
10
|
+
|
|
11
|
+
export function useChargeAction() {
|
|
12
|
+
const queryClient = useQueryClient();
|
|
13
|
+
const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY]);
|
|
14
|
+
const subsKey = useAuthQueryKey([...SUBSCRIPTIONS_QUERY_KEY]);
|
|
15
|
+
|
|
16
|
+
return useMutation({
|
|
17
|
+
mutationFn: (data: PayChargeInput) =>
|
|
18
|
+
withAction(chargeActionAction)(data),
|
|
19
|
+
onSuccess: () => {
|
|
20
|
+
queryClient.invalidateQueries({ queryKey: chargesKey });
|
|
21
|
+
queryClient.invalidateQueries({ queryKey: subsKey });
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { withAction } from '../../../utils/withAction';
|
|
5
|
+
import { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';
|
|
6
|
+
import { findChargeByIdAction } from '../actions/find-charge-by-id.action';
|
|
7
|
+
import { CHARGES_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';
|
|
8
|
+
|
|
9
|
+
export function useChargeById(chargeId: string | number | null | undefined) {
|
|
10
|
+
const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY, chargeId]);
|
|
11
|
+
|
|
12
|
+
return useQuery({
|
|
13
|
+
queryKey: chargesKey,
|
|
14
|
+
queryFn: () => withAction(findChargeByIdAction)(chargeId!),
|
|
15
|
+
enabled: !!chargeId,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { withAction } from '../../../utils/withAction';
|
|
5
|
+
import { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';
|
|
6
|
+
import { listChargesAction } from '../actions/list-charges.action';
|
|
7
|
+
import { FindChargesParams } from '../types/charge.type';
|
|
8
|
+
import { CHARGES_QUERY_KEY } from '../../subscriptions/constants/query-keys.constants';
|
|
9
|
+
|
|
10
|
+
export function useCharges(params?: Partial<FindChargesParams>) {
|
|
11
|
+
const chargesKey = useAuthQueryKey([...CHARGES_QUERY_KEY, params]);
|
|
12
|
+
|
|
13
|
+
return useQuery({
|
|
14
|
+
queryKey: chargesKey,
|
|
15
|
+
queryFn: () => withAction(listChargesAction)(params),
|
|
16
|
+
staleTime: 10_000,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
|
|
3
|
+
import { api } from '../../../infra/api/client';
|
|
4
|
+
import { ApiError, ApiActionResult, ApiPaginatedActionResult, PaginatedSuccessResult, SuccessResult } from '../../../infra/api/types';
|
|
5
|
+
import { buildQueryParams } from '../../../infra/utils/params';
|
|
6
|
+
import { getUserContext } from '../../auth/utils/get-user-context';
|
|
7
|
+
import { Charge, ChargeSchema, FindChargesParams, PayChargeInput } from '../types/charge.type';
|
|
8
|
+
|
|
9
|
+
class ChargesService {
|
|
10
|
+
async listCharges(params?: Partial<FindChargesParams>): Promise<PaginatedSuccessResult<Charge>> {
|
|
11
|
+
const { id_account } = await getUserContext();
|
|
12
|
+
|
|
13
|
+
const query = buildQueryParams({ ...params, id_account });
|
|
14
|
+
|
|
15
|
+
const response = await api.apps.get<ApiPaginatedActionResult<Charge>>(`/charges?${query}`);
|
|
16
|
+
|
|
17
|
+
if (response.status === 0) {
|
|
18
|
+
throw new ApiError(
|
|
19
|
+
response.message || 'Erro ao listar cobranças',
|
|
20
|
+
'LIST_CHARGES_FAILED',
|
|
21
|
+
400
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const data = response.data.reduce<Charge[]>((acc, item) => {
|
|
26
|
+
const result = ChargeSchema.safeParse(item);
|
|
27
|
+
if (result.success) acc.push(result.data);
|
|
28
|
+
return acc;
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return { data, total: response.total, success: true };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async chargeAction(data: PayChargeInput): Promise<SuccessResult<void>> {
|
|
35
|
+
const response = await api.apps.put<ApiActionResult<void>>(
|
|
36
|
+
`/charges/${data.chargeId}/action/charge`,
|
|
37
|
+
{
|
|
38
|
+
payment_method: data.paymentMethod,
|
|
39
|
+
payment_method_id: data.paymentMethodId,
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (response.status === 0) {
|
|
44
|
+
throw new ApiError(
|
|
45
|
+
response.message || 'Erro ao processar cobrança',
|
|
46
|
+
'CHARGE_ACTION_FAILED',
|
|
47
|
+
400
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return { success: true, data: undefined };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async findChargeById(chargeId: string | number): Promise<SuccessResult<Charge>> {
|
|
55
|
+
const { id_account } = await getUserContext();
|
|
56
|
+
|
|
57
|
+
const response = await api.apps.get<ApiPaginatedActionResult<Charge>>(
|
|
58
|
+
`/charges/${chargeId}?id_account=${id_account}`
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (response.status === 0) {
|
|
62
|
+
throw new ApiError(response.message || 'Erro ao buscar cobrança', 'FIND_CHARGE_FAILED', 400);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const data = ChargeSchema.parse(response.data[0]);
|
|
66
|
+
|
|
67
|
+
return { data, success: true };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const chargesService = new ChargesService();
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { PaginationParamsSchema, SearchParamsSchema, SortParamsSchema } from '../../../infra/api/types';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
|
|
4
|
+
const BoletoPaymentDetailsSchema = z.object({
|
|
5
|
+
type: z.literal('boleto'),
|
|
6
|
+
barcode: z.string().nullable().optional(),
|
|
7
|
+
expiration_date: z.number().nullable().optional(),
|
|
8
|
+
hosted_voucher_url: z.string().nullable().optional(),
|
|
9
|
+
pdf: z.string().nullable().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const PaymentDetailsSchema = z.union([BoletoPaymentDetailsSchema, z.record(z.string(), z.unknown())]).nullable().optional();
|
|
13
|
+
|
|
14
|
+
export const ChargeSchema = z.object({
|
|
15
|
+
id: z.coerce.number(),
|
|
16
|
+
id_wl: z.number(),
|
|
17
|
+
id_product: z.number().nullable().optional(),
|
|
18
|
+
title: z.string().nullable().optional(),
|
|
19
|
+
id_subscription: z.union([z.number(), z.string()]).nullable().optional(),
|
|
20
|
+
id_account: z.coerce.number(),
|
|
21
|
+
status: z.number().nullable().optional().default(0),
|
|
22
|
+
description: z.string().nullable().optional(),
|
|
23
|
+
date_due: z.coerce.date().nullable().optional(),
|
|
24
|
+
date_payment: z.coerce.date().nullable().optional(),
|
|
25
|
+
payment_method: z.number().nullable().optional(),
|
|
26
|
+
value: z.number().nullable().optional().default(0),
|
|
27
|
+
type: z.number().nullable().optional(),
|
|
28
|
+
periodicity: z.number().nullable().optional(),
|
|
29
|
+
id_gateway: z.number().nullable().optional(),
|
|
30
|
+
gateway_invoice: z.string().nullable().optional(),
|
|
31
|
+
gateway_billet: z.string().nullable().optional(),
|
|
32
|
+
invoice_id: z.string().nullable().optional(),
|
|
33
|
+
invoice_service: z.string().nullable().optional(),
|
|
34
|
+
invoice_url: z.string().nullable().optional(),
|
|
35
|
+
invoice_pdf: z.string().nullable().optional(),
|
|
36
|
+
date_created: z.coerce.date().nullable().optional(),
|
|
37
|
+
deleted: z.number().transform((val) => val === 1).nullable().optional().default(false),
|
|
38
|
+
datetime_alt: z.coerce.date().nullable().optional(),
|
|
39
|
+
datetime_del: z.coerce.date().nullable().optional(),
|
|
40
|
+
datetime_add: z.coerce.date().nullable().optional(),
|
|
41
|
+
line_descriptions: z.array(z.string()).nullable().optional().default([]),
|
|
42
|
+
payment_details: PaymentDetailsSchema,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type Charge = z.infer<typeof ChargeSchema>;
|
|
46
|
+
|
|
47
|
+
export const FindChargesParamsSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
date_start: z.date(),
|
|
50
|
+
date_end: z.date(),
|
|
51
|
+
date_payment_start: z.date(),
|
|
52
|
+
date_payment_end: z.date(),
|
|
53
|
+
status: z.array(z.number()).optional(),
|
|
54
|
+
})
|
|
55
|
+
.extend(PaginationParamsSchema.shape)
|
|
56
|
+
.extend(SortParamsSchema.shape)
|
|
57
|
+
.extend(SearchParamsSchema.shape);
|
|
58
|
+
|
|
59
|
+
export const PayChargeInputSchema = z.object({
|
|
60
|
+
chargeId: z.union([z.number(), z.string()]),
|
|
61
|
+
paymentMethod: z.number(),
|
|
62
|
+
paymentMethodId: z.string().optional(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export type PayChargeInput = z.infer<typeof PayChargeInputSchema>;
|
|
66
|
+
|
|
67
|
+
export type FindChargesParams = z.infer<typeof FindChargesParamsSchema>;
|
package/src/server.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscri
|
|
|
14
14
|
export { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';
|
|
15
15
|
export { plansService } from './modules/plans/services/plans.service';
|
|
16
16
|
export { cardsService } from './modules/cards/services/cards.service';
|
|
17
|
+
export { chargesService } from './modules/charges/services/charges.service';
|
|
17
18
|
export { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';
|
|
18
19
|
|
|
19
20
|
// Actions
|
|
@@ -30,6 +31,9 @@ export { updateSubscriptionPlanAction } from './modules/subscriptions/actions/up
|
|
|
30
31
|
export { updateSubscriptionPaymentAction } from './modules/subscriptions/actions/update-subscription-payment.action';
|
|
31
32
|
export { listCardsAction } from './modules/cards/actions/list-cards.action';
|
|
32
33
|
export { createCardAction } from './modules/cards/actions/create-card.action';
|
|
34
|
+
export { listChargesAction } from './modules/charges/actions/list-charges.action';
|
|
35
|
+
export { findChargeByIdAction } from './modules/charges/actions/find-charge-by-id.action';
|
|
36
|
+
export { chargeActionAction } from './modules/charges/actions/charge-action.action';
|
|
33
37
|
export { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';
|
|
34
38
|
export { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';
|
|
35
39
|
export { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';
|