@greatapps/common 1.1.790 → 1.1.792
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/AccountUnsavedChangesDialog.mjs +34 -0
- package/dist/components/account/AccountUnsavedChangesDialog.mjs.map +1 -0
- 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 +173 -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 +212 -164
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +74 -68
- 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 +868 -3
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +868 -3
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +868 -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 +2 -4
- 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/useAccountUnsavedChanges.mjs +31 -0
- package/dist/store/useAccountUnsavedChanges.mjs.map +1 -0
- 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/AccountUnsavedChangesDialog.tsx +49 -0
- package/src/components/account/DeleteAccountModal.tsx +1 -1
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +9 -1
- package/src/components/account/MyAccountModal.tsx +222 -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 +215 -147
- package/src/components/account/sections/PreferencesSection.tsx +71 -71
- 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 +909 -2
- package/src/i18n/messages/es-es.ts +913 -2
- package/src/i18n/messages/pt-br.ts +913 -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 +2 -5
- 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/useAccountUnsavedChanges.ts +52 -0
- 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,253 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { IconCheck, IconInfoCircle, IconX } from "@tabler/icons-react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import { Badge } from "../../../ui/data-display/Badge";
|
|
6
|
+
import { Separator } from "../../../ui/data-display/Separator";
|
|
7
|
+
import { Skeleton } from "../../../ui/feedback/Skeleton";
|
|
8
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle } from "../../../ui/overlay/Sheet";
|
|
9
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../../../ui/overlay/Tooltip";
|
|
10
|
+
import { useCurrencyFormatter } from "../../../../modules/accounts/hooks/use-currency-formatter.hook";
|
|
11
|
+
import { useManagementPermissions } from "../../../../modules/auth/hooks/useManagementPermissions";
|
|
12
|
+
import { useCouponById } from "../../../../modules/coupons/hooks/use-coupon-by-id.hook";
|
|
13
|
+
import { usePlanById } from "../../../../modules/plans/hooks/use-plan-by-id.hook";
|
|
14
|
+
import { mapApiPlanToUiPlanForCurrency } from "../../../../modules/plans/utils/map-api-plan-to-ui";
|
|
15
|
+
import {
|
|
16
|
+
ADDON_IDS,
|
|
17
|
+
canBuyExtraDomains,
|
|
18
|
+
getDomainExtraPrice
|
|
19
|
+
} from "../../../../modules/subscriptions/constants/addons.constants";
|
|
20
|
+
import { useCurrentSubscription } from "../../../../modules/subscriptions/hooks/use-current-subscription.hook";
|
|
21
|
+
import {
|
|
22
|
+
getPeriodicityLabel,
|
|
23
|
+
periodicityToBillingPeriod
|
|
24
|
+
} from "../../../../modules/subscriptions/utils/periodicity";
|
|
25
|
+
import { resolveSubscriptionPlanName } from "../../../../modules/subscriptions/utils/resolve-subscription-plan-name";
|
|
26
|
+
import { useIsDefaultWhitelabel } from "../../../../providers/whitelabel.provider";
|
|
27
|
+
import { formatShortDate } from "../../../../infra/utils/date";
|
|
28
|
+
import useIsMobile from "../../../../hooks/useIsMobile";
|
|
29
|
+
import { cn } from "../../../../infra/utils/clsx";
|
|
30
|
+
import { useSubscriptionFlows } from "../../../../store/useSubscriptionFlows";
|
|
31
|
+
import useSubscriptionActions from "../../hooks/useSubscriptionActions";
|
|
32
|
+
function buildDisplayFeatures(uiPlan, subscriptionItems, planItems, translate) {
|
|
33
|
+
const features = [{ label: uiPlan.mainFeatures.pages, enabled: true }];
|
|
34
|
+
const subDomainItems = subscriptionItems.filter((item) => item.id_addon === ADDON_IDS.DOMAINS);
|
|
35
|
+
const planDomainItem = planItems.find((item) => item.id_addon === ADDON_IDS.DOMAINS);
|
|
36
|
+
const totalDomains = subDomainItems.reduce((sum, item) => sum + (item.quantity ?? 0), 0);
|
|
37
|
+
const baseDomains = subDomainItems.find((item) => (item.value ?? 0) === 0)?.quantity ?? planDomainItem?.quantity ?? 0;
|
|
38
|
+
const extraDomains = Math.max(0, totalDomains - baseDomains);
|
|
39
|
+
if (totalDomains >= 999) {
|
|
40
|
+
features.push({
|
|
41
|
+
label: translate("common.account.workspace.subscription.planDetails.unlimitedDomains"),
|
|
42
|
+
enabled: true
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
features.push({
|
|
46
|
+
label: extraDomains > 0 ? translate("common.account.workspace.subscription.planDetails.domainsSummary", {
|
|
47
|
+
total: String(totalDomains),
|
|
48
|
+
base: String(baseDomains),
|
|
49
|
+
extra: String(extraDomains)
|
|
50
|
+
}) : translate("common.account.workspace.subscription.planDetails.domainsSummaryNoExtra", {
|
|
51
|
+
total: String(totalDomains),
|
|
52
|
+
base: String(baseDomains)
|
|
53
|
+
}),
|
|
54
|
+
enabled: true,
|
|
55
|
+
isDomain: true
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
features.push({ label: uiPlan.mainFeatures.users, enabled: true });
|
|
59
|
+
const abTestItem = subscriptionItems.find((item) => item.id_addon === ADDON_IDS.AB_TEST);
|
|
60
|
+
if (abTestItem && abTestItem.quantity > 0) {
|
|
61
|
+
features.push({
|
|
62
|
+
label: translate("common.account.workspace.subscription.planDetails.abTestUnlimited"),
|
|
63
|
+
enabled: true
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const heatmapItem = subscriptionItems.find((item) => item.id_addon === ADDON_IDS.HEATMAP);
|
|
67
|
+
if (heatmapItem && heatmapItem.quantity > 0) {
|
|
68
|
+
features.push({
|
|
69
|
+
label: translate("common.account.workspace.subscription.planDetails.heatmap"),
|
|
70
|
+
enabled: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
for (const feature of uiPlan.features) {
|
|
74
|
+
features.push({ label: feature.text, enabled: feature.icon === "check" });
|
|
75
|
+
}
|
|
76
|
+
return features;
|
|
77
|
+
}
|
|
78
|
+
function DetailField({ label, value }) {
|
|
79
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
80
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950 w-[45%] wrap-break-word", children: label }),
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600 w-[55%] wrap-break-word", children: value })
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
function PlanDetailsSheet() {
|
|
85
|
+
const translate = useTranslations();
|
|
86
|
+
const translateSheet = useTranslations("common.account.workspace.subscription.planDetails");
|
|
87
|
+
const isMobile = useIsMobile();
|
|
88
|
+
const isDefaultWhitelabel = useIsDefaultWhitelabel();
|
|
89
|
+
const { currency, formatCurrencyNumber } = useCurrencyFormatter();
|
|
90
|
+
const { isOwnerOrAdmin } = useManagementPermissions();
|
|
91
|
+
const isOpen = useSubscriptionFlows((state) => state.isPlanDetailsOpen);
|
|
92
|
+
const close = useSubscriptionFlows((state) => state.closePlanDetails);
|
|
93
|
+
const actions = useSubscriptionActions();
|
|
94
|
+
const { data: subscriptionData } = useCurrentSubscription();
|
|
95
|
+
const subscription = subscriptionData?.data?.[0];
|
|
96
|
+
const { data: planData } = usePlanById(subscription?.id_plan);
|
|
97
|
+
const plan = planData?.data;
|
|
98
|
+
const { data: couponData } = useCouponById(subscription?.id_coupon);
|
|
99
|
+
const appliedCoupon = couponData?.data;
|
|
100
|
+
const hasData = !!subscription && !!plan;
|
|
101
|
+
const uiPlan = hasData ? mapApiPlanToUiPlanForCurrency(currency, translate)(plan) : null;
|
|
102
|
+
const features = uiPlan && plan && subscription ? buildDisplayFeatures(uiPlan, subscription.items, plan.items ?? [], translate) : [];
|
|
103
|
+
const domainItem = hasData ? subscription.items.find((item) => item.id_addon === ADDON_IDS.DOMAINS) : void 0;
|
|
104
|
+
const domainExtraPrice = hasData ? plan.items?.find((item) => item.id_addon === ADDON_IDS.DOMAINS && item.base)?.value ?? plan.items?.find((item) => item.id_addon === ADDON_IDS.DOMAINS && (item.value ?? 0) > 0)?.value ?? getDomainExtraPrice(plan.id) : 0;
|
|
105
|
+
const domainExtraBuckets = hasData ? Array.from(
|
|
106
|
+
subscription.items.filter((item) => item.id_addon === ADDON_IDS.DOMAINS && (item.value ?? 0) > 0).reduce(
|
|
107
|
+
(acc, item) => acc.set(item.value, (acc.get(item.value) ?? 0) + item.quantity),
|
|
108
|
+
/* @__PURE__ */ new Map()
|
|
109
|
+
).entries()
|
|
110
|
+
).map(([value2, quantity]) => ({
|
|
111
|
+
value: value2,
|
|
112
|
+
quantity,
|
|
113
|
+
isPromo: Math.abs(value2 - domainExtraPrice) > 0.01
|
|
114
|
+
})).sort((a, b) => a.isPromo === b.isPromo ? b.value - a.value : a.isPromo ? 1 : -1) : [];
|
|
115
|
+
const value = hasData ? formatCurrencyNumber(subscription.value ?? 0) : "--";
|
|
116
|
+
const periodicity = hasData ? getPeriodicityLabel(subscription.periodicity, translate) : "";
|
|
117
|
+
const billingPeriod = hasData ? periodicityToBillingPeriod(subscription.periodicity) : "monthly";
|
|
118
|
+
const periodicityAdverb = hasData ? billingPeriod === "semiannual" ? translateSheet("periodicitySemiannual") : billingPeriod === "annual" ? translateSheet("periodicityAnnual") : translateSheet("periodicityMonthly") : "";
|
|
119
|
+
const isTrialNoCard = hasData && subscription.type === "trial" && !subscription.id_card;
|
|
120
|
+
const paymentMethod = !hasData ? "--" : isTrialNoCard ? translateSheet("trialPeriod") : subscription.payment_method === 2 ? translateSheet("paymentMethodBoleto") : translateSheet("paymentMethodCard");
|
|
121
|
+
const stripeData = appliedCoupon?.stripe_data;
|
|
122
|
+
const couponValue = !appliedCoupon ? null : stripeData?.percent_off != null ? translateSheet("couponValuePercent", {
|
|
123
|
+
code: appliedCoupon.code,
|
|
124
|
+
percent: String(stripeData.percent_off)
|
|
125
|
+
}) : stripeData?.amount_off != null ? translateSheet("couponValueAmount", {
|
|
126
|
+
code: appliedCoupon.code,
|
|
127
|
+
amount: formatCurrencyNumber(stripeData.amount_off / 100)
|
|
128
|
+
}) : appliedCoupon.code;
|
|
129
|
+
const dueDate = hasData && subscription.date_due ? formatShortDate(subscription.date_due) : "--";
|
|
130
|
+
const planName = hasData ? resolveSubscriptionPlanName(subscription, translate, translateSheet("noName")) : "";
|
|
131
|
+
const cancelled = hasData && !!subscription.date_cancellation && subscription.date_cancellation < /* @__PURE__ */ new Date();
|
|
132
|
+
const isPartnerPlan = hasData && subscription.type === "partner";
|
|
133
|
+
const isOverdue = hasData && !!subscription.date_due && new Date(subscription.date_due) < /* @__PURE__ */ new Date();
|
|
134
|
+
const showAddonsCta = hasData && !cancelled && !isOverdue && isOwnerOrAdmin;
|
|
135
|
+
const showBadge = cancelled && subscription.type === "client";
|
|
136
|
+
const handleManageAddons = () => {
|
|
137
|
+
close();
|
|
138
|
+
actions.changePlan();
|
|
139
|
+
};
|
|
140
|
+
return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange: (nextOpen) => !nextOpen && close(), children: /* @__PURE__ */ jsxs(
|
|
141
|
+
SheetContent,
|
|
142
|
+
{
|
|
143
|
+
side: isMobile ? "bottom" : "right",
|
|
144
|
+
className: cn(
|
|
145
|
+
isMobile ? "h-dvh w-full max-w-full rounded-t-lg pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]" : "h-screen max-w-120! w-120!",
|
|
146
|
+
"data-[state=open]:max-h-none data-[state=open]:h-dvh gap-6!"
|
|
147
|
+
),
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-zinc-200", children: /* @__PURE__ */ jsx(SheetTitle, { className: "paragraph-medium-semibold text-zinc-950", children: translateSheet("title") }) }),
|
|
150
|
+
!hasData ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 px-5 pb-6", children: [
|
|
151
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
152
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
153
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40 rounded" }),
|
|
154
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-16 rounded-lg" })
|
|
155
|
+
] }),
|
|
156
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-28 rounded" })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
159
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
160
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32 rounded" }),
|
|
161
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col bg-zinc-50 rounded-lg p-4 gap-3", children: Array.from({ length: 12 }).map((_, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
162
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "size-4 rounded shrink-0" }),
|
|
163
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full rounded" })
|
|
164
|
+
] }, index)) })
|
|
165
|
+
] })
|
|
166
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 px-5 pb-6 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300", children: [
|
|
167
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
168
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
169
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950", children: translateSheet("planName", { name: planName }) }),
|
|
170
|
+
showBadge ? /* @__PURE__ */ jsx(Badge, { className: "text-red-700 border border-red-100 bg-red-50 rounded-lg paragraph-xsmall-semibold", children: translateSheet("cancelledBadge") }) : /* @__PURE__ */ jsx(Badge, { className: "text-blue-700 border border-blue-100 bg-blue-50 rounded-lg paragraph-xsmall-semibold", children: periodicity })
|
|
171
|
+
] }),
|
|
172
|
+
!isPartnerPlan && /* @__PURE__ */ jsxs("span", { className: "paragraph-small-medium text-zinc-600", children: [
|
|
173
|
+
translateSheet("validity"),
|
|
174
|
+
" ",
|
|
175
|
+
/* @__PURE__ */ jsx("span", { className: "text-zinc-950", children: dueDate })
|
|
176
|
+
] })
|
|
177
|
+
] }),
|
|
178
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
179
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
180
|
+
/* @__PURE__ */ jsx("span", { className: "text-zinc-600 paragraph-small-regular", children: translateSheet("includedInPlan") }),
|
|
181
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col bg-zinc-50 rounded-lg p-4 gap-3", children: features.map((feature) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
182
|
+
feature.enabled ? /* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 shrink-0 mt-0.5" }) : /* @__PURE__ */ jsx(IconX, { size: 16, className: "text-zinc-300 shrink-0 mt-0.5" }),
|
|
183
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
184
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
185
|
+
/* @__PURE__ */ jsx(
|
|
186
|
+
"span",
|
|
187
|
+
{
|
|
188
|
+
className: cn(
|
|
189
|
+
"paragraph-small-medium",
|
|
190
|
+
feature.enabled ? "text-zinc-500" : "text-zinc-300"
|
|
191
|
+
),
|
|
192
|
+
children: feature.label
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
feature.isDomain && domainItem && canBuyExtraDomains(plan.id) && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
196
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: "flex items-center justify-center size-5 shrink-0", children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 14, className: "text-zinc-400" }) }) }),
|
|
197
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", className: "max-w-53.75 p-3", children: translateSheet("domainTooltip") })
|
|
198
|
+
] })
|
|
199
|
+
] }),
|
|
200
|
+
feature.isDomain && domainItem && canBuyExtraDomains(plan.id) && domainExtraBuckets.map((bucket) => /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-zinc-400", children: bucket.isPromo ? translateSheet("domainPromoPrice", {
|
|
201
|
+
count: String(bucket.quantity),
|
|
202
|
+
price: formatCurrencyNumber(bucket.value)
|
|
203
|
+
}) : translateSheet("domainBucketPrice", {
|
|
204
|
+
count: String(bucket.quantity),
|
|
205
|
+
price: formatCurrencyNumber(bucket.value)
|
|
206
|
+
}) }, bucket.value))
|
|
207
|
+
] })
|
|
208
|
+
] }, feature.label)) })
|
|
209
|
+
] }),
|
|
210
|
+
showAddonsCta && /* @__PURE__ */ jsxs(
|
|
211
|
+
"div",
|
|
212
|
+
{
|
|
213
|
+
className: cn(
|
|
214
|
+
"flex items-center gap-3 p-4 rounded-lg",
|
|
215
|
+
isDefaultWhitelabel ? "bg-cyan-50" : "bg-zinc-50"
|
|
216
|
+
),
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsx(IconInfoCircle, { size: 16, className: "text-zinc-950 shrink-0 mt-0.5" }),
|
|
219
|
+
/* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-zinc-950", children: [
|
|
220
|
+
translateSheet("manageAddons"),
|
|
221
|
+
" ",
|
|
222
|
+
/* @__PURE__ */ jsx(
|
|
223
|
+
"button",
|
|
224
|
+
{
|
|
225
|
+
type: "button",
|
|
226
|
+
onClick: handleManageAddons,
|
|
227
|
+
className: "paragraph-small-semibold underline cursor-pointer hover:text-zinc-700 transition-colors",
|
|
228
|
+
children: translateSheet("manageAddonsLink")
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] })
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
236
|
+
/* @__PURE__ */ jsx("span", { className: "text-zinc-600 paragraph-small-regular", children: translateSheet("paymentInfo") }),
|
|
237
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col bg-zinc-50 rounded-lg p-4 gap-4", children: [
|
|
238
|
+
/* @__PURE__ */ jsx(DetailField, { label: translateSheet("valueLabel"), value }),
|
|
239
|
+
couponValue && /* @__PURE__ */ jsx(DetailField, { label: translateSheet("couponLabel"), value: couponValue }),
|
|
240
|
+
/* @__PURE__ */ jsx(DetailField, { label: translateSheet("paymentMethodLabel"), value: paymentMethod }),
|
|
241
|
+
/* @__PURE__ */ jsx(DetailField, { label: translateSheet("periodicityLabel"), value: periodicityAdverb }),
|
|
242
|
+
!isPartnerPlan && /* @__PURE__ */ jsx(DetailField, { label: translateSheet("planValidityLabel"), value: dueDate })
|
|
243
|
+
] })
|
|
244
|
+
] })
|
|
245
|
+
] })
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
) });
|
|
249
|
+
}
|
|
250
|
+
export {
|
|
251
|
+
PlanDetailsSheet
|
|
252
|
+
};
|
|
253
|
+
//# sourceMappingURL=PlanDetailsSheet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/subscription/PlanDetailsSheet.tsx"],"sourcesContent":["'use client';\n\nimport { IconCheck, IconInfoCircle, IconX } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Badge } from '../../../ui/data-display/Badge';\nimport { Separator } from '../../../ui/data-display/Separator';\nimport { Skeleton } from '../../../ui/feedback/Skeleton';\nimport { Sheet, SheetContent, SheetHeader, SheetTitle } from '../../../ui/overlay/Sheet';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../../ui/overlay/Tooltip';\nimport { useCurrencyFormatter } from '../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { useManagementPermissions } from '../../../../modules/auth/hooks/useManagementPermissions';\nimport { useCouponById } from '../../../../modules/coupons/hooks/use-coupon-by-id.hook';\nimport { usePlanById } from '../../../../modules/plans/hooks/use-plan-by-id.hook';\nimport { mapApiPlanToUiPlanForCurrency } from '../../../../modules/plans/utils/map-api-plan-to-ui';\nimport type { UiPlan } from '../../../../modules/plans/types/plan.type';\nimport {\n ADDON_IDS,\n canBuyExtraDomains,\n getDomainExtraPrice,\n} from '../../../../modules/subscriptions/constants/addons.constants';\nimport { useCurrentSubscription } from '../../../../modules/subscriptions/hooks/use-current-subscription.hook';\nimport {\n getPeriodicityLabel,\n periodicityToBillingPeriod,\n} from '../../../../modules/subscriptions/utils/periodicity';\nimport { resolveSubscriptionPlanName } from '../../../../modules/subscriptions/utils/resolve-subscription-plan-name';\nimport { useIsDefaultWhitelabel } from '../../../../providers/whitelabel.provider';\nimport { formatShortDate } from '../../../../infra/utils/date';\nimport useIsMobile from '../../../../hooks/useIsMobile';\nimport { cn } from '../../../../infra/utils/clsx';\nimport { useSubscriptionFlows } from '../../../../store/useSubscriptionFlows';\nimport useSubscriptionActions from '../../hooks/useSubscriptionActions';\n\ntype DisplayFeature = {\n label: string;\n enabled: boolean;\n isDomain?: boolean;\n};\n\nfunction buildDisplayFeatures(\n uiPlan: UiPlan,\n subscriptionItems: { id_addon: number | null; quantity: number; value: number | null }[],\n planItems: { id_addon: number; quantity: number }[],\n // `key: any`: o app tipa `useTranslations()` contra o catálogo dele e a chave literal não é\n // atribuível a `string` — mesmo padrão dos outros helpers que recebem o translate.\n translate: (key: any, values?: Record<string, string | number>) => string\n): DisplayFeature[] {\n const features: DisplayFeature[] = [{ label: uiPlan.mainFeatures.pages, enabled: true }];\n\n // Domínios: total = soma dos itens; base = item com value 0 (o incluso no plano); extras = resto.\n const subDomainItems = subscriptionItems.filter((item) => item.id_addon === ADDON_IDS.DOMAINS);\n const planDomainItem = planItems.find((item) => item.id_addon === ADDON_IDS.DOMAINS);\n const totalDomains = subDomainItems.reduce((sum, item) => sum + (item.quantity ?? 0), 0);\n const baseDomains =\n subDomainItems.find((item) => (item.value ?? 0) === 0)?.quantity ?? planDomainItem?.quantity ?? 0;\n const extraDomains = Math.max(0, totalDomains - baseDomains);\n\n if (totalDomains >= 999) {\n features.push({\n label: translate('common.account.workspace.subscription.planDetails.unlimitedDomains'),\n enabled: true,\n });\n } else {\n features.push({\n label:\n extraDomains > 0\n ? translate('common.account.workspace.subscription.planDetails.domainsSummary', {\n total: String(totalDomains),\n base: String(baseDomains),\n extra: String(extraDomains),\n })\n : translate('common.account.workspace.subscription.planDetails.domainsSummaryNoExtra', {\n total: String(totalDomains),\n base: String(baseDomains),\n }),\n enabled: true,\n isDomain: true,\n });\n }\n\n features.push({ label: uiPlan.mainFeatures.users, enabled: true });\n\n const abTestItem = subscriptionItems.find((item) => item.id_addon === ADDON_IDS.AB_TEST);\n if (abTestItem && abTestItem.quantity > 0) {\n features.push({\n label: translate('common.account.workspace.subscription.planDetails.abTestUnlimited'),\n enabled: true,\n });\n }\n\n const heatmapItem = subscriptionItems.find((item) => item.id_addon === ADDON_IDS.HEATMAP);\n if (heatmapItem && heatmapItem.quantity > 0) {\n features.push({\n label: translate('common.account.workspace.subscription.planDetails.heatmap'),\n enabled: true,\n });\n }\n\n for (const feature of uiPlan.features) {\n features.push({ label: feature.text, enabled: feature.icon === 'check' });\n }\n\n return features;\n}\n\nfunction DetailField({ label, value }: { label: string; value: string }) {\n return (\n <div className=\"flex items-start\">\n <span className=\"paragraph-small-medium text-zinc-950 w-[45%] wrap-break-word\">{label}</span>\n <span className=\"paragraph-small-regular text-zinc-600 w-[55%] wrap-break-word\">{value}</span>\n </div>\n );\n}\n\n/** Tudo que o plano inclui e as informações de cobrança da assinatura corrente. */\nexport function PlanDetailsSheet() {\n const translate = useTranslations();\n const translateSheet = useTranslations('common.account.workspace.subscription.planDetails');\n const isMobile = useIsMobile();\n const isDefaultWhitelabel = useIsDefaultWhitelabel();\n const { currency, formatCurrencyNumber } = useCurrencyFormatter();\n const { isOwnerOrAdmin } = useManagementPermissions();\n\n const isOpen = useSubscriptionFlows((state) => state.isPlanDetailsOpen);\n const close = useSubscriptionFlows((state) => state.closePlanDetails);\n const actions = useSubscriptionActions();\n\n const { data: subscriptionData } = useCurrentSubscription();\n const subscription = subscriptionData?.data?.[0];\n const { data: planData } = usePlanById(subscription?.id_plan);\n const plan = planData?.data;\n const { data: couponData } = useCouponById(subscription?.id_coupon);\n const appliedCoupon = couponData?.data;\n\n const hasData = !!subscription && !!plan;\n\n const uiPlan = hasData ? mapApiPlanToUiPlanForCurrency(currency, translate)(plan) : null;\n const features =\n uiPlan && plan && subscription\n ? buildDisplayFeatures(uiPlan, subscription.items, plan.items ?? [], translate)\n : [];\n const domainItem = hasData ? subscription.items.find((item) => item.id_addon === ADDON_IDS.DOMAINS) : undefined;\n\n // Preço do domínio extra: o item base do plano, com fallback na tabela por plano.\n const domainExtraPrice = hasData\n ? (plan.items?.find((item) => item.id_addon === ADDON_IDS.DOMAINS && item.base)?.value ??\n plan.items?.find((item) => item.id_addon === ADDON_IDS.DOMAINS && (item.value ?? 0) > 0)?.value ??\n getDomainExtraPrice(plan.id))\n : 0;\n\n // Domínios pagos agrupados por preço; base primeiro, promoções depois.\n const domainExtraBuckets = hasData\n ? Array.from(\n subscription.items\n .filter((item) => item.id_addon === ADDON_IDS.DOMAINS && (item.value ?? 0) > 0)\n .reduce(\n (acc, item) => acc.set(item.value!, (acc.get(item.value!) ?? 0) + item.quantity),\n new Map<number, number>()\n )\n .entries()\n )\n .map(([value, quantity]) => ({\n value,\n quantity,\n isPromo: Math.abs(value - domainExtraPrice) > 0.01,\n }))\n .sort((a, b) => (a.isPromo === b.isPromo ? b.value - a.value : a.isPromo ? 1 : -1))\n : [];\n\n const value = hasData ? formatCurrencyNumber(subscription.value ?? 0) : '--';\n const periodicity = hasData ? getPeriodicityLabel(subscription.periodicity, translate) : '';\n const billingPeriod = hasData ? periodicityToBillingPeriod(subscription.periodicity) : 'monthly';\n const periodicityAdverb = hasData\n ? billingPeriod === 'semiannual'\n ? translateSheet('periodicitySemiannual')\n : billingPeriod === 'annual'\n ? translateSheet('periodicityAnnual')\n : translateSheet('periodicityMonthly')\n : '';\n\n // Trial sem cartão: mostrar forma de cobrança não faz sentido.\n const isTrialNoCard = hasData && subscription.type === 'trial' && !subscription.id_card;\n const paymentMethod = !hasData\n ? '--'\n : isTrialNoCard\n ? translateSheet('trialPeriod')\n : subscription.payment_method === 2\n ? translateSheet('paymentMethodBoleto')\n : translateSheet('paymentMethodCard');\n\n const stripeData = appliedCoupon?.stripe_data;\n const couponValue = !appliedCoupon\n ? null\n : stripeData?.percent_off != null\n ? translateSheet('couponValuePercent', {\n code: appliedCoupon.code,\n percent: String(stripeData.percent_off),\n })\n : stripeData?.amount_off != null\n ? translateSheet('couponValueAmount', {\n code: appliedCoupon.code,\n amount: formatCurrencyNumber(stripeData.amount_off / 100),\n })\n : appliedCoupon.code;\n\n const dueDate = hasData && subscription.date_due ? formatShortDate(subscription.date_due) : '--';\n const planName = hasData ? resolveSubscriptionPlanName(subscription, translate, translateSheet('noName')) : '';\n const cancelled =\n hasData && !!subscription.date_cancellation && subscription.date_cancellation < new Date();\n const isPartnerPlan = hasData && subscription.type === 'partner';\n const isOverdue = hasData && !!subscription.date_due && new Date(subscription.date_due) < new Date();\n const showAddonsCta = hasData && !cancelled && !isOverdue && isOwnerOrAdmin;\n const showBadge = cancelled && subscription.type === 'client';\n\n const handleManageAddons = () => {\n close();\n actions.changePlan();\n };\n\n return (\n <Sheet open={isOpen} onOpenChange={(nextOpen) => !nextOpen && close()}>\n <SheetContent\n side={isMobile ? 'bottom' : 'right'}\n className={cn(\n isMobile\n ? 'h-dvh w-full max-w-full rounded-t-lg pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]'\n : 'h-screen max-w-120! w-120!',\n 'data-[state=open]:max-h-none data-[state=open]:h-dvh gap-6!'\n )}\n >\n <SheetHeader className=\"border-b border-zinc-200\">\n <SheetTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {translateSheet('title')}\n </SheetTitle>\n </SheetHeader>\n\n {!hasData ? (\n <div className=\"flex flex-col gap-6 px-5 pb-6\">\n <div className=\"flex flex-col gap-0.5\">\n <div className=\"flex items-center gap-2\">\n <Skeleton className=\"h-5 w-40 rounded\" />\n <Skeleton className=\"h-5 w-16 rounded-lg\" />\n </div>\n <Skeleton className=\"h-4 w-28 rounded\" />\n </div>\n <Separator />\n <div className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-4 w-32 rounded\" />\n <div className=\"flex flex-col bg-zinc-50 rounded-lg p-4 gap-3\">\n {Array.from({ length: 12 }).map((_, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n <Skeleton className=\"size-4 rounded shrink-0\" />\n <Skeleton className=\"h-4 w-full rounded\" />\n </div>\n ))}\n </div>\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col gap-6 px-5 pb-6 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300\">\n <div className=\"flex flex-col gap-0.5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"paragraph-medium-semibold text-zinc-950\">\n {translateSheet('planName', { name: planName })}\n </span>\n {showBadge ? (\n <Badge className=\"text-red-700 border border-red-100 bg-red-50 rounded-lg paragraph-xsmall-semibold\">\n {translateSheet('cancelledBadge')}\n </Badge>\n ) : (\n <Badge className=\"text-blue-700 border border-blue-100 bg-blue-50 rounded-lg paragraph-xsmall-semibold\">\n {periodicity}\n </Badge>\n )}\n </div>\n {!isPartnerPlan && (\n <span className=\"paragraph-small-medium text-zinc-600\">\n {translateSheet('validity')} <span className=\"text-zinc-950\">{dueDate}</span>\n </span>\n )}\n </div>\n\n <Separator />\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"text-zinc-600 paragraph-small-regular\">\n {translateSheet('includedInPlan')}\n </span>\n <div className=\"flex flex-col bg-zinc-50 rounded-lg p-4 gap-3\">\n {features.map((feature) => (\n <div key={feature.label} className=\"flex items-start gap-2\">\n {feature.enabled ? (\n <IconCheck size={16} className=\"text-zinc-950 shrink-0 mt-0.5\" />\n ) : (\n <IconX size={16} className=\"text-zinc-300 shrink-0 mt-0.5\" />\n )}\n <div className=\"flex flex-col\">\n <div className=\"flex items-center gap-1.5\">\n <span\n className={cn(\n 'paragraph-small-medium',\n feature.enabled ? 'text-zinc-500' : 'text-zinc-300'\n )}\n >\n {feature.label}\n </span>\n {feature.isDomain && domainItem && canBuyExtraDomains(plan.id) && (\n <Tooltip>\n <TooltipTrigger asChild>\n <button type=\"button\" className=\"flex items-center justify-center size-5 shrink-0\">\n <IconInfoCircle size={14} className=\"text-zinc-400\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\" className=\"max-w-53.75 p-3\">\n {translateSheet('domainTooltip')}\n </TooltipContent>\n </Tooltip>\n )}\n </div>\n {feature.isDomain &&\n domainItem &&\n canBuyExtraDomains(plan.id) &&\n domainExtraBuckets.map((bucket) => (\n <span key={bucket.value} className=\"paragraph-xsmall-medium text-zinc-400\">\n {bucket.isPromo\n ? translateSheet('domainPromoPrice', {\n count: String(bucket.quantity),\n price: formatCurrencyNumber(bucket.value),\n })\n : translateSheet('domainBucketPrice', {\n count: String(bucket.quantity),\n price: formatCurrencyNumber(bucket.value),\n })}\n </span>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n\n {showAddonsCta && (\n <div\n className={cn(\n 'flex items-center gap-3 p-4 rounded-lg',\n isDefaultWhitelabel ? 'bg-cyan-50' : 'bg-zinc-50'\n )}\n >\n <IconInfoCircle size={16} className=\"text-zinc-950 shrink-0 mt-0.5\" />\n <p className=\"paragraph-small-regular text-zinc-950\">\n {translateSheet('manageAddons')}{' '}\n <button\n type=\"button\"\n onClick={handleManageAddons}\n className=\"paragraph-small-semibold underline cursor-pointer hover:text-zinc-700 transition-colors\"\n >\n {translateSheet('manageAddonsLink')}\n </button>\n </p>\n </div>\n )}\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"text-zinc-600 paragraph-small-regular\">{translateSheet('paymentInfo')}</span>\n <div className=\"flex flex-col bg-zinc-50 rounded-lg p-4 gap-4\">\n <DetailField label={translateSheet('valueLabel')} value={value} />\n {couponValue && <DetailField label={translateSheet('couponLabel')} value={couponValue} />}\n <DetailField label={translateSheet('paymentMethodLabel')} value={paymentMethod} />\n <DetailField label={translateSheet('periodicityLabel')} value={periodicityAdverb} />\n {!isPartnerPlan && (\n <DetailField label={translateSheet('planValidityLabel')} value={dueDate} />\n )}\n </div>\n </div>\n </div>\n )}\n </SheetContent>\n </Sheet>\n );\n}\n"],"mappings":";AA2GI,SACE,KADF;AAzGJ,SAAS,WAAW,gBAAgB,aAAa;AACjD,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,OAAO,cAAc,aAAa,kBAAkB;AAC7D,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AACzC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,qCAAqC;AAE9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAC5C,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,OAAO,iBAAiB;AACxB,SAAS,UAAU;AACnB,SAAS,4BAA4B;AACrC,OAAO,4BAA4B;AAQnC,SAAS,qBACP,QACA,mBACA,WAGA,WACkB;AAClB,QAAM,WAA6B,CAAC,EAAE,OAAO,OAAO,aAAa,OAAO,SAAS,KAAK,CAAC;AAGvF,QAAM,iBAAiB,kBAAkB,OAAO,CAAC,SAAS,KAAK,aAAa,UAAU,OAAO;AAC7F,QAAM,iBAAiB,UAAU,KAAK,CAAC,SAAS,KAAK,aAAa,UAAU,OAAO;AACnF,QAAM,eAAe,eAAe,OAAO,CAAC,KAAK,SAAS,OAAO,KAAK,YAAY,IAAI,CAAC;AACvF,QAAM,cACJ,eAAe,KAAK,CAAC,UAAU,KAAK,SAAS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A,YACvF,qBAAC,SAAI,WAAU,iDACb;AAAA,kCAAC,eAAY,OAAO,eAAe,YAAY,GAAG,OAAc;AAAA,cAC/D,eAAe,oBAAC,eAAY,OAAO,eAAe,aAAa,GAAG,OAAO,aAAa;AAAA,cACvF,oBAAC,eAAY,OAAO,eAAe,oBAAoB,GAAG,OAAO,eAAe;AAAA,cAChF,oBAAC,eAAY,OAAO,eAAe,kBAAkB,GAAG,OAAO,mBAAmB;AAAA,cACjF,CAAC,iBACA,oBAAC,eAAY,OAAO,eAAe,mBAAmB,GAAG,OAAO,SAAS;AAAA,eAE7E;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":["value"]}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import {
|
|
5
|
+
IconBarcode,
|
|
6
|
+
IconCreditCard,
|
|
7
|
+
IconDownload,
|
|
8
|
+
IconExternalLink,
|
|
9
|
+
IconFileInvoice,
|
|
10
|
+
IconLoader2,
|
|
11
|
+
IconQrcode
|
|
12
|
+
} from "@tabler/icons-react";
|
|
13
|
+
import { useTranslations } from "next-intl";
|
|
14
|
+
import { toast } from "sonner";
|
|
15
|
+
import { Button } from "../../../ui/buttons/Button";
|
|
16
|
+
import { CardBrandIcon } from "../../../ui/data-display/CardBrandIcons";
|
|
17
|
+
import { BoletoIcon } from "../../../ui/data-display/PaymentMethodIcons";
|
|
18
|
+
import { Skeleton } from "../../../ui/feedback/Skeleton";
|
|
19
|
+
import { Toast } from "../../../ui/feedback/Toast";
|
|
20
|
+
import { Sheet, SheetContent, SheetFooter, SheetHeader, SheetTitle } from "../../../ui/overlay/Sheet";
|
|
21
|
+
import { useCurrencyFormatter } from "../../../../modules/accounts/hooks/use-currency-formatter.hook";
|
|
22
|
+
import { useNotaFiscal } from "../../../../modules/charges/hooks/nota-fiscal.hook";
|
|
23
|
+
import { getChargeDownloadUrl } from "../../../../modules/charges/utils/get-charge-download-url";
|
|
24
|
+
import { useSubscriptionById } from "../../../../modules/subscriptions/hooks/find-subscription-by-id.hook";
|
|
25
|
+
import { useWhitelabel } from "../../../../providers/whitelabel.provider";
|
|
26
|
+
import useIsMobile from "../../../../hooks/useIsMobile";
|
|
27
|
+
import { cn } from "../../../../infra/utils/clsx";
|
|
28
|
+
import { useSubscriptionFlows } from "../../../../store/useSubscriptionFlows";
|
|
29
|
+
import { ChargeStatusBadge } from "./ChargeStatusBadge";
|
|
30
|
+
import { BoletoDetailsDialog } from "./BoletoDetailsDialog";
|
|
31
|
+
import { PixDetailsDialog } from "./PixDetailsDialog";
|
|
32
|
+
function InfoRow({ label, value }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row gap-1 lg:gap-3 lg:items-center", children: [
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950 lg:w-[160px] shrink-0", children: label }),
|
|
35
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: value })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
function PaymentMethodIcon({
|
|
39
|
+
paymentMethod,
|
|
40
|
+
cardBrand
|
|
41
|
+
}) {
|
|
42
|
+
if (paymentMethod === 1 && cardBrand) {
|
|
43
|
+
return /* @__PURE__ */ jsx(CardBrandIcon, { brand: cardBrand.toLowerCase(), className: "h-[17px] w-auto" });
|
|
44
|
+
}
|
|
45
|
+
if (paymentMethod === 2) return /* @__PURE__ */ jsx(BoletoIcon, { className: "text-zinc-950" });
|
|
46
|
+
if (paymentMethod === 3) return /* @__PURE__ */ jsx(IconQrcode, { size: 20, className: "text-zinc-950" });
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
function ReceiptDetailsSheet() {
|
|
50
|
+
const translate = useTranslations("common.account.workspace.subscription.receipt");
|
|
51
|
+
const isMobile = useIsMobile();
|
|
52
|
+
const { formatCurrencyNumber, currency } = useCurrencyFormatter();
|
|
53
|
+
const { whitelabel } = useWhitelabel();
|
|
54
|
+
const { mutateAsync: fetchNotaFiscal, isPending: isLoadingNotaFiscal } = useNotaFiscal();
|
|
55
|
+
const charge = useSubscriptionFlows((state) => state.receiptCharge);
|
|
56
|
+
const close = useSubscriptionFlows((state) => state.closeReceipt);
|
|
57
|
+
const openPayCharge = useSubscriptionFlows((state) => state.openPayCharge);
|
|
58
|
+
const [boletoDialogOpen, setBoletoDialogOpen] = useState(false);
|
|
59
|
+
const [pixDialogOpen, setPixDialogOpen] = useState(false);
|
|
60
|
+
const { data: subscriptionData, isLoading: isLoadingSubscription } = useSubscriptionById(
|
|
61
|
+
charge?.id_subscription ?? void 0
|
|
62
|
+
);
|
|
63
|
+
if (!charge) return null;
|
|
64
|
+
const isPending = charge.status === 0;
|
|
65
|
+
const isPaid = charge.status === 1;
|
|
66
|
+
const downloadUrl = getChargeDownloadUrl(charge);
|
|
67
|
+
const paymentDetails = charge.payment_details;
|
|
68
|
+
const resolvedPaymentMethod = charge.payment_method ?? (paymentDetails?.type === "card" ? 1 : paymentDetails?.type === "boleto" ? 2 : paymentDetails?.type === "pix" ? 3 : 0);
|
|
69
|
+
const subscription = subscriptionData?.data;
|
|
70
|
+
const subscriptionCard = subscription?.card;
|
|
71
|
+
const paidCardBrand = paymentDetails?.brand;
|
|
72
|
+
const paidCardLast4 = paymentDetails?.last4;
|
|
73
|
+
const currentCardBrand = subscriptionCard?.brand || subscription?.card_brand;
|
|
74
|
+
const currentCardLast4 = subscriptionCard?.last4 || subscription?.card_number?.slice(-4);
|
|
75
|
+
const resolvedCardBrand = isPaid ? paidCardBrand || currentCardBrand : currentCardBrand || paidCardBrand;
|
|
76
|
+
const resolvedCardLast4 = isPaid ? paidCardLast4 || currentCardLast4 : currentCardLast4 || paidCardLast4;
|
|
77
|
+
const isBoleto = resolvedPaymentMethod === 2;
|
|
78
|
+
const isPix = resolvedPaymentMethod === 3;
|
|
79
|
+
const boletoDetails = paymentDetails?.type === "boleto" ? paymentDetails : null;
|
|
80
|
+
const boletoUrl = boletoDetails?.hosted_voucher_url ?? boletoDetails?.pdf ?? charge.gateway_billet ?? charge.invoice_url;
|
|
81
|
+
const canHaveNotaFiscal = isPaid && whitelabel?.id === 1 && currency !== "usd";
|
|
82
|
+
const handleDownloadNotaFiscal = async () => {
|
|
83
|
+
try {
|
|
84
|
+
const result = await fetchNotaFiscal(charge.id);
|
|
85
|
+
const nota = result.notas.find((item) => item.linkPdf) ?? result.notas[0];
|
|
86
|
+
const url = nota?.linkPdf ?? nota?.linkXml ?? null;
|
|
87
|
+
if (!result.emitida || !url) {
|
|
88
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: translate("notaFiscalEmpty"), toastId }));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
92
|
+
} catch (error) {
|
|
93
|
+
const message = error instanceof Error ? error.message : translate("notaFiscalError");
|
|
94
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId }));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const paymentMethodLabel = resolvedPaymentMethod === 1 ? translate("paymentMethodCreditCard") : resolvedPaymentMethod === 2 ? translate("paymentMethodBoleto") : resolvedPaymentMethod === 3 ? translate("paymentMethodPix") : "";
|
|
98
|
+
const paymentMethodBlock = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row gap-1 lg:gap-3 lg:items-center", children: [
|
|
100
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950 lg:w-[160px] shrink-0", children: translate("paymentMethod") }),
|
|
101
|
+
isLoadingSubscription && resolvedPaymentMethod === 1 ? /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-10 rounded" }) : /* @__PURE__ */ jsx(PaymentMethodIcon, { paymentMethod: resolvedPaymentMethod, cardBrand: resolvedCardBrand })
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:pl-[172px]", children: [
|
|
104
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: paymentMethodLabel }),
|
|
105
|
+
resolvedPaymentMethod === 1 && (isLoadingSubscription && !resolvedCardLast4 ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20 rounded" }) : resolvedCardLast4 && /* @__PURE__ */ jsxs("span", { className: "paragraph-small-medium text-zinc-600", children: [
|
|
106
|
+
"\u2022\u2022\u2022\u2022 ",
|
|
107
|
+
resolvedCardLast4
|
|
108
|
+
] }))
|
|
109
|
+
] })
|
|
110
|
+
] });
|
|
111
|
+
return /* @__PURE__ */ jsxs(Sheet, { open: !!charge, onOpenChange: (nextOpen) => !nextOpen && close(), children: [
|
|
112
|
+
/* @__PURE__ */ jsxs(
|
|
113
|
+
SheetContent,
|
|
114
|
+
{
|
|
115
|
+
side: isMobile ? "bottom" : "right",
|
|
116
|
+
className: cn(
|
|
117
|
+
"flex flex-col gap-0 p-0",
|
|
118
|
+
isMobile ? "h-dvh w-full max-w-full rounded-none pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]" : "w-[480px]! sm:max-w-[480px]!"
|
|
119
|
+
),
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsx(SheetHeader, { className: "px-4 sm:px-5 py-3 border-b border-zinc-200", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "paragraph-medium-semibold text-zinc-950", children: [
|
|
122
|
+
"ID ",
|
|
123
|
+
charge.id
|
|
124
|
+
] }) }),
|
|
125
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 sm:gap-6 p-4 sm:p-5 flex-1 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300", children: [
|
|
126
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: translate("generalInfo") }),
|
|
128
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-4 bg-zinc-50 rounded-lg", children: [
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
InfoRow,
|
|
131
|
+
{
|
|
132
|
+
label: translate("chargeLabel"),
|
|
133
|
+
value: charge.line_descriptions?.[0] || charge.title || charge.description || translate("noTitle")
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
charge.description && charge.line_descriptions?.length ? /* @__PURE__ */ jsx(InfoRow, { label: translate("detailsLabel"), value: charge.description }) : null,
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row gap-1 lg:gap-3 lg:items-center", children: [
|
|
138
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950 lg:w-[160px] shrink-0", children: translate("statusLabel") }),
|
|
139
|
+
/* @__PURE__ */ jsx(ChargeStatusBadge, { status: charge.status })
|
|
140
|
+
] })
|
|
141
|
+
] })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
144
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: translate("paymentSection") }),
|
|
145
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-4 bg-zinc-50 rounded-lg", children: [
|
|
146
|
+
/* @__PURE__ */ jsx(InfoRow, { label: translate("totalValue"), value: formatCurrencyNumber(charge.value) }),
|
|
147
|
+
isPaid ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
InfoRow,
|
|
150
|
+
{
|
|
151
|
+
label: translate("paymentDate"),
|
|
152
|
+
value: charge.date_payment ? new Date(charge.date_payment).toLocaleDateString("pt-BR") : void 0
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsx("div", { className: "w-full h-px bg-zinc-200" }),
|
|
156
|
+
paymentMethodBlock
|
|
157
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
InfoRow,
|
|
160
|
+
{
|
|
161
|
+
label: translate("dueDate"),
|
|
162
|
+
value: charge.date_due ? new Date(charge.date_due).toLocaleDateString("pt-BR", { timeZone: "UTC" }) : void 0
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ jsx("div", { className: "w-full h-px bg-zinc-200" }),
|
|
166
|
+
paymentMethodBlock
|
|
167
|
+
] })
|
|
168
|
+
] })
|
|
169
|
+
] })
|
|
170
|
+
] }),
|
|
171
|
+
(isPending || isPaid && (!!downloadUrl || canHaveNotaFiscal)) && /* @__PURE__ */ jsx(SheetFooter, { className: "flex-row gap-2 p-4 sm:p-5 border-t border-zinc-200", children: isPending && isPix ? /* @__PURE__ */ jsxs(Button, { className: "h-10 flex-1", onClick: () => setPixDialogOpen(true), children: [
|
|
172
|
+
/* @__PURE__ */ jsx(IconQrcode, { size: 20 }),
|
|
173
|
+
translate("viewPixCode")
|
|
174
|
+
] }) : isPending && isBoleto ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
175
|
+
boletoUrl && /* @__PURE__ */ jsxs(
|
|
176
|
+
Button,
|
|
177
|
+
{
|
|
178
|
+
className: "h-10 flex-1",
|
|
179
|
+
onClick: () => window.open(boletoUrl, "_blank", "noopener,noreferrer"),
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx(IconExternalLink, { size: 20 }),
|
|
182
|
+
translate("payBoleto")
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ jsxs(
|
|
187
|
+
Button,
|
|
188
|
+
{
|
|
189
|
+
variant: "secondary",
|
|
190
|
+
className: "h-10 flex-1",
|
|
191
|
+
onClick: () => setBoletoDialogOpen(true),
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ jsx(IconBarcode, { size: 20 }),
|
|
194
|
+
translate("viewBoletoDetails")
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] }) : isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
199
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: () => openPayCharge(charge), children: translate("retryPayment") }),
|
|
200
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", className: "h-10 flex-1", onClick: () => openPayCharge(charge), children: [
|
|
201
|
+
/* @__PURE__ */ jsx(IconCreditCard, { size: 20 }),
|
|
202
|
+
translate("changeCard")
|
|
203
|
+
] })
|
|
204
|
+
] }) : canHaveNotaFiscal ? /* @__PURE__ */ jsxs(
|
|
205
|
+
Button,
|
|
206
|
+
{
|
|
207
|
+
className: "w-full lg:w-fit h-10",
|
|
208
|
+
onClick: handleDownloadNotaFiscal,
|
|
209
|
+
disabled: isLoadingNotaFiscal,
|
|
210
|
+
children: [
|
|
211
|
+
isLoadingNotaFiscal ? /* @__PURE__ */ jsx(IconLoader2, { size: 20, className: "animate-spin" }) : /* @__PURE__ */ jsx(IconFileInvoice, { size: 20 }),
|
|
212
|
+
translate("notaFiscal")
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
) : downloadUrl ? /* @__PURE__ */ jsxs(
|
|
216
|
+
Button,
|
|
217
|
+
{
|
|
218
|
+
variant: "secondary",
|
|
219
|
+
className: "w-full lg:w-fit h-10",
|
|
220
|
+
onClick: () => window.open(downloadUrl, "_blank", "noopener,noreferrer"),
|
|
221
|
+
children: [
|
|
222
|
+
translate("downloadReceipt"),
|
|
223
|
+
/* @__PURE__ */ jsx(IconDownload, { size: 20 })
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
) : null })
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ jsx(BoletoDetailsDialog, { open: boletoDialogOpen, charge, onOpenChange: setBoletoDialogOpen }),
|
|
231
|
+
/* @__PURE__ */ jsx(PixDetailsDialog, { open: pixDialogOpen, charge, onOpenChange: setPixDialogOpen })
|
|
232
|
+
] });
|
|
233
|
+
}
|
|
234
|
+
export {
|
|
235
|
+
ReceiptDetailsSheet
|
|
236
|
+
};
|
|
237
|
+
//# sourceMappingURL=ReceiptDetailsSheet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/subscription/ReceiptDetailsSheet.tsx"],"sourcesContent":["'use client';\n\nimport { useState, type ReactNode } from 'react';\nimport {\n IconBarcode,\n IconCreditCard,\n IconDownload,\n IconExternalLink,\n IconFileInvoice,\n IconLoader2,\n IconQrcode,\n} from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { toast } from 'sonner';\nimport { Button } from '../../../ui/buttons/Button';\nimport { CardBrandIcon } from '../../../ui/data-display/CardBrandIcons';\nimport { BoletoIcon } from '../../../ui/data-display/PaymentMethodIcons';\nimport { Skeleton } from '../../../ui/feedback/Skeleton';\nimport { Toast } from '../../../ui/feedback/Toast';\nimport { Sheet, SheetContent, SheetFooter, SheetHeader, SheetTitle } from '../../../ui/overlay/Sheet';\nimport { useCurrencyFormatter } from '../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { useNotaFiscal } from '../../../../modules/charges/hooks/nota-fiscal.hook';\nimport { getChargeDownloadUrl } from '../../../../modules/charges/utils/get-charge-download-url';\nimport type { Charge } from '../../../../modules/charges/types/charge.type';\nimport { useSubscriptionById } from '../../../../modules/subscriptions/hooks/find-subscription-by-id.hook';\nimport { useWhitelabel } from '../../../../providers/whitelabel.provider';\nimport useIsMobile from '../../../../hooks/useIsMobile';\nimport { cn } from '../../../../infra/utils/clsx';\nimport { useSubscriptionFlows } from '../../../../store/useSubscriptionFlows';\nimport { ChargeStatusBadge } from './ChargeStatusBadge';\nimport { BoletoDetailsDialog } from './BoletoDetailsDialog';\nimport { PixDetailsDialog } from './PixDetailsDialog';\n\nfunction InfoRow({ label, value }: { label: string; value: ReactNode }) {\n return (\n <div className=\"flex flex-col lg:flex-row gap-1 lg:gap-3 lg:items-center\">\n <span className=\"paragraph-small-medium text-zinc-950 lg:w-[160px] shrink-0\">{label}</span>\n <span className=\"paragraph-small-regular text-zinc-600\">{value}</span>\n </div>\n );\n}\n\nfunction PaymentMethodIcon({\n paymentMethod,\n cardBrand,\n}: {\n paymentMethod: number;\n cardBrand?: string | null;\n}) {\n if (paymentMethod === 1 && cardBrand) {\n return <CardBrandIcon brand={cardBrand.toLowerCase()} className=\"h-[17px] w-auto\" />;\n }\n if (paymentMethod === 2) return <BoletoIcon className=\"text-zinc-950\" />;\n if (paymentMethod === 3) return <IconQrcode size={20} className=\"text-zinc-950\" />;\n return null;\n}\n\n/** Detalhes de uma cobrança: dados gerais, pagamento e as ações de pagar, boleto, pix e nota. */\nexport function ReceiptDetailsSheet() {\n const translate = useTranslations('common.account.workspace.subscription.receipt');\n const isMobile = useIsMobile();\n const { formatCurrencyNumber, currency } = useCurrencyFormatter();\n const { whitelabel } = useWhitelabel();\n const { mutateAsync: fetchNotaFiscal, isPending: isLoadingNotaFiscal } = useNotaFiscal();\n\n const charge = useSubscriptionFlows((state) => state.receiptCharge);\n const close = useSubscriptionFlows((state) => state.closeReceipt);\n const openPayCharge = useSubscriptionFlows((state) => state.openPayCharge);\n\n const [boletoDialogOpen, setBoletoDialogOpen] = useState(false);\n const [pixDialogOpen, setPixDialogOpen] = useState(false);\n\n const { data: subscriptionData, isLoading: isLoadingSubscription } = useSubscriptionById(\n charge?.id_subscription ?? undefined\n );\n\n if (!charge) return null;\n\n const isPending = charge.status === 0;\n const isPaid = charge.status === 1;\n const downloadUrl = getChargeDownloadUrl(charge);\n\n // Sem `payment_method`, o meio vem do `payment_details` que o gateway devolveu.\n const paymentDetails = charge.payment_details as Record<string, unknown> | null | undefined;\n const resolvedPaymentMethod =\n charge.payment_method ??\n (paymentDetails?.type === 'card'\n ? 1\n : paymentDetails?.type === 'boleto'\n ? 2\n : paymentDetails?.type === 'pix'\n ? 3\n : 0);\n\n const subscription = subscriptionData?.data;\n const subscriptionCard = subscription?.card;\n const paidCardBrand = paymentDetails?.brand as string | undefined;\n const paidCardLast4 = paymentDetails?.last4 as string | undefined;\n const currentCardBrand = subscriptionCard?.brand || subscription?.card_brand;\n const currentCardLast4 = subscriptionCard?.last4 || subscription?.card_number?.slice(-4);\n\n // Paga mostra o cartão que pagou; em aberto mostra o cartão atual da assinatura, que é quem vai pagar.\n const resolvedCardBrand = isPaid ? paidCardBrand || currentCardBrand : currentCardBrand || paidCardBrand;\n const resolvedCardLast4 = isPaid ? paidCardLast4 || currentCardLast4 : currentCardLast4 || paidCardLast4;\n\n const isBoleto = resolvedPaymentMethod === 2;\n const isPix = resolvedPaymentMethod === 3;\n const boletoDetails = paymentDetails?.type === 'boleto' ? paymentDetails : null;\n const boletoUrl =\n (boletoDetails?.hosted_voucher_url as string | null | undefined) ??\n (boletoDetails?.pdf as string | null | undefined) ??\n charge.gateway_billet ??\n charge.invoice_url;\n\n // Nota fiscal só existe na whitelabel principal e em cobrança BRL. Em USD o recibo do gateway já\n // tem valor fiscal lá fora — nesse caso fica o \"Baixar recibo\".\n const canHaveNotaFiscal = isPaid && whitelabel?.id === 1 && currency !== 'usd';\n\n const handleDownloadNotaFiscal = async () => {\n try {\n const result = await fetchNotaFiscal(charge.id);\n const nota = result.notas.find((item) => item.linkPdf) ?? result.notas[0];\n const url = nota?.linkPdf ?? nota?.linkXml ?? null;\n\n if (!result.emitida || !url) {\n toast.custom((toastId) => (\n <Toast variant=\"error\" message={translate('notaFiscalEmpty')} toastId={toastId} />\n ));\n return;\n }\n\n window.open(url, '_blank', 'noopener,noreferrer');\n } catch (error) {\n const message = error instanceof Error ? error.message : translate('notaFiscalError');\n toast.custom((toastId) => <Toast variant=\"error\" message={message} toastId={toastId} />);\n }\n };\n\n const paymentMethodLabel =\n resolvedPaymentMethod === 1\n ? translate('paymentMethodCreditCard')\n : resolvedPaymentMethod === 2\n ? translate('paymentMethodBoleto')\n : resolvedPaymentMethod === 3\n ? translate('paymentMethodPix')\n : '';\n\n const paymentMethodBlock = (\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex flex-col lg:flex-row gap-1 lg:gap-3 lg:items-center\">\n <span className=\"paragraph-small-medium text-zinc-950 lg:w-[160px] shrink-0\">\n {translate('paymentMethod')}\n </span>\n {isLoadingSubscription && resolvedPaymentMethod === 1 ? (\n <Skeleton className=\"h-5 w-10 rounded\" />\n ) : (\n <PaymentMethodIcon paymentMethod={resolvedPaymentMethod} cardBrand={resolvedCardBrand} />\n )}\n </div>\n <div className=\"flex flex-col lg:pl-[172px]\">\n <span className=\"paragraph-small-regular text-zinc-600\">{paymentMethodLabel}</span>\n {resolvedPaymentMethod === 1 &&\n (isLoadingSubscription && !resolvedCardLast4 ? (\n <Skeleton className=\"h-4 w-20 rounded\" />\n ) : (\n resolvedCardLast4 && (\n <span className=\"paragraph-small-medium text-zinc-600\">•••• {resolvedCardLast4}</span>\n )\n ))}\n </div>\n </div>\n );\n\n return (\n <Sheet open={!!charge} onOpenChange={(nextOpen) => !nextOpen && close()}>\n <SheetContent\n side={isMobile ? 'bottom' : 'right'}\n className={cn(\n 'flex flex-col gap-0 p-0',\n isMobile\n ? 'h-dvh w-full max-w-full rounded-none pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]'\n : 'w-[480px]! sm:max-w-[480px]!'\n )}\n >\n <SheetHeader className=\"px-4 sm:px-5 py-3 border-b border-zinc-200\">\n <SheetTitle className=\"paragraph-medium-semibold text-zinc-950\">ID {charge.id}</SheetTitle>\n </SheetHeader>\n\n <div className=\"flex flex-col gap-5 sm:gap-6 p-4 sm:p-5 flex-1 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300\">\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-small-regular text-zinc-600\">{translate('generalInfo')}</span>\n <div className=\"flex flex-col gap-4 p-4 bg-zinc-50 rounded-lg\">\n <InfoRow\n label={translate('chargeLabel')}\n value={\n charge.line_descriptions?.[0] ||\n charge.title ||\n charge.description ||\n translate('noTitle')\n }\n />\n {charge.description && charge.line_descriptions?.length ? (\n <InfoRow label={translate('detailsLabel')} value={charge.description} />\n ) : null}\n <div className=\"flex flex-col lg:flex-row gap-1 lg:gap-3 lg:items-center\">\n <span className=\"paragraph-small-medium text-zinc-950 lg:w-[160px] shrink-0\">\n {translate('statusLabel')}\n </span>\n <ChargeStatusBadge status={charge.status} />\n </div>\n </div>\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-small-regular text-zinc-600\">{translate('paymentSection')}</span>\n <div className=\"flex flex-col gap-4 p-4 bg-zinc-50 rounded-lg\">\n <InfoRow label={translate('totalValue')} value={formatCurrencyNumber(charge.value)} />\n\n {isPaid ? (\n <>\n <InfoRow\n label={translate('paymentDate')}\n value={\n charge.date_payment\n ? new Date(charge.date_payment).toLocaleDateString('pt-BR')\n : undefined\n }\n />\n <div className=\"w-full h-px bg-zinc-200\" />\n {paymentMethodBlock}\n </>\n ) : (\n <>\n <InfoRow\n label={translate('dueDate')}\n value={\n charge.date_due\n ? new Date(charge.date_due).toLocaleDateString('pt-BR', { timeZone: 'UTC' })\n : undefined\n }\n />\n <div className=\"w-full h-px bg-zinc-200\" />\n {paymentMethodBlock}\n </>\n )}\n </div>\n </div>\n </div>\n\n {(isPending || (isPaid && (!!downloadUrl || canHaveNotaFiscal))) && (\n <SheetFooter className=\"flex-row gap-2 p-4 sm:p-5 border-t border-zinc-200\">\n {isPending && isPix ? (\n <Button className=\"h-10 flex-1\" onClick={() => setPixDialogOpen(true)}>\n <IconQrcode size={20} />\n {translate('viewPixCode')}\n </Button>\n ) : isPending && isBoleto ? (\n <>\n {boletoUrl && (\n <Button\n className=\"h-10 flex-1\"\n onClick={() => window.open(boletoUrl, '_blank', 'noopener,noreferrer')}\n >\n <IconExternalLink size={20} />\n {translate('payBoleto')}\n </Button>\n )}\n <Button\n variant=\"secondary\"\n className=\"h-10 flex-1\"\n onClick={() => setBoletoDialogOpen(true)}\n >\n <IconBarcode size={20} />\n {translate('viewBoletoDetails')}\n </Button>\n </>\n ) : isPending ? (\n <>\n <Button className=\"h-10 flex-1\" onClick={() => openPayCharge(charge)}>\n {translate('retryPayment')}\n </Button>\n <Button variant=\"secondary\" className=\"h-10 flex-1\" onClick={() => openPayCharge(charge)}>\n <IconCreditCard size={20} />\n {translate('changeCard')}\n </Button>\n </>\n ) : canHaveNotaFiscal ? (\n <Button\n className=\"w-full lg:w-fit h-10\"\n onClick={handleDownloadNotaFiscal}\n disabled={isLoadingNotaFiscal}\n >\n {isLoadingNotaFiscal ? (\n <IconLoader2 size={20} className=\"animate-spin\" />\n ) : (\n <IconFileInvoice size={20} />\n )}\n {translate('notaFiscal')}\n </Button>\n ) : downloadUrl ? (\n <Button\n variant=\"secondary\"\n className=\"w-full lg:w-fit h-10\"\n onClick={() => window.open(downloadUrl, '_blank', 'noopener,noreferrer')}\n >\n {translate('downloadReceipt')}\n <IconDownload size={20} />\n </Button>\n ) : null}\n </SheetFooter>\n )}\n </SheetContent>\n\n <BoletoDetailsDialog open={boletoDialogOpen} charge={charge} onOpenChange={setBoletoDialogOpen} />\n <PixDetailsDialog open={pixDialogOpen} charge={charge} onOpenChange={setPixDialogOpen} />\n </Sheet>\n );\n}\n"],"mappings":";AAmCI,SAwLY,UAvLV,KADF;AAjCJ,SAAS,gBAAgC;AACzC;AAAA,EACE;AAAA,EAC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