@greatapps/common 1.1.790 → 1.1.791
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/AccountHubLinkHandler.mjs +36 -0
- package/dist/components/account/AccountHubLinkHandler.mjs.map +1 -0
- package/dist/components/account/AccountModalLayout.mjs +137 -0
- package/dist/components/account/AccountModalLayout.mjs.map +1 -0
- package/dist/components/account/AccountModals.mjs +10 -3
- package/dist/components/account/AccountModals.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +1 -1
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +8 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/MyAccountModal.mjs +167 -0
- package/dist/components/account/MyAccountModal.mjs.map +1 -0
- package/dist/components/account/TwoFactorAuthModal.mjs +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/hooks/useAccountHubActions.mjs +85 -0
- package/dist/components/account/hooks/useAccountHubActions.mjs.map +1 -0
- package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs +44 -0
- package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs.map +1 -0
- package/dist/components/account/hooks/useAffiliatesActions.mjs +69 -0
- package/dist/components/account/hooks/useAffiliatesActions.mjs.map +1 -0
- package/dist/components/account/hooks/useMyAccountModal.mjs +27 -0
- package/dist/components/account/hooks/useMyAccountModal.mjs.map +1 -0
- package/dist/components/account/hooks/useProjectsActions.mjs +40 -0
- package/dist/components/account/hooks/useProjectsActions.mjs.map +1 -0
- package/dist/components/account/hooks/useSubscriptionActions.mjs +87 -0
- package/dist/components/account/hooks/useSubscriptionActions.mjs.map +1 -0
- package/dist/components/account/hooks/useTeamActions.mjs +31 -0
- package/dist/components/account/hooks/useTeamActions.mjs.map +1 -0
- package/dist/components/account/sections/AffiliatesSection.mjs +313 -0
- package/dist/components/account/sections/AffiliatesSection.mjs.map +1 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs +5 -5
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +194 -144
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +60 -49
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/ProjectsSection.mjs +77 -0
- package/dist/components/account/sections/ProjectsSection.mjs.map +1 -0
- package/dist/components/account/sections/SecuritySection.mjs +55 -36
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/account/sections/SubscriptionSection.mjs +29 -0
- package/dist/components/account/sections/SubscriptionSection.mjs.map +1 -0
- package/dist/components/account/sections/TeamSection.mjs +119 -0
- package/dist/components/account/sections/TeamSection.mjs.map +1 -0
- package/dist/components/account/sections/TokenSection.mjs +41 -43
- package/dist/components/account/sections/TokenSection.mjs.map +1 -1
- package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs +73 -0
- package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateFlows.mjs +20 -0
- package/dist/components/account/sections/affiliates/AffiliateFlows.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs +99 -0
- package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs +31 -0
- package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs +15 -0
- package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs +108 -0
- package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs +49 -0
- package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs +182 -0
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs +476 -0
- package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs +34 -0
- package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs +27 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs +30 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs +120 -0
- package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs.map +1 -0
- package/dist/components/account/sections/projects/DeleteProjectModal.mjs +205 -0
- package/dist/components/account/sections/projects/DeleteProjectModal.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectFlows.mjs +16 -0
- package/dist/components/account/sections/projects/ProjectFlows.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectMembersStack.mjs +53 -0
- package/dist/components/account/sections/projects/ProjectMembersStack.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectRow.mjs +85 -0
- package/dist/components/account/sections/projects/ProjectRow.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectSheet.mjs +499 -0
- package/dist/components/account/sections/projects/ProjectSheet.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs +55 -0
- package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs.map +1 -0
- package/dist/components/account/sections/projects/project-form.schema.mjs +28 -0
- package/dist/components/account/sections/projects/project-form.schema.mjs.map +1 -0
- package/dist/components/account/sections/shared/ConnectListRow.mjs +45 -0
- package/dist/components/account/sections/shared/ConnectListRow.mjs.map +1 -0
- package/dist/components/account/sections/shared/DateFilterPopover.mjs +51 -0
- package/dist/components/account/sections/shared/DateFilterPopover.mjs.map +1 -0
- package/dist/components/account/sections/shared/EntityAvatar.mjs +41 -0
- package/dist/components/account/sections/shared/EntityAvatar.mjs.map +1 -0
- package/dist/components/account/sections/shared/FilterPopover.mjs +62 -0
- package/dist/components/account/sections/shared/FilterPopover.mjs.map +1 -0
- package/dist/components/account/sections/shared/FormSection.mjs +14 -0
- package/dist/components/account/sections/shared/FormSection.mjs.map +1 -0
- package/dist/components/account/sections/shared/IconBox.mjs +18 -0
- package/dist/components/account/sections/shared/IconBox.mjs.map +1 -0
- package/dist/components/account/sections/shared/InfiniteScrollList.mjs +36 -0
- package/dist/components/account/sections/shared/InfiniteScrollList.mjs.map +1 -0
- package/dist/components/account/sections/shared/ListPagination.mjs +69 -0
- package/dist/components/account/sections/shared/ListPagination.mjs.map +1 -0
- package/dist/components/account/sections/shared/RowActionsMenu.mjs +52 -0
- package/dist/components/account/sections/shared/RowActionsMenu.mjs.map +1 -0
- package/dist/components/account/sections/shared/SectionLoadError.mjs +20 -0
- package/dist/components/account/sections/shared/SectionLoadError.mjs.map +1 -0
- package/dist/components/account/sections/shared/StatusBadge.mjs +26 -0
- package/dist/components/account/sections/shared/StatusBadge.mjs.map +1 -0
- package/dist/components/account/sections/shared/WorkspaceSection.mjs +10 -0
- package/dist/components/account/sections/shared/WorkspaceSection.mjs.map +1 -0
- package/dist/components/account/sections/subscription/AiCreditsUsage.mjs +106 -0
- package/dist/components/account/sections/subscription/AiCreditsUsage.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BillingAddressSheet.mjs +407 -0
- package/dist/components/account/sections/subscription/BillingAddressSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs +73 -0
- package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs +22 -0
- package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/CancelPlanDialog.mjs +161 -0
- package/dist/components/account/sections/subscription/CancelPlanDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargeRow.mjs +127 -0
- package/dist/components/account/sections/subscription/ChargeRow.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs +27 -0
- package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargesList.mjs +88 -0
- package/dist/components/account/sections/subscription/ChargesList.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ManageCardsSheet.mjs +49 -0
- package/dist/components/account/sections/subscription/ManageCardsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs +26 -0
- package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PayChargeDialog.mjs +222 -0
- package/dist/components/account/sections/subscription/PayChargeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs +61 -0
- package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs +72 -0
- package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PendingChangeDialog.mjs +117 -0
- package/dist/components/account/sections/subscription/PendingChangeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PixDetailsDialog.mjs +165 -0
- package/dist/components/account/sections/subscription/PixDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PixPaymentDialog.mjs +155 -0
- package/dist/components/account/sections/subscription/PixPaymentDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs +253 -0
- package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs +237 -0
- package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/SubscriptionFlows.mjs +40 -0
- package/dist/components/account/sections/subscription/SubscriptionFlows.mjs.map +1 -0
- package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs +303 -0
- package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/UsageReportSheet.mjs +163 -0
- package/dist/components/account/sections/subscription/UsageReportSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs +75 -0
- package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs +55 -0
- package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs +188 -0
- package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs +66 -0
- package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs +42 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs +119 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs +17 -0
- package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs +130 -0
- package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs +38 -0
- package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs +127 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs +111 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs +69 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs +88 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs +115 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs +918 -0
- package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs.map +1 -0
- package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs +216 -0
- package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs +128 -0
- package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlanCard.mjs +281 -0
- package/dist/components/account/sections/subscription/plans/PlanCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs +53 -0
- package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs +119 -0
- package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs.map +1 -0
- package/dist/components/account/sections/team/DeleteUserModal.mjs +116 -0
- package/dist/components/account/sections/team/DeleteUserModal.mjs.map +1 -0
- package/dist/components/account/sections/team/TeamFlows.mjs +14 -0
- package/dist/components/account/sections/team/TeamFlows.mjs.map +1 -0
- package/dist/components/account/sections/team/TeamMemberRow.mjs +99 -0
- package/dist/components/account/sections/team/TeamMemberRow.mjs.map +1 -0
- package/dist/components/account/sections/team/UserSheet.mjs +570 -0
- package/dist/components/account/sections/team/UserSheet.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/NotificationsStep.mjs +80 -0
- package/dist/components/account/sections/team/steps/NotificationsStep.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs +180 -0
- package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/UserInformationStep.mjs +371 -0
- package/dist/components/account/sections/team/steps/UserInformationStep.mjs.map +1 -0
- package/dist/components/account/sections/team/user-form.schema.mjs +37 -0
- package/dist/components/account/sections/team/user-form.schema.mjs.map +1 -0
- package/dist/components/account/types/workspace-actions.type.mjs +1 -0
- package/dist/components/account/types/workspace-actions.type.mjs.map +1 -0
- package/dist/components/layouts/ProfilePopover.mjs +10 -12
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +7 -4
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/AccountDeletionWarningModal.mjs +4 -5
- package/dist/components/modals/AccountDeletionWarningModal.mjs.map +1 -1
- package/dist/components/modals/AccountFrozenModal.mjs +6 -3
- package/dist/components/modals/AccountFrozenModal.mjs.map +1 -1
- package/dist/components/modals/Modals.mjs +3 -3
- package/dist/components/modals/Modals.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +4 -5
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddFirstCardWarningModal.mjs +63 -0
- package/dist/components/modals/cards/AddFirstCardWarningModal.mjs.map +1 -0
- package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs +187 -0
- package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs.map +1 -0
- package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs +5 -4
- package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +9 -1
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentMethodIcons.mjs +50 -0
- package/dist/components/ui/data-display/PaymentMethodIcons.mjs.map +1 -0
- package/dist/components/ui/form/BillingPeriodSelector.mjs +108 -0
- package/dist/components/ui/form/BillingPeriodSelector.mjs.map +1 -0
- package/dist/components/ui/form/PaymentMethodToggle.mjs +82 -0
- package/dist/components/ui/form/PaymentMethodToggle.mjs.map +1 -0
- package/dist/components/ui/form/RadioOptionFieldIcon.mjs +57 -0
- package/dist/components/ui/form/RadioOptionFieldIcon.mjs.map +1 -0
- package/dist/components/ui/form/SegmentedControl.mjs +56 -0
- package/dist/components/ui/form/SegmentedControl.mjs.map +1 -0
- package/dist/components/ui/overlay/Dialog.mjs +21 -4
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -1
- package/dist/components/ui/overlay/Sheet.mjs +26 -8
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
- package/dist/components/ui/overlay/layers.mjs +52 -5
- package/dist/components/ui/overlay/layers.mjs.map +1 -1
- package/dist/enums/AccountHubFlow.mjs +13 -0
- package/dist/enums/AccountHubFlow.mjs.map +1 -0
- package/dist/enums/DateFilterPeriod.mjs +22 -0
- package/dist/enums/DateFilterPeriod.mjs.map +1 -0
- package/dist/enums/WorkspaceSectionType.mjs +11 -0
- package/dist/enums/WorkspaceSectionType.mjs.map +1 -0
- package/dist/handlers.mjs +24 -0
- package/dist/handlers.mjs.map +1 -1
- package/dist/hooks/useDebounce.mjs +5 -3
- package/dist/hooks/useDebounce.mjs.map +1 -1
- package/dist/hooks/useUploadProgress.mjs +33 -0
- package/dist/hooks/useUploadProgress.mjs.map +1 -0
- package/dist/i18n/messages/en-us.mjs +863 -3
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +863 -3
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +863 -3
- package/dist/i18n/messages/pt-br.mjs.map +1 -1
- package/dist/index.mjs +87 -7
- package/dist/index.mjs.map +1 -1
- package/dist/infra/http/paged.mjs +20 -0
- package/dist/infra/http/paged.mjs.map +1 -0
- package/dist/middleware.mjs +2 -0
- package/dist/middleware.mjs.map +1 -1
- package/dist/middlewares/create-auth-middleware.mjs +1 -3
- package/dist/middlewares/create-auth-middleware.mjs.map +1 -1
- package/dist/middlewares/create-legacy-account-routes-middleware.mjs +44 -0
- package/dist/middlewares/create-legacy-account-routes-middleware.mjs.map +1 -0
- package/dist/middlewares/is-route-equals.mjs +7 -0
- package/dist/middlewares/is-route-equals.mjs.map +1 -0
- package/dist/modules/accounts/actions/account-management.action.mjs +20 -1
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -1
- package/dist/modules/accounts/constants/account-hub-link.constants.mjs +9 -0
- package/dist/modules/accounts/constants/account-hub-link.constants.mjs.map +1 -0
- package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs +5 -0
- package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs.map +1 -0
- package/dist/modules/accounts/handlers/list-account-members.handler.mjs +22 -0
- package/dist/modules/accounts/handlers/list-account-members.handler.mjs.map +1 -0
- package/dist/modules/accounts/hooks/add-user-projects.hook.mjs +51 -0
- package/dist/modules/accounts/hooks/add-user-projects.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/create-account-user.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/create-account-user.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs +47 -0
- package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/use-account-members.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/use-account-members.hook.mjs.map +1 -0
- package/dist/modules/accounts/services/account.service.mjs +59 -0
- package/dist/modules/accounts/services/account.service.mjs.map +1 -1
- package/dist/modules/accounts/types/account-hub-link.type.mjs +1 -0
- package/dist/modules/accounts/types/account-hub-link.type.mjs.map +1 -0
- package/dist/modules/accounts/utils/build-account-hub-url.mjs +16 -0
- package/dist/modules/accounts/utils/build-account-hub-url.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-account-hub-flow.mjs +9 -0
- package/dist/modules/accounts/utils/is-account-hub-flow.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-account-section.mjs +9 -0
- package/dist/modules/accounts/utils/is-account-section.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-my-account-section.mjs +13 -0
- package/dist/modules/accounts/utils/is-my-account-section.mjs.map +1 -0
- package/dist/modules/accounts/utils/map-legacy-account-route.mjs +93 -0
- package/dist/modules/accounts/utils/map-legacy-account-route.mjs.map +1 -0
- package/dist/modules/accounts/utils/parse-account-hub-link.mjs +20 -0
- package/dist/modules/accounts/utils/parse-account-hub-link.mjs.map +1 -0
- package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs +10 -0
- package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs.map +1 -0
- package/dist/modules/affiliates/actions/request-deposit.action.mjs +10 -0
- package/dist/modules/affiliates/actions/request-deposit.action.mjs.map +1 -0
- package/dist/modules/affiliates/actions/update-affiliate.action.mjs +10 -0
- package/dist/modules/affiliates/actions/update-affiliate.action.mjs.map +1 -0
- package/dist/modules/affiliates/constants/affiliate.constants.mjs +11 -0
- package/dist/modules/affiliates/constants/affiliate.constants.mjs.map +1 -0
- package/dist/modules/affiliates/constants/query-keys.constants.mjs +15 -0
- package/dist/modules/affiliates/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs +16 -0
- package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs +22 -0
- package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs +22 -0
- package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs +22 -0
- package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs +20 -0
- package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs +23 -0
- package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs +28 -0
- package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs +22 -0
- package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs.map +1 -0
- package/dist/modules/affiliates/services/affiliates.service.mjs +183 -0
- package/dist/modules/affiliates/services/affiliates.service.mjs.map +1 -0
- package/dist/modules/affiliates/types/affiliate.type.mjs +100 -0
- package/dist/modules/affiliates/types/affiliate.type.mjs.map +1 -0
- package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs +9 -0
- package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs.map +1 -0
- package/dist/modules/charges/actions/get-nota-fiscal.action.mjs +10 -0
- package/dist/modules/charges/actions/get-nota-fiscal.action.mjs.map +1 -0
- package/dist/modules/charges/actions/refresh-pix.action.mjs +10 -0
- package/dist/modules/charges/actions/refresh-pix.action.mjs.map +1 -0
- package/dist/modules/charges/hooks/nota-fiscal.hook.mjs +13 -0
- package/dist/modules/charges/hooks/nota-fiscal.hook.mjs.map +1 -0
- package/dist/modules/charges/hooks/refresh-pix.hook.mjs +13 -0
- package/dist/modules/charges/hooks/refresh-pix.hook.mjs.map +1 -0
- package/dist/modules/charges/services/charges.service.mjs +67 -0
- package/dist/modules/charges/services/charges.service.mjs.map +1 -1
- package/dist/modules/charges/types/nota-fiscal.type.mjs +1 -0
- package/dist/modules/charges/types/nota-fiscal.type.mjs.map +1 -0
- package/dist/modules/charges/types/refresh-pix.type.mjs +1 -0
- package/dist/modules/charges/types/refresh-pix.type.mjs.map +1 -0
- package/dist/modules/charges/utils/get-charge-download-url.mjs +8 -0
- package/dist/modules/charges/utils/get-charge-download-url.mjs.map +1 -0
- package/dist/modules/coupons/constants/query-keys.constants.mjs +5 -0
- package/dist/modules/coupons/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs +17 -0
- package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs.map +1 -0
- package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs +16 -0
- package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs.map +1 -0
- package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs +15 -0
- package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs.map +1 -0
- package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs +18 -0
- package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs.map +1 -0
- package/dist/modules/coupons/services/coupons.service.mjs +44 -0
- package/dist/modules/coupons/services/coupons.service.mjs.map +1 -0
- package/dist/modules/coupons/types/coupon.type.mjs +61 -0
- package/dist/modules/coupons/types/coupon.type.mjs.map +1 -0
- package/dist/modules/coupons/utils/coupon-restrictions.mjs +60 -0
- package/dist/modules/coupons/utils/coupon-restrictions.mjs.map +1 -0
- package/dist/modules/domains/handlers/count-domains.handler.mjs +12 -0
- package/dist/modules/domains/handlers/count-domains.handler.mjs.map +1 -0
- package/dist/modules/domains/hooks/count-domains.hook.mjs +17 -0
- package/dist/modules/domains/hooks/count-domains.hook.mjs.map +1 -0
- package/dist/modules/domains/services/domains.service.mjs +18 -0
- package/dist/modules/domains/services/domains.service.mjs.map +1 -0
- package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs +15 -0
- package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs.map +1 -0
- package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs +28 -0
- package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs.map +1 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs +23 -2
- package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -1
- package/dist/modules/pages/handlers/count-pages.handler.mjs +4 -2
- package/dist/modules/pages/handlers/count-pages.handler.mjs.map +1 -1
- package/dist/modules/pages/hooks/count-published-pages.hook.mjs +26 -0
- package/dist/modules/pages/hooks/count-published-pages.hook.mjs.map +1 -0
- package/dist/modules/pages/services/pages.service.mjs +3 -2
- package/dist/modules/pages/services/pages.service.mjs.map +1 -1
- package/dist/modules/plans/constants/plan-tooltips.constants.mjs +14 -0
- package/dist/modules/plans/constants/plan-tooltips.constants.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs +28 -0
- package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-ui-plans.hook.mjs +20 -0
- package/dist/modules/plans/hooks/use-ui-plans.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/add-project-users.hook.mjs +25 -0
- package/dist/modules/projects/hooks/add-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/remove-project-users.hook.mjs +25 -0
- package/dist/modules/projects/hooks/remove-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/services/project-users.service.mjs +5 -0
- package/dist/modules/projects/services/project-users.service.mjs.map +1 -1
- package/dist/modules/projects/types.mjs +3 -2
- package/dist/modules/projects/types.mjs.map +1 -1
- package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/create-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/create-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs +35 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/constants/downgrade.constants.mjs +25 -0
- package/dist/modules/subscriptions/constants/downgrade.constants.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/subscription.constants.mjs +2 -0
- package/dist/modules/subscriptions/constants/subscription.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs +15 -0
- package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs +25 -0
- package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs +33 -0
- package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs +18 -0
- package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs +25 -0
- package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs +71 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -1
- package/dist/modules/subscriptions/types/cancel-subscription.type.mjs +9 -0
- package/dist/modules/subscriptions/types/cancel-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/create-subscription.type.mjs +62 -0
- package/dist/modules/subscriptions/types/create-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/pending-pix-status.type.mjs +28 -0
- package/dist/modules/subscriptions/types/pending-pix-status.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/subscription.type.mjs +9 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/addon-buckets.mjs +69 -0
- package/dist/modules/subscriptions/utils/addon-buckets.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs +8 -2
- package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/first-period-pricing.mjs +25 -0
- package/dist/modules/subscriptions/utils/first-period-pricing.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-api-subscription.mjs +8 -0
- package/dist/modules/subscriptions/utils/is-api-subscription.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-boleto-payer.mjs +17 -0
- package/dist/modules/subscriptions/utils/is-boleto-payer.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-free-subscription.mjs +8 -0
- package/dist/modules/subscriptions/utils/is-free-subscription.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/periodicity.mjs +55 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs +27 -0
- package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs.map +1 -0
- package/dist/modules/users/hooks/messages.hook.mjs +3 -5
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
- package/dist/server.mjs +6 -0
- package/dist/server.mjs.map +1 -1
- package/dist/store/useAccountModals.mjs +9 -2
- package/dist/store/useAccountModals.mjs.map +1 -1
- package/dist/store/useAffiliateFlows.mjs +23 -0
- package/dist/store/useAffiliateFlows.mjs.map +1 -0
- package/dist/store/useProjectFlows.mjs +18 -0
- package/dist/store/useProjectFlows.mjs.map +1 -0
- package/dist/store/useSubscriptionFlows.mjs +58 -0
- package/dist/store/useSubscriptionFlows.mjs.map +1 -0
- package/dist/store/useTeamFlows.mjs +15 -0
- package/dist/store/useTeamFlows.mjs.map +1 -0
- package/dist/testing/factories/coupon.factory.mjs +19 -0
- package/dist/testing/factories/coupon.factory.mjs.map +1 -0
- package/dist/testing/factories/index.mjs +6 -0
- package/dist/testing/factories/index.mjs.map +1 -1
- package/dist/testing/factories/project-user.factory.mjs +17 -0
- package/dist/testing/factories/project-user.factory.mjs.map +1 -0
- package/dist/testing/factories/project.factory.mjs +21 -0
- package/dist/testing/factories/project.factory.mjs.map +1 -0
- package/dist/testing/react/providers.mjs +1 -1
- package/dist/testing/react/providers.mjs.map +1 -1
- package/dist/utils/browser/chart-custom-tooltip.mjs +69 -0
- package/dist/utils/browser/chart-custom-tooltip.mjs.map +1 -0
- package/dist/utils/browser/get-css-variable.mjs +9 -0
- package/dist/utils/browser/get-css-variable.mjs.map +1 -0
- package/dist/utils/constants/scrollbar.mjs +5 -0
- package/dist/utils/constants/scrollbar.mjs.map +1 -0
- package/dist/utils/date-filter-period.mjs +34 -0
- package/dist/utils/date-filter-period.mjs.map +1 -0
- package/dist/utils/file/index.mjs +11 -1
- package/dist/utils/file/index.mjs.map +1 -1
- package/dist/utils/format/initials.mjs +8 -0
- package/dist/utils/format/initials.mjs.map +1 -0
- package/dist/utils/format/masks.mjs +32 -1
- package/dist/utils/format/masks.mjs.map +1 -1
- package/dist/utils/qrcode/to-data-url.mjs +12 -0
- package/dist/utils/qrcode/to-data-url.mjs.map +1 -0
- package/dist/utils/validators/account.mjs +1 -7
- package/dist/utils/validators/account.mjs.map +1 -1
- package/package.json +15 -2
- package/src/components/account/AccountHubLinkHandler.tsx +39 -0
- package/src/components/account/AccountModalLayout.tsx +190 -0
- package/src/components/account/AccountModals.tsx +12 -2
- package/src/components/account/DeleteAccountModal.tsx +1 -1
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +9 -1
- package/src/components/account/MyAccountModal.tsx +215 -0
- package/src/components/account/TwoFactorAuthModal.tsx +1 -1
- package/src/components/account/hooks/useAccountHubActions.ts +95 -0
- package/src/components/account/hooks/useAddCardWithPaymentSwitch.ts +70 -0
- package/src/components/account/hooks/useAffiliatesActions.tsx +78 -0
- package/src/components/account/hooks/useMyAccountModal.ts +40 -0
- package/src/components/account/hooks/useProjectsActions.ts +44 -0
- package/src/components/account/hooks/useSubscriptionActions.ts +99 -0
- package/src/components/account/hooks/useTeamActions.ts +35 -0
- package/src/components/account/sections/AffiliatesSection.tsx +342 -0
- package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
- package/src/components/account/sections/MyProfileSection.tsx +207 -143
- package/src/components/account/sections/PreferencesSection.tsx +55 -51
- package/src/components/account/sections/ProjectsSection.tsx +110 -0
- package/src/components/account/sections/SecuritySection.tsx +72 -62
- package/src/components/account/sections/SubscriptionSection.tsx +36 -0
- package/src/components/account/sections/TeamSection.tsx +161 -0
- package/src/components/account/sections/TokenSection.tsx +4 -8
- package/src/components/account/sections/affiliates/AffiliateCommissionCard.tsx +83 -0
- package/src/components/account/sections/affiliates/AffiliateFlows.tsx +20 -0
- package/src/components/account/sections/affiliates/AffiliateLeadsSheet.tsx +143 -0
- package/src/components/account/sections/affiliates/AffiliateStatsCard.tsx +56 -0
- package/src/components/account/sections/affiliates/AffiliateStepCard.tsx +20 -0
- package/src/components/account/sections/affiliates/AffiliateTransactionsList.tsx +194 -0
- package/src/components/account/sections/affiliates/NoReceivingAccountModal.tsx +63 -0
- package/src/components/account/sections/affiliates/ReceivingAccountModal.tsx +213 -0
- package/src/components/account/sections/affiliates/RequestWithdrawalSheet.tsx +586 -0
- package/src/components/account/sections/affiliates/ViewAttachmentModal.tsx +47 -0
- package/src/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.tsx +45 -0
- package/src/components/account/sections/affiliates/reports/AffiliatesReportsTab.tsx +44 -0
- package/src/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.ts +148 -0
- package/src/components/account/sections/projects/DeleteProjectModal.tsx +246 -0
- package/src/components/account/sections/projects/ProjectFlows.tsx +16 -0
- package/src/components/account/sections/projects/ProjectMembersStack.tsx +75 -0
- package/src/components/account/sections/projects/ProjectRow.tsx +96 -0
- package/src/components/account/sections/projects/ProjectSheet.tsx +603 -0
- package/src/components/account/sections/projects/ProjectsDisabledModal.tsx +69 -0
- package/src/components/account/sections/projects/project-form.schema.ts +30 -0
- package/src/components/account/sections/shared/ConnectListRow.tsx +68 -0
- package/src/components/account/sections/shared/DateFilterPopover.tsx +58 -0
- package/src/components/account/sections/shared/EntityAvatar.tsx +54 -0
- package/src/components/account/sections/shared/FilterPopover.tsx +79 -0
- package/src/components/account/sections/shared/FormSection.tsx +23 -0
- package/src/components/account/sections/shared/IconBox.tsx +21 -0
- package/src/components/account/sections/shared/InfiniteScrollList.tsx +57 -0
- package/src/components/account/sections/shared/ListPagination.tsx +84 -0
- package/src/components/account/sections/shared/RowActionsMenu.tsx +66 -0
- package/src/components/account/sections/shared/SectionLoadError.tsx +27 -0
- package/src/components/account/sections/shared/StatusBadge.tsx +33 -0
- package/src/components/account/sections/shared/WorkspaceSection.tsx +22 -0
- package/src/components/account/sections/subscription/AiCreditsUsage.tsx +152 -0
- package/src/components/account/sections/subscription/BillingAddressSheet.tsx +460 -0
- package/src/components/account/sections/subscription/BoletoDetailsDialog.tsx +104 -0
- package/src/components/account/sections/subscription/BoletoGeneratedDialog.tsx +24 -0
- package/src/components/account/sections/subscription/CancelPlanDialog.tsx +221 -0
- package/src/components/account/sections/subscription/ChargeRow.tsx +161 -0
- package/src/components/account/sections/subscription/ChargeStatusBadge.tsx +29 -0
- package/src/components/account/sections/subscription/ChargesList.tsx +125 -0
- package/src/components/account/sections/subscription/ManageCardsSheet.tsx +93 -0
- package/src/components/account/sections/subscription/OverdueReceiptOpener.tsx +29 -0
- package/src/components/account/sections/subscription/PayChargeDialog.tsx +306 -0
- package/src/components/account/sections/subscription/PaymentConfirmationDialog.tsx +70 -0
- package/src/components/account/sections/subscription/PaymentMethodsCard.tsx +117 -0
- package/src/components/account/sections/subscription/PendingChangeDialog.tsx +168 -0
- package/src/components/account/sections/subscription/PixDetailsDialog.tsx +246 -0
- package/src/components/account/sections/subscription/PixPaymentDialog.tsx +242 -0
- package/src/components/account/sections/subscription/PlanDetailsSheet.tsx +380 -0
- package/src/components/account/sections/subscription/ReceiptDetailsSheet.tsx +318 -0
- package/src/components/account/sections/subscription/SubscriptionFlows.tsx +40 -0
- package/src/components/account/sections/subscription/SubscriptionPlanCard.tsx +433 -0
- package/src/components/account/sections/subscription/UsageReportSheet.tsx +244 -0
- package/src/components/account/sections/subscription/change-plan/ChangePlanSheet.tsx +95 -0
- package/src/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.tsx +57 -0
- package/src/components/account/sections/subscription/change-plan/components/AddonsBlock.tsx +214 -0
- package/src/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.tsx +92 -0
- package/src/components/account/sections/subscription/change-plan/components/CouponBlock.tsx +42 -0
- package/src/components/account/sections/subscription/change-plan/components/CouponDialog.tsx +134 -0
- package/src/components/account/sections/subscription/change-plan/components/PricePreview.tsx +28 -0
- package/src/components/account/sections/subscription/change-plan/components/SummaryBlock.tsx +194 -0
- package/src/components/account/sections/subscription/change-plan/plan-comparison.ts +52 -0
- package/src/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.tsx +161 -0
- package/src/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.tsx +165 -0
- package/src/components/account/sections/subscription/change-plan/steps/PlanViewStep.tsx +89 -0
- package/src/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.tsx +117 -0
- package/src/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.tsx +139 -0
- package/src/components/account/sections/subscription/change-plan/useChangePlanState.tsx +1158 -0
- package/src/components/account/sections/subscription/downgrade/CannotDowngradeDialog.tsx +297 -0
- package/src/components/account/sections/subscription/downgrade/DowngradeReasonDialog.tsx +154 -0
- package/src/components/account/sections/subscription/plans/PlanCard.tsx +417 -0
- package/src/components/account/sections/subscription/plans/PlanCardSkeleton.tsx +70 -0
- package/src/components/account/sections/subscription/plans/PlansCatalogDialog.tsx +156 -0
- package/src/components/account/sections/team/DeleteUserModal.tsx +134 -0
- package/src/components/account/sections/team/TeamFlows.tsx +14 -0
- package/src/components/account/sections/team/TeamMemberRow.tsx +151 -0
- package/src/components/account/sections/team/UserSheet.tsx +688 -0
- package/src/components/account/sections/team/steps/NotificationsStep.tsx +109 -0
- package/src/components/account/sections/team/steps/ProjectSelectionStep.tsx +219 -0
- package/src/components/account/sections/team/steps/UserInformationStep.tsx +423 -0
- package/src/components/account/sections/team/user-form.schema.ts +43 -0
- package/src/components/account/types/workspace-actions.type.ts +56 -0
- package/src/components/layouts/ProfilePopover.tsx +11 -12
- package/src/components/layouts/UsersSelectorPopover.tsx +7 -4
- package/src/components/modals/AccountDeletionWarningModal.tsx +4 -5
- package/src/components/modals/AccountFrozenModal.tsx +6 -3
- package/src/components/modals/Modals.tsx +6 -3
- package/src/components/modals/PaidPlanRequiredModal.tsx +4 -5
- package/src/components/modals/cards/AddFirstCardWarningModal.tsx +72 -0
- package/src/components/modals/cards/SwitchPaymentToCardModal.tsx +232 -0
- package/src/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.tsx +5 -4
- package/src/components/ui/data-display/CardItem.tsx +9 -5
- package/src/components/ui/data-display/PaymentMethodIcons.tsx +43 -0
- package/src/components/ui/form/BillingPeriodSelector.tsx +173 -0
- package/src/components/ui/form/PaymentMethodToggle.tsx +119 -0
- package/src/components/ui/form/RadioOptionFieldIcon.tsx +64 -0
- package/src/components/ui/form/SegmentedControl.tsx +77 -0
- package/src/components/ui/overlay/Dialog.tsx +21 -2
- package/src/components/ui/overlay/Sheet.tsx +26 -5
- package/src/components/ui/overlay/layers.tsx +88 -4
- package/src/enums/AccountHubFlow.ts +8 -0
- package/src/enums/DateFilterPeriod.ts +17 -0
- package/src/enums/WorkspaceSectionType.ts +6 -0
- package/src/handlers.ts +14 -0
- package/src/hooks/useDebounce.ts +5 -3
- package/src/hooks/useUploadProgress.ts +42 -0
- package/src/i18n/messages/en-us.ts +904 -2
- package/src/i18n/messages/es-es.ts +908 -2
- package/src/i18n/messages/pt-br.ts +908 -2
- package/src/index.ts +56 -1
- package/src/infra/http/paged.ts +24 -0
- package/src/middleware.ts +1 -0
- package/src/middlewares/create-auth-middleware.ts +1 -4
- package/src/middlewares/create-legacy-account-routes-middleware.ts +54 -0
- package/src/middlewares/is-route-equals.ts +3 -0
- package/src/modules/accounts/actions/account-management.action.ts +22 -1
- package/src/modules/accounts/constants/account-hub-link.constants.ts +3 -0
- package/src/modules/accounts/constants/legacy-account-routes.constants.ts +1 -0
- package/src/modules/accounts/handlers/list-account-members.handler.ts +23 -0
- package/src/modules/accounts/hooks/add-user-projects.hook.ts +72 -0
- package/src/modules/accounts/hooks/create-account-user.hook.ts +21 -0
- package/src/modules/accounts/hooks/remove-user-projects.hook.ts +68 -0
- package/src/modules/accounts/hooks/use-account-members.hook.ts +31 -0
- package/src/modules/accounts/services/account.service.ts +71 -0
- package/src/modules/accounts/types/account-hub-link.type.ts +13 -0
- package/src/modules/accounts/types.ts +9 -0
- package/src/modules/accounts/utils/build-account-hub-url.ts +14 -0
- package/src/modules/accounts/utils/is-account-hub-flow.ts +7 -0
- package/src/modules/accounts/utils/is-account-section.ts +7 -0
- package/src/modules/accounts/utils/is-my-account-section.ts +12 -0
- package/src/modules/accounts/utils/map-legacy-account-route.ts +108 -0
- package/src/modules/accounts/utils/parse-account-hub-link.ts +21 -0
- package/src/modules/affiliates/actions/ensure-affiliate.action.ts +9 -0
- package/src/modules/affiliates/actions/request-deposit.action.ts +9 -0
- package/src/modules/affiliates/actions/update-affiliate.action.ts +9 -0
- package/src/modules/affiliates/constants/affiliate.constants.ts +11 -0
- package/src/modules/affiliates/constants/query-keys.constants.ts +7 -0
- package/src/modules/affiliates/handlers/affiliate-report-analytics.handler.ts +16 -0
- package/src/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.ts +10 -0
- package/src/modules/affiliates/handlers/current-affiliate.handler.ts +10 -0
- package/src/modules/affiliates/handlers/list-affiliate-coupons.handler.ts +10 -0
- package/src/modules/affiliates/handlers/list-affiliate-leads.handler.ts +23 -0
- package/src/modules/affiliates/handlers/list-affiliate-transactions.handler.ts +23 -0
- package/src/modules/affiliates/hooks/use-affiliate-coupons.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-affiliate-leads.hook.ts +27 -0
- package/src/modules/affiliates/hooks/use-affiliate-report-analytics.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-affiliate-transactions.hook.ts +25 -0
- package/src/modules/affiliates/hooks/use-current-affiliate.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-ensure-affiliate.hook.ts +24 -0
- package/src/modules/affiliates/hooks/use-request-deposit.hook.ts +29 -0
- package/src/modules/affiliates/hooks/use-update-affiliate.hook.ts +24 -0
- package/src/modules/affiliates/hooks/use-withdrawal-limits.hook.ts +20 -0
- package/src/modules/affiliates/services/affiliates.service.ts +240 -0
- package/src/modules/affiliates/types/affiliate.type.ts +180 -0
- package/src/modules/affiliates/utils/get-affiliate-share-link.ts +8 -0
- package/src/modules/charges/actions/get-nota-fiscal.action.ts +8 -0
- package/src/modules/charges/actions/refresh-pix.action.ts +8 -0
- package/src/modules/charges/hooks/nota-fiscal.hook.ts +13 -0
- package/src/modules/charges/hooks/refresh-pix.hook.ts +13 -0
- package/src/modules/charges/services/charges.service.ts +121 -0
- package/src/modules/charges/types/nota-fiscal.type.ts +20 -0
- package/src/modules/charges/types/refresh-pix.type.ts +14 -0
- package/src/modules/charges/utils/get-charge-download-url.ts +10 -0
- package/src/modules/coupons/constants/query-keys.constants.ts +1 -0
- package/src/modules/coupons/handlers/find-coupon-by-code.handler.ts +16 -0
- package/src/modules/coupons/handlers/find-coupon-by-id.handler.ts +15 -0
- package/src/modules/coupons/hooks/use-coupon-by-code.hook.ts +16 -0
- package/src/modules/coupons/hooks/use-coupon-by-id.hook.ts +20 -0
- package/src/modules/coupons/services/coupons.service.ts +54 -0
- package/src/modules/coupons/types/coupon.type.ts +70 -0
- package/src/modules/coupons/utils/coupon-restrictions.ts +112 -0
- package/src/modules/domains/handlers/count-domains.handler.ts +10 -0
- package/src/modules/domains/hooks/count-domains.hook.ts +17 -0
- package/src/modules/domains/services/domains.service.ts +18 -0
- package/src/modules/ia-credits/handlers/list-ia-credit-operations.handler.ts +14 -0
- package/src/modules/ia-credits/hooks/ia-credit-operations.hook.ts +33 -0
- package/src/modules/ia-credits/services/ia-credits.service.ts +32 -1
- package/src/modules/pages/handlers/count-pages.handler.ts +5 -2
- package/src/modules/pages/hooks/count-published-pages.hook.ts +26 -0
- package/src/modules/pages/services/pages.service.ts +3 -2
- package/src/modules/plans/constants/plan-tooltips.constants.ts +16 -0
- package/src/modules/plans/hooks/use-enriched-plans.hook.ts +31 -0
- package/src/modules/plans/hooks/use-ui-plans.hook.ts +22 -0
- package/src/modules/projects/hooks/add-project-users.hook.ts +29 -0
- package/src/modules/projects/hooks/list-all-account-users.hook.ts +3 -6
- package/src/modules/projects/hooks/list-available-users.hook.ts +3 -6
- package/src/modules/projects/hooks/list-infinite-projects.hook.ts +3 -6
- package/src/modules/projects/hooks/list-project-users.hook.ts +3 -6
- package/src/modules/projects/hooks/remove-project-users.hook.ts +29 -0
- package/src/modules/projects/services/project-users.service.ts +135 -130
- package/src/modules/projects/types.ts +89 -88
- package/src/modules/subscriptions/actions/cancel-subscription.action.ts +12 -0
- package/src/modules/subscriptions/actions/create-subscription.action.ts +9 -0
- package/src/modules/subscriptions/actions/find-pending-pix-status.action.ts +8 -0
- package/src/modules/subscriptions/actions/find-subscription-by-id.action.ts +8 -0
- package/src/modules/subscriptions/constants/addons.constants.ts +50 -0
- package/src/modules/subscriptions/constants/downgrade.constants.ts +30 -0
- package/src/modules/subscriptions/constants/subscription.constants.ts +3 -0
- package/src/modules/subscriptions/handlers/pending-pix-status.handler.ts +17 -0
- package/src/modules/subscriptions/hooks/cancel-subscription.hook.ts +28 -0
- package/src/modules/subscriptions/hooks/create-subscription.hook.ts +34 -0
- package/src/modules/subscriptions/hooks/find-subscription-by-id.hook.ts +17 -0
- package/src/modules/subscriptions/hooks/pending-pix-status.hook.ts +30 -0
- package/src/modules/subscriptions/services/subscriptions.service.ts +401 -301
- package/src/modules/subscriptions/types/cancel-subscription.type.ts +8 -0
- package/src/modules/subscriptions/types/create-subscription.type.ts +79 -0
- package/src/modules/subscriptions/types/pending-pix-status.type.ts +33 -0
- package/src/modules/subscriptions/types/subscription.type.ts +157 -147
- package/src/modules/subscriptions/utils/addon-buckets.ts +129 -0
- package/src/modules/subscriptions/utils/confirm-payment-if-required.ts +9 -2
- package/src/modules/subscriptions/utils/first-period-pricing.ts +63 -0
- package/src/modules/subscriptions/utils/is-api-subscription.ts +6 -0
- package/src/modules/subscriptions/utils/is-boleto-payer.ts +21 -0
- package/src/modules/subscriptions/utils/is-free-subscription.ts +6 -0
- package/src/modules/subscriptions/utils/periodicity.ts +101 -0
- package/src/modules/subscriptions/utils/resolve-subscription-plan-name.ts +44 -0
- package/src/modules/users/hooks/messages.hook.ts +3 -5
- package/src/server.ts +102 -99
- package/src/store/useAccountModals.ts +22 -5
- package/src/store/useAffiliateFlows.ts +46 -0
- package/src/store/useProjectFlows.ts +42 -0
- package/src/store/useSubscriptionFlows.ts +176 -0
- package/src/store/useTeamFlows.ts +34 -0
- package/src/testing/factories/coupon.factory.ts +17 -0
- package/src/testing/factories/index.ts +3 -0
- package/src/testing/factories/project-user.factory.ts +15 -0
- package/src/testing/factories/project.factory.ts +19 -0
- package/src/testing/react/providers.tsx +2 -1
- package/src/utils/browser/chart-custom-tooltip.ts +85 -0
- package/src/utils/browser/get-css-variable.ts +6 -0
- package/src/utils/constants/scrollbar.ts +10 -0
- package/src/utils/date-filter-period.ts +34 -0
- package/src/utils/file/index.ts +13 -0
- package/src/utils/format/initials.ts +10 -0
- package/src/utils/format/masks.ts +41 -0
- package/src/utils/qrcode/to-data-url.ts +23 -0
- package/src/utils/validators/account.ts +0 -8
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -143
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
- package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -34
- package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
- package/src/components/account/ConfigurationsMyAccountModal.tsx +0 -179
- package/src/components/account/hooks/useConfigurationsModal.ts +0 -45
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { BillingAddressSheet } from "./BillingAddressSheet";
|
|
4
|
+
import { BoletoGeneratedDialog } from "./BoletoGeneratedDialog";
|
|
5
|
+
import { CancelPlanDialog } from "./CancelPlanDialog";
|
|
6
|
+
import { PayChargeDialog } from "./PayChargeDialog";
|
|
7
|
+
import { PaymentConfirmationDialog } from "./PaymentConfirmationDialog";
|
|
8
|
+
import { PendingChangeDialog } from "./PendingChangeDialog";
|
|
9
|
+
import { PixPaymentDialog } from "./PixPaymentDialog";
|
|
10
|
+
import { PlanDetailsSheet } from "./PlanDetailsSheet";
|
|
11
|
+
import { ReceiptDetailsSheet } from "./ReceiptDetailsSheet";
|
|
12
|
+
import { UsageReportSheet } from "./UsageReportSheet";
|
|
13
|
+
import { ChangePlanSheet } from "./change-plan/ChangePlanSheet";
|
|
14
|
+
import { CannotDowngradeDialog } from "./downgrade/CannotDowngradeDialog";
|
|
15
|
+
import { DowngradeReasonDialog } from "./downgrade/DowngradeReasonDialog";
|
|
16
|
+
import { OverdueReceiptOpener } from "./OverdueReceiptOpener";
|
|
17
|
+
import { PlansCatalogDialog } from "./plans/PlansCatalogDialog";
|
|
18
|
+
function SubscriptionFlows() {
|
|
19
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(OverdueReceiptOpener, {}),
|
|
21
|
+
/* @__PURE__ */ jsx(ReceiptDetailsSheet, {}),
|
|
22
|
+
/* @__PURE__ */ jsx(PayChargeDialog, {}),
|
|
23
|
+
/* @__PURE__ */ jsx(PlanDetailsSheet, {}),
|
|
24
|
+
/* @__PURE__ */ jsx(BillingAddressSheet, {}),
|
|
25
|
+
/* @__PURE__ */ jsx(UsageReportSheet, {}),
|
|
26
|
+
/* @__PURE__ */ jsx(CancelPlanDialog, {}),
|
|
27
|
+
/* @__PURE__ */ jsx(PendingChangeDialog, {}),
|
|
28
|
+
/* @__PURE__ */ jsx(ChangePlanSheet, {}),
|
|
29
|
+
/* @__PURE__ */ jsx(PlansCatalogDialog, {}),
|
|
30
|
+
/* @__PURE__ */ jsx(DowngradeReasonDialog, {}),
|
|
31
|
+
/* @__PURE__ */ jsx(CannotDowngradeDialog, {}),
|
|
32
|
+
/* @__PURE__ */ jsx(PixPaymentDialog, {}),
|
|
33
|
+
/* @__PURE__ */ jsx(BoletoGeneratedDialog, {}),
|
|
34
|
+
/* @__PURE__ */ jsx(PaymentConfirmationDialog, {})
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
SubscriptionFlows
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=SubscriptionFlows.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/subscription/SubscriptionFlows.tsx"],"sourcesContent":["'use client';\n\nimport { BillingAddressSheet } from './BillingAddressSheet';\nimport { BoletoGeneratedDialog } from './BoletoGeneratedDialog';\nimport { CancelPlanDialog } from './CancelPlanDialog';\nimport { PayChargeDialog } from './PayChargeDialog';\nimport { PaymentConfirmationDialog } from './PaymentConfirmationDialog';\nimport { PendingChangeDialog } from './PendingChangeDialog';\nimport { PixPaymentDialog } from './PixPaymentDialog';\nimport { PlanDetailsSheet } from './PlanDetailsSheet';\nimport { ReceiptDetailsSheet } from './ReceiptDetailsSheet';\nimport { UsageReportSheet } from './UsageReportSheet';\nimport { ChangePlanSheet } from './change-plan/ChangePlanSheet';\nimport { CannotDowngradeDialog } from './downgrade/CannotDowngradeDialog';\nimport { DowngradeReasonDialog } from './downgrade/DowngradeReasonDialog';\nimport { OverdueReceiptOpener } from './OverdueReceiptOpener';\nimport { PlansCatalogDialog } from './plans/PlansCatalogDialog';\n\n/** Fluxos da aba Assinatura, abertos por cima do modal Minha conta. */\nexport function SubscriptionFlows() {\n return (\n <>\n <OverdueReceiptOpener />\n <ReceiptDetailsSheet />\n <PayChargeDialog />\n <PlanDetailsSheet />\n <BillingAddressSheet />\n <UsageReportSheet />\n <CancelPlanDialog />\n <PendingChangeDialog />\n <ChangePlanSheet />\n <PlansCatalogDialog />\n <DowngradeReasonDialog />\n <CannotDowngradeDialog />\n <PixPaymentDialog />\n <BoletoGeneratedDialog />\n <PaymentConfirmationDialog />\n </>\n );\n}\n"],"mappings":";AAqBI,mBACE,KADF;AAnBJ,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,6BAA6B;AACtC,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AAG5B,SAAS,oBAAoB;AAClC,SACE,iCACE;AAAA,wBAAC,wBAAqB;AAAA,IACtB,oBAAC,uBAAoB;AAAA,IACrB,oBAAC,mBAAgB;AAAA,IACjB,oBAAC,oBAAiB;AAAA,IAClB,oBAAC,uBAAoB;AAAA,IACrB,oBAAC,oBAAiB;AAAA,IAClB,oBAAC,oBAAiB;AAAA,IAClB,oBAAC,uBAAoB;AAAA,IACrB,oBAAC,mBAAgB;AAAA,IACjB,oBAAC,sBAAmB;AAAA,IACpB,oBAAC,yBAAsB;AAAA,IACvB,oBAAC,yBAAsB;AAAA,IACvB,oBAAC,oBAAiB;AAAA,IAClB,oBAAC,yBAAsB;AAAA,IACvB,oBAAC,6BAA0B;AAAA,KAC7B;AAEJ;","names":[]}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { IconAlertTriangle, IconBolt, IconChevronRight, IconChevronsDown, IconPencil } from "@tabler/icons-react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import { Button } from "../../../ui/buttons/Button";
|
|
6
|
+
import { Progress } from "../../../ui/feedback/Progress";
|
|
7
|
+
import { Skeleton } from "../../../ui/feedback/Skeleton";
|
|
8
|
+
import { cn } from "../../../../infra/utils/clsx";
|
|
9
|
+
import { daysBetween, formatShortDate, toCalendarDate } from "../../../../infra/utils/date";
|
|
10
|
+
import { useWhitelabel } from "../../../../providers/whitelabel.provider";
|
|
11
|
+
import { useManagementPermissions } from "../../../../modules/auth/hooks/useManagementPermissions";
|
|
12
|
+
import { useCurrencyFormatter } from "../../../../modules/accounts/hooks/use-currency-formatter.hook";
|
|
13
|
+
import { useCharges } from "../../../../modules/charges/hooks/charges.hook";
|
|
14
|
+
import { useCurrentSubscription } from "../../../../modules/subscriptions/hooks/use-current-subscription.hook";
|
|
15
|
+
import { useAccountFreeze } from "../../../../modules/subscriptions/hooks/use-account-freeze.hook";
|
|
16
|
+
import { ADDON_IDS } from "../../../../modules/subscriptions/constants/addons.constants";
|
|
17
|
+
import { SUBSCRIPTION_GRACE_PERIOD_DAYS } from "../../../../modules/subscriptions/constants/subscription.constants";
|
|
18
|
+
import { hasSubscriptionExpired } from "../../../../modules/subscriptions/utils/has-subscription-expired";
|
|
19
|
+
import { getPeriodicityLabel } from "../../../../modules/subscriptions/utils/periodicity";
|
|
20
|
+
import { isFreeSubscription } from "../../../../modules/subscriptions/utils/is-free-subscription";
|
|
21
|
+
import { isApiSubscription } from "../../../../modules/subscriptions/utils/is-api-subscription";
|
|
22
|
+
import { resolveSubscriptionPlanName } from "../../../../modules/subscriptions/utils/resolve-subscription-plan-name";
|
|
23
|
+
import useSubscriptionActions from "../../hooks/useSubscriptionActions";
|
|
24
|
+
import { AiCreditsPromo, AiCreditsUsage } from "./AiCreditsUsage";
|
|
25
|
+
import { IconBox } from "../shared/IconBox";
|
|
26
|
+
import { RowActionsMenu } from "../shared/RowActionsMenu";
|
|
27
|
+
import { StatusBadge } from "../shared/StatusBadge";
|
|
28
|
+
const UPCOMING_CHARGE_DETAILS_WINDOW_DAYS = 7;
|
|
29
|
+
function PlanCardShell({ children, className }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col border border-zinc-200 rounded-lg min-w-0 bg-white", className), children });
|
|
31
|
+
}
|
|
32
|
+
function MoreDetailsButton({ onClick }) {
|
|
33
|
+
const translate = useTranslations();
|
|
34
|
+
return /* @__PURE__ */ jsxs(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick,
|
|
39
|
+
className: "flex items-center gap-0.5 paragraph-small-semibold text-zinc-950 underline cursor-pointer hover:text-zinc-700 transition-colors w-fit",
|
|
40
|
+
children: [
|
|
41
|
+
translate("common.account.workspace.subscription.planCard.moreDetails"),
|
|
42
|
+
/* @__PURE__ */ jsx(IconChevronRight, { size: 14, strokeWidth: 2.7 })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function PlanPrice({ value, muted = false }) {
|
|
48
|
+
const colorClasses = muted ? "text-zinc-950 opacity-20" : "text-zinc-950";
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx("span", { className: cn("md:hidden paragraph-xlarge-semibold", colorClasses), children: value }),
|
|
51
|
+
/* @__PURE__ */ jsx("span", { className: cn("hidden md:inline title-large-semibold", colorClasses), children: value })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
function SubscriptionPlanCard() {
|
|
55
|
+
const translate = useTranslations();
|
|
56
|
+
const {
|
|
57
|
+
data: { data: [subscription] = [] } = {},
|
|
58
|
+
isPending: isLoading,
|
|
59
|
+
isError,
|
|
60
|
+
refetch
|
|
61
|
+
} = useCurrentSubscription();
|
|
62
|
+
const { isOwnerOrAdmin: canManage } = useManagementPermissions();
|
|
63
|
+
const { whitelabel } = useWhitelabel();
|
|
64
|
+
const isMainWhitelabel = whitelabel?.id === 1;
|
|
65
|
+
const { formatCurrencyNumber } = useCurrencyFormatter();
|
|
66
|
+
const actions = useSubscriptionActions();
|
|
67
|
+
const { data: pendingChargesData } = useCharges({ page: 1, limit: 1, status: [0] });
|
|
68
|
+
const pendingCharge = pendingChargesData?.data?.[0] ?? null;
|
|
69
|
+
const { isFrozen } = useAccountFreeze();
|
|
70
|
+
const today = toCalendarDate(/* @__PURE__ */ new Date());
|
|
71
|
+
const dueCalendarDate = toCalendarDate(subscription?.date_due);
|
|
72
|
+
const hiringCalendarDate = toCalendarDate(subscription?.date_hiring);
|
|
73
|
+
const trialDaysRemaining = today && dueCalendarDate ? Math.max(0, daysBetween(today, dueCalendarDate)) : 0;
|
|
74
|
+
const trialTotalDays = hiringCalendarDate && dueCalendarDate ? Math.max(1, daysBetween(hiringCalendarDate, dueCalendarDate)) : trialDaysRemaining;
|
|
75
|
+
const trialProgressPercentage = trialTotalDays > 0 ? (trialTotalDays - trialDaysRemaining) / trialTotalDays * 100 : 0;
|
|
76
|
+
const hasNoSubscription = !subscription;
|
|
77
|
+
const isFreePlan = !!subscription && isFreeSubscription(subscription) && subscription.active;
|
|
78
|
+
const isTrialPlan = subscription?.type === "trial" && trialDaysRemaining > 0;
|
|
79
|
+
const isApiPlan = isApiSubscription(subscription);
|
|
80
|
+
if (!isLoading && isError) {
|
|
81
|
+
return /* @__PURE__ */ jsx(PlanCardShell, { children: /* @__PURE__ */ jsx("div", { className: "p-2 flex-1", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-between gap-6 p-5 lg:p-6 bg-zinc-50 rounded-lg h-full", children: [
|
|
82
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
83
|
+
/* @__PURE__ */ jsx(IconBox, { icon: IconAlertTriangle }),
|
|
84
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950", children: translate("common.account.workspace.subscription.planCard.readFailed") })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => refetch(), className: "w-fit h-10!", children: translate("common.account.workspace.subscription.planCard.readFailedRetry") })
|
|
87
|
+
] }) }) });
|
|
88
|
+
}
|
|
89
|
+
if (!isLoading && !isTrialPlan && (hasNoSubscription || isFreePlan)) {
|
|
90
|
+
return /* @__PURE__ */ jsxs(PlanCardShell, { children: [
|
|
91
|
+
/* @__PURE__ */ jsx("div", { className: "p-2 flex-1", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-between gap-6 p-5 lg:p-6 bg-zinc-50 rounded-lg h-full", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
93
|
+
/* @__PURE__ */ jsx(IconBox, { icon: IconBolt }),
|
|
94
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950", children: hasNoSubscription ? translate("common.account.workspace.subscription.planCard.noSubscription") : translate("common.account.workspace.subscription.planCard.freePlan") })
|
|
95
|
+
] }),
|
|
96
|
+
canManage && /* @__PURE__ */ jsx(Button, { onClick: actions.choosePlan, className: "w-fit h-10!", children: translate("common.account.workspace.subscription.planCard.choosePlan") })
|
|
97
|
+
] }) }),
|
|
98
|
+
isMainWhitelabel && /* @__PURE__ */ jsx(AiCreditsPromo, { isMainWhitelabel })
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
if (!isLoading && isTrialPlan) {
|
|
102
|
+
const trialHasAiCredits = subscription?.items?.some((item) => item.id_addon === ADDON_IDS.AI) ?? false;
|
|
103
|
+
return /* @__PURE__ */ jsxs(PlanCardShell, { children: [
|
|
104
|
+
/* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-5 lg:p-6 bg-zinc-50 rounded-lg", children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
106
|
+
/* @__PURE__ */ jsx(IconBox, { icon: IconBolt }),
|
|
107
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
108
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950", children: translate("common.account.workspace.subscription.planCard.planName", {
|
|
110
|
+
name: resolveSubscriptionPlanName(subscription, translate)
|
|
111
|
+
}) }),
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-regular text-zinc-400", children: translate("common.account.workspace.subscription.planCard.trialBadge") })
|
|
113
|
+
] }),
|
|
114
|
+
isMainWhitelabel && /* @__PURE__ */ jsx(MoreDetailsButton, { onClick: actions.viewPlanDetails })
|
|
115
|
+
] })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
118
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: translate("common.account.workspace.subscription.planCard.trialDaysRemaining", {
|
|
119
|
+
days: String(trialDaysRemaining)
|
|
120
|
+
}) }),
|
|
121
|
+
/* @__PURE__ */ jsx(Progress, { value: trialProgressPercentage, indicatorColor: "bg-zinc-950", className: "bg-zinc-200 h-2" })
|
|
122
|
+
] }),
|
|
123
|
+
canManage && /* @__PURE__ */ jsx(Button, { onClick: actions.choosePlan, className: "w-fit h-10!", children: translate("common.account.workspace.subscription.planCard.hirePlan") })
|
|
124
|
+
] }) }),
|
|
125
|
+
isMainWhitelabel && (trialHasAiCredits ? /* @__PURE__ */ jsx(
|
|
126
|
+
AiCreditsUsage,
|
|
127
|
+
{
|
|
128
|
+
canManage,
|
|
129
|
+
isApiPlan: false,
|
|
130
|
+
cancelled: false,
|
|
131
|
+
onViewUsageReport: actions.viewUsageReport
|
|
132
|
+
}
|
|
133
|
+
) : /* @__PURE__ */ jsx(AiCreditsPromo, { isMainWhitelabel }))
|
|
134
|
+
] });
|
|
135
|
+
}
|
|
136
|
+
const pendingChange = subscription?.pending_change ?? null;
|
|
137
|
+
const hasPendingDowngrade = !!pendingChange?.takes_effect_at_iso && !!pendingChange.new_plan && new Date(pendingChange.takes_effect_at_iso) > /* @__PURE__ */ new Date();
|
|
138
|
+
const planName = translate("common.account.workspace.subscription.planCard.planName", {
|
|
139
|
+
name: resolveSubscriptionPlanName(
|
|
140
|
+
subscription,
|
|
141
|
+
translate,
|
|
142
|
+
translate("common.account.workspace.subscription.planCard.noName")
|
|
143
|
+
)
|
|
144
|
+
});
|
|
145
|
+
const cancelled = !!subscription?.date_cancellation;
|
|
146
|
+
const isPartnerPlan = subscription?.type === "partner";
|
|
147
|
+
const isEffectivelyCancelled = !subscription?.active;
|
|
148
|
+
const planPrice = formatCurrencyNumber(subscription?.value ?? 0);
|
|
149
|
+
const periodicityLabel = getPeriodicityLabel(subscription?.periodicity, translate);
|
|
150
|
+
const cancellationDate = toCalendarDate(subscription?.date_cancellation);
|
|
151
|
+
const hasFutureCancellation = !!subscription?.date_cancellation && !!cancellationDate && !!today && cancellationDate.getTime() > today.getTime();
|
|
152
|
+
const daysToDue = today && dueCalendarDate ? daysBetween(today, dueCalendarDate) : null;
|
|
153
|
+
const daysSinceDue = today && dueCalendarDate ? daysBetween(dueCalendarDate, today) : null;
|
|
154
|
+
const isWithinChargeDetailsWindow = daysToDue != null && daysSinceDue != null && (daysToDue >= 0 && daysToDue <= UPCOMING_CHARGE_DETAILS_WINDOW_DAYS || daysSinceDue > 0 && daysSinceDue <= SUBSCRIPTION_GRACE_PERIOD_DAYS);
|
|
155
|
+
const isOverdue = !!today && !!dueCalendarDate && today.getTime() > dueCalendarDate.getTime();
|
|
156
|
+
const isExpired = hasSubscriptionExpired(subscription?.date_due);
|
|
157
|
+
const canOpenChargeDetails = !!pendingCharge && !hasFutureCancellation && isWithinChargeDetailsWindow;
|
|
158
|
+
const handleOpenChargeDetails = () => {
|
|
159
|
+
if (!canOpenChargeDetails || !pendingCharge) return;
|
|
160
|
+
actions.viewCharge(pendingCharge);
|
|
161
|
+
};
|
|
162
|
+
const renewalDateLabel = isExpired ? translate("common.account.workspace.subscription.planCard.expired") : isOverdue ? translate("common.account.workspace.subscription.planCard.overdueDate", {
|
|
163
|
+
date: formatShortDate(subscription?.date_due)
|
|
164
|
+
}) : translate("common.account.workspace.subscription.planCard.expiresOn", {
|
|
165
|
+
date: formatShortDate(subscription?.date_due)
|
|
166
|
+
});
|
|
167
|
+
const statusBadge = cancelled ? /* @__PURE__ */ jsx(StatusBadge, { tone: "red", children: translate("common.account.workspace.subscription.planCard.cancelled") }) : isFrozen ? /* @__PURE__ */ jsx(StatusBadge, { tone: "red", children: translate("common.account.workspace.subscription.planCard.frozen") }) : /* @__PURE__ */ jsx(StatusBadge, { tone: "blue", children: periodicityLabel });
|
|
168
|
+
const planActionsMenu = /* @__PURE__ */ jsx(
|
|
169
|
+
RowActionsMenu,
|
|
170
|
+
{
|
|
171
|
+
width: 220,
|
|
172
|
+
items: [
|
|
173
|
+
{
|
|
174
|
+
icon: /* @__PURE__ */ jsx(IconPencil, { size: 20 }),
|
|
175
|
+
label: translate("common.account.workspace.subscription.planCard.billingAddress"),
|
|
176
|
+
onClick: actions.editBillingAddress
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-600" }),
|
|
180
|
+
label: translate("common.account.workspace.subscription.planCard.cancelPlan"),
|
|
181
|
+
onClick: actions.cancelPlan,
|
|
182
|
+
destructive: true
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
const payButton = canOpenChargeDetails && /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10! flex-1 md:flex-none min-w-0", onClick: handleOpenChargeDetails, children: translate("common.account.workspace.subscription.planCard.paySubscription") });
|
|
188
|
+
if (hasPendingDowngrade && pendingChange?.new_plan) {
|
|
189
|
+
const pendingPlanName = translate("common.account.workspace.subscription.planCard.planName", {
|
|
190
|
+
name: pendingChange.new_plan.name
|
|
191
|
+
});
|
|
192
|
+
const pendingPlanPrice = formatCurrencyNumber(pendingChange.new_plan.value);
|
|
193
|
+
const pendingPeriodicityLabel = getPeriodicityLabel(pendingChange.new_plan.periodicity, translate);
|
|
194
|
+
const pendingDateLabel = translate("common.account.workspace.subscription.planCard.pendingDate", {
|
|
195
|
+
date: formatShortDate(pendingChange.takes_effect_at_iso)
|
|
196
|
+
});
|
|
197
|
+
return /* @__PURE__ */ jsxs(PlanCardShell, { children: [
|
|
198
|
+
/* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col p-5 lg:p-6 bg-zinc-50 rounded-lg justify-between gap-3", children: [
|
|
199
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
200
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
201
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-500", children: translate("common.account.workspace.subscription.planCard.current") }),
|
|
202
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-500", children: "\u2022" }),
|
|
203
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: planName }),
|
|
204
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: "blue", children: periodicityLabel })
|
|
205
|
+
] }),
|
|
206
|
+
isMainWhitelabel && /* @__PURE__ */ jsx(MoreDetailsButton, { onClick: actions.viewPlanDetails }),
|
|
207
|
+
/* @__PURE__ */ jsx(PlanPrice, { value: planPrice })
|
|
208
|
+
] }),
|
|
209
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 py-1", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
210
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-4 border-l border-dashed border-zinc-300" }),
|
|
211
|
+
/* @__PURE__ */ jsx("div", { className: "size-7 rounded-full border border-zinc-200 bg-white flex items-center justify-center", children: /* @__PURE__ */ jsx(IconChevronsDown, { size: 16, className: "text-zinc-400" }) }),
|
|
212
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-4 border-l border-dashed border-zinc-300" })
|
|
213
|
+
] }) }),
|
|
214
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-end justify-between gap-4", children: [
|
|
215
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
216
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
217
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-500", children: pendingDateLabel }),
|
|
218
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-500", children: "\u2022" }),
|
|
219
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: pendingPlanName }),
|
|
220
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: "blue", children: pendingPeriodicityLabel })
|
|
221
|
+
] }),
|
|
222
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
223
|
+
/* @__PURE__ */ jsx(PlanPrice, { value: pendingPlanPrice }),
|
|
224
|
+
/* @__PURE__ */ jsx(
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
type: "button",
|
|
228
|
+
onClick: () => actions.viewPendingChange(pendingChange),
|
|
229
|
+
className: "paragraph-xsmall-medium text-zinc-500 underline cursor-pointer hover:text-zinc-700 transition-colors",
|
|
230
|
+
children: translate("common.account.workspace.subscription.planCard.details")
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
] })
|
|
234
|
+
] }),
|
|
235
|
+
canManage && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
236
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10! flex-1 md:flex-none min-w-0", onClick: actions.changePlan, children: translate("common.account.workspace.subscription.planCard.changePlan") }),
|
|
237
|
+
payButton,
|
|
238
|
+
planActionsMenu
|
|
239
|
+
] })
|
|
240
|
+
] })
|
|
241
|
+
] }) }),
|
|
242
|
+
!isApiPlan && isMainWhitelabel && /* @__PURE__ */ jsx(
|
|
243
|
+
AiCreditsUsage,
|
|
244
|
+
{
|
|
245
|
+
canManage,
|
|
246
|
+
isApiPlan,
|
|
247
|
+
cancelled,
|
|
248
|
+
onViewUsageReport: actions.viewUsageReport
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
253
|
+
return /* @__PURE__ */ jsxs(PlanCardShell, { children: [
|
|
254
|
+
/* @__PURE__ */ jsx("div", { className: cn("p-2", isApiPlan && "flex-1 flex flex-col"), children: /* @__PURE__ */ jsxs(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
className: cn(
|
|
258
|
+
"flex flex-col p-5 lg:p-6 bg-zinc-50 rounded-lg min-h-56.25 justify-between gap-8 md:gap-3",
|
|
259
|
+
isApiPlan && "flex-1"
|
|
260
|
+
),
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4 md:gap-3", children: [
|
|
263
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
264
|
+
/* @__PURE__ */ jsx(IconBox, { icon: IconBolt }),
|
|
265
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
266
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
267
|
+
isLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-28 rounded" }) : /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950", children: planName }),
|
|
268
|
+
!isLoading && statusBadge
|
|
269
|
+
] }),
|
|
270
|
+
!isLoading && isMainWhitelabel && /* @__PURE__ */ jsx(MoreDetailsButton, { onClick: actions.viewPlanDetails })
|
|
271
|
+
] })
|
|
272
|
+
] }),
|
|
273
|
+
isLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-28 rounded" }) : !isPartnerPlan && !isEffectivelyCancelled ? /* @__PURE__ */ jsx("span", { className: "text-zinc-500 paragraph-small-medium", children: renewalDateLabel }) : null
|
|
274
|
+
] }),
|
|
275
|
+
canManage && /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4", children: [
|
|
276
|
+
isLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-28 rounded" }) : /* @__PURE__ */ jsx(PlanPrice, { value: planPrice, muted: cancelled }),
|
|
277
|
+
cancelled ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row md:items-center gap-2", children: [
|
|
278
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10!", onClick: actions.choosePlan, children: translate("common.account.workspace.subscription.planCard.choosePlan") }),
|
|
279
|
+
payButton
|
|
280
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
281
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10! flex-1 md:flex-none min-w-0", onClick: actions.changePlan, children: translate("common.account.workspace.subscription.planCard.changePlan") }),
|
|
282
|
+
payButton,
|
|
283
|
+
planActionsMenu
|
|
284
|
+
] })
|
|
285
|
+
] })
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
) }),
|
|
289
|
+
!isApiPlan && isMainWhitelabel && /* @__PURE__ */ jsx(
|
|
290
|
+
AiCreditsUsage,
|
|
291
|
+
{
|
|
292
|
+
canManage,
|
|
293
|
+
isApiPlan,
|
|
294
|
+
cancelled,
|
|
295
|
+
onViewUsageReport: actions.viewUsageReport
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
export {
|
|
301
|
+
SubscriptionPlanCard
|
|
302
|
+
};
|
|
303
|
+
//# sourceMappingURL=SubscriptionPlanCard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/subscription/SubscriptionPlanCard.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { IconAlertTriangle, IconBolt, IconChevronRight, IconChevronsDown, IconPencil } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../../../ui/buttons/Button';\nimport { Progress } from '../../../ui/feedback/Progress';\nimport { Skeleton } from '../../../ui/feedback/Skeleton';\nimport { cn } from '../../../../infra/utils/clsx';\nimport { daysBetween, formatShortDate, toCalendarDate } from '../../../../infra/utils/date';\nimport { useWhitelabel } from '../../../../providers/whitelabel.provider';\nimport { useManagementPermissions } from '../../../../modules/auth/hooks/useManagementPermissions';\nimport { useCurrencyFormatter } from '../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { useCharges } from '../../../../modules/charges/hooks/charges.hook';\nimport { useCurrentSubscription } from '../../../../modules/subscriptions/hooks/use-current-subscription.hook';\nimport { useAccountFreeze } from '../../../../modules/subscriptions/hooks/use-account-freeze.hook';\nimport { ADDON_IDS } from '../../../../modules/subscriptions/constants/addons.constants';\nimport { SUBSCRIPTION_GRACE_PERIOD_DAYS } from '../../../../modules/subscriptions/constants/subscription.constants';\nimport { hasSubscriptionExpired } from '../../../../modules/subscriptions/utils/has-subscription-expired';\nimport { getPeriodicityLabel } from '../../../../modules/subscriptions/utils/periodicity';\nimport { isFreeSubscription } from '../../../../modules/subscriptions/utils/is-free-subscription';\nimport { isApiSubscription } from '../../../../modules/subscriptions/utils/is-api-subscription';\nimport { resolveSubscriptionPlanName } from '../../../../modules/subscriptions/utils/resolve-subscription-plan-name';\nimport useSubscriptionActions from '../../hooks/useSubscriptionActions';\nimport { AiCreditsPromo, AiCreditsUsage } from './AiCreditsUsage';\nimport { IconBox } from '../shared/IconBox';\nimport { RowActionsMenu } from '../shared/RowActionsMenu';\nimport { StatusBadge } from '../shared/StatusBadge';\n\nconst UPCOMING_CHARGE_DETAILS_WINDOW_DAYS = 7;\n\nfunction PlanCardShell({ children, className }: { children: ReactNode; className?: string }) {\n return (\n <div className={cn('flex flex-col border border-zinc-200 rounded-lg min-w-0 bg-white', className)}>\n {children}\n </div>\n );\n}\n\nfunction MoreDetailsButton({ onClick }: { onClick: () => void }) {\n const translate = useTranslations();\n\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"flex items-center gap-0.5 paragraph-small-semibold text-zinc-950 underline cursor-pointer hover:text-zinc-700 transition-colors w-fit\"\n >\n {translate('common.account.workspace.subscription.planCard.moreDetails')}\n <IconChevronRight size={14} strokeWidth={2.7} />\n </button>\n );\n}\n\nfunction PlanPrice({ value, muted = false }: { value: string; muted?: boolean }) {\n const colorClasses = muted ? 'text-zinc-950 opacity-20' : 'text-zinc-950';\n\n return (\n <>\n <span className={cn('md:hidden paragraph-xlarge-semibold', colorClasses)}>{value}</span>\n <span className={cn('hidden md:inline title-large-semibold', colorClasses)}>{value}</span>\n </>\n );\n}\n\nexport function SubscriptionPlanCard() {\n const translate = useTranslations();\n const {\n data: { data: [subscription] = [] } = {},\n isPending: isLoading,\n isError,\n refetch,\n } = useCurrentSubscription();\n\n const { isOwnerOrAdmin: canManage } = useManagementPermissions();\n const { whitelabel } = useWhitelabel();\n const isMainWhitelabel = whitelabel?.id === 1;\n const { formatCurrencyNumber } = useCurrencyFormatter();\n const actions = useSubscriptionActions();\n const { data: pendingChargesData } = useCharges({ page: 1, limit: 1, status: [0] });\n const pendingCharge = pendingChargesData?.data?.[0] ?? null;\n const { isFrozen } = useAccountFreeze();\n\n const today = toCalendarDate(new Date());\n const dueCalendarDate = toCalendarDate(subscription?.date_due);\n const hiringCalendarDate = toCalendarDate(subscription?.date_hiring);\n const trialDaysRemaining =\n today && dueCalendarDate ? Math.max(0, daysBetween(today, dueCalendarDate)) : 0;\n const trialTotalDays =\n hiringCalendarDate && dueCalendarDate\n ? Math.max(1, daysBetween(hiringCalendarDate, dueCalendarDate))\n : trialDaysRemaining;\n const trialProgressPercentage =\n trialTotalDays > 0 ? ((trialTotalDays - trialDaysRemaining) / trialTotalDays) * 100 : 0;\n\n const hasNoSubscription = !subscription;\n const isFreePlan = !!subscription && isFreeSubscription(subscription) && subscription.active;\n const isTrialPlan = subscription?.type === 'trial' && trialDaysRemaining > 0;\n const isApiPlan = isApiSubscription(subscription);\n\n if (!isLoading && isError) {\n return (\n <PlanCardShell>\n <div className=\"p-2 flex-1\">\n <div className=\"flex flex-col justify-between gap-6 p-5 lg:p-6 bg-zinc-50 rounded-lg h-full\">\n <div className=\"flex items-center gap-4\">\n <IconBox icon={IconAlertTriangle} />\n <span className=\"paragraph-medium-semibold text-zinc-950\">\n {translate('common.account.workspace.subscription.planCard.readFailed')}\n </span>\n </div>\n <Button variant=\"secondary\" onClick={() => refetch()} className=\"w-fit h-10!\">\n {translate('common.account.workspace.subscription.planCard.readFailedRetry')}\n </Button>\n </div>\n </div>\n </PlanCardShell>\n );\n }\n\n if (!isLoading && !isTrialPlan && (hasNoSubscription || isFreePlan)) {\n return (\n <PlanCardShell>\n <div className=\"p-2 flex-1\">\n <div className=\"flex flex-col justify-between gap-6 p-5 lg:p-6 bg-zinc-50 rounded-lg h-full\">\n <div className=\"flex items-center gap-4\">\n <IconBox icon={IconBolt} />\n <span className=\"paragraph-medium-semibold text-zinc-950\">\n {hasNoSubscription\n ? translate('common.account.workspace.subscription.planCard.noSubscription')\n : translate('common.account.workspace.subscription.planCard.freePlan')}\n </span>\n </div>\n {canManage && (\n <Button onClick={actions.choosePlan} className=\"w-fit h-10!\">\n {translate('common.account.workspace.subscription.planCard.choosePlan')}\n </Button>\n )}\n </div>\n </div>\n {isMainWhitelabel && <AiCreditsPromo isMainWhitelabel={isMainWhitelabel} />}\n </PlanCardShell>\n );\n }\n\n if (!isLoading && isTrialPlan) {\n // Contas trial têm créditos de IA inclusos (id_addon=6): mostram o mesmo uso/relatório\n // do plano pago quando a assinatura tem item de crédito de IA.\n const trialHasAiCredits = subscription?.items?.some((item) => item.id_addon === ADDON_IDS.AI) ?? false;\n\n return (\n <PlanCardShell>\n <div className=\"p-2\">\n <div className=\"flex flex-col gap-6 p-5 lg:p-6 bg-zinc-50 rounded-lg\">\n <div className=\"flex items-center gap-4\">\n <IconBox icon={IconBolt} />\n <div className=\"flex flex-col gap-0.5\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"paragraph-medium-semibold text-zinc-950\">\n {translate('common.account.workspace.subscription.planCard.planName', {\n name: resolveSubscriptionPlanName(subscription, translate),\n })}\n </span>\n <span className=\"paragraph-medium-regular text-zinc-400\">\n {translate('common.account.workspace.subscription.planCard.trialBadge')}\n </span>\n </div>\n {isMainWhitelabel && <MoreDetailsButton onClick={actions.viewPlanDetails} />}\n </div>\n </div>\n <div className=\"flex flex-col gap-3\">\n <span className=\"paragraph-small-regular text-zinc-600\">\n {translate('common.account.workspace.subscription.planCard.trialDaysRemaining', {\n days: String(trialDaysRemaining),\n })}\n </span>\n <Progress value={trialProgressPercentage} indicatorColor=\"bg-zinc-950\" className=\"bg-zinc-200 h-2\" />\n </div>\n {canManage && (\n <Button onClick={actions.choosePlan} className=\"w-fit h-10!\">\n {translate('common.account.workspace.subscription.planCard.hirePlan')}\n </Button>\n )}\n </div>\n </div>\n {isMainWhitelabel &&\n (trialHasAiCredits ? (\n <AiCreditsUsage\n canManage={canManage}\n isApiPlan={false}\n cancelled={false}\n onViewUsageReport={actions.viewUsageReport}\n />\n ) : (\n <AiCreditsPromo isMainWhitelabel={isMainWhitelabel} />\n ))}\n </PlanCardShell>\n );\n }\n\n const pendingChange = subscription?.pending_change ?? null;\n const hasPendingDowngrade =\n !!pendingChange?.takes_effect_at_iso &&\n !!pendingChange.new_plan &&\n new Date(pendingChange.takes_effect_at_iso) > new Date();\n\n const planName = translate('common.account.workspace.subscription.planCard.planName', {\n name: resolveSubscriptionPlanName(\n subscription,\n translate,\n translate('common.account.workspace.subscription.planCard.noName')\n ),\n });\n const cancelled = !!subscription?.date_cancellation;\n const isPartnerPlan = subscription?.type === 'partner';\n // Assinatura efetivamente cancelada (active === false, ex.: baixa por falha de pagamento):\n // a linha de data não faz sentido, o badge \"Cancelado\" já cobre.\n const isEffectivelyCancelled = !subscription?.active;\n\n const planPrice = formatCurrencyNumber(subscription?.value ?? 0);\n const periodicityLabel = getPeriodicityLabel(subscription?.periodicity, translate);\n const cancellationDate = toCalendarDate(subscription?.date_cancellation);\n const hasFutureCancellation =\n !!subscription?.date_cancellation &&\n !!cancellationDate &&\n !!today &&\n cancellationDate.getTime() > today.getTime();\n const daysToDue = today && dueCalendarDate ? daysBetween(today, dueCalendarDate) : null;\n const daysSinceDue = today && dueCalendarDate ? daysBetween(dueCalendarDate, today) : null;\n const isWithinChargeDetailsWindow =\n daysToDue != null &&\n daysSinceDue != null &&\n ((daysToDue >= 0 && daysToDue <= UPCOMING_CHARGE_DETAILS_WINDOW_DAYS) ||\n (daysSinceDue > 0 && daysSinceDue <= SUBSCRIPTION_GRACE_PERIOD_DAYS));\n const isOverdue = !!today && !!dueCalendarDate && today.getTime() > dueCalendarDate.getTime();\n const isExpired = hasSubscriptionExpired(subscription?.date_due);\n\n const canOpenChargeDetails = !!pendingCharge && !hasFutureCancellation && isWithinChargeDetailsWindow;\n\n const handleOpenChargeDetails = () => {\n if (!canOpenChargeDetails || !pendingCharge) return;\n actions.viewCharge(pendingCharge);\n };\n\n const renewalDateLabel = isExpired\n ? translate('common.account.workspace.subscription.planCard.expired')\n : isOverdue\n ? translate('common.account.workspace.subscription.planCard.overdueDate', {\n date: formatShortDate(subscription?.date_due),\n })\n : translate('common.account.workspace.subscription.planCard.expiresOn', {\n date: formatShortDate(subscription?.date_due),\n });\n\n const statusBadge = cancelled ? (\n <StatusBadge tone=\"red\">{translate('common.account.workspace.subscription.planCard.cancelled')}</StatusBadge>\n ) : isFrozen ? (\n <StatusBadge tone=\"red\">{translate('common.account.workspace.subscription.planCard.frozen')}</StatusBadge>\n ) : (\n <StatusBadge tone=\"blue\">{periodicityLabel}</StatusBadge>\n );\n\n const planActionsMenu = (\n <RowActionsMenu\n width={220}\n items={[\n {\n icon: <IconPencil size={20} />,\n label: translate('common.account.workspace.subscription.planCard.billingAddress'),\n onClick: actions.editBillingAddress,\n },\n {\n icon: <IconAlertTriangle size={20} className=\"text-red-600\" />,\n label: translate('common.account.workspace.subscription.planCard.cancelPlan'),\n onClick: actions.cancelPlan,\n destructive: true,\n },\n ]}\n />\n );\n\n const payButton = canOpenChargeDetails && (\n <Button variant=\"secondary\" className=\"h-10! flex-1 md:flex-none min-w-0\" onClick={handleOpenChargeDetails}>\n {translate('common.account.workspace.subscription.planCard.paySubscription')}\n </Button>\n );\n\n if (hasPendingDowngrade && pendingChange?.new_plan) {\n const pendingPlanName = translate('common.account.workspace.subscription.planCard.planName', {\n name: pendingChange.new_plan.name,\n });\n const pendingPlanPrice = formatCurrencyNumber(pendingChange.new_plan.value);\n const pendingPeriodicityLabel = getPeriodicityLabel(pendingChange.new_plan.periodicity, translate);\n const pendingDateLabel = translate('common.account.workspace.subscription.planCard.pendingDate', {\n date: formatShortDate(pendingChange.takes_effect_at_iso),\n });\n\n return (\n <PlanCardShell>\n <div className=\"p-2\">\n <div className=\"flex flex-col p-5 lg:p-6 bg-zinc-50 rounded-lg justify-between gap-3\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-1.5 flex-wrap\">\n <span className=\"paragraph-small-regular text-zinc-500\">\n {translate('common.account.workspace.subscription.planCard.current')}\n </span>\n <span className=\"paragraph-small-regular text-zinc-500\">•</span>\n <span className=\"paragraph-small-semibold text-zinc-950\">{planName}</span>\n <StatusBadge tone=\"blue\">{periodicityLabel}</StatusBadge>\n </div>\n {isMainWhitelabel && <MoreDetailsButton onClick={actions.viewPlanDetails} />}\n <PlanPrice value={planPrice} />\n </div>\n\n <div className=\"flex items-center gap-2 py-1\">\n <div className=\"flex flex-col items-center\">\n <div className=\"w-px h-4 border-l border-dashed border-zinc-300\" />\n <div className=\"size-7 rounded-full border border-zinc-200 bg-white flex items-center justify-center\">\n <IconChevronsDown size={16} className=\"text-zinc-400\" />\n </div>\n <div className=\"w-px h-4 border-l border-dashed border-zinc-300\" />\n </div>\n </div>\n\n <div className=\"flex flex-col md:flex-row md:items-end justify-between gap-4\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-1.5 flex-wrap\">\n <span className=\"paragraph-small-regular text-zinc-500\">{pendingDateLabel}</span>\n <span className=\"paragraph-small-regular text-zinc-500\">•</span>\n <span className=\"paragraph-small-semibold text-zinc-950\">{pendingPlanName}</span>\n <StatusBadge tone=\"blue\">{pendingPeriodicityLabel}</StatusBadge>\n </div>\n <div className=\"flex items-center gap-2\">\n <PlanPrice value={pendingPlanPrice} />\n <button\n type=\"button\"\n onClick={() => actions.viewPendingChange(pendingChange)}\n className=\"paragraph-xsmall-medium text-zinc-500 underline cursor-pointer hover:text-zinc-700 transition-colors\"\n >\n {translate('common.account.workspace.subscription.planCard.details')}\n </button>\n </div>\n </div>\n\n {canManage && (\n <div className=\"flex items-center gap-2 shrink-0\">\n <Button className=\"h-10! flex-1 md:flex-none min-w-0\" onClick={actions.changePlan}>\n {translate('common.account.workspace.subscription.planCard.changePlan')}\n </Button>\n {payButton}\n {planActionsMenu}\n </div>\n )}\n </div>\n </div>\n </div>\n {!isApiPlan && isMainWhitelabel && (\n <AiCreditsUsage\n canManage={canManage}\n isApiPlan={isApiPlan}\n cancelled={cancelled}\n onViewUsageReport={actions.viewUsageReport}\n />\n )}\n </PlanCardShell>\n );\n }\n\n return (\n <PlanCardShell>\n <div className={cn('p-2', isApiPlan && 'flex-1 flex flex-col')}>\n <div\n className={cn(\n 'flex flex-col p-5 lg:p-6 bg-zinc-50 rounded-lg min-h-56.25 justify-between gap-8 md:gap-3',\n isApiPlan && 'flex-1'\n )}\n >\n <div className=\"flex flex-col md:flex-row md:items-center justify-between gap-4 md:gap-3\">\n <div className=\"flex items-center gap-4\">\n <IconBox icon={IconBolt} />\n <div className=\"flex flex-col gap-0.5\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n {isLoading ? (\n <Skeleton className=\"h-4 w-28 rounded\" />\n ) : (\n <span className=\"paragraph-medium-semibold text-zinc-950\">{planName}</span>\n )}\n {!isLoading && statusBadge}\n </div>\n {!isLoading && isMainWhitelabel && <MoreDetailsButton onClick={actions.viewPlanDetails} />}\n </div>\n </div>\n {isLoading ? (\n <Skeleton className=\"h-4 w-28 rounded\" />\n ) : !isPartnerPlan && !isEffectivelyCancelled ? (\n <span className=\"text-zinc-500 paragraph-small-medium\">{renewalDateLabel}</span>\n ) : null}\n </div>\n\n {canManage && (\n <div className=\"flex flex-col md:flex-row md:items-center justify-between gap-4\">\n {isLoading ? <Skeleton className=\"h-7 w-28 rounded\" /> : <PlanPrice value={planPrice} muted={cancelled} />}\n {cancelled ? (\n <div className=\"flex flex-col md:flex-row md:items-center gap-2\">\n <Button className=\"h-10!\" onClick={actions.choosePlan}>\n {translate('common.account.workspace.subscription.planCard.choosePlan')}\n </Button>\n {payButton}\n </div>\n ) : (\n <div className=\"flex items-center gap-2\">\n <Button className=\"h-10! flex-1 md:flex-none min-w-0\" onClick={actions.changePlan}>\n {translate('common.account.workspace.subscription.planCard.changePlan')}\n </Button>\n {payButton}\n {planActionsMenu}\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n {!isApiPlan && isMainWhitelabel && (\n <AiCreditsUsage\n canManage={canManage}\n isApiPlan={isAp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,WAAU,2CAA2C,oBAAS;AAAA,kBAErE,CAAC,aAAa;AAAA,mBACjB;AAAA,gBACC,CAAC,aAAa,oBAAoB,oBAAC,qBAAkB,SAAS,QAAQ,iBAAiB;AAAA,iBAC1F;AAAA,eACF;AAAA,YACC,YACC,oBAAC,YAAS,WAAU,oBAAmB,IACrC,CAAC,iBAAiB,CAAC,yBACrB,oBAAC,UAAK,WAAU,wCAAwC,4BAAiB,IACvE;AAAA,aACN;AAAA,UAEC,aACC,qBAAC,SAAI,WAAU,mEACZ;AAAA,wBAAY,oBAAC,YAAS,WAAU,oBAAmB,IAAK,oBAAC,aAAU,OAAO,WAAW,OAAO,WAAW;AAAA,YACvG,YACC,qBAAC,SAAI,WAAU,mDACb;AAAA,kCAAC,UAAO,WAAU,SAAQ,SAAS,QAAQ,YACxC,oBAAU,2DAA2D,GACxE;AAAA,cACC;AAAA,eACH,IAEA,qBAAC,SAAI,WAAU,2BACb;AAAA,kCAAC,UAAO,WAAU,qCAAoC,SAAS,QAAQ,YACpE,oBAAU,2DAA2D,GACxE;AAAA,cACC;AAAA,cACA;AAAA,eACH;AAAA,aAEJ;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA,IACC,CAAC,aAAa,oBACb;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,mBAAmB,QAAQ;AAAA;AAAA,IAC7B;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { IconCornerDownRight, IconExternalLink } from "@tabler/icons-react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import { Button } from "../../../ui/buttons/Button";
|
|
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 { useIaCreditOperations } from "../../../../modules/ia-credits/hooks/ia-credit-operations.hook";
|
|
11
|
+
import { useWhitelabel } from "../../../../providers/whitelabel.provider";
|
|
12
|
+
import useIsMobile from "../../../../hooks/useIsMobile";
|
|
13
|
+
import { cn } from "../../../../infra/utils/clsx";
|
|
14
|
+
import { useSubscriptionFlows } from "../../../../store/useSubscriptionFlows";
|
|
15
|
+
function extractPageId(description) {
|
|
16
|
+
const pageId = description.split("-")[1]?.replace("P\xE1gina ID: ", " ").trim();
|
|
17
|
+
return pageId || null;
|
|
18
|
+
}
|
|
19
|
+
function UsageItemRow({ item }) {
|
|
20
|
+
const translate = useTranslations("common.account.workspace.subscription.usageReport");
|
|
21
|
+
const { whitelabel } = useWhitelabel();
|
|
22
|
+
const pageId = extractPageId(item.description);
|
|
23
|
+
const pageUrl = pageId && whitelabel?.pages_url ? `${whitelabel.pages_url}/pages/${pageId}` : null;
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
25
|
+
/* @__PURE__ */ jsx(IconCornerDownRight, { size: 18, className: "text-zinc-400 shrink-0" }),
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 flex-1", children: [
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: item.description.split("-")[0] }),
|
|
28
|
+
/* @__PURE__ */ jsx("p", { className: "paragraph-small-regular text-zinc-600", children: translate.rich("madeBy", {
|
|
29
|
+
author: item.author,
|
|
30
|
+
b: (chunks) => /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: chunks })
|
|
31
|
+
}) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950 text-right shrink-0", children: translate("creditsLabel", { credits: String(item.credits) }) }),
|
|
34
|
+
pageUrl && /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 300, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
36
|
+
Button,
|
|
37
|
+
{
|
|
38
|
+
variant: "secondary",
|
|
39
|
+
size: "icon-lg",
|
|
40
|
+
className: "size-8 shrink-0",
|
|
41
|
+
onClick: () => window.open(pageUrl, "_blank", "noopener,noreferrer"),
|
|
42
|
+
children: /* @__PURE__ */ jsx(IconExternalLink, { size: 16, className: "text-zinc-950" })
|
|
43
|
+
}
|
|
44
|
+
) }),
|
|
45
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: translate("viewPage") })
|
|
46
|
+
] })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
function PurchaseSection({ purchase }) {
|
|
50
|
+
const translate = useTranslations("common.account.workspace.subscription.usageReport");
|
|
51
|
+
const expiresLabel = purchase.expired ? translate("expired") : purchase.expiresInDays != null ? purchase.expiresInDays === 1 ? translate("expiresInOneDay") : translate("expiresInDays", { days: String(purchase.expiresInDays) }) : "";
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950", children: translate("creditsAdded", { count: String(purchase.addedCredits) }) }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: purchase.purchaseDateLabel })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: translate("creditsUsed", {
|
|
59
|
+
consumed: String(purchase.consumedCredits),
|
|
60
|
+
total: String(purchase.addedCredits)
|
|
61
|
+
}) }),
|
|
62
|
+
expiresLabel && /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950", children: expiresLabel })
|
|
63
|
+
] }),
|
|
64
|
+
purchase.groups.map((group) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 p-4 bg-zinc-50 rounded-lg", children: [
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-600", children: group.date }),
|
|
66
|
+
group.items.map((item, index) => /* @__PURE__ */ jsxs("div", { children: [
|
|
67
|
+
index > 0 && /* @__PURE__ */ jsx(Separator, { className: "mb-5" }),
|
|
68
|
+
/* @__PURE__ */ jsx(UsageItemRow, { item })
|
|
69
|
+
] }, `${group.date}-${index}`))
|
|
70
|
+
] }, group.date))
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
function UsageReportSheet() {
|
|
74
|
+
const translate = useTranslations("common.account.workspace.subscription.usageReport");
|
|
75
|
+
const isMobile = useIsMobile();
|
|
76
|
+
const isOpen = useSubscriptionFlows((state) => state.isUsageReportOpen);
|
|
77
|
+
const close = useSubscriptionFlows((state) => state.closeUsageReport);
|
|
78
|
+
const { operations, isLoading } = useIaCreditOperations();
|
|
79
|
+
const adds = operations.filter((operation) => operation.operation === "add");
|
|
80
|
+
const subtracts = operations.filter((operation) => operation.operation === "subtract");
|
|
81
|
+
const purchases = adds.map((add) => {
|
|
82
|
+
const purchaseDate = add.datetime_add ? new Date(add.datetime_add) : /* @__PURE__ */ new Date();
|
|
83
|
+
const today = /* @__PURE__ */ new Date();
|
|
84
|
+
const todayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
85
|
+
const expiration = add.expiration_time ? new Date(add.expiration_time) : null;
|
|
86
|
+
const expirationDate = expiration && new Date(expiration.getFullYear(), expiration.getMonth(), expiration.getDate());
|
|
87
|
+
const expired = add.has_expired || expirationDate != null && expirationDate.getTime() < todayDate.getTime();
|
|
88
|
+
let expiresInDays = null;
|
|
89
|
+
if (!expired && expirationDate) {
|
|
90
|
+
const diffMs = expirationDate.getTime() - todayDate.getTime();
|
|
91
|
+
expiresInDays = Math.max(0, Math.ceil(diffMs / (1e3 * 60 * 60 * 24)));
|
|
92
|
+
}
|
|
93
|
+
const relatedSubtracts = subtracts.filter(
|
|
94
|
+
(subtract) => String(subtract.consumed_from_add_id) === String(add.id)
|
|
95
|
+
);
|
|
96
|
+
const consumedCredits = relatedSubtracts.reduce(
|
|
97
|
+
(sum, subtract) => sum + subtract.operation_value,
|
|
98
|
+
0
|
|
99
|
+
);
|
|
100
|
+
const groupsMap = /* @__PURE__ */ new Map();
|
|
101
|
+
for (const subtract of relatedSubtracts) {
|
|
102
|
+
const date = subtract.datetime_add ? new Date(subtract.datetime_add) : /* @__PURE__ */ new Date();
|
|
103
|
+
const dateLabel = date.toLocaleDateString("pt-BR");
|
|
104
|
+
const item = {
|
|
105
|
+
description: subtract.operation_ref || translate("defaultRef"),
|
|
106
|
+
author: subtract.user_name || translate("defaultUser"),
|
|
107
|
+
credits: subtract.operation_value
|
|
108
|
+
};
|
|
109
|
+
const existing = groupsMap.get(dateLabel);
|
|
110
|
+
if (existing) existing.items.push(item);
|
|
111
|
+
else groupsMap.set(dateLabel, { date: dateLabel, items: [item] });
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
id: String(add.id),
|
|
115
|
+
addedCredits: add.operation_value,
|
|
116
|
+
consumedCredits,
|
|
117
|
+
purchaseDateLabel: purchaseDate.toLocaleDateString("pt-BR"),
|
|
118
|
+
expiresInDays,
|
|
119
|
+
expired,
|
|
120
|
+
groups: Array.from(groupsMap.values())
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange: (nextOpen) => !nextOpen && close(), children: /* @__PURE__ */ jsxs(
|
|
124
|
+
SheetContent,
|
|
125
|
+
{
|
|
126
|
+
side: isMobile ? "bottom" : "right",
|
|
127
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
128
|
+
className: cn(
|
|
129
|
+
"flex flex-col gap-0 p-0",
|
|
130
|
+
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]!"
|
|
131
|
+
),
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ jsx(SheetHeader, { className: "px-4 sm:px-5 py-3 border-b border-zinc-200", children: /* @__PURE__ */ jsx(SheetTitle, { className: "paragraph-medium-semibold text-zinc-950", children: translate("title") }) }),
|
|
134
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 sm:gap-6 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 px-4 sm:px-5 py-5 sm:py-6", children: [
|
|
135
|
+
isLoading && purchases.length === 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-6", children: [0, 1, 2].map((key) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
137
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-40 rounded" }),
|
|
138
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-28 rounded" })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
141
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-40 rounded" }),
|
|
142
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24 rounded" })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-4 bg-zinc-50 rounded-lg", children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-32 rounded" }),
|
|
146
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-full rounded" }),
|
|
147
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-2/3 rounded" })
|
|
148
|
+
] })
|
|
149
|
+
] }, key)) }),
|
|
150
|
+
!isLoading && purchases.length === 0 && /* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-500", children: translate("noHistory") }),
|
|
151
|
+
purchases.map((purchase, index) => /* @__PURE__ */ jsxs("div", { children: [
|
|
152
|
+
index > 0 && /* @__PURE__ */ jsx(Separator, { className: "mb-6" }),
|
|
153
|
+
/* @__PURE__ */ jsx(PurchaseSection, { purchase })
|
|
154
|
+
] }, purchase.id))
|
|
155
|
+
] })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
) });
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
UsageReportSheet
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=UsageReportSheet.mjs.map
|