@greatapps/common 1.1.790 → 1.1.791
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/AccountHubLinkHandler.mjs +36 -0
- package/dist/components/account/AccountHubLinkHandler.mjs.map +1 -0
- package/dist/components/account/AccountModalLayout.mjs +137 -0
- package/dist/components/account/AccountModalLayout.mjs.map +1 -0
- package/dist/components/account/AccountModals.mjs +10 -3
- package/dist/components/account/AccountModals.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +1 -1
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +8 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/MyAccountModal.mjs +167 -0
- package/dist/components/account/MyAccountModal.mjs.map +1 -0
- package/dist/components/account/TwoFactorAuthModal.mjs +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/hooks/useAccountHubActions.mjs +85 -0
- package/dist/components/account/hooks/useAccountHubActions.mjs.map +1 -0
- package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs +44 -0
- package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs.map +1 -0
- package/dist/components/account/hooks/useAffiliatesActions.mjs +69 -0
- package/dist/components/account/hooks/useAffiliatesActions.mjs.map +1 -0
- package/dist/components/account/hooks/useMyAccountModal.mjs +27 -0
- package/dist/components/account/hooks/useMyAccountModal.mjs.map +1 -0
- package/dist/components/account/hooks/useProjectsActions.mjs +40 -0
- package/dist/components/account/hooks/useProjectsActions.mjs.map +1 -0
- package/dist/components/account/hooks/useSubscriptionActions.mjs +87 -0
- package/dist/components/account/hooks/useSubscriptionActions.mjs.map +1 -0
- package/dist/components/account/hooks/useTeamActions.mjs +31 -0
- package/dist/components/account/hooks/useTeamActions.mjs.map +1 -0
- package/dist/components/account/sections/AffiliatesSection.mjs +313 -0
- package/dist/components/account/sections/AffiliatesSection.mjs.map +1 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs +5 -5
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +194 -144
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +60 -49
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/ProjectsSection.mjs +77 -0
- package/dist/components/account/sections/ProjectsSection.mjs.map +1 -0
- package/dist/components/account/sections/SecuritySection.mjs +55 -36
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/account/sections/SubscriptionSection.mjs +29 -0
- package/dist/components/account/sections/SubscriptionSection.mjs.map +1 -0
- package/dist/components/account/sections/TeamSection.mjs +119 -0
- package/dist/components/account/sections/TeamSection.mjs.map +1 -0
- package/dist/components/account/sections/TokenSection.mjs +41 -43
- package/dist/components/account/sections/TokenSection.mjs.map +1 -1
- package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs +73 -0
- package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateFlows.mjs +20 -0
- package/dist/components/account/sections/affiliates/AffiliateFlows.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs +99 -0
- package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs +31 -0
- package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs +15 -0
- package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs +108 -0
- package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs +49 -0
- package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs +182 -0
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs +476 -0
- package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs +34 -0
- package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs +27 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs +30 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs +120 -0
- package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs.map +1 -0
- package/dist/components/account/sections/projects/DeleteProjectModal.mjs +205 -0
- package/dist/components/account/sections/projects/DeleteProjectModal.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectFlows.mjs +16 -0
- package/dist/components/account/sections/projects/ProjectFlows.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectMembersStack.mjs +53 -0
- package/dist/components/account/sections/projects/ProjectMembersStack.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectRow.mjs +85 -0
- package/dist/components/account/sections/projects/ProjectRow.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectSheet.mjs +499 -0
- package/dist/components/account/sections/projects/ProjectSheet.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs +55 -0
- package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs.map +1 -0
- package/dist/components/account/sections/projects/project-form.schema.mjs +28 -0
- package/dist/components/account/sections/projects/project-form.schema.mjs.map +1 -0
- package/dist/components/account/sections/shared/ConnectListRow.mjs +45 -0
- package/dist/components/account/sections/shared/ConnectListRow.mjs.map +1 -0
- package/dist/components/account/sections/shared/DateFilterPopover.mjs +51 -0
- package/dist/components/account/sections/shared/DateFilterPopover.mjs.map +1 -0
- package/dist/components/account/sections/shared/EntityAvatar.mjs +41 -0
- package/dist/components/account/sections/shared/EntityAvatar.mjs.map +1 -0
- package/dist/components/account/sections/shared/FilterPopover.mjs +62 -0
- package/dist/components/account/sections/shared/FilterPopover.mjs.map +1 -0
- package/dist/components/account/sections/shared/FormSection.mjs +14 -0
- package/dist/components/account/sections/shared/FormSection.mjs.map +1 -0
- package/dist/components/account/sections/shared/IconBox.mjs +18 -0
- package/dist/components/account/sections/shared/IconBox.mjs.map +1 -0
- package/dist/components/account/sections/shared/InfiniteScrollList.mjs +36 -0
- package/dist/components/account/sections/shared/InfiniteScrollList.mjs.map +1 -0
- package/dist/components/account/sections/shared/ListPagination.mjs +69 -0
- package/dist/components/account/sections/shared/ListPagination.mjs.map +1 -0
- package/dist/components/account/sections/shared/RowActionsMenu.mjs +52 -0
- package/dist/components/account/sections/shared/RowActionsMenu.mjs.map +1 -0
- package/dist/components/account/sections/shared/SectionLoadError.mjs +20 -0
- package/dist/components/account/sections/shared/SectionLoadError.mjs.map +1 -0
- package/dist/components/account/sections/shared/StatusBadge.mjs +26 -0
- package/dist/components/account/sections/shared/StatusBadge.mjs.map +1 -0
- package/dist/components/account/sections/shared/WorkspaceSection.mjs +10 -0
- package/dist/components/account/sections/shared/WorkspaceSection.mjs.map +1 -0
- package/dist/components/account/sections/subscription/AiCreditsUsage.mjs +106 -0
- package/dist/components/account/sections/subscription/AiCreditsUsage.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BillingAddressSheet.mjs +407 -0
- package/dist/components/account/sections/subscription/BillingAddressSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs +73 -0
- package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs +22 -0
- package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/CancelPlanDialog.mjs +161 -0
- package/dist/components/account/sections/subscription/CancelPlanDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargeRow.mjs +127 -0
- package/dist/components/account/sections/subscription/ChargeRow.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs +27 -0
- package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargesList.mjs +88 -0
- package/dist/components/account/sections/subscription/ChargesList.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ManageCardsSheet.mjs +49 -0
- package/dist/components/account/sections/subscription/ManageCardsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs +26 -0
- package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PayChargeDialog.mjs +222 -0
- package/dist/components/account/sections/subscription/PayChargeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs +61 -0
- package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs +72 -0
- package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PendingChangeDialog.mjs +117 -0
- package/dist/components/account/sections/subscription/PendingChangeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PixDetailsDialog.mjs +165 -0
- package/dist/components/account/sections/subscription/PixDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PixPaymentDialog.mjs +155 -0
- package/dist/components/account/sections/subscription/PixPaymentDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs +253 -0
- package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs +237 -0
- package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/SubscriptionFlows.mjs +40 -0
- package/dist/components/account/sections/subscription/SubscriptionFlows.mjs.map +1 -0
- package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs +303 -0
- package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/UsageReportSheet.mjs +163 -0
- package/dist/components/account/sections/subscription/UsageReportSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs +75 -0
- package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs +55 -0
- package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs +188 -0
- package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs +66 -0
- package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs +42 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs +119 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs +17 -0
- package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs +130 -0
- package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs +38 -0
- package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs +127 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs +111 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs +69 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs +88 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs +115 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs +918 -0
- package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs.map +1 -0
- package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs +216 -0
- package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs +128 -0
- package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlanCard.mjs +281 -0
- package/dist/components/account/sections/subscription/plans/PlanCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs +53 -0
- package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs +119 -0
- package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs.map +1 -0
- package/dist/components/account/sections/team/DeleteUserModal.mjs +116 -0
- package/dist/components/account/sections/team/DeleteUserModal.mjs.map +1 -0
- package/dist/components/account/sections/team/TeamFlows.mjs +14 -0
- package/dist/components/account/sections/team/TeamFlows.mjs.map +1 -0
- package/dist/components/account/sections/team/TeamMemberRow.mjs +99 -0
- package/dist/components/account/sections/team/TeamMemberRow.mjs.map +1 -0
- package/dist/components/account/sections/team/UserSheet.mjs +570 -0
- package/dist/components/account/sections/team/UserSheet.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/NotificationsStep.mjs +80 -0
- package/dist/components/account/sections/team/steps/NotificationsStep.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs +180 -0
- package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/UserInformationStep.mjs +371 -0
- package/dist/components/account/sections/team/steps/UserInformationStep.mjs.map +1 -0
- package/dist/components/account/sections/team/user-form.schema.mjs +37 -0
- package/dist/components/account/sections/team/user-form.schema.mjs.map +1 -0
- package/dist/components/account/types/workspace-actions.type.mjs +1 -0
- package/dist/components/account/types/workspace-actions.type.mjs.map +1 -0
- package/dist/components/layouts/ProfilePopover.mjs +10 -12
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +7 -4
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/AccountDeletionWarningModal.mjs +4 -5
- package/dist/components/modals/AccountDeletionWarningModal.mjs.map +1 -1
- package/dist/components/modals/AccountFrozenModal.mjs +6 -3
- package/dist/components/modals/AccountFrozenModal.mjs.map +1 -1
- package/dist/components/modals/Modals.mjs +3 -3
- package/dist/components/modals/Modals.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +4 -5
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddFirstCardWarningModal.mjs +63 -0
- package/dist/components/modals/cards/AddFirstCardWarningModal.mjs.map +1 -0
- package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs +187 -0
- package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs.map +1 -0
- package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs +5 -4
- package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +9 -1
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentMethodIcons.mjs +50 -0
- package/dist/components/ui/data-display/PaymentMethodIcons.mjs.map +1 -0
- package/dist/components/ui/form/BillingPeriodSelector.mjs +108 -0
- package/dist/components/ui/form/BillingPeriodSelector.mjs.map +1 -0
- package/dist/components/ui/form/PaymentMethodToggle.mjs +82 -0
- package/dist/components/ui/form/PaymentMethodToggle.mjs.map +1 -0
- package/dist/components/ui/form/RadioOptionFieldIcon.mjs +57 -0
- package/dist/components/ui/form/RadioOptionFieldIcon.mjs.map +1 -0
- package/dist/components/ui/form/SegmentedControl.mjs +56 -0
- package/dist/components/ui/form/SegmentedControl.mjs.map +1 -0
- package/dist/components/ui/overlay/Dialog.mjs +21 -4
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -1
- package/dist/components/ui/overlay/Sheet.mjs +26 -8
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
- package/dist/components/ui/overlay/layers.mjs +52 -5
- package/dist/components/ui/overlay/layers.mjs.map +1 -1
- package/dist/enums/AccountHubFlow.mjs +13 -0
- package/dist/enums/AccountHubFlow.mjs.map +1 -0
- package/dist/enums/DateFilterPeriod.mjs +22 -0
- package/dist/enums/DateFilterPeriod.mjs.map +1 -0
- package/dist/enums/WorkspaceSectionType.mjs +11 -0
- package/dist/enums/WorkspaceSectionType.mjs.map +1 -0
- package/dist/handlers.mjs +24 -0
- package/dist/handlers.mjs.map +1 -1
- package/dist/hooks/useDebounce.mjs +5 -3
- package/dist/hooks/useDebounce.mjs.map +1 -1
- package/dist/hooks/useUploadProgress.mjs +33 -0
- package/dist/hooks/useUploadProgress.mjs.map +1 -0
- package/dist/i18n/messages/en-us.mjs +863 -3
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +863 -3
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +863 -3
- package/dist/i18n/messages/pt-br.mjs.map +1 -1
- package/dist/index.mjs +87 -7
- package/dist/index.mjs.map +1 -1
- package/dist/infra/http/paged.mjs +20 -0
- package/dist/infra/http/paged.mjs.map +1 -0
- package/dist/middleware.mjs +2 -0
- package/dist/middleware.mjs.map +1 -1
- package/dist/middlewares/create-auth-middleware.mjs +1 -3
- package/dist/middlewares/create-auth-middleware.mjs.map +1 -1
- package/dist/middlewares/create-legacy-account-routes-middleware.mjs +44 -0
- package/dist/middlewares/create-legacy-account-routes-middleware.mjs.map +1 -0
- package/dist/middlewares/is-route-equals.mjs +7 -0
- package/dist/middlewares/is-route-equals.mjs.map +1 -0
- package/dist/modules/accounts/actions/account-management.action.mjs +20 -1
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -1
- package/dist/modules/accounts/constants/account-hub-link.constants.mjs +9 -0
- package/dist/modules/accounts/constants/account-hub-link.constants.mjs.map +1 -0
- package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs +5 -0
- package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs.map +1 -0
- package/dist/modules/accounts/handlers/list-account-members.handler.mjs +22 -0
- package/dist/modules/accounts/handlers/list-account-members.handler.mjs.map +1 -0
- package/dist/modules/accounts/hooks/add-user-projects.hook.mjs +51 -0
- package/dist/modules/accounts/hooks/add-user-projects.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/create-account-user.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/create-account-user.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs +47 -0
- package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/use-account-members.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/use-account-members.hook.mjs.map +1 -0
- package/dist/modules/accounts/services/account.service.mjs +59 -0
- package/dist/modules/accounts/services/account.service.mjs.map +1 -1
- package/dist/modules/accounts/types/account-hub-link.type.mjs +1 -0
- package/dist/modules/accounts/types/account-hub-link.type.mjs.map +1 -0
- package/dist/modules/accounts/utils/build-account-hub-url.mjs +16 -0
- package/dist/modules/accounts/utils/build-account-hub-url.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-account-hub-flow.mjs +9 -0
- package/dist/modules/accounts/utils/is-account-hub-flow.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-account-section.mjs +9 -0
- package/dist/modules/accounts/utils/is-account-section.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-my-account-section.mjs +13 -0
- package/dist/modules/accounts/utils/is-my-account-section.mjs.map +1 -0
- package/dist/modules/accounts/utils/map-legacy-account-route.mjs +93 -0
- package/dist/modules/accounts/utils/map-legacy-account-route.mjs.map +1 -0
- package/dist/modules/accounts/utils/parse-account-hub-link.mjs +20 -0
- package/dist/modules/accounts/utils/parse-account-hub-link.mjs.map +1 -0
- package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs +10 -0
- package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs.map +1 -0
- package/dist/modules/affiliates/actions/request-deposit.action.mjs +10 -0
- package/dist/modules/affiliates/actions/request-deposit.action.mjs.map +1 -0
- package/dist/modules/affiliates/actions/update-affiliate.action.mjs +10 -0
- package/dist/modules/affiliates/actions/update-affiliate.action.mjs.map +1 -0
- package/dist/modules/affiliates/constants/affiliate.constants.mjs +11 -0
- package/dist/modules/affiliates/constants/affiliate.constants.mjs.map +1 -0
- package/dist/modules/affiliates/constants/query-keys.constants.mjs +15 -0
- package/dist/modules/affiliates/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs +16 -0
- package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs +22 -0
- package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs +22 -0
- package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs +22 -0
- package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs +20 -0
- package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs +23 -0
- package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs +28 -0
- package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs +22 -0
- package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs.map +1 -0
- package/dist/modules/affiliates/services/affiliates.service.mjs +183 -0
- package/dist/modules/affiliates/services/affiliates.service.mjs.map +1 -0
- package/dist/modules/affiliates/types/affiliate.type.mjs +100 -0
- package/dist/modules/affiliates/types/affiliate.type.mjs.map +1 -0
- package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs +9 -0
- package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs.map +1 -0
- package/dist/modules/charges/actions/get-nota-fiscal.action.mjs +10 -0
- package/dist/modules/charges/actions/get-nota-fiscal.action.mjs.map +1 -0
- package/dist/modules/charges/actions/refresh-pix.action.mjs +10 -0
- package/dist/modules/charges/actions/refresh-pix.action.mjs.map +1 -0
- package/dist/modules/charges/hooks/nota-fiscal.hook.mjs +13 -0
- package/dist/modules/charges/hooks/nota-fiscal.hook.mjs.map +1 -0
- package/dist/modules/charges/hooks/refresh-pix.hook.mjs +13 -0
- package/dist/modules/charges/hooks/refresh-pix.hook.mjs.map +1 -0
- package/dist/modules/charges/services/charges.service.mjs +67 -0
- package/dist/modules/charges/services/charges.service.mjs.map +1 -1
- package/dist/modules/charges/types/nota-fiscal.type.mjs +1 -0
- package/dist/modules/charges/types/nota-fiscal.type.mjs.map +1 -0
- package/dist/modules/charges/types/refresh-pix.type.mjs +1 -0
- package/dist/modules/charges/types/refresh-pix.type.mjs.map +1 -0
- package/dist/modules/charges/utils/get-charge-download-url.mjs +8 -0
- package/dist/modules/charges/utils/get-charge-download-url.mjs.map +1 -0
- package/dist/modules/coupons/constants/query-keys.constants.mjs +5 -0
- package/dist/modules/coupons/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs +17 -0
- package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs.map +1 -0
- package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs +16 -0
- package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs.map +1 -0
- package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs +15 -0
- package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs.map +1 -0
- package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs +18 -0
- package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs.map +1 -0
- package/dist/modules/coupons/services/coupons.service.mjs +44 -0
- package/dist/modules/coupons/services/coupons.service.mjs.map +1 -0
- package/dist/modules/coupons/types/coupon.type.mjs +61 -0
- package/dist/modules/coupons/types/coupon.type.mjs.map +1 -0
- package/dist/modules/coupons/utils/coupon-restrictions.mjs +60 -0
- package/dist/modules/coupons/utils/coupon-restrictions.mjs.map +1 -0
- package/dist/modules/domains/handlers/count-domains.handler.mjs +12 -0
- package/dist/modules/domains/handlers/count-domains.handler.mjs.map +1 -0
- package/dist/modules/domains/hooks/count-domains.hook.mjs +17 -0
- package/dist/modules/domains/hooks/count-domains.hook.mjs.map +1 -0
- package/dist/modules/domains/services/domains.service.mjs +18 -0
- package/dist/modules/domains/services/domains.service.mjs.map +1 -0
- package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs +15 -0
- package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs.map +1 -0
- package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs +28 -0
- package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs.map +1 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs +23 -2
- package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -1
- package/dist/modules/pages/handlers/count-pages.handler.mjs +4 -2
- package/dist/modules/pages/handlers/count-pages.handler.mjs.map +1 -1
- package/dist/modules/pages/hooks/count-published-pages.hook.mjs +26 -0
- package/dist/modules/pages/hooks/count-published-pages.hook.mjs.map +1 -0
- package/dist/modules/pages/services/pages.service.mjs +3 -2
- package/dist/modules/pages/services/pages.service.mjs.map +1 -1
- package/dist/modules/plans/constants/plan-tooltips.constants.mjs +14 -0
- package/dist/modules/plans/constants/plan-tooltips.constants.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs +28 -0
- package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-ui-plans.hook.mjs +20 -0
- package/dist/modules/plans/hooks/use-ui-plans.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/add-project-users.hook.mjs +25 -0
- package/dist/modules/projects/hooks/add-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/remove-project-users.hook.mjs +25 -0
- package/dist/modules/projects/hooks/remove-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/services/project-users.service.mjs +5 -0
- package/dist/modules/projects/services/project-users.service.mjs.map +1 -1
- package/dist/modules/projects/types.mjs +3 -2
- package/dist/modules/projects/types.mjs.map +1 -1
- package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/create-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/create-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs +35 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/constants/downgrade.constants.mjs +25 -0
- package/dist/modules/subscriptions/constants/downgrade.constants.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/subscription.constants.mjs +2 -0
- package/dist/modules/subscriptions/constants/subscription.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs +15 -0
- package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs +25 -0
- package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs +33 -0
- package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs +18 -0
- package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs +25 -0
- package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs +71 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -1
- package/dist/modules/subscriptions/types/cancel-subscription.type.mjs +9 -0
- package/dist/modules/subscriptions/types/cancel-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/create-subscription.type.mjs +62 -0
- package/dist/modules/subscriptions/types/create-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/pending-pix-status.type.mjs +28 -0
- package/dist/modules/subscriptions/types/pending-pix-status.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/subscription.type.mjs +9 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/addon-buckets.mjs +69 -0
- package/dist/modules/subscriptions/utils/addon-buckets.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs +8 -2
- package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/first-period-pricing.mjs +25 -0
- package/dist/modules/subscriptions/utils/first-period-pricing.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-api-subscription.mjs +8 -0
- package/dist/modules/subscriptions/utils/is-api-subscription.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-boleto-payer.mjs +17 -0
- package/dist/modules/subscriptions/utils/is-boleto-payer.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-free-subscription.mjs +8 -0
- package/dist/modules/subscriptions/utils/is-free-subscription.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/periodicity.mjs +55 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs +27 -0
- package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs.map +1 -0
- package/dist/modules/users/hooks/messages.hook.mjs +3 -5
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
- package/dist/server.mjs +6 -0
- package/dist/server.mjs.map +1 -1
- package/dist/store/useAccountModals.mjs +9 -2
- package/dist/store/useAccountModals.mjs.map +1 -1
- package/dist/store/useAffiliateFlows.mjs +23 -0
- package/dist/store/useAffiliateFlows.mjs.map +1 -0
- package/dist/store/useProjectFlows.mjs +18 -0
- package/dist/store/useProjectFlows.mjs.map +1 -0
- package/dist/store/useSubscriptionFlows.mjs +58 -0
- package/dist/store/useSubscriptionFlows.mjs.map +1 -0
- package/dist/store/useTeamFlows.mjs +15 -0
- package/dist/store/useTeamFlows.mjs.map +1 -0
- package/dist/testing/factories/coupon.factory.mjs +19 -0
- package/dist/testing/factories/coupon.factory.mjs.map +1 -0
- package/dist/testing/factories/index.mjs +6 -0
- package/dist/testing/factories/index.mjs.map +1 -1
- package/dist/testing/factories/project-user.factory.mjs +17 -0
- package/dist/testing/factories/project-user.factory.mjs.map +1 -0
- package/dist/testing/factories/project.factory.mjs +21 -0
- package/dist/testing/factories/project.factory.mjs.map +1 -0
- package/dist/testing/react/providers.mjs +1 -1
- package/dist/testing/react/providers.mjs.map +1 -1
- package/dist/utils/browser/chart-custom-tooltip.mjs +69 -0
- package/dist/utils/browser/chart-custom-tooltip.mjs.map +1 -0
- package/dist/utils/browser/get-css-variable.mjs +9 -0
- package/dist/utils/browser/get-css-variable.mjs.map +1 -0
- package/dist/utils/constants/scrollbar.mjs +5 -0
- package/dist/utils/constants/scrollbar.mjs.map +1 -0
- package/dist/utils/date-filter-period.mjs +34 -0
- package/dist/utils/date-filter-period.mjs.map +1 -0
- package/dist/utils/file/index.mjs +11 -1
- package/dist/utils/file/index.mjs.map +1 -1
- package/dist/utils/format/initials.mjs +8 -0
- package/dist/utils/format/initials.mjs.map +1 -0
- package/dist/utils/format/masks.mjs +32 -1
- package/dist/utils/format/masks.mjs.map +1 -1
- package/dist/utils/qrcode/to-data-url.mjs +12 -0
- package/dist/utils/qrcode/to-data-url.mjs.map +1 -0
- package/dist/utils/validators/account.mjs +1 -7
- package/dist/utils/validators/account.mjs.map +1 -1
- package/package.json +15 -2
- package/src/components/account/AccountHubLinkHandler.tsx +39 -0
- package/src/components/account/AccountModalLayout.tsx +190 -0
- package/src/components/account/AccountModals.tsx +12 -2
- package/src/components/account/DeleteAccountModal.tsx +1 -1
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +9 -1
- package/src/components/account/MyAccountModal.tsx +215 -0
- package/src/components/account/TwoFactorAuthModal.tsx +1 -1
- package/src/components/account/hooks/useAccountHubActions.ts +95 -0
- package/src/components/account/hooks/useAddCardWithPaymentSwitch.ts +70 -0
- package/src/components/account/hooks/useAffiliatesActions.tsx +78 -0
- package/src/components/account/hooks/useMyAccountModal.ts +40 -0
- package/src/components/account/hooks/useProjectsActions.ts +44 -0
- package/src/components/account/hooks/useSubscriptionActions.ts +99 -0
- package/src/components/account/hooks/useTeamActions.ts +35 -0
- package/src/components/account/sections/AffiliatesSection.tsx +342 -0
- package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
- package/src/components/account/sections/MyProfileSection.tsx +207 -143
- package/src/components/account/sections/PreferencesSection.tsx +55 -51
- package/src/components/account/sections/ProjectsSection.tsx +110 -0
- package/src/components/account/sections/SecuritySection.tsx +72 -62
- package/src/components/account/sections/SubscriptionSection.tsx +36 -0
- package/src/components/account/sections/TeamSection.tsx +161 -0
- package/src/components/account/sections/TokenSection.tsx +4 -8
- package/src/components/account/sections/affiliates/AffiliateCommissionCard.tsx +83 -0
- package/src/components/account/sections/affiliates/AffiliateFlows.tsx +20 -0
- package/src/components/account/sections/affiliates/AffiliateLeadsSheet.tsx +143 -0
- package/src/components/account/sections/affiliates/AffiliateStatsCard.tsx +56 -0
- package/src/components/account/sections/affiliates/AffiliateStepCard.tsx +20 -0
- package/src/components/account/sections/affiliates/AffiliateTransactionsList.tsx +194 -0
- package/src/components/account/sections/affiliates/NoReceivingAccountModal.tsx +63 -0
- package/src/components/account/sections/affiliates/ReceivingAccountModal.tsx +213 -0
- package/src/components/account/sections/affiliates/RequestWithdrawalSheet.tsx +586 -0
- package/src/components/account/sections/affiliates/ViewAttachmentModal.tsx +47 -0
- package/src/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.tsx +45 -0
- package/src/components/account/sections/affiliates/reports/AffiliatesReportsTab.tsx +44 -0
- package/src/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.ts +148 -0
- package/src/components/account/sections/projects/DeleteProjectModal.tsx +246 -0
- package/src/components/account/sections/projects/ProjectFlows.tsx +16 -0
- package/src/components/account/sections/projects/ProjectMembersStack.tsx +75 -0
- package/src/components/account/sections/projects/ProjectRow.tsx +96 -0
- package/src/components/account/sections/projects/ProjectSheet.tsx +603 -0
- package/src/components/account/sections/projects/ProjectsDisabledModal.tsx +69 -0
- package/src/components/account/sections/projects/project-form.schema.ts +30 -0
- package/src/components/account/sections/shared/ConnectListRow.tsx +68 -0
- package/src/components/account/sections/shared/DateFilterPopover.tsx +58 -0
- package/src/components/account/sections/shared/EntityAvatar.tsx +54 -0
- package/src/components/account/sections/shared/FilterPopover.tsx +79 -0
- package/src/components/account/sections/shared/FormSection.tsx +23 -0
- package/src/components/account/sections/shared/IconBox.tsx +21 -0
- package/src/components/account/sections/shared/InfiniteScrollList.tsx +57 -0
- package/src/components/account/sections/shared/ListPagination.tsx +84 -0
- package/src/components/account/sections/shared/RowActionsMenu.tsx +66 -0
- package/src/components/account/sections/shared/SectionLoadError.tsx +27 -0
- package/src/components/account/sections/shared/StatusBadge.tsx +33 -0
- package/src/components/account/sections/shared/WorkspaceSection.tsx +22 -0
- package/src/components/account/sections/subscription/AiCreditsUsage.tsx +152 -0
- package/src/components/account/sections/subscription/BillingAddressSheet.tsx +460 -0
- package/src/components/account/sections/subscription/BoletoDetailsDialog.tsx +104 -0
- package/src/components/account/sections/subscription/BoletoGeneratedDialog.tsx +24 -0
- package/src/components/account/sections/subscription/CancelPlanDialog.tsx +221 -0
- package/src/components/account/sections/subscription/ChargeRow.tsx +161 -0
- package/src/components/account/sections/subscription/ChargeStatusBadge.tsx +29 -0
- package/src/components/account/sections/subscription/ChargesList.tsx +125 -0
- package/src/components/account/sections/subscription/ManageCardsSheet.tsx +93 -0
- package/src/components/account/sections/subscription/OverdueReceiptOpener.tsx +29 -0
- package/src/components/account/sections/subscription/PayChargeDialog.tsx +306 -0
- package/src/components/account/sections/subscription/PaymentConfirmationDialog.tsx +70 -0
- package/src/components/account/sections/subscription/PaymentMethodsCard.tsx +117 -0
- package/src/components/account/sections/subscription/PendingChangeDialog.tsx +168 -0
- package/src/components/account/sections/subscription/PixDetailsDialog.tsx +246 -0
- package/src/components/account/sections/subscription/PixPaymentDialog.tsx +242 -0
- package/src/components/account/sections/subscription/PlanDetailsSheet.tsx +380 -0
- package/src/components/account/sections/subscription/ReceiptDetailsSheet.tsx +318 -0
- package/src/components/account/sections/subscription/SubscriptionFlows.tsx +40 -0
- package/src/components/account/sections/subscription/SubscriptionPlanCard.tsx +433 -0
- package/src/components/account/sections/subscription/UsageReportSheet.tsx +244 -0
- package/src/components/account/sections/subscription/change-plan/ChangePlanSheet.tsx +95 -0
- package/src/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.tsx +57 -0
- package/src/components/account/sections/subscription/change-plan/components/AddonsBlock.tsx +214 -0
- package/src/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.tsx +92 -0
- package/src/components/account/sections/subscription/change-plan/components/CouponBlock.tsx +42 -0
- package/src/components/account/sections/subscription/change-plan/components/CouponDialog.tsx +134 -0
- package/src/components/account/sections/subscription/change-plan/components/PricePreview.tsx +28 -0
- package/src/components/account/sections/subscription/change-plan/components/SummaryBlock.tsx +194 -0
- package/src/components/account/sections/subscription/change-plan/plan-comparison.ts +52 -0
- package/src/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.tsx +161 -0
- package/src/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.tsx +165 -0
- package/src/components/account/sections/subscription/change-plan/steps/PlanViewStep.tsx +89 -0
- package/src/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.tsx +117 -0
- package/src/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.tsx +139 -0
- package/src/components/account/sections/subscription/change-plan/useChangePlanState.tsx +1158 -0
- package/src/components/account/sections/subscription/downgrade/CannotDowngradeDialog.tsx +297 -0
- package/src/components/account/sections/subscription/downgrade/DowngradeReasonDialog.tsx +154 -0
- package/src/components/account/sections/subscription/plans/PlanCard.tsx +417 -0
- package/src/components/account/sections/subscription/plans/PlanCardSkeleton.tsx +70 -0
- package/src/components/account/sections/subscription/plans/PlansCatalogDialog.tsx +156 -0
- package/src/components/account/sections/team/DeleteUserModal.tsx +134 -0
- package/src/components/account/sections/team/TeamFlows.tsx +14 -0
- package/src/components/account/sections/team/TeamMemberRow.tsx +151 -0
- package/src/components/account/sections/team/UserSheet.tsx +688 -0
- package/src/components/account/sections/team/steps/NotificationsStep.tsx +109 -0
- package/src/components/account/sections/team/steps/ProjectSelectionStep.tsx +219 -0
- package/src/components/account/sections/team/steps/UserInformationStep.tsx +423 -0
- package/src/components/account/sections/team/user-form.schema.ts +43 -0
- package/src/components/account/types/workspace-actions.type.ts +56 -0
- package/src/components/layouts/ProfilePopover.tsx +11 -12
- package/src/components/layouts/UsersSelectorPopover.tsx +7 -4
- package/src/components/modals/AccountDeletionWarningModal.tsx +4 -5
- package/src/components/modals/AccountFrozenModal.tsx +6 -3
- package/src/components/modals/Modals.tsx +6 -3
- package/src/components/modals/PaidPlanRequiredModal.tsx +4 -5
- package/src/components/modals/cards/AddFirstCardWarningModal.tsx +72 -0
- package/src/components/modals/cards/SwitchPaymentToCardModal.tsx +232 -0
- package/src/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.tsx +5 -4
- package/src/components/ui/data-display/CardItem.tsx +9 -5
- package/src/components/ui/data-display/PaymentMethodIcons.tsx +43 -0
- package/src/components/ui/form/BillingPeriodSelector.tsx +173 -0
- package/src/components/ui/form/PaymentMethodToggle.tsx +119 -0
- package/src/components/ui/form/RadioOptionFieldIcon.tsx +64 -0
- package/src/components/ui/form/SegmentedControl.tsx +77 -0
- package/src/components/ui/overlay/Dialog.tsx +21 -2
- package/src/components/ui/overlay/Sheet.tsx +26 -5
- package/src/components/ui/overlay/layers.tsx +88 -4
- package/src/enums/AccountHubFlow.ts +8 -0
- package/src/enums/DateFilterPeriod.ts +17 -0
- package/src/enums/WorkspaceSectionType.ts +6 -0
- package/src/handlers.ts +14 -0
- package/src/hooks/useDebounce.ts +5 -3
- package/src/hooks/useUploadProgress.ts +42 -0
- package/src/i18n/messages/en-us.ts +904 -2
- package/src/i18n/messages/es-es.ts +908 -2
- package/src/i18n/messages/pt-br.ts +908 -2
- package/src/index.ts +56 -1
- package/src/infra/http/paged.ts +24 -0
- package/src/middleware.ts +1 -0
- package/src/middlewares/create-auth-middleware.ts +1 -4
- package/src/middlewares/create-legacy-account-routes-middleware.ts +54 -0
- package/src/middlewares/is-route-equals.ts +3 -0
- package/src/modules/accounts/actions/account-management.action.ts +22 -1
- package/src/modules/accounts/constants/account-hub-link.constants.ts +3 -0
- package/src/modules/accounts/constants/legacy-account-routes.constants.ts +1 -0
- package/src/modules/accounts/handlers/list-account-members.handler.ts +23 -0
- package/src/modules/accounts/hooks/add-user-projects.hook.ts +72 -0
- package/src/modules/accounts/hooks/create-account-user.hook.ts +21 -0
- package/src/modules/accounts/hooks/remove-user-projects.hook.ts +68 -0
- package/src/modules/accounts/hooks/use-account-members.hook.ts +31 -0
- package/src/modules/accounts/services/account.service.ts +71 -0
- package/src/modules/accounts/types/account-hub-link.type.ts +13 -0
- package/src/modules/accounts/types.ts +9 -0
- package/src/modules/accounts/utils/build-account-hub-url.ts +14 -0
- package/src/modules/accounts/utils/is-account-hub-flow.ts +7 -0
- package/src/modules/accounts/utils/is-account-section.ts +7 -0
- package/src/modules/accounts/utils/is-my-account-section.ts +12 -0
- package/src/modules/accounts/utils/map-legacy-account-route.ts +108 -0
- package/src/modules/accounts/utils/parse-account-hub-link.ts +21 -0
- package/src/modules/affiliates/actions/ensure-affiliate.action.ts +9 -0
- package/src/modules/affiliates/actions/request-deposit.action.ts +9 -0
- package/src/modules/affiliates/actions/update-affiliate.action.ts +9 -0
- package/src/modules/affiliates/constants/affiliate.constants.ts +11 -0
- package/src/modules/affiliates/constants/query-keys.constants.ts +7 -0
- package/src/modules/affiliates/handlers/affiliate-report-analytics.handler.ts +16 -0
- package/src/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.ts +10 -0
- package/src/modules/affiliates/handlers/current-affiliate.handler.ts +10 -0
- package/src/modules/affiliates/handlers/list-affiliate-coupons.handler.ts +10 -0
- package/src/modules/affiliates/handlers/list-affiliate-leads.handler.ts +23 -0
- package/src/modules/affiliates/handlers/list-affiliate-transactions.handler.ts +23 -0
- package/src/modules/affiliates/hooks/use-affiliate-coupons.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-affiliate-leads.hook.ts +27 -0
- package/src/modules/affiliates/hooks/use-affiliate-report-analytics.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-affiliate-transactions.hook.ts +25 -0
- package/src/modules/affiliates/hooks/use-current-affiliate.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-ensure-affiliate.hook.ts +24 -0
- package/src/modules/affiliates/hooks/use-request-deposit.hook.ts +29 -0
- package/src/modules/affiliates/hooks/use-update-affiliate.hook.ts +24 -0
- package/src/modules/affiliates/hooks/use-withdrawal-limits.hook.ts +20 -0
- package/src/modules/affiliates/services/affiliates.service.ts +240 -0
- package/src/modules/affiliates/types/affiliate.type.ts +180 -0
- package/src/modules/affiliates/utils/get-affiliate-share-link.ts +8 -0
- package/src/modules/charges/actions/get-nota-fiscal.action.ts +8 -0
- package/src/modules/charges/actions/refresh-pix.action.ts +8 -0
- package/src/modules/charges/hooks/nota-fiscal.hook.ts +13 -0
- package/src/modules/charges/hooks/refresh-pix.hook.ts +13 -0
- package/src/modules/charges/services/charges.service.ts +121 -0
- package/src/modules/charges/types/nota-fiscal.type.ts +20 -0
- package/src/modules/charges/types/refresh-pix.type.ts +14 -0
- package/src/modules/charges/utils/get-charge-download-url.ts +10 -0
- package/src/modules/coupons/constants/query-keys.constants.ts +1 -0
- package/src/modules/coupons/handlers/find-coupon-by-code.handler.ts +16 -0
- package/src/modules/coupons/handlers/find-coupon-by-id.handler.ts +15 -0
- package/src/modules/coupons/hooks/use-coupon-by-code.hook.ts +16 -0
- package/src/modules/coupons/hooks/use-coupon-by-id.hook.ts +20 -0
- package/src/modules/coupons/services/coupons.service.ts +54 -0
- package/src/modules/coupons/types/coupon.type.ts +70 -0
- package/src/modules/coupons/utils/coupon-restrictions.ts +112 -0
- package/src/modules/domains/handlers/count-domains.handler.ts +10 -0
- package/src/modules/domains/hooks/count-domains.hook.ts +17 -0
- package/src/modules/domains/services/domains.service.ts +18 -0
- package/src/modules/ia-credits/handlers/list-ia-credit-operations.handler.ts +14 -0
- package/src/modules/ia-credits/hooks/ia-credit-operations.hook.ts +33 -0
- package/src/modules/ia-credits/services/ia-credits.service.ts +32 -1
- package/src/modules/pages/handlers/count-pages.handler.ts +5 -2
- package/src/modules/pages/hooks/count-published-pages.hook.ts +26 -0
- package/src/modules/pages/services/pages.service.ts +3 -2
- package/src/modules/plans/constants/plan-tooltips.constants.ts +16 -0
- package/src/modules/plans/hooks/use-enriched-plans.hook.ts +31 -0
- package/src/modules/plans/hooks/use-ui-plans.hook.ts +22 -0
- package/src/modules/projects/hooks/add-project-users.hook.ts +29 -0
- package/src/modules/projects/hooks/list-all-account-users.hook.ts +3 -6
- package/src/modules/projects/hooks/list-available-users.hook.ts +3 -6
- package/src/modules/projects/hooks/list-infinite-projects.hook.ts +3 -6
- package/src/modules/projects/hooks/list-project-users.hook.ts +3 -6
- package/src/modules/projects/hooks/remove-project-users.hook.ts +29 -0
- package/src/modules/projects/services/project-users.service.ts +135 -130
- package/src/modules/projects/types.ts +89 -88
- package/src/modules/subscriptions/actions/cancel-subscription.action.ts +12 -0
- package/src/modules/subscriptions/actions/create-subscription.action.ts +9 -0
- package/src/modules/subscriptions/actions/find-pending-pix-status.action.ts +8 -0
- package/src/modules/subscriptions/actions/find-subscription-by-id.action.ts +8 -0
- package/src/modules/subscriptions/constants/addons.constants.ts +50 -0
- package/src/modules/subscriptions/constants/downgrade.constants.ts +30 -0
- package/src/modules/subscriptions/constants/subscription.constants.ts +3 -0
- package/src/modules/subscriptions/handlers/pending-pix-status.handler.ts +17 -0
- package/src/modules/subscriptions/hooks/cancel-subscription.hook.ts +28 -0
- package/src/modules/subscriptions/hooks/create-subscription.hook.ts +34 -0
- package/src/modules/subscriptions/hooks/find-subscription-by-id.hook.ts +17 -0
- package/src/modules/subscriptions/hooks/pending-pix-status.hook.ts +30 -0
- package/src/modules/subscriptions/services/subscriptions.service.ts +401 -301
- package/src/modules/subscriptions/types/cancel-subscription.type.ts +8 -0
- package/src/modules/subscriptions/types/create-subscription.type.ts +79 -0
- package/src/modules/subscriptions/types/pending-pix-status.type.ts +33 -0
- package/src/modules/subscriptions/types/subscription.type.ts +157 -147
- package/src/modules/subscriptions/utils/addon-buckets.ts +129 -0
- package/src/modules/subscriptions/utils/confirm-payment-if-required.ts +9 -2
- package/src/modules/subscriptions/utils/first-period-pricing.ts +63 -0
- package/src/modules/subscriptions/utils/is-api-subscription.ts +6 -0
- package/src/modules/subscriptions/utils/is-boleto-payer.ts +21 -0
- package/src/modules/subscriptions/utils/is-free-subscription.ts +6 -0
- package/src/modules/subscriptions/utils/periodicity.ts +101 -0
- package/src/modules/subscriptions/utils/resolve-subscription-plan-name.ts +44 -0
- package/src/modules/users/hooks/messages.hook.ts +3 -5
- package/src/server.ts +102 -99
- package/src/store/useAccountModals.ts +22 -5
- package/src/store/useAffiliateFlows.ts +46 -0
- package/src/store/useProjectFlows.ts +42 -0
- package/src/store/useSubscriptionFlows.ts +176 -0
- package/src/store/useTeamFlows.ts +34 -0
- package/src/testing/factories/coupon.factory.ts +17 -0
- package/src/testing/factories/index.ts +3 -0
- package/src/testing/factories/project-user.factory.ts +15 -0
- package/src/testing/factories/project.factory.ts +19 -0
- package/src/testing/react/providers.tsx +2 -1
- package/src/utils/browser/chart-custom-tooltip.ts +85 -0
- package/src/utils/browser/get-css-variable.ts +6 -0
- package/src/utils/constants/scrollbar.ts +10 -0
- package/src/utils/date-filter-period.ts +34 -0
- package/src/utils/file/index.ts +13 -0
- package/src/utils/format/initials.ts +10 -0
- package/src/utils/format/masks.ts +41 -0
- package/src/utils/qrcode/to-data-url.ts +23 -0
- package/src/utils/validators/account.ts +0 -8
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -143
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
- package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -34
- package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
- package/src/components/account/ConfigurationsMyAccountModal.tsx +0 -179
- package/src/components/account/hooks/useConfigurationsModal.ts +0 -45
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { API_PLAN_ID } from "../constants/subscription.constants";
|
|
2
|
+
function isApiSubscription(subscription) {
|
|
3
|
+
return !!subscription && subscription.id_plan === API_PLAN_ID;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
isApiSubscription
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=is-api-subscription.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/is-api-subscription.ts"],"sourcesContent":["import type { Subscription } from '../types/subscription.type';\nimport { API_PLAN_ID } from '../constants/subscription.constants';\n\nexport function isApiSubscription(subscription: Subscription | null | undefined): boolean {\n return !!subscription && subscription.id_plan === API_PLAN_ID;\n}\n"],"mappings":"AACA,SAAS,mBAAmB;AAErB,SAAS,kBAAkB,cAAwD;AACxF,SAAO,CAAC,CAAC,gBAAgB,aAAa,YAAY;AACpD;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const PAYMENT_METHOD_BOLETO = 2;
|
|
2
|
+
function isBoletoPayer(paymentMethod) {
|
|
3
|
+
return paymentMethod === PAYMENT_METHOD_BOLETO;
|
|
4
|
+
}
|
|
5
|
+
function isBoletoAvailable({
|
|
6
|
+
isBoletoPayer: payerByBoleto,
|
|
7
|
+
allowedPaymentMethod,
|
|
8
|
+
unlocksAllPaymentMethods
|
|
9
|
+
}) {
|
|
10
|
+
return payerByBoleto || allowedPaymentMethod === "boleto" || unlocksAllPaymentMethods;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
PAYMENT_METHOD_BOLETO,
|
|
14
|
+
isBoletoAvailable,
|
|
15
|
+
isBoletoPayer
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=is-boleto-payer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/is-boleto-payer.ts"],"sourcesContent":["export const PAYMENT_METHOD_BOLETO = 2;\n\n/** A assinatura já é paga por boleto — só nesse caso o boleto aparece como opção. */\nexport function isBoletoPayer(paymentMethod: number | null | undefined): boolean {\n return paymentMethod === PAYMENT_METHOD_BOLETO;\n}\n\ntype BoletoAvailabilityInput = {\n isBoletoPayer: boolean;\n allowedPaymentMethod: 'card' | 'boleto' | 'pix' | null;\n unlocksAllPaymentMethods: boolean;\n};\n\n/** Boleto liberado: já é pagante por boleto, ou o cupom aplicado libera o método. */\nexport function isBoletoAvailable({\n isBoletoPayer: payerByBoleto,\n allowedPaymentMethod,\n unlocksAllPaymentMethods,\n}: BoletoAvailabilityInput): boolean {\n return payerByBoleto || allowedPaymentMethod === 'boleto' || unlocksAllPaymentMethods;\n}\n"],"mappings":"AAAO,MAAM,wBAAwB;AAG9B,SAAS,cAAc,eAAmD;AAC/E,SAAO,kBAAkB;AAC3B;AASO,SAAS,kBAAkB;AAAA,EAChC,eAAe;AAAA,EACf;AAAA,EACA;AACF,GAAqC;AACnC,SAAO,iBAAiB,yBAAyB,YAAY;AAC/D;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FREE_PLAN_ID } from "../constants/subscription.constants";
|
|
2
|
+
function isFreeSubscription(subscription) {
|
|
3
|
+
return !!subscription && (subscription.type === "free" || subscription.id_plan === FREE_PLAN_ID);
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
isFreeSubscription
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=is-free-subscription.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/is-free-subscription.ts"],"sourcesContent":["import type { Subscription } from '../types/subscription.type';\nimport { FREE_PLAN_ID } from '../constants/subscription.constants';\n\nexport function isFreeSubscription(subscription: Subscription | null | undefined): boolean {\n return !!subscription && (subscription.type === 'free' || subscription.id_plan === FREE_PLAN_ID);\n}\n"],"mappings":"AACA,SAAS,oBAAoB;AAEtB,SAAS,mBAAmB,cAAwD;AACzF,SAAO,CAAC,CAAC,iBAAiB,aAAa,SAAS,UAAU,aAAa,YAAY;AACrF;","names":[]}
|
|
@@ -48,14 +48,68 @@ function getOriginalPriceFromCalculatedData(data, periodicity) {
|
|
|
48
48
|
if (period === "semiannual") return data.semmester_original;
|
|
49
49
|
return data.month_original;
|
|
50
50
|
}
|
|
51
|
+
function getDiscount(data, period) {
|
|
52
|
+
if (!data) return 0;
|
|
53
|
+
if (period === "annual") return data.year_discount ?? 0;
|
|
54
|
+
if (period === "semiannual") return data.semmester_discount ?? 0;
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
function getCouponDiscount(data, period) {
|
|
58
|
+
if (!data) return 0;
|
|
59
|
+
if (period === "annual") return data.year_discount_coupom ?? 0;
|
|
60
|
+
if (period === "semiannual") return data.semmester_discount_coupom ?? 0;
|
|
61
|
+
return data.month_discount_coupom ?? 0;
|
|
62
|
+
}
|
|
63
|
+
function roundDiscountPercent(value) {
|
|
64
|
+
return Math.min(100, Math.max(0, Math.round(value)));
|
|
65
|
+
}
|
|
66
|
+
function getEffectiveDiscountPercent(data, period) {
|
|
67
|
+
if (!data) return null;
|
|
68
|
+
const declaredBadgePercent = period === "annual" ? data.year_badge_percent : period === "semiannual" ? data.semmester_badge_percent : data.month_badge_percent;
|
|
69
|
+
if (declaredBadgePercent != null) return roundDiscountPercent(declaredBadgePercent);
|
|
70
|
+
const price = period === "annual" ? data.year : period === "semiannual" ? data.semmester : data.month;
|
|
71
|
+
const discount = getDiscount(data, period) + getCouponDiscount(data, period);
|
|
72
|
+
const base = price + discount;
|
|
73
|
+
if (base <= 0 || discount <= 0) return 0;
|
|
74
|
+
return roundDiscountPercent(discount / base * 100);
|
|
75
|
+
}
|
|
76
|
+
function getPeriodPricingKey(billingPeriod) {
|
|
77
|
+
if (billingPeriod === "annual") return "annual";
|
|
78
|
+
if (billingPeriod === "semiannual") return "semester";
|
|
79
|
+
return "monthly";
|
|
80
|
+
}
|
|
81
|
+
const USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT = 40;
|
|
82
|
+
function getPlanBadgePercents(pricing) {
|
|
83
|
+
if (!pricing) return null;
|
|
84
|
+
return {
|
|
85
|
+
monthly: roundDiscountPercent(pricing.monthly.discount_percent),
|
|
86
|
+
annual: roundDiscountPercent(pricing.annual.discount_percent)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function getCatalogBadgePercents(plans) {
|
|
90
|
+
const percents = plans.flatMap((plan) => getPlanBadgePercents(plan.pricing) ?? []);
|
|
91
|
+
if (!percents.length) return null;
|
|
92
|
+
return {
|
|
93
|
+
monthly: Math.max(...percents.map((percent) => percent.monthly)),
|
|
94
|
+
annual: Math.max(...percents.map((percent) => percent.annual))
|
|
95
|
+
};
|
|
96
|
+
}
|
|
51
97
|
export {
|
|
98
|
+
USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT,
|
|
52
99
|
billingPeriodToNumeric,
|
|
53
100
|
getBillingPeriodLabel,
|
|
54
101
|
getBillingPeriodMonths,
|
|
55
102
|
getBillingPeriodSuffix,
|
|
103
|
+
getCatalogBadgePercents,
|
|
104
|
+
getCouponDiscount,
|
|
105
|
+
getDiscount,
|
|
106
|
+
getEffectiveDiscountPercent,
|
|
56
107
|
getOriginalPriceFromCalculatedData,
|
|
108
|
+
getPeriodPricingKey,
|
|
57
109
|
getPeriodicityLabel,
|
|
110
|
+
getPlanBadgePercents,
|
|
58
111
|
getPriceFromCalculatedData,
|
|
59
|
-
periodicityToBillingPeriod
|
|
112
|
+
periodicityToBillingPeriod,
|
|
113
|
+
roundDiscountPercent
|
|
60
114
|
};
|
|
61
115
|
//# sourceMappingURL=periodicity.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/periodicity.ts"],"sourcesContent":["import type { BillingPeriod } from '../types/billing-period.type';\nimport type { CalculateSubscriptionResponse } from '../types/calculate-subscription.type';\n\ntype TranslateFn = (key: any, values?: Record<string, string | number>) => string;\n\nexport function periodicityToBillingPeriod(\n periodicity: number | string | null | undefined\n): BillingPeriod | null {\n if (periodicity === 30 || periodicity === 1 || periodicity === 'monthly') return 'monthly';\n if (periodicity === 180 || periodicity === 3 || periodicity === 'semiannual') return 'semiannual';\n if (periodicity === 365 || periodicity === 2 || periodicity === 'annual') return 'annual';\n return null;\n}\n\nexport function billingPeriodToNumeric(billingPeriod: BillingPeriod): 30 | 180 | 365 {\n if (billingPeriod === 'semiannual') return 180;\n if (billingPeriod === 'annual') return 365;\n return 30;\n}\n\nexport function getPeriodicityLabel(\n periodicity: number | string | null | undefined,\n translate?: TranslateFn\n): string {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'semiannual')\n return translate ? translate('common.periodicity.semiannual') : 'Semestral';\n if (period === 'annual')\n return translate ? translate('common.periodicity.annual') : 'Anual';\n return translate ? translate('common.periodicity.monthly') : 'Mensal';\n}\n\nexport function getBillingPeriodSuffix(\n billingPeriod: BillingPeriod,\n translate?: TranslateFn\n): string {\n if (billingPeriod === 'semiannual')\n return translate ? translate('common.periodicity.suffixSemiannual') : '/semestre';\n if (billingPeriod === 'annual')\n return translate ? translate('common.periodicity.suffixAnnual') : '/ano';\n return translate ? translate('common.periodicity.suffixMonthly') : '/mês';\n}\n\nexport function getBillingPeriodLabel(\n billingPeriod: BillingPeriod,\n translate?: TranslateFn\n): string {\n if (billingPeriod === 'semiannual')\n return translate ? translate('common.periodicity.labelSemiannual') : 'semestral';\n if (billingPeriod === 'annual')\n return translate ? translate('common.periodicity.labelAnnual') : 'anual';\n return translate ? translate('common.periodicity.labelMonthly') : 'mensal';\n}\n\nexport function getBillingPeriodMonths(billingPeriod: BillingPeriod): number {\n if (billingPeriod === 'semiannual') return 6;\n if (billingPeriod === 'annual') return 12;\n return 1;\n}\n\nexport function getPriceFromCalculatedData(\n data: CalculateSubscriptionResponse,\n periodicity: number | string | null | undefined\n): number {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'annual') return data.year;\n if (period === 'semiannual') return data.semmester;\n return data.month;\n}\n\nexport function getOriginalPriceFromCalculatedData(\n data: CalculateSubscriptionResponse,\n periodicity: number | string | null | undefined\n): number {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'annual') return data.year_original;\n if (period === 'semiannual') return data.semmester_original;\n return data.month_original;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/periodicity.ts"],"sourcesContent":["import type { BillingPeriod } from '../types/billing-period.type';\nimport type { CalculateSubscriptionResponse } from '../types/calculate-subscription.type';\nimport type { UiPlan } from '../../plans/types/plan.type';\n\ntype TranslateFn = (key: any, values?: Record<string, string | number>) => string;\n\nexport function periodicityToBillingPeriod(\n periodicity: number | string | null | undefined\n): BillingPeriod | null {\n if (periodicity === 30 || periodicity === 1 || periodicity === 'monthly') return 'monthly';\n if (periodicity === 180 || periodicity === 3 || periodicity === 'semiannual') return 'semiannual';\n if (periodicity === 365 || periodicity === 2 || periodicity === 'annual') return 'annual';\n return null;\n}\n\nexport function billingPeriodToNumeric(billingPeriod: BillingPeriod): 30 | 180 | 365 {\n if (billingPeriod === 'semiannual') return 180;\n if (billingPeriod === 'annual') return 365;\n return 30;\n}\n\nexport function getPeriodicityLabel(\n periodicity: number | string | null | undefined,\n translate?: TranslateFn\n): string {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'semiannual')\n return translate ? translate('common.periodicity.semiannual') : 'Semestral';\n if (period === 'annual')\n return translate ? translate('common.periodicity.annual') : 'Anual';\n return translate ? translate('common.periodicity.monthly') : 'Mensal';\n}\n\nexport function getBillingPeriodSuffix(\n billingPeriod: BillingPeriod,\n translate?: TranslateFn\n): string {\n if (billingPeriod === 'semiannual')\n return translate ? translate('common.periodicity.suffixSemiannual') : '/semestre';\n if (billingPeriod === 'annual')\n return translate ? translate('common.periodicity.suffixAnnual') : '/ano';\n return translate ? translate('common.periodicity.suffixMonthly') : '/mês';\n}\n\nexport function getBillingPeriodLabel(\n billingPeriod: BillingPeriod,\n translate?: TranslateFn\n): string {\n if (billingPeriod === 'semiannual')\n return translate ? translate('common.periodicity.labelSemiannual') : 'semestral';\n if (billingPeriod === 'annual')\n return translate ? translate('common.periodicity.labelAnnual') : 'anual';\n return translate ? translate('common.periodicity.labelMonthly') : 'mensal';\n}\n\nexport function getBillingPeriodMonths(billingPeriod: BillingPeriod): number {\n if (billingPeriod === 'semiannual') return 6;\n if (billingPeriod === 'annual') return 12;\n return 1;\n}\n\nexport function getPriceFromCalculatedData(\n data: CalculateSubscriptionResponse,\n periodicity: number | string | null | undefined\n): number {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'annual') return data.year;\n if (period === 'semiannual') return data.semmester;\n return data.month;\n}\n\nexport function getOriginalPriceFromCalculatedData(\n data: CalculateSubscriptionResponse,\n periodicity: number | string | null | undefined\n): number {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'annual') return data.year_original;\n if (period === 'semiannual') return data.semmester_original;\n return data.month_original;\n}\n\n/** Desconto do período (semestral/anual) a partir do cálculo da API. */\nexport function getDiscount(\n data: CalculateSubscriptionResponse | null,\n period: BillingPeriod\n): number {\n if (!data) return 0;\n if (period === 'annual') return data.year_discount ?? 0;\n if (period === 'semiannual') return data.semmester_discount ?? 0;\n return 0;\n}\n\n/** Desconto de cupom a partir do cálculo da API. */\nexport function getCouponDiscount(\n data: CalculateSubscriptionResponse | null,\n period: BillingPeriod\n): number {\n if (!data) return 0;\n if (period === 'annual') return data.year_discount_coupom ?? 0;\n if (period === 'semiannual') return data.semmester_discount_coupom ?? 0;\n return data.month_discount_coupom ?? 0;\n}\n\n/**\n * Ponto ÚNICO de arredondamento do percentual exibido no badge \"X% OFF\", espelhando o backend.\n * Clamp [0, 100]: cupom de valor fixo maior que a base reporta desconto acima do preço.\n */\nexport function roundDiscountPercent(value: number): number {\n return Math.min(100, Math.max(0, Math.round(value)));\n}\n\n/**\n * Percentual de desconto EFETIVO do período (periodicidade + cupom, já compostos pelo backend),\n * derivado do calculate. Usa o `*_badge_percent` quando o backend manda; sem ele, deriva do preço\n * final. `null` só quando não há dados — com dados, carrinho zerado é 0 mesmo.\n */\nexport function getEffectiveDiscountPercent(\n data: CalculateSubscriptionResponse | null,\n period: BillingPeriod\n): number | null {\n if (!data) return null;\n\n const declaredBadgePercent =\n period === 'annual'\n ? data.year_badge_percent\n : period === 'semiannual'\n ? data.semmester_badge_percent\n : data.month_badge_percent;\n if (declaredBadgePercent != null) return roundDiscountPercent(declaredBadgePercent);\n\n const price = period === 'annual' ? data.year : period === 'semiannual' ? data.semmester : data.month;\n const discount = getDiscount(data, period) + getCouponDiscount(data, period);\n const base = price + discount;\n if (base <= 0 || discount <= 0) return 0;\n\n return roundDiscountPercent((discount / base) * 100);\n}\n\n/**\n * Chave de pricing do período (contrato `pricing.{monthly,semester,annual}` do /plans). A âncora\n * anual não deriva da mensal — cada período tem calibração própria.\n */\nexport function getPeriodPricingKey(\n billingPeriod: BillingPeriod\n): 'monthly' | 'semester' | 'annual' {\n if (billingPeriod === 'annual') return 'annual';\n if (billingPeriod === 'semiannual') return 'semester';\n return 'monthly';\n}\n\n/**\n * Teto do badge anual em contas USD: o catálogo em dólar não expõe `discount_percent` por plano,\n * então a vitrine anuncia o desconto máximo da tabela em vez de derivar plano a plano.\n */\nexport const USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT = 40;\n\ntype BadgePercents = { monthly: number; annual: number };\n\n/** Percentuais de desconto declarados pelo /plans para um plano (null quando não vieram). */\nexport function getPlanBadgePercents(\n pricing: UiPlan['pricing'] | null | undefined\n): BadgePercents | null {\n if (!pricing) return null;\n\n return {\n monthly: roundDiscountPercent(pricing.monthly.discount_percent),\n annual: roundDiscountPercent(pricing.annual.discount_percent),\n };\n}\n\n/** Maior desconto do catálogo por período — é o que o badge \"até X% off\" da vitrine anuncia. */\nexport function getCatalogBadgePercents(plans: UiPlan[]): BadgePercents | null {\n const percents = plans.flatMap((plan) => getPlanBadgePercents(plan.pricing) ?? []);\n if (!percents.length) return null;\n\n return {\n monthly: Math.max(...percents.map((percent) => percent.monthly)),\n annual: Math.max(...percents.map((percent) => percent.annual)),\n };\n}\n"],"mappings":"AAMO,SAAS,2BACd,aACsB;AACtB,MAAI,gBAAgB,MAAM,gBAAgB,KAAK,gBAAgB,UAAW,QAAO;AACjF,MAAI,gBAAgB,OAAO,gBAAgB,KAAK,gBAAgB,aAAc,QAAO;AACrF,MAAI,gBAAgB,OAAO,gBAAgB,KAAK,gBAAgB,SAAU,QAAO;AACjF,SAAO;AACT;AAEO,SAAS,uBAAuB,eAA8C;AACnF,MAAI,kBAAkB,aAAc,QAAO;AAC3C,MAAI,kBAAkB,SAAU,QAAO;AACvC,SAAO;AACT;AAEO,SAAS,oBACd,aACA,WACQ;AACR,QAAM,SAAS,2BAA2B,WAAW;AACrD,MAAI,WAAW;AACb,WAAO,YAAY,UAAU,+BAA+B,IAAI;AAClE,MAAI,WAAW;AACb,WAAO,YAAY,UAAU,2BAA2B,IAAI;AAC9D,SAAO,YAAY,UAAU,4BAA4B,IAAI;AAC/D;AAEO,SAAS,uBACd,eACA,WACQ;AACR,MAAI,kBAAkB;AACpB,WAAO,YAAY,UAAU,qCAAqC,IAAI;AACxE,MAAI,kBAAkB;AACpB,WAAO,YAAY,UAAU,iCAAiC,IAAI;AACpE,SAAO,YAAY,UAAU,kCAAkC,IAAI;AACrE;AAEO,SAAS,sBACd,eACA,WACQ;AACR,MAAI,kBAAkB;AACpB,WAAO,YAAY,UAAU,oCAAoC,IAAI;AACvE,MAAI,kBAAkB;AACpB,WAAO,YAAY,UAAU,gCAAgC,IAAI;AACnE,SAAO,YAAY,UAAU,iCAAiC,IAAI;AACpE;AAEO,SAAS,uBAAuB,eAAsC;AAC3E,MAAI,kBAAkB,aAAc,QAAO;AAC3C,MAAI,kBAAkB,SAAU,QAAO;AACvC,SAAO;AACT;AAEO,SAAS,2BACd,MACA,aACQ;AACR,QAAM,SAAS,2BAA2B,WAAW;AACrD,MAAI,WAAW,SAAU,QAAO,KAAK;AACrC,MAAI,WAAW,aAAc,QAAO,KAAK;AACzC,SAAO,KAAK;AACd;AAEO,SAAS,mCACd,MACA,aACQ;AACR,QAAM,SAAS,2BAA2B,WAAW;AACrD,MAAI,WAAW,SAAU,QAAO,KAAK;AACrC,MAAI,WAAW,aAAc,QAAO,KAAK;AACzC,SAAO,KAAK;AACd;AAGO,SAAS,YACd,MACA,QACQ;AACR,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,WAAW,SAAU,QAAO,KAAK,iBAAiB;AACtD,MAAI,WAAW,aAAc,QAAO,KAAK,sBAAsB;AAC/D,SAAO;AACT;AAGO,SAAS,kBACd,MACA,QACQ;AACR,MAAI,CAAC,KAAM,QAAO;AAClB,MAAI,WAAW,SAAU,QAAO,KAAK,wBAAwB;AAC7D,MAAI,WAAW,aAAc,QAAO,KAAK,6BAA6B;AACtE,SAAO,KAAK,yBAAyB;AACvC;AAMO,SAAS,qBAAqB,OAAuB;AAC1D,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC;AACrD;AAOO,SAAS,4BACd,MACA,QACe;AACf,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,uBACJ,WAAW,WACP,KAAK,qBACL,WAAW,eACT,KAAK,0BACL,KAAK;AACb,MAAI,wBAAwB,KAAM,QAAO,qBAAqB,oBAAoB;AAElF,QAAM,QAAQ,WAAW,WAAW,KAAK,OAAO,WAAW,eAAe,KAAK,YAAY,KAAK;AAChG,QAAM,WAAW,YAAY,MAAM,MAAM,IAAI,kBAAkB,MAAM,MAAM;AAC3E,QAAM,OAAO,QAAQ;AACrB,MAAI,QAAQ,KAAK,YAAY,EAAG,QAAO;AAEvC,SAAO,qBAAsB,WAAW,OAAQ,GAAG;AACrD;AAMO,SAAS,oBACd,eACmC;AACnC,MAAI,kBAAkB,SAAU,QAAO;AACvC,MAAI,kBAAkB,aAAc,QAAO;AAC3C,SAAO;AACT;AAMO,MAAM,0CAA0C;AAKhD,SAAS,qBACd,SACsB;AACtB,MAAI,CAAC,QAAS,QAAO;AAErB,SAAO;AAAA,IACL,SAAS,qBAAqB,QAAQ,QAAQ,gBAAgB;AAAA,IAC9D,QAAQ,qBAAqB,QAAQ,OAAO,gBAAgB;AAAA,EAC9D;AACF;AAGO,SAAS,wBAAwB,OAAuC;AAC7E,QAAM,WAAW,MAAM,QAAQ,CAAC,SAAS,qBAAqB,KAAK,OAAO,KAAK,CAAC,CAAC;AACjF,MAAI,CAAC,SAAS,OAAQ,QAAO;AAE7B,SAAO;AAAA,IACL,SAAS,KAAK,IAAI,GAAG,SAAS,IAAI,CAAC,YAAY,QAAQ,OAAO,CAAC;AAAA,IAC/D,QAAQ,KAAK,IAAI,GAAG,SAAS,IAAI,CAAC,YAAY,QAAQ,MAAM,CAAC;AAAA,EAC/D;AACF;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function resolveSubscriptionPlanName(subscription, translate, fallback = "") {
|
|
2
|
+
if (subscription?.id_plan != null) {
|
|
3
|
+
const key = `common.plans.names.${subscription.id_plan}`;
|
|
4
|
+
try {
|
|
5
|
+
const translated = translate(key);
|
|
6
|
+
if (translated && translated !== key) return translated;
|
|
7
|
+
} catch {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return subscription?.plan_name || fallback;
|
|
11
|
+
}
|
|
12
|
+
function resolvePlanNameById(idPlan, backendName, translate, fallback = "") {
|
|
13
|
+
if (idPlan != null) {
|
|
14
|
+
const key = `common.plans.names.${idPlan}`;
|
|
15
|
+
try {
|
|
16
|
+
const translated = translate(key);
|
|
17
|
+
if (translated && translated !== key) return translated;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return backendName || fallback;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
resolvePlanNameById,
|
|
25
|
+
resolveSubscriptionPlanName
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=resolve-subscription-plan-name.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/resolve-subscription-plan-name.ts"],"sourcesContent":["import type { Subscription } from '../types/subscription.type';\n\ntype TranslateFn = (key: any, values?: Record<string, string | number>) => string;\n\n/**\n * Nome do plano para exibição. O nome vindo do backend está sempre em português, então a\n * tradução sai do id (`common.plans.names.<id>`) e o valor do backend fica como fallback —\n * plano sem chave (whitelabel, trial nomeado, plano novo) continua aparecendo com o nome que veio.\n */\nexport function resolveSubscriptionPlanName(\n subscription: Pick<Subscription, 'id_plan' | 'plan_name'> | null | undefined,\n translate: TranslateFn,\n fallback = ''\n): string {\n if (subscription?.id_plan != null) {\n const key = `common.plans.names.${subscription.id_plan}`;\n try {\n const translated = translate(key);\n if (translated && translated !== key) return translated;\n } catch {\n /* chave ausente: cai no nome do backend */\n }\n }\n return subscription?.plan_name || fallback;\n}\n\n/** Mesmo mapeamento por id, para quando só se tem o plano (não a assinatura). */\nexport function resolvePlanNameById(\n idPlan: number | null | undefined,\n backendName: string | null | undefined,\n translate: TranslateFn,\n fallback = ''\n): string {\n if (idPlan != null) {\n const key = `common.plans.names.${idPlan}`;\n try {\n const translated = translate(key);\n if (translated && translated !== key) return translated;\n } catch {\n /* chave ausente: cai no nome do backend */\n }\n }\n return backendName || fallback;\n}\n"],"mappings":"AASO,SAAS,4BACd,cACA,WACA,WAAW,IACH;AACR,MAAI,cAAc,WAAW,MAAM;AACjC,UAAM,MAAM,sBAAsB,aAAa,OAAO;AACtD,QAAI;AACF,YAAM,aAAa,UAAU,GAAG;AAChC,UAAI,cAAc,eAAe,IAAK,QAAO;AAAA,IAC/C,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO,cAAc,aAAa;AACpC;AAGO,SAAS,oBACd,QACA,aACA,WACA,WAAW,IACH;AACR,MAAI,UAAU,MAAM;AAClB,UAAM,MAAM,sBAAsB,MAAM;AACxC,QAAI;AACF,YAAM,aAAa,UAAU,GAAG;AAChC,UAAI,cAAc,eAAe,IAAK,QAAO;AAAA,IAC/C,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO,eAAe;AACxB;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { apiFetch } from "../../../infra/http/api-fetch";
|
|
4
|
+
import { apiFetchPaged, nextPageParam } from "../../../infra/http/paged";
|
|
4
5
|
import { markMessageAsReadAction } from "../action/mark-message-as-read.action";
|
|
5
6
|
import { markAllMessagesAsReadAction } from "../action/mark-all-messages-as-read.action";
|
|
6
7
|
import { withAction } from "../../../utils/withAction";
|
|
@@ -18,7 +19,7 @@ function useInfiniteMessages(params) {
|
|
|
18
19
|
const queryKey = useAuthQueryKey([...MESSAGES_QUERY_KEY, "infinite", params]);
|
|
19
20
|
return useInfiniteQuery({
|
|
20
21
|
queryKey,
|
|
21
|
-
queryFn: ({ pageParam, signal }) =>
|
|
22
|
+
queryFn: ({ pageParam, signal }) => apiFetchPaged("/api/messages", {
|
|
22
23
|
params: {
|
|
23
24
|
...params,
|
|
24
25
|
page: pageParam,
|
|
@@ -26,10 +27,7 @@ function useInfiniteMessages(params) {
|
|
|
26
27
|
},
|
|
27
28
|
signal
|
|
28
29
|
}),
|
|
29
|
-
getNextPageParam:
|
|
30
|
-
const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);
|
|
31
|
-
return loaded < lastPage.total ? allPages.length + 1 : void 0;
|
|
32
|
-
},
|
|
30
|
+
getNextPageParam: nextPageParam,
|
|
33
31
|
initialPageParam: 1
|
|
34
32
|
});
|
|
35
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/hooks/messages.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from '../../../infra/http/api-fetch';\nimport { markMessageAsReadAction } from '../action/mark-message-as-read.action';\nimport { markAllMessagesAsReadAction } from '../action/mark-all-messages-as-read.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { FindMessagesParams, ListMessagesResult } from '../schema/messages.schema';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const MESSAGES_QUERY_KEY = ['messages'] as const;\n\nconst INFINITE_MESSAGES_PAGE_SIZE = 10;\n\nexport function useMessages(params?: Partial<FindMessagesParams>) {\n const queryKey = useAuthQueryKey([...MESSAGES_QUERY_KEY, params]);\n\n return useQuery({\n queryKey,\n queryFn: ({ signal }) =>\n apiFetch<ListMessagesResult>('/api/messages', { params, signal }),\n });\n}\n\nexport function useInfiniteMessages(params?: Partial<Omit<FindMessagesParams, 'page' | 'limit'>>) {\n const queryKey = useAuthQueryKey([...MESSAGES_QUERY_KEY, 'infinite', params]);\n\n return useInfiniteQuery({\n queryKey,\n queryFn: ({ pageParam, signal }) =>\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/hooks/messages.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from '../../../infra/http/api-fetch';\nimport { apiFetchPaged, nextPageParam } from '../../../infra/http/paged';\nimport { markMessageAsReadAction } from '../action/mark-message-as-read.action';\nimport { markAllMessagesAsReadAction } from '../action/mark-all-messages-as-read.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { FindMessagesParams, ListMessagesResult } from '../schema/messages.schema';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const MESSAGES_QUERY_KEY = ['messages'] as const;\n\nconst INFINITE_MESSAGES_PAGE_SIZE = 10;\n\nexport function useMessages(params?: Partial<FindMessagesParams>) {\n const queryKey = useAuthQueryKey([...MESSAGES_QUERY_KEY, params]);\n\n return useQuery({\n queryKey,\n queryFn: ({ signal }) =>\n apiFetch<ListMessagesResult>('/api/messages', { params, signal }),\n });\n}\n\nexport function useInfiniteMessages(params?: Partial<Omit<FindMessagesParams, 'page' | 'limit'>>) {\n const queryKey = useAuthQueryKey([...MESSAGES_QUERY_KEY, 'infinite', params]);\n\n return useInfiniteQuery({\n queryKey,\n queryFn: ({ pageParam, signal }) =>\n apiFetchPaged<ListMessagesResult>('/api/messages', {\n params: {\n ...params,\n page: pageParam as number,\n limit: INFINITE_MESSAGES_PAGE_SIZE,\n },\n signal,\n }),\n getNextPageParam: nextPageParam,\n initialPageParam: 1,\n });\n}\n\nexport function useMarkMessageAsRead() {\n const queryClient = useQueryClient();\n const messagesKey = useAuthQueryKey([...MESSAGES_QUERY_KEY]);\n\n return useMutation({\n mutationFn: withAction(markMessageAsReadAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: messagesKey });\n },\n });\n}\n\nexport function useMarkAllMessagesAsRead() {\n const queryClient = useQueryClient();\n const messagesKey = useAuthQueryKey([...MESSAGES_QUERY_KEY]);\n\n return useMutation({\n mutationFn: withAction(markAllMessagesAsReadAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: messagesKey });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,kBAAkB,aAAa,UAAU,sBAAsB;AACxE,SAAS,gBAAgB;AACzB,SAAS,eAAe,qBAAqB;AAC7C,SAAS,+BAA+B;AACxC,SAAS,mCAAmC;AAC5C,SAAS,kBAAkB;AAE3B,SAAS,uBAAuB;AAEzB,MAAM,qBAAqB,CAAC,UAAU;AAE7C,MAAM,8BAA8B;AAE7B,SAAS,YAAY,QAAsC;AAChE,QAAM,WAAW,gBAAgB,CAAC,GAAG,oBAAoB,MAAM,CAAC;AAEhE,SAAO,SAAS;AAAA,IACd;AAAA,IACA,SAAS,CAAC,EAAE,OAAO,MACjB,SAA6B,iBAAiB,EAAE,QAAQ,OAAO,CAAC;AAAA,EACpE,CAAC;AACH;AAEO,SAAS,oBAAoB,QAA8D;AAChG,QAAM,WAAW,gBAAgB,CAAC,GAAG,oBAAoB,YAAY,MAAM,CAAC;AAE5E,SAAO,iBAAiB;AAAA,IACtB;AAAA,IACA,SAAS,CAAC,EAAE,WAAW,OAAO,MAC5B,cAAkC,iBAAiB;AAAA,MACjD,QAAQ;AAAA,QACN,GAAG;AAAA,QACH,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,EACpB,CAAC;AACH;AAEO,SAAS,uBAAuB;AACrC,QAAM,cAAc,eAAe;AACnC,QAAM,cAAc,gBAAgB,CAAC,GAAG,kBAAkB,CAAC;AAE3D,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,uBAAuB;AAAA,IAC9C,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,YAAY,CAAC;AAAA,IACzD;AAAA,EACF,CAAC;AACH;AAEO,SAAS,2BAA2B;AACzC,QAAM,cAAc,eAAe;AACnC,QAAM,cAAc,gBAAgB,CAAC,GAAG,kBAAkB,CAAC;AAE3D,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,2BAA2B;AAAA,IAClD,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,YAAY,CAAC;AAAA,IACzD;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/dist/server.mjs
CHANGED
|
@@ -55,6 +55,9 @@ import {
|
|
|
55
55
|
deleteAccountUserAction,
|
|
56
56
|
deleteAccountAction,
|
|
57
57
|
createAccountUserAction,
|
|
58
|
+
checkUserExistsAction,
|
|
59
|
+
addUserProjectsAction,
|
|
60
|
+
removeUserProjectsAction,
|
|
58
61
|
changePasswordAction,
|
|
59
62
|
requestEmailChangeAction,
|
|
60
63
|
confirmEmailChangeAction,
|
|
@@ -79,6 +82,7 @@ export {
|
|
|
79
82
|
accountService,
|
|
80
83
|
ackFreezeNoticeAction,
|
|
81
84
|
addProjectUserAction,
|
|
85
|
+
addUserProjectsAction,
|
|
82
86
|
api,
|
|
83
87
|
apiClient,
|
|
84
88
|
assertAccountNotFrozen,
|
|
@@ -94,6 +98,7 @@ export {
|
|
|
94
98
|
changePasswordAction,
|
|
95
99
|
chargeActionAction,
|
|
96
100
|
chargesService,
|
|
101
|
+
checkUserExistsAction,
|
|
97
102
|
confirmEmailChangeAction,
|
|
98
103
|
confirmPhoneChangeAction,
|
|
99
104
|
confirmTwoFactorAction,
|
|
@@ -128,6 +133,7 @@ export {
|
|
|
128
133
|
projectsService,
|
|
129
134
|
readCurrentSubscription,
|
|
130
135
|
removeProjectUserAction,
|
|
136
|
+
removeUserProjectsAction,
|
|
131
137
|
requestEmailChangeAction,
|
|
132
138
|
requestPhoneChangeAction,
|
|
133
139
|
requireTokenNotExpired,
|
package/dist/server.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\n\n// API Client\nexport { ApiClient, api, apiClient } from './infra/api/client';\n\n// Services\nexport { authService } from './modules/auth/services/auth.service';\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\nexport { assertSubscriptionAddon } from './modules/auth/utils/assert-subscription-addon';\nexport { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscription';\nexport { assertAccountNotFrozen } from './modules/auth/utils/assert-account-not-frozen';\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\nexport { plansService } from './modules/plans/services/plans.service';\nexport { cardsService } from './modules/cards/services/cards.service';\nexport { chargesService } from './modules/charges/services/charges.service';\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\n\n// Actions\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\nexport { socialGoogleLoginAction } from './modules/auth/actions/social-google-login.action';\nexport { socialGoogleOnboardingAction } from './modules/auth/actions/social-google-onboarding.action';\nexport { unlinkGoogleAction } from './modules/auth/actions/unlink-google.action';\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\nexport { getAccountTokenAction } from './modules/accounts/actions/get-account-token.action';\nexport { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\nexport { getCurrentSubscriptionAction } from './modules/subscriptions/actions/get-current-subscription.action';\nexport { readCurrentSubscription } from './modules/subscriptions/utils/read-current-subscription';\nexport { ackFreezeNoticeAction } from './modules/subscriptions/actions/ack-freeze-notice.action';\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\nexport { updateSubscriptionPaymentAction } from './modules/subscriptions/actions/update-subscription-payment.action';\nexport { createCardAction } from './modules/cards/actions/create-card.action';\nexport { createSetupIntentAction } from './modules/cards/actions/create-setup-intent.action';\nexport { chargeActionAction } from './modules/charges/actions/charge-action.action';\nexport { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';\nexport { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';\nexport { hasActivePaidSubscription } from './modules/subscriptions/utils/has-active-paid-subscription';\n\n// Project Services & Actions (server-only)\nexport { projectsService } from './modules/projects/services/projects.service';\nexport { listProjectsAction } from './modules/projects/actions/list-projects.action';\nexport { findProjectAction } from './modules/projects/actions/find-project.action';\nexport { createProjectAction } from './modules/projects/actions/create-project.action';\nexport { updateProjectAction } from './modules/projects/actions/update-project.action';\nexport { deleteProjectAction } from './modules/projects/actions/delete-project.action';\n\n// Project Users Services & Actions (server-only)\nexport { projectUsersService } from './modules/projects/services/project-users.service';\nexport { listProjectUsersAction } from './modules/projects/actions/list-project-users.action';\nexport { addProjectUserAction } from './modules/projects/actions/add-project-user.action';\nexport { removeProjectUserAction } from './modules/projects/actions/remove-project-user.action';\n\n// Account Services & Actions (server-only)\nexport { accountService } from './modules/accounts/services/account.service';\nexport { twoFactorService } from './modules/accounts/services/two-factor.service';\nexport {\n listAccountUsersAction,\n updateUserAction,\n updateAccountAction,\n updateAccountUserByIdAction,\n updateBillingDataAction,\n deleteAccountUserAction,\n deleteAccountAction,\n createAccountUserAction,\n checkUserExistsAction,\n addUserProjectsAction,\n removeUserProjectsAction,\n changePasswordAction,\n requestEmailChangeAction,\n confirmEmailChangeAction,\n requestPhoneChangeAction,\n confirmPhoneChangeAction,\n generateTwoFactorAction,\n confirmTwoFactorAction,\n disableTwoFactorAction,\n} from './modules/accounts/actions/account-management.action';\n\n// Server Utils\nexport { getClientInfoFromRequest } from './infra/utils/client-info';\nexport { getUserContext } from './modules/auth/utils/get-user-context';\nexport { resolveLocale } from './i18n/resolve-locale';\nexport type { ResolveLocaleOptions } from './i18n/resolve-locale';\nexport { requireValidSession } from './modules/auth/utils/require-valid-session';\nexport { requireTokenNotExpired } from './modules/auth/utils/require-token-not-expired';\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\nexport { safeServerAction } from './utils/safeServerAction';\nexport { safeMutationAction } from './utils/safeMutationAction';\n\n// Image Processing (server-side)\nexport { processImageAction } from './modules/images/actions/process-image.action';\nexport { processImage } from './modules/images/services/image-processing.service';\nexport type {\n ProcessImageInput,\n ProcessImageOutput,\n ProcessImageActionInput,\n ProcessImageActionOutput,\n} from './modules/images/types/image.type';\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,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,oCAAoC;AAC7C,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AACxC,SAAS,6BAA6B;AACtC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uCAAuC;AAChD,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,iCAAiC;AAG1C,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,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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAE9B,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,iBAAiB,8BAA8B;AACxD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAGnC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { create } from "zustand";
|
|
3
|
+
import { AccountSectionType } from "../enums/AccountSectionType";
|
|
3
4
|
const useAccountModals = create((set) => ({
|
|
4
5
|
activeModal: null,
|
|
5
6
|
config: {},
|
|
@@ -7,12 +8,18 @@ const useAccountModals = create((set) => ({
|
|
|
7
8
|
deleteAccountPayload: null,
|
|
8
9
|
deleteAccountError: null,
|
|
9
10
|
updateConfig: (config) => set({ config }),
|
|
10
|
-
openConfigurations: (initialSection) => set({
|
|
11
|
-
activeModal: "
|
|
11
|
+
openConfigurations: (initialSection = AccountSectionType.PREFERENCES) => set({
|
|
12
|
+
activeModal: "account",
|
|
12
13
|
initialSection,
|
|
13
14
|
deleteAccountPayload: null,
|
|
14
15
|
deleteAccountError: null
|
|
15
16
|
}),
|
|
17
|
+
openWorkspace: (section) => set({
|
|
18
|
+
activeModal: "account",
|
|
19
|
+
initialSection: section,
|
|
20
|
+
deleteAccountPayload: null,
|
|
21
|
+
deleteAccountError: null
|
|
22
|
+
}),
|
|
16
23
|
openDeleteAccount: (error) => set({
|
|
17
24
|
activeModal: "deleteAccount",
|
|
18
25
|
deleteAccountPayload: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport { AccountSectionType } from '../enums/AccountSectionType';\nimport type { WorkspaceSectionType } from '../enums/WorkspaceSectionType';\nimport type { WorkspaceActions } from '../components/account/types/workspace-actions.type';\n\ntype AccountModalType =\n | 'account'\n | 'deleteAccount'\n | 'isntPossibleDelete'\n | 'confirmDelete';\n\nexport interface AccountModalsConfig {\n onGoToSubscription?: () => void;\n workspaceActions?: WorkspaceActions;\n}\n\n/** Aba do modal Minha conta: seções da conta (preferências, token, segurança) ou do workspace. */\nexport type MyAccountSection = AccountSectionType | WorkspaceSectionType;\n\ninterface DeleteAccountPayload {\n password: string;\n}\n\ninterface AccountModalsState {\n activeModal: AccountModalType | null;\n config: AccountModalsConfig;\n initialSection?: MyAccountSection;\n\n /** Payload coletado no DeleteAccountModal, consumido pelo ConfirmDeleteAccountModal. */\n deleteAccountPayload: DeleteAccountPayload | null;\n /** Mensagem de erro do backend quando o delete falha (ex.: senha inválida).\n * Mostrada no DeleteAccountModal quando o usuário é mandado de volta. */\n deleteAccountError: string | null;\n\n /** Called by <AccountModals> to keep app-level config in sync */\n updateConfig: (config: AccountModalsConfig) => void;\n\n /** Abre o modal Minha conta numa seção da conta (padrão: Preferências). */\n openConfigurations: (initialSection?: AccountSectionType) => void;\n /** Abre o modal Minha conta numa seção do workspace (padrão: primeira aba visível). */\n openWorkspace: (section?: WorkspaceSectionType) => void;\n openDeleteAccount: (error?: string) => void;\n openIsntPossibleDelete: () => void;\n openConfirmDelete: (payload: DeleteAccountPayload) => void;\n clearDeleteAccountError: () => void;\n close: () => void;\n}\n\nexport const useAccountModals = create<AccountModalsState>((set) => ({\n activeModal: null,\n config: {},\n initialSection: undefined,\n deleteAccountPayload: null,\n deleteAccountError: null,\n\n updateConfig: (config) => set({ config }),\n\n openConfigurations: (initialSection = AccountSectionType.PREFERENCES) =>\n set({\n activeModal: 'account',\n initialSection,\n deleteAccountPayload: null,\n deleteAccountError: null,\n }),\n\n openWorkspace: (section) =>\n set({\n activeModal: 'account',\n initialSection: section,\n deleteAccountPayload: null,\n deleteAccountError: null,\n }),\n\n openDeleteAccount: (error) =>\n set({\n activeModal: 'deleteAccount',\n deleteAccountPayload: null,\n deleteAccountError: error ?? null,\n }),\n\n openIsntPossibleDelete: () =>\n set({ activeModal: 'isntPossibleDelete' }),\n\n openConfirmDelete: (payload) =>\n set({\n activeModal: 'confirmDelete',\n deleteAccountPayload: payload,\n deleteAccountError: null,\n }),\n\n clearDeleteAccountError: () => set({ deleteAccountError: null }),\n\n close: () =>\n set({\n activeModal: null,\n initialSection: undefined,\n deleteAccountPayload: null,\n deleteAccountError: null,\n }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AACvB,SAAS,0BAA0B;AA+C5B,MAAM,mBAAmB,OAA2B,CAAC,SAAS;AAAA,EACnE,aAAa;AAAA,EACb,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EAEpB,cAAc,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EAExC,oBAAoB,CAAC,iBAAiB,mBAAmB,gBACvD,IAAI;AAAA,IACF,aAAa;AAAA,IACb;AAAA,IACA,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,EACtB,CAAC;AAAA,EAEH,eAAe,CAAC,YACd,IAAI;AAAA,IACF,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,EACtB,CAAC;AAAA,EAEH,mBAAmB,CAAC,UAClB,IAAI;AAAA,IACF,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,oBAAoB,SAAS;AAAA,EAC/B,CAAC;AAAA,EAEH,wBAAwB,MACtB,IAAI,EAAE,aAAa,qBAAqB,CAAC;AAAA,EAE3C,mBAAmB,CAAC,YAClB,IAAI;AAAA,IACF,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,EACtB,CAAC;AAAA,EAEH,yBAAyB,MAAM,IAAI,EAAE,oBAAoB,KAAK,CAAC;AAAA,EAE/D,OAAO,MACL,IAAI;AAAA,IACF,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,EACtB,CAAC;AACL,EAAE;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useAffiliateFlows = create((set) => ({
|
|
4
|
+
isWithdrawalOpen: false,
|
|
5
|
+
isReceivingAccountOpen: false,
|
|
6
|
+
isMissingReceivingAccountOpen: false,
|
|
7
|
+
isLeadsOpen: false,
|
|
8
|
+
attachment: null,
|
|
9
|
+
openWithdrawal: () => set({ isWithdrawalOpen: true }),
|
|
10
|
+
closeWithdrawal: () => set({ isWithdrawalOpen: false }),
|
|
11
|
+
openReceivingAccount: () => set({ isReceivingAccountOpen: true }),
|
|
12
|
+
closeReceivingAccount: () => set({ isReceivingAccountOpen: false }),
|
|
13
|
+
openMissingReceivingAccount: () => set({ isMissingReceivingAccountOpen: true }),
|
|
14
|
+
closeMissingReceivingAccount: () => set({ isMissingReceivingAccountOpen: false }),
|
|
15
|
+
openLeads: () => set({ isLeadsOpen: true }),
|
|
16
|
+
closeLeads: () => set({ isLeadsOpen: false }),
|
|
17
|
+
openAttachment: (attachment) => set({ attachment }),
|
|
18
|
+
closeAttachment: () => set({ attachment: null })
|
|
19
|
+
}));
|
|
20
|
+
export {
|
|
21
|
+
useAffiliateFlows
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useAffiliateFlows.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useAffiliateFlows.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\n\ninterface AffiliateFlowsState {\n isWithdrawalOpen: boolean;\n isReceivingAccountOpen: boolean;\n isMissingReceivingAccountOpen: boolean;\n isLeadsOpen: boolean;\n /** Caminho do anexo (nota fiscal) aberto no visualizador. */\n attachment: string | null;\n\n openWithdrawal: () => void;\n closeWithdrawal: () => void;\n openReceivingAccount: () => void;\n closeReceivingAccount: () => void;\n openMissingReceivingAccount: () => void;\n closeMissingReceivingAccount: () => void;\n openLeads: () => void;\n closeLeads: () => void;\n openAttachment: (attachment: string) => void;\n closeAttachment: () => void;\n}\n\n/**\n * Fluxos da aba Afiliados do modal Minha conta (saque, conta de recebimento, leads e anexo).\n * Ficam em store porque quem dispara são a lista e o cabeçalho, e quem renderiza é `AffiliateFlows`.\n */\nexport const useAffiliateFlows = create<AffiliateFlowsState>((set) => ({\n isWithdrawalOpen: false,\n isReceivingAccountOpen: false,\n isMissingReceivingAccountOpen: false,\n isLeadsOpen: false,\n attachment: null,\n\n openWithdrawal: () => set({ isWithdrawalOpen: true }),\n closeWithdrawal: () => set({ isWithdrawalOpen: false }),\n openReceivingAccount: () => set({ isReceivingAccountOpen: true }),\n closeReceivingAccount: () => set({ isReceivingAccountOpen: false }),\n openMissingReceivingAccount: () => set({ isMissingReceivingAccountOpen: true }),\n closeMissingReceivingAccount: () => set({ isMissingReceivingAccountOpen: false }),\n openLeads: () => set({ isLeadsOpen: true }),\n closeLeads: () => set({ isLeadsOpen: false }),\n openAttachment: (attachment) => set({ attachment }),\n closeAttachment: () => set({ attachment: null }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AA0BhB,MAAM,oBAAoB,OAA4B,CAAC,SAAS;AAAA,EACrE,kBAAkB;AAAA,EAClB,wBAAwB;AAAA,EACxB,+BAA+B;AAAA,EAC/B,aAAa;AAAA,EACb,YAAY;AAAA,EAEZ,gBAAgB,MAAM,IAAI,EAAE,kBAAkB,KAAK,CAAC;AAAA,EACpD,iBAAiB,MAAM,IAAI,EAAE,kBAAkB,MAAM,CAAC;AAAA,EACtD,sBAAsB,MAAM,IAAI,EAAE,wBAAwB,KAAK,CAAC;AAAA,EAChE,uBAAuB,MAAM,IAAI,EAAE,wBAAwB,MAAM,CAAC;AAAA,EAClE,6BAA6B,MAAM,IAAI,EAAE,+BAA+B,KAAK,CAAC;AAAA,EAC9E,8BAA8B,MAAM,IAAI,EAAE,+BAA+B,MAAM,CAAC;AAAA,EAChF,WAAW,MAAM,IAAI,EAAE,aAAa,KAAK,CAAC;AAAA,EAC1C,YAAY,MAAM,IAAI,EAAE,aAAa,MAAM,CAAC;AAAA,EAC5C,gBAAgB,CAAC,eAAe,IAAI,EAAE,WAAW,CAAC;AAAA,EAClD,iBAAiB,MAAM,IAAI,EAAE,YAAY,KAAK,CAAC;AACjD,EAAE;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useProjectFlows = create((set) => ({
|
|
4
|
+
sheet: null,
|
|
5
|
+
projectToDelete: null,
|
|
6
|
+
isProjectsDisabledOpen: false,
|
|
7
|
+
openCreateProject: () => set({ sheet: { mode: "create" } }),
|
|
8
|
+
openProjectDetails: (project) => set({ sheet: { mode: "details", project } }),
|
|
9
|
+
closeProjectSheet: () => set({ sheet: null }),
|
|
10
|
+
openDeleteProject: (project) => set({ projectToDelete: project }),
|
|
11
|
+
closeDeleteProject: () => set({ projectToDelete: null }),
|
|
12
|
+
openProjectsDisabled: () => set({ isProjectsDisabledOpen: true }),
|
|
13
|
+
closeProjectsDisabled: () => set({ isProjectsDisabledOpen: false })
|
|
14
|
+
}));
|
|
15
|
+
export {
|
|
16
|
+
useProjectFlows
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useProjectFlows.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useProjectFlows.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { Project } from '../modules/projects/types';\n\n/** Sheet de projeto: criação, ou detalhes/edição de um projeto já existente. */\nexport type ProjectSheetState = { mode: 'create' } | { mode: 'details'; project: Project } | null;\n\ninterface ProjectFlowsState {\n sheet: ProjectSheetState;\n projectToDelete: Project | null;\n isProjectsDisabledOpen: boolean;\n\n openCreateProject: () => void;\n openProjectDetails: (project: Project) => void;\n closeProjectSheet: () => void;\n openDeleteProject: (project: Project) => void;\n closeDeleteProject: () => void;\n openProjectsDisabled: () => void;\n closeProjectsDisabled: () => void;\n}\n\n/**\n * Fluxos da aba Projetos do modal Minha conta (sheet de projeto, exclusão e aviso de plano sem\n * gestão de projetos). Ficam em store porque quem dispara é a lista e quem renderiza é\n * `ProjectFlows`, montado uma única vez na seção.\n */\nexport const useProjectFlows = create<ProjectFlowsState>((set) => ({\n sheet: null,\n projectToDelete: null,\n isProjectsDisabledOpen: false,\n\n openCreateProject: () => set({ sheet: { mode: 'create' } }),\n openProjectDetails: (project) => set({ sheet: { mode: 'details', project } }),\n closeProjectSheet: () => set({ sheet: null }),\n\n openDeleteProject: (project) => set({ projectToDelete: project }),\n closeDeleteProject: () => set({ projectToDelete: null }),\n\n openProjectsDisabled: () => set({ isProjectsDisabledOpen: true }),\n closeProjectsDisabled: () => set({ isProjectsDisabledOpen: false }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAyBhB,MAAM,kBAAkB,OAA0B,CAAC,SAAS;AAAA,EACjE,OAAO;AAAA,EACP,iBAAiB;AAAA,EACjB,wBAAwB;AAAA,EAExB,mBAAmB,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,SAAS,EAAE,CAAC;AAAA,EAC1D,oBAAoB,CAAC,YAAY,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,QAAQ,EAAE,CAAC;AAAA,EAC5E,mBAAmB,MAAM,IAAI,EAAE,OAAO,KAAK,CAAC;AAAA,EAE5C,mBAAmB,CAAC,YAAY,IAAI,EAAE,iBAAiB,QAAQ,CAAC;AAAA,EAChE,oBAAoB,MAAM,IAAI,EAAE,iBAAiB,KAAK,CAAC;AAAA,EAEvD,sBAAsB,MAAM,IAAI,EAAE,wBAAwB,KAAK,CAAC;AAAA,EAChE,uBAAuB,MAAM,IAAI,EAAE,wBAAwB,MAAM,CAAC;AACpE,EAAE;","names":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useSubscriptionFlows = create((set) => ({
|
|
4
|
+
receiptCharge: null,
|
|
5
|
+
payCharge: null,
|
|
6
|
+
isBillingAddressOpen: false,
|
|
7
|
+
isPlanDetailsOpen: false,
|
|
8
|
+
isUsageReportOpen: false,
|
|
9
|
+
isCancelPlanOpen: false,
|
|
10
|
+
changePlan: null,
|
|
11
|
+
plansCatalog: null,
|
|
12
|
+
downgradeReason: null,
|
|
13
|
+
cannotDowngrade: null,
|
|
14
|
+
pixPayment: null,
|
|
15
|
+
boletoGenerated: null,
|
|
16
|
+
paymentConfirmation: null,
|
|
17
|
+
pendingChange: null,
|
|
18
|
+
isOverdueReceiptRequested: false,
|
|
19
|
+
openReceipt: (charge) => set({ receiptCharge: charge }),
|
|
20
|
+
closeReceipt: () => set({ receiptCharge: null }),
|
|
21
|
+
// Pagar sai do recibo: fecha um e abre o outro para não empilhar dois sheets da mesma cobrança.
|
|
22
|
+
openPayCharge: (charge) => set({ payCharge: { charge }, receiptCharge: null }),
|
|
23
|
+
closePayCharge: () => set({ payCharge: null }),
|
|
24
|
+
openBillingAddress: () => set({ isBillingAddressOpen: true }),
|
|
25
|
+
closeBillingAddress: () => set({ isBillingAddressOpen: false }),
|
|
26
|
+
openPlanDetails: () => set({ isPlanDetailsOpen: true }),
|
|
27
|
+
closePlanDetails: () => set({ isPlanDetailsOpen: false }),
|
|
28
|
+
openUsageReport: () => set({ isUsageReportOpen: true }),
|
|
29
|
+
closeUsageReport: () => set({ isUsageReportOpen: false }),
|
|
30
|
+
openCancelPlan: () => set({ isCancelPlanOpen: true }),
|
|
31
|
+
closeCancelPlan: () => set({ isCancelPlanOpen: false }),
|
|
32
|
+
openChangePlan: (state = {}) => set({ changePlan: state, plansCatalog: null, downgradeReason: null, cannotDowngrade: null }),
|
|
33
|
+
closeChangePlan: () => set({ changePlan: null }),
|
|
34
|
+
openPlansCatalog: (state = {}) => set({ plansCatalog: state }),
|
|
35
|
+
closePlansCatalog: () => set({ plansCatalog: null }),
|
|
36
|
+
openDowngradeReason: (state) => set({ downgradeReason: state }),
|
|
37
|
+
closeDowngradeReason: () => set({ downgradeReason: null }),
|
|
38
|
+
// Sair do roteiro encerra o downgrade inteiro: o motivo embaixo também fecha.
|
|
39
|
+
openCannotDowngrade: (state) => set({ cannotDowngrade: state, downgradeReason: null }),
|
|
40
|
+
updateCannotDowngrade: (patch) => set(
|
|
41
|
+
(current) => current.cannotDowngrade ? { cannotDowngrade: { ...current.cannotDowngrade, ...patch } } : {}
|
|
42
|
+
),
|
|
43
|
+
closeCannotDowngrade: () => set({ cannotDowngrade: null }),
|
|
44
|
+
openPixPayment: (state) => set({ pixPayment: state }),
|
|
45
|
+
closePixPayment: () => set({ pixPayment: null }),
|
|
46
|
+
openBoletoGenerated: (state) => set({ boletoGenerated: state }),
|
|
47
|
+
closeBoletoGenerated: () => set({ boletoGenerated: null }),
|
|
48
|
+
openPaymentConfirmation: (state) => set({ paymentConfirmation: state }),
|
|
49
|
+
closePaymentConfirmation: () => set({ paymentConfirmation: null }),
|
|
50
|
+
openPendingChange: (pendingChange) => set({ pendingChange }),
|
|
51
|
+
closePendingChange: () => set({ pendingChange: null }),
|
|
52
|
+
requestOverdueReceipt: () => set({ isOverdueReceiptRequested: true }),
|
|
53
|
+
clearOverdueReceiptRequest: () => set({ isOverdueReceiptRequested: false })
|
|
54
|
+
}));
|
|
55
|
+
export {
|
|
56
|
+
useSubscriptionFlows
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=useSubscriptionFlows.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useSubscriptionFlows.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { Charge } from '../modules/charges/types/charge.type';\nimport type { CouponStripeData } from '../modules/coupons/types/coupon.type';\nimport type { UiPlan } from '../modules/plans/types/plan.type';\nimport type { BillingPeriod } from '../modules/subscriptions/types/billing-period.type';\nimport type { Subscription } from '../modules/subscriptions/types/subscription.type';\n\ntype PendingChange = NonNullable<Subscription['pending_change']>;\n\nexport type PayChargeState = { charge: Charge } | null;\n\n/** Contexto da troca de plano: sem `targetPlan` é só gerenciamento dos adicionais do plano atual. */\nexport type ChangePlanState = {\n targetPlan?: UiPlan;\n billingPeriod?: BillingPeriod;\n isDowngrade?: boolean;\n isReactivation?: boolean;\n selectedCreditIndex?: number;\n} | null;\n\nexport type PlansCatalogState = { appliedCouponStripeData?: CouponStripeData | null } | null;\n\n/**\n * Payload compartilhado do downgrade: vitrine → motivo → ajuste de limites (quando o plano\n * alvo não comporta o que a conta usa) ou direto para a troca de plano.\n */\nexport type DowngradeFlowState = {\n targetPlan: UiPlan;\n planName: string;\n billingPeriod: BillingPeriod;\n /** Limite que vale no downgrade: domínios inclusos no plano alvo, sem os extras pagos. */\n planIncludedDomains: number;\n /** null = páginas ilimitadas no plano alvo. */\n planIncludedPages: number | null;\n registeredDomains: number;\n /**\n * Recursos que estouraram o limite e ganham etapa no roteiro. Ficam no payload para a etapa\n * não sumir quando o usuário resolve o excedente — resolvida, ela vira check.\n */\n domainsExceeded?: boolean;\n pagesExceeded?: boolean;\n} | null;\n\nexport type PixPaymentState = {\n qrCode: string | null;\n expiresAt: string | null;\n correlationId: string;\n /** Pró-rata em centavos quando o QR cobra só o delta do upgrade. */\n payNowCents: number | null;\n} | null;\n\n/** Boleto recém-gerado na contratação: o dialog busca a cobrança da assinatura criada. */\nexport type BoletoGeneratedState = { subscriptionId: string | number } | null;\n\nexport type PaymentConfirmationState = {\n planName?: string;\n total: number;\n periodLabel: string;\n immediateChargeTotal: number | null;\n} | null;\n\ninterface SubscriptionFlowsState {\n /** Cobrança aberta no sheet de detalhes/recibo. */\n receiptCharge: Charge | null;\n /** Cobrança aberta no pagamento de fatura. */\n payCharge: PayChargeState;\n isBillingAddressOpen: boolean;\n isPlanDetailsOpen: boolean;\n isUsageReportOpen: boolean;\n isCancelPlanOpen: boolean;\n changePlan: ChangePlanState;\n plansCatalog: PlansCatalogState;\n downgradeReason: DowngradeFlowState;\n cannotDowngrade: DowngradeFlowState;\n pixPayment: PixPaymentState;\n boletoGenerated: BoletoGeneratedState;\n paymentConfirmation: PaymentConfirmationState;\n pendingChange: PendingChange | null;\n isOverdueReceiptRequested: boolean;\n\n openReceipt: (charge: Charge) => void;\n closeReceipt: () => void;\n openPayCharge: (charge: Charge) => void;\n closePayCharge: () => void;\n openBillingAddress: () => void;\n closeBillingAddress: () => void;\n openPlanDetails: () => void;\n closePlanDetails: () => void;\n openUsageReport: () => void;\n closeUsageReport: () => void;\n openCancelPlan: () => void;\n closeCancelPlan: () => void;\n openChangePlan: (state?: NonNullable<ChangePlanState>) => void;\n closeChangePlan: () => void;\n openPlansCatalog: (state?: NonNullable<PlansCatalogState>) => void;\n closePlansCatalog: () => void;\n openDowngradeReason: (state: NonNullable<DowngradeFlowState>) => void;\n closeDowngradeReason: () => void;\n openCannotDowngrade: (state: NonNullable<DowngradeFlowState>) => void;\n /** Promove a etapa de um excedente descoberto com o roteiro já aberto. */\n updateCannotDowngrade: (patch: Partial<NonNullable<DowngradeFlowState>>) => void;\n closeCannotDowngrade: () => void;\n openPixPayment: (state: NonNullable<PixPaymentState>) => void;\n closePixPayment: () => void;\n openBoletoGenerated: (state: NonNullable<BoletoGeneratedState>) => void;\n closeBoletoGenerated: () => void;\n openPaymentConfirmation: (state: NonNullable<PaymentConfirmationState>) => void;\n closePaymentConfirmation: () => void;\n openPendingChange: (pendingChange: PendingChange) => void;\n closePendingChange: () => void;\n requestOverdueReceipt: () => void;\n clearOverdueReceiptRequest: () => void;\n}\n\n/**\n * Fluxos da aba Assinatura do modal Minha conta (recibo, pagamento, plano, relatório e catálogo).\n * Ficam em store porque quem dispara são os cartões e a lista, e quem renderiza é\n * `SubscriptionFlows`, montado uma única vez na seção.\n */\nexport const useSubscriptionFlows = create<SubscriptionFlowsState>((set) => ({\n receiptCharge: null,\n payCharge: null,\n isBillingAddressOpen: false,\n isPlanDetailsOpen: false,\n isUsageReportOpen: false,\n isCancelPlanOpen: false,\n changePlan: null,\n plansCatalog: null,\n downgradeReason: null,\n cannotDowngrade: null,\n pixPayment: null,\n boletoGenerated: null,\n paymentConfirmation: null,\n pendingChange: null,\n isOverdueReceiptRequested: false,\n\n openReceipt: (charge) => set({ receiptCharge: charge }),\n closeReceipt: () => set({ receiptCharge: null }),\n // Pagar sai do recibo: fecha um e abre o outro para não empilhar dois sheets da mesma cobrança.\n openPayCharge: (charge) => set({ payCharge: { charge }, receiptCharge: null }),\n closePayCharge: () => set({ payCharge: null }),\n openBillingAddress: () => set({ isBillingAddressOpen: true }),\n closeBillingAddress: () => set({ isBillingAddressOpen: false }),\n openPlanDetails: () => set({ isPlanDetailsOpen: true }),\n closePlanDetails: () => set({ isPlanDetailsOpen: false }),\n openUsageReport: () => set({ isUsageReportOpen: true }),\n closeUsageReport: () => set({ isUsageReportOpen: false }),\n openCancelPlan: () => set({ isCancelPlanOpen: true }),\n closeCancelPlan: () => set({ isCancelPlanOpen: false }),\n openChangePlan: (state = {}) =>\n set({ changePlan: state, plansCatalog: null, downgradeReason: null, cannotDowngrade: null }),\n closeChangePlan: () => set({ changePlan: null }),\n openPlansCatalog: (state = {}) => set({ plansCatalog: state }),\n closePlansCatalog: () => set({ plansCatalog: null }),\n openDowngradeReason: (state) => set({ downgradeReason: state }),\n closeDowngradeReason: () => set({ downgradeReason: null }),\n // Sair do roteiro encerra o downgrade inteiro: o motivo embaixo também fecha.\n openCannotDowngrade: (state) => set({ cannotDowngrade: state, downgradeReason: null }),\n updateCannotDowngrade: (patch) =>\n set((current) =>\n current.cannotDowngrade ? { cannotDowngrade: { ...current.cannotDowngrade, ...patch } } : {}\n ),\n closeCannotDowngrade: () => set({ cannotDowngrade: null }),\n openPixPayment: (state) => set({ pixPayment: state }),\n closePixPayment: () => set({ pixPayment: null }),\n openBoletoGenerated: (state) => set({ boletoGenerated: state }),\n closeBoletoGenerated: () => set({ boletoGenerated: null }),\n openPaymentConfirmation: (state) => set({ paymentConfirmation: state }),\n closePaymentConfirmation: () => set({ paymentConfirmation: null }),\n openPendingChange: (pendingChange) => set({ pendingChange }),\n closePendingChange: () => set({ pendingChange: null }),\n requestOverdueReceipt: () => set({ isOverdueReceiptRequested: true }),\n clearOverdueReceiptRequest: () => set({ isOverdueReceiptRequested: false }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAuHhB,MAAM,uBAAuB,OAA+B,CAAC,SAAS;AAAA,EAC3E,eAAe;AAAA,EACf,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,eAAe;AAAA,EACf,2BAA2B;AAAA,EAE3B,aAAa,CAAC,WAAW,IAAI,EAAE,eAAe,OAAO,CAAC;AAAA,EACtD,cAAc,MAAM,IAAI,EAAE,eAAe,KAAK,CAAC;AAAA;AAAA,EAE/C,eAAe,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,OAAO,GAAG,eAAe,KAAK,CAAC;AAAA,EAC7E,gBAAgB,MAAM,IAAI,EAAE,WAAW,KAAK,CAAC;AAAA,EAC7C,oBAAoB,MAAM,IAAI,EAAE,sBAAsB,KAAK,CAAC;AAAA,EAC5D,qBAAqB,MAAM,IAAI,EAAE,sBAAsB,MAAM,CAAC;AAAA,EAC9D,iBAAiB,MAAM,IAAI,EAAE,mBAAmB,KAAK,CAAC;AAAA,EACtD,kBAAkB,MAAM,IAAI,EAAE,mBAAmB,MAAM,CAAC;AAAA,EACxD,iBAAiB,MAAM,IAAI,EAAE,mBAAmB,KAAK,CAAC;AAAA,EACtD,kBAAkB,MAAM,IAAI,EAAE,mBAAmB,MAAM,CAAC;AAAA,EACxD,gBAAgB,MAAM,IAAI,EAAE,kBAAkB,KAAK,CAAC;AAAA,EACpD,iBAAiB,MAAM,IAAI,EAAE,kBAAkB,MAAM,CAAC;AAAA,EACtD,gBAAgB,CAAC,QAAQ,CAAC,MACxB,IAAI,EAAE,YAAY,OAAO,cAAc,MAAM,iBAAiB,MAAM,iBAAiB,KAAK,CAAC;AAAA,EAC7F,iBAAiB,MAAM,IAAI,EAAE,YAAY,KAAK,CAAC;AAAA,EAC/C,kBAAkB,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,cAAc,MAAM,CAAC;AAAA,EAC7D,mBAAmB,MAAM,IAAI,EAAE,cAAc,KAAK,CAAC;AAAA,EACnD,qBAAqB,CAAC,UAAU,IAAI,EAAE,iBAAiB,MAAM,CAAC;AAAA,EAC9D,sBAAsB,MAAM,IAAI,EAAE,iBAAiB,KAAK,CAAC;AAAA;AAAA,EAEzD,qBAAqB,CAAC,UAAU,IAAI,EAAE,iBAAiB,OAAO,iBAAiB,KAAK,CAAC;AAAA,EACrF,uBAAuB,CAAC,UACtB;AAAA,IAAI,CAAC,YACH,QAAQ,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,QAAQ,iBAAiB,GAAG,MAAM,EAAE,IAAI,CAAC;AAAA,EAC7F;AAAA,EACF,sBAAsB,MAAM,IAAI,EAAE,iBAAiB,KAAK,CAAC;AAAA,EACzD,gBAAgB,CAAC,UAAU,IAAI,EAAE,YAAY,MAAM,CAAC;AAAA,EACpD,iBAAiB,MAAM,IAAI,EAAE,YAAY,KAAK,CAAC;AAAA,EAC/C,qBAAqB,CAAC,UAAU,IAAI,EAAE,iBAAiB,MAAM,CAAC;AAAA,EAC9D,sBAAsB,MAAM,IAAI,EAAE,iBAAiB,KAAK,CAAC;AAAA,EACzD,yBAAyB,CAAC,UAAU,IAAI,EAAE,qBAAqB,MAAM,CAAC;AAAA,EACtE,0BAA0B,MAAM,IAAI,EAAE,qBAAqB,KAAK,CAAC;AAAA,EACjE,mBAAmB,CAAC,kBAAkB,IAAI,EAAE,cAAc,CAAC;AAAA,EAC3D,oBAAoB,MAAM,IAAI,EAAE,eAAe,KAAK,CAAC;AAAA,EACrD,uBAAuB,MAAM,IAAI,EAAE,2BAA2B,KAAK,CAAC;AAAA,EACpE,4BAA4B,MAAM,IAAI,EAAE,2BAA2B,MAAM,CAAC;AAC5E,EAAE;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useTeamFlows = create((set) => ({
|
|
4
|
+
sheet: null,
|
|
5
|
+
userToDelete: null,
|
|
6
|
+
openAddUser: () => set({ sheet: { mode: "add" } }),
|
|
7
|
+
openEditUser: (user) => set({ sheet: { mode: "edit", user } }),
|
|
8
|
+
closeUserSheet: () => set({ sheet: null }),
|
|
9
|
+
openDeleteUser: (user) => set({ userToDelete: user }),
|
|
10
|
+
closeDeleteUser: () => set({ userToDelete: null })
|
|
11
|
+
}));
|
|
12
|
+
export {
|
|
13
|
+
useTeamFlows
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useTeamFlows.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useTeamFlows.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { User } from '../modules/users/schema';\n\n/** Sheet de usuário: cadastro, ou edição/detalhes de um usuário já existente. */\nexport type UserSheetState = { mode: 'add' } | { mode: 'edit'; user: User } | null;\n\ninterface TeamFlowsState {\n sheet: UserSheetState;\n userToDelete: User | null;\n\n openAddUser: () => void;\n openEditUser: (user: User) => void;\n closeUserSheet: () => void;\n openDeleteUser: (user: User) => void;\n closeDeleteUser: () => void;\n}\n\n/**\n * Fluxos da aba Minha equipe do modal Minha conta (sheet de usuário e exclusão). Ficam em store\n * porque quem dispara é a lista e quem renderiza é `TeamFlows`, montado uma única vez na seção.\n */\nexport const useTeamFlows = create<TeamFlowsState>((set) => ({\n sheet: null,\n userToDelete: null,\n\n openAddUser: () => set({ sheet: { mode: 'add' } }),\n openEditUser: (user) => set({ sheet: { mode: 'edit', user } }),\n closeUserSheet: () => set({ sheet: null }),\n\n openDeleteUser: (user) => set({ userToDelete: user }),\n closeDeleteUser: () => set({ userToDelete: null }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAqBhB,MAAM,eAAe,OAAuB,CAAC,SAAS;AAAA,EAC3D,OAAO;AAAA,EACP,cAAc;AAAA,EAEd,aAAa,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,EAAE,CAAC;AAAA,EACjD,cAAc,CAAC,SAAS,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,KAAK,EAAE,CAAC;AAAA,EAC7D,gBAAgB,MAAM,IAAI,EAAE,OAAO,KAAK,CAAC;AAAA,EAEzC,gBAAgB,CAAC,SAAS,IAAI,EAAE,cAAc,KAAK,CAAC;AAAA,EACpD,iBAAiB,MAAM,IAAI,EAAE,cAAc,KAAK,CAAC;AACnD,EAAE;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { faker } from "@faker-js/faker";
|
|
2
|
+
import { TEST_IDS } from "../constants";
|
|
3
|
+
import { createMock } from "./create-mock";
|
|
4
|
+
const createCouponMock = createMock((overrides) => ({
|
|
5
|
+
id: overrides?.id ?? 1,
|
|
6
|
+
id_wl: overrides?.id_wl ?? TEST_IDS.wl,
|
|
7
|
+
id_affiliate: overrides?.id_affiliate ?? null,
|
|
8
|
+
title: overrides?.title || faker.commerce.productName(),
|
|
9
|
+
code: overrides?.code || faker.string.alphanumeric(8).toUpperCase(),
|
|
10
|
+
discount: overrides?.discount ?? 10,
|
|
11
|
+
discount_type: overrides?.discount_type ?? 1,
|
|
12
|
+
active: overrides?.active ?? true,
|
|
13
|
+
deleted: overrides?.deleted ?? false,
|
|
14
|
+
stripe_data: overrides?.stripe_data ?? null
|
|
15
|
+
}));
|
|
16
|
+
export {
|
|
17
|
+
createCouponMock
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=coupon.factory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/testing/factories/coupon.factory.ts"],"sourcesContent":["import { faker } from '@faker-js/faker';\nimport type { Coupon } from '../../modules/coupons/types/coupon.type';\nimport { TEST_IDS } from '../constants';\nimport { createMock } from './create-mock';\n\nexport const createCouponMock = createMock<Coupon, Partial<Coupon>>((overrides) => ({\n id: overrides?.id ?? 1,\n id_wl: overrides?.id_wl ?? TEST_IDS.wl,\n id_affiliate: overrides?.id_affiliate ?? null,\n title: overrides?.title || faker.commerce.productName(),\n code: overrides?.code || faker.string.alphanumeric(8).toUpperCase(),\n discount: overrides?.discount ?? 10,\n discount_type: overrides?.discount_type ?? 1,\n active: overrides?.active ?? true,\n deleted: overrides?.deleted ?? false,\n stripe_data: overrides?.stripe_data ?? null,\n}));\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAEpB,MAAM,mBAAmB,WAAoC,CAAC,eAAe;AAAA,EAClF,IAAI,WAAW,MAAM;AAAA,EACrB,OAAO,WAAW,SAAS,SAAS;AAAA,EACpC,cAAc,WAAW,gBAAgB;AAAA,EACzC,OAAO,WAAW,SAAS,MAAM,SAAS,YAAY;AAAA,EACtD,MAAM,WAAW,QAAQ,MAAM,OAAO,aAAa,CAAC,EAAE,YAAY;AAAA,EAClE,UAAU,WAAW,YAAY;AAAA,EACjC,eAAe,WAAW,iBAAiB;AAAA,EAC3C,QAAQ,WAAW,UAAU;AAAA,EAC7B,SAAS,WAAW,WAAW;AAAA,EAC/B,aAAa,WAAW,eAAe;AACzC,EAAE;","names":[]}
|
|
@@ -5,11 +5,17 @@ import { createAccountMock } from "./account.factory";
|
|
|
5
5
|
import { createWhitelabelMock, createWhitelabelTokenMock } from "./whitelabel.factory";
|
|
6
6
|
import { createSubscriptionMock, createSubscriptionItemMock } from "./subscription.factory";
|
|
7
7
|
import { createPlanMock, createPlanItemMock } from "./plan.factory";
|
|
8
|
+
import { createProjectMock } from "./project.factory";
|
|
9
|
+
import { createProjectUserMock } from "./project-user.factory";
|
|
10
|
+
import { createCouponMock } from "./coupon.factory";
|
|
8
11
|
export {
|
|
9
12
|
createAccountMock,
|
|
13
|
+
createCouponMock,
|
|
10
14
|
createMock,
|
|
11
15
|
createPlanItemMock,
|
|
12
16
|
createPlanMock,
|
|
17
|
+
createProjectMock,
|
|
18
|
+
createProjectUserMock,
|
|
13
19
|
createSubscriptionItemMock,
|
|
14
20
|
createSubscriptionMock,
|
|
15
21
|
createTestJwt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/testing/factories/index.ts"],"sourcesContent":["export { createMock, resetMocks } from './create-mock';\nexport { createTestJwt, type TestJwtClaims } from './jwt';\nexport { createUserMock } from './user.factory';\nexport { createAccountMock } from './account.factory';\nexport { createWhitelabelMock, createWhitelabelTokenMock } from './whitelabel.factory';\nexport { createSubscriptionMock, createSubscriptionItemMock } from './subscription.factory';\nexport { createPlanMock, createPlanItemMock } from './plan.factory';\n"],"mappings":"AAAA,SAAS,YAAY,kBAAkB;AACvC,SAAS,qBAAyC;AAClD,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAClC,SAAS,sBAAsB,iCAAiC;AAChE,SAAS,wBAAwB,kCAAkC;AACnE,SAAS,gBAAgB,0BAA0B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/testing/factories/index.ts"],"sourcesContent":["export { createMock, resetMocks } from './create-mock';\nexport { createTestJwt, type TestJwtClaims } from './jwt';\nexport { createUserMock } from './user.factory';\nexport { createAccountMock } from './account.factory';\nexport { createWhitelabelMock, createWhitelabelTokenMock } from './whitelabel.factory';\nexport { createSubscriptionMock, createSubscriptionItemMock } from './subscription.factory';\nexport { createPlanMock, createPlanItemMock } from './plan.factory';\nexport { createProjectMock } from './project.factory';\nexport { createProjectUserMock } from './project-user.factory';\nexport { createCouponMock } from './coupon.factory';\n"],"mappings":"AAAA,SAAS,YAAY,kBAAkB;AACvC,SAAS,qBAAyC;AAClD,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAClC,SAAS,sBAAsB,iCAAiC;AAChE,SAAS,wBAAwB,kCAAkC;AACnE,SAAS,gBAAgB,0BAA0B;AACnD,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { faker } from "@faker-js/faker";
|
|
2
|
+
import { UserProfile } from "../../modules/users/schema";
|
|
3
|
+
import { TEST_IDS } from "../constants";
|
|
4
|
+
import { createMock } from "./create-mock";
|
|
5
|
+
const createProjectUserMock = createMock((overrides) => ({
|
|
6
|
+
id_user: overrides?.id_user ?? TEST_IDS.user,
|
|
7
|
+
id_account: overrides?.id_account ?? TEST_IDS.account,
|
|
8
|
+
id_project: overrides?.id_project ?? 1,
|
|
9
|
+
name: overrides?.name || faker.person.fullName(),
|
|
10
|
+
email: overrides?.email || faker.internet.email().toLowerCase(),
|
|
11
|
+
profile: overrides?.profile ?? UserProfile.viewer,
|
|
12
|
+
photo: overrides?.photo ?? null
|
|
13
|
+
}));
|
|
14
|
+
export {
|
|
15
|
+
createProjectUserMock
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=project-user.factory.mjs.map
|