@greatapps/common 1.1.789 → 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 +41 -6
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -1
- package/dist/components/ui/overlay/Sheet.mjs +43 -13
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
- package/dist/components/ui/overlay/layers.mjs +72 -26
- 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 +20 -8
- 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 +70 -33
- package/src/components/ui/overlay/Sheet.tsx +89 -56
- package/src/components/ui/overlay/layers.tsx +114 -27
- 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,281 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { IconCheck, IconInfoCircle, IconStack2, IconUsers, IconWorld, IconX } from "@tabler/icons-react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import { Button } from "../../../../ui/buttons/Button";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../../../../ui/overlay/Tooltip";
|
|
7
|
+
import { useCurrencyFormatter } from "../../../../../modules/accounts/hooks/use-currency-formatter.hook";
|
|
8
|
+
import { useManagementPermissions } from "../../../../../modules/auth/hooks/useManagementPermissions";
|
|
9
|
+
import {
|
|
10
|
+
couponAllowedBillingPeriod,
|
|
11
|
+
isCouponApplicableToPlan
|
|
12
|
+
} from "../../../../../modules/coupons/utils/coupon-restrictions";
|
|
13
|
+
import { useCountDomains } from "../../../../../modules/domains/hooks/count-domains.hook";
|
|
14
|
+
import { getPlanTooltips } from "../../../../../modules/plans/constants/plan-tooltips.constants";
|
|
15
|
+
import { useEnrichedPlans } from "../../../../../modules/plans/hooks/use-enriched-plans.hook";
|
|
16
|
+
import { useUiPlans } from "../../../../../modules/plans/hooks/use-ui-plans.hook";
|
|
17
|
+
import {
|
|
18
|
+
ADDON_IDS,
|
|
19
|
+
buildAiCreditOptions,
|
|
20
|
+
AI_CREDIT_SIZES
|
|
21
|
+
} from "../../../../../modules/subscriptions/constants/addons.constants";
|
|
22
|
+
import { useCurrentSubscription } from "../../../../../modules/subscriptions/hooks/use-current-subscription.hook";
|
|
23
|
+
import { isFreeSubscription } from "../../../../../modules/subscriptions/utils/is-free-subscription";
|
|
24
|
+
import { roundDiscountPercent } from "../../../../../modules/subscriptions/utils/periodicity";
|
|
25
|
+
import { useExternalContracting, useIsDefaultWhitelabel } from "../../../../../providers/whitelabel.provider";
|
|
26
|
+
import { useSubscriptionFlows } from "../../../../../store/useSubscriptionFlows";
|
|
27
|
+
import { parseCurrencyToNumber } from "../../../../../utils/format/currency";
|
|
28
|
+
import { cn } from "../../../../../infra/utils/clsx";
|
|
29
|
+
function InfoTooltip({ tooltipKey, disabled }) {
|
|
30
|
+
const translate = useTranslations();
|
|
31
|
+
const planTooltips = getPlanTooltips(translate);
|
|
32
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: "flex items-center justify-center size-6 shrink-0", children: /* @__PURE__ */ jsx(
|
|
34
|
+
IconInfoCircle,
|
|
35
|
+
{
|
|
36
|
+
size: 16,
|
|
37
|
+
className: disabled ? "text-zinc-500 opacity-40" : "text-zinc-950"
|
|
38
|
+
}
|
|
39
|
+
) }) }),
|
|
40
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", className: "max-w-53.75 p-3", children: planTooltips[tooltipKey] })
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
function PlanCard({ plan, billingPeriod, couponStripeData, onBeforeAction }) {
|
|
44
|
+
const translate = useTranslations();
|
|
45
|
+
const translateCard = useTranslations("common.plans.card");
|
|
46
|
+
const translateCatalog = useTranslations("common.account.workspace.subscription.plansCatalog");
|
|
47
|
+
const isDefaultWhitelabel = useIsDefaultWhitelabel();
|
|
48
|
+
const { redirectToExternal } = useExternalContracting();
|
|
49
|
+
const { isOwnerOrAdmin } = useManagementPermissions();
|
|
50
|
+
const { formatCurrencyNumber } = useCurrencyFormatter();
|
|
51
|
+
const openChangePlan = useSubscriptionFlows((state) => state.openChangePlan);
|
|
52
|
+
const openDowngradeReason = useSubscriptionFlows((state) => state.openDowngradeReason);
|
|
53
|
+
const openCannotDowngrade = useSubscriptionFlows((state) => state.openCannotDowngrade);
|
|
54
|
+
const aiCreditOptions = buildAiCreditOptions(plan.items);
|
|
55
|
+
const defaultCredit = aiCreditOptions[0];
|
|
56
|
+
const includedAiCredits = plan.items.find((item) => item.id_addon === ADDON_IDS.AI && (item.value ?? 0) === 0)?.quantity ?? 0;
|
|
57
|
+
const includesAbTest = plan.items.some(
|
|
58
|
+
(item) => item.id_addon === ADDON_IDS.AB_TEST && item.quantity > 0
|
|
59
|
+
);
|
|
60
|
+
const { data: plans = [], subscriptionId } = useEnrichedPlans();
|
|
61
|
+
const { data: allPlans = [] } = useUiPlans();
|
|
62
|
+
const currentPlan = plans.find((item) => item.isCurrentPlan);
|
|
63
|
+
const { data: subscriptionData, isPending: isLoadingSubscription } = useCurrentSubscription();
|
|
64
|
+
const { data: registeredDomains = 0 } = useCountDomains();
|
|
65
|
+
const activeSubscription = subscriptionData?.data?.[0] ?? null;
|
|
66
|
+
const isFirstPurchase = !activeSubscription || !activeSubscription.active || isFreeSubscription(activeSubscription) || activeSubscription.type === "trial";
|
|
67
|
+
const isSubscriptionLoaded = !isLoadingSubscription;
|
|
68
|
+
const priceUnavailable = !!plan.priceUnavailable;
|
|
69
|
+
const couponApplies = isCouponApplicableToPlan(couponStripeData, plan.planId);
|
|
70
|
+
const couponPeriod = couponAllowedBillingPeriod(couponStripeData?.periodicity);
|
|
71
|
+
const couponActiveForCard = !!couponStripeData && isFirstPurchase && !priceUnavailable && couponApplies && (couponPeriod === null || couponPeriod === billingPeriod);
|
|
72
|
+
const couponPercentOff = couponStripeData?.percent_off ?? 0;
|
|
73
|
+
const couponAmountOff = couponStripeData?.amount_off ?? 0;
|
|
74
|
+
const computePriceData = () => {
|
|
75
|
+
if (priceUnavailable) {
|
|
76
|
+
return {
|
|
77
|
+
creditLabel: "",
|
|
78
|
+
creditPrice: "",
|
|
79
|
+
totalFormatted: plan.price,
|
|
80
|
+
promoTotalFormatted: "",
|
|
81
|
+
promoActive: false,
|
|
82
|
+
periodLabel: "",
|
|
83
|
+
upfrontNote: "",
|
|
84
|
+
badgePercent: 0
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const planPriceMonthly = parseCurrencyToNumber(plan.price);
|
|
88
|
+
const creditPriceMonthly = isDefaultWhitelabel ? defaultCredit.price ?? 0 : 0;
|
|
89
|
+
const baseMonthly = planPriceMonthly + creditPriceMonthly;
|
|
90
|
+
const periodDiscountFactor = (period) => {
|
|
91
|
+
const listMonthly = plan.pricingByPeriod?.monthly ?? 0;
|
|
92
|
+
const periodMonthly = plan.pricingByPeriod?.[period];
|
|
93
|
+
if (!listMonthly || periodMonthly == null) return 1;
|
|
94
|
+
return periodMonthly / listMonthly;
|
|
95
|
+
};
|
|
96
|
+
const periodPricingKey = billingPeriod === "annual" ? "annual" : billingPeriod === "semiannual" ? "semester" : "monthly";
|
|
97
|
+
const periodPricing = plan.pricing?.[periodPricingKey];
|
|
98
|
+
let months = 1;
|
|
99
|
+
let discountFactor = 1;
|
|
100
|
+
if (billingPeriod === "semiannual") {
|
|
101
|
+
months = 6;
|
|
102
|
+
discountFactor = periodDiscountFactor("semiannual");
|
|
103
|
+
} else if (billingPeriod === "annual") {
|
|
104
|
+
months = 12;
|
|
105
|
+
discountFactor = periodDiscountFactor("annual");
|
|
106
|
+
}
|
|
107
|
+
const badgePercent = periodPricing ? roundDiscountPercent(periodPricing.discount_percent) : 0;
|
|
108
|
+
const total = baseMonthly * months * discountFactor;
|
|
109
|
+
const promoTotal = couponActiveForCard ? couponPercentOff > 0 ? total * (1 - couponPercentOff / 100) : couponAmountOff > 0 ? Math.max(0, total - couponAmountOff / 100) : total : total;
|
|
110
|
+
const chargedTotal = couponActiveForCard && promoTotal < total ? promoTotal : total;
|
|
111
|
+
let upfrontNote = "";
|
|
112
|
+
if (billingPeriod === "annual") {
|
|
113
|
+
upfrontNote = translateCard("upfrontNoteAnnual", { price: formatCurrencyNumber(chargedTotal) });
|
|
114
|
+
} else if (billingPeriod === "semiannual") {
|
|
115
|
+
upfrontNote = translateCard("upfrontNoteSemiannual", {
|
|
116
|
+
price: formatCurrencyNumber(chargedTotal)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
creditLabel: isDefaultWhitelabel && defaultCredit.credits !== AI_CREDIT_SIZES[0] ? translateCard("aiCreditsLabel", { credits: defaultCredit.credits.toLocaleString("pt-BR") }) : "",
|
|
121
|
+
creditPrice: defaultCredit.price === 0 ? translateCard("defaultPrice") : formatCurrencyNumber(defaultCredit.price),
|
|
122
|
+
totalFormatted: formatCurrencyNumber(total / months),
|
|
123
|
+
promoTotalFormatted: formatCurrencyNumber(promoTotal / months),
|
|
124
|
+
promoActive: couponActiveForCard && promoTotal < total,
|
|
125
|
+
periodLabel: translate("common.periodicity.suffixMonthly"),
|
|
126
|
+
upfrontNote,
|
|
127
|
+
badgePercent
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
const handleSelectPlan = () => {
|
|
131
|
+
if (priceUnavailable || !isSubscriptionLoaded) return;
|
|
132
|
+
if (redirectToExternal(isFirstPurchase ? "plans" : "contracting")) return;
|
|
133
|
+
const targetPlan = allPlans.find((item) => item.planId === plan.planId);
|
|
134
|
+
const targetDomainItem = targetPlan?.items.find((item) => item.id_addon === ADDON_IDS.DOMAINS);
|
|
135
|
+
const targetIncludedDomains = targetDomainItem?.quantity ?? 0;
|
|
136
|
+
const targetSupportsExtraDomains = !!targetDomainItem && targetDomainItem.quantity > 1;
|
|
137
|
+
const targetPagesItem = targetPlan?.items.find((item) => item.id_addon === ADDON_IDS.PAGES);
|
|
138
|
+
const targetIncludedPages = targetPagesItem && targetPagesItem.quantity > 0 ? targetPagesItem.quantity : null;
|
|
139
|
+
const newPlanMonthly = plan.pricingByPeriod?.monthly ?? parseCurrencyToNumber(plan.price);
|
|
140
|
+
const currentPlanMonthly = currentPlan ? currentPlan.pricingByPeriod?.monthly ?? parseCurrencyToNumber(currentPlan.price) : 0;
|
|
141
|
+
const isDowngrade = !isFirstPurchase && newPlanMonthly < currentPlanMonthly;
|
|
142
|
+
const downgradeData = {
|
|
143
|
+
targetPlan: plan,
|
|
144
|
+
planName: plan.name,
|
|
145
|
+
billingPeriod,
|
|
146
|
+
planIncludedDomains: targetIncludedDomains,
|
|
147
|
+
planIncludedPages: targetIncludedPages,
|
|
148
|
+
registeredDomains
|
|
149
|
+
};
|
|
150
|
+
onBeforeAction?.();
|
|
151
|
+
if (isDowngrade) {
|
|
152
|
+
openDowngradeReason(downgradeData);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (!targetSupportsExtraDomains && registeredDomains > targetIncludedDomains) {
|
|
156
|
+
openCannotDowngrade({ ...downgradeData, domainsExceeded: true, pagesExceeded: false });
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (isFirstPurchase) {
|
|
160
|
+
openChangePlan({ targetPlan: plan, billingPeriod, isReactivation: true, selectedCreditIndex: 0 });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (subscriptionId == null) return;
|
|
164
|
+
openChangePlan({ targetPlan: plan, billingPeriod, isDowngrade, selectedCreditIndex: 0 });
|
|
165
|
+
};
|
|
166
|
+
const priceData = computePriceData();
|
|
167
|
+
const isCurrentForPeriod = plan.isCurrentPlan && plan.currentPeriodicity === billingPeriod;
|
|
168
|
+
const shouldShowCurrentPlanBadge = isCurrentForPeriod && !isFreeSubscription(activeSubscription) && activeSubscription?.type !== "trial" && !activeSubscription?.date_cancellation;
|
|
169
|
+
return /* @__PURE__ */ jsxs(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
className: cn(
|
|
173
|
+
"flex flex-col flex-1 min-w-0 rounded-lg overflow-hidden relative",
|
|
174
|
+
plan.isPopular ? "bg-primary" : "border border-zinc-200"
|
|
175
|
+
),
|
|
176
|
+
children: [
|
|
177
|
+
plan.isPopular && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-8 px-1.5 shrink-0 bg-primary", children: /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold text-zinc-950", children: translateCard("mostPopular") }) }),
|
|
178
|
+
/* @__PURE__ */ jsxs(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
className: cn(
|
|
182
|
+
"flex flex-col flex-1 bg-white overflow-hidden relative",
|
|
183
|
+
plan.isPopular && "border-2 border-primary rounded-lg"
|
|
184
|
+
),
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ jsx("div", { className: "pt-2 px-2 bg-white shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-5 bg-zinc-50 rounded", children: [
|
|
187
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
188
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-zinc-950 font-outfit", children: plan.name }),
|
|
189
|
+
priceData.promoActive && /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-md bg-cyan-50 px-2 py-1 paragraph-xsmall-semibold text-cyan-700", children: translateCard("promoBadge") })
|
|
190
|
+
] }),
|
|
191
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
192
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
193
|
+
/* @__PURE__ */ jsx(IconStack2, { size: 16, className: "text-zinc-950 shrink-0" }),
|
|
194
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950", children: plan.mainFeatures.pages })
|
|
195
|
+
] }),
|
|
196
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
197
|
+
/* @__PURE__ */ jsx(IconWorld, { size: 16, className: "text-zinc-950 shrink-0" }),
|
|
198
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950", children: plan.mainFeatures.domains }),
|
|
199
|
+
/* @__PURE__ */ jsx(InfoTooltip, { tooltipKey: "domains" })
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
202
|
+
/* @__PURE__ */ jsx(IconUsers, { size: 16, className: "text-zinc-950 shrink-0" }),
|
|
203
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950", children: plan.mainFeatures.users }),
|
|
204
|
+
/* @__PURE__ */ jsx(InfoTooltip, { tooltipKey: "users" })
|
|
205
|
+
] })
|
|
206
|
+
] })
|
|
207
|
+
] }) }),
|
|
208
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 p-6 bg-white", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
209
|
+
plan.features.map((feature, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
210
|
+
feature.icon === "check" ? /* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 shrink-0" }) : /* @__PURE__ */ jsx(IconX, { size: 16, className: "text-zinc-950 shrink-0" }),
|
|
211
|
+
/* @__PURE__ */ jsx(
|
|
212
|
+
"span",
|
|
213
|
+
{
|
|
214
|
+
className: cn(
|
|
215
|
+
"paragraph-small-medium text-zinc-500",
|
|
216
|
+
feature.disabled && "opacity-40"
|
|
217
|
+
),
|
|
218
|
+
children: feature.text
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
feature.tooltip && /* @__PURE__ */ jsx(InfoTooltip, { tooltipKey: feature.tooltip, disabled: feature.disabled })
|
|
222
|
+
] }, index)),
|
|
223
|
+
includesAbTest && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
224
|
+
/* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 shrink-0" }),
|
|
225
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-500", children: translateCard("abTestIncluded") })
|
|
226
|
+
] }),
|
|
227
|
+
isDefaultWhitelabel && includedAiCredits > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
228
|
+
/* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 shrink-0" }),
|
|
229
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-500", children: translateCard("aiCreditsIncluded", {
|
|
230
|
+
credits: includedAiCredits.toLocaleString("pt-BR")
|
|
231
|
+
}) })
|
|
232
|
+
] })
|
|
233
|
+
] }) }),
|
|
234
|
+
/* @__PURE__ */ jsxs("div", { className: "shrink-0 relative", children: [
|
|
235
|
+
/* @__PURE__ */ jsx("div", { className: "absolute -top-6 left-0 right-0 h-6 bg-linear-to-t from-white to-transparent pointer-events-none" }),
|
|
236
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-6 border-t border-zinc-200 bg-white", children: [
|
|
237
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
238
|
+
priceData.promoActive ? /* @__PURE__ */ jsxs("span", { className: "paragraph-xsmall-medium text-zinc-500 line-through", children: [
|
|
239
|
+
translateCard("promoFrom"),
|
|
240
|
+
" ",
|
|
241
|
+
priceData.totalFormatted
|
|
242
|
+
] }) : priceData.badgePercent > 0 && /* @__PURE__ */ jsx("span", { className: "w-fit paragraph-xsmall-semibold h-5 flex items-center px-1.5 rounded bg-green-50 text-green-600 border border-green-100", children: translateCatalog("discountBadge", { percent: String(priceData.badgePercent) }) }),
|
|
243
|
+
/* @__PURE__ */ jsxs("p", { className: "paragraph-xlarge-semibold text-zinc-950 tracking-[-0.24px] font-outfit", children: [
|
|
244
|
+
priceData.promoActive ? priceData.promoTotalFormatted : priceData.totalFormatted,
|
|
245
|
+
/* @__PURE__ */ jsxs("span", { className: "paragraph-xsmall-medium text-zinc-500", children: [
|
|
246
|
+
" ",
|
|
247
|
+
priceData.periodLabel
|
|
248
|
+
] })
|
|
249
|
+
] })
|
|
250
|
+
] }),
|
|
251
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
252
|
+
shouldShowCurrentPlanBadge ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 h-12", children: [
|
|
253
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center size-6 bg-zinc-200 rounded-full shrink-0", children: /* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950" }) }),
|
|
254
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: translateCard("currentPlan") })
|
|
255
|
+
] }) : isOwnerOrAdmin ? /* @__PURE__ */ jsx(
|
|
256
|
+
Button,
|
|
257
|
+
{
|
|
258
|
+
className: cn(
|
|
259
|
+
"w-full h-12 paragraph-small-semibold",
|
|
260
|
+
plan.buttonVariant === "brand" ? "bg-primary hover:bg-primary text-zinc-950" : "bg-zinc-950 hover:bg-zinc-950 text-white"
|
|
261
|
+
),
|
|
262
|
+
onClick: handleSelectPlan,
|
|
263
|
+
disabled: priceUnavailable,
|
|
264
|
+
children: translateCard("selectPlan")
|
|
265
|
+
}
|
|
266
|
+
) : null,
|
|
267
|
+
priceData.upfrontNote && /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-zinc-500 text-center text-balance", children: priceData.upfrontNote })
|
|
268
|
+
] })
|
|
269
|
+
] })
|
|
270
|
+
] })
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
export {
|
|
279
|
+
PlanCard
|
|
280
|
+
};
|
|
281
|
+
//# sourceMappingURL=PlanCard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/account/sections/subscription/plans/PlanCard.tsx"],"sourcesContent":["'use client';\n\nimport { IconCheck, IconInfoCircle, IconStack2, IconUsers, IconWorld, IconX } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../../../../ui/buttons/Button';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../../../ui/overlay/Tooltip';\nimport { useCurrencyFormatter } from '../../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { useManagementPermissions } from '../../../../../modules/auth/hooks/useManagementPermissions';\nimport {\n couponAllowedBillingPeriod,\n isCouponApplicableToPlan,\n} from '../../../../../modules/coupons/utils/coupon-restrictions';\nimport type { CouponStripeData } from '../../../../../modules/coupons/types/coupon.type';\nimport { useCountDomains } from '../../../../../modules/domains/hooks/count-domains.hook';\nimport { getPlanTooltips } from '../../../../../modules/plans/constants/plan-tooltips.constants';\nimport { useEnrichedPlans } from '../../../../../modules/plans/hooks/use-enriched-plans.hook';\nimport { useUiPlans } from '../../../../../modules/plans/hooks/use-ui-plans.hook';\nimport type { PlanTooltips, UiPlan } from '../../../../../modules/plans/types/plan.type';\nimport {\n ADDON_IDS,\n buildAiCreditOptions,\n AI_CREDIT_SIZES,\n} from '../../../../../modules/subscriptions/constants/addons.constants';\nimport { useCurrentSubscription } from '../../../../../modules/subscriptions/hooks/use-current-subscription.hook';\nimport type { BillingPeriod } from '../../../../../modules/subscriptions/types/billing-period.type';\nimport { isFreeSubscription } from '../../../../../modules/subscriptions/utils/is-free-subscription';\nimport { roundDiscountPercent } from '../../../../../modules/subscriptions/utils/periodicity';\nimport { useExternalContracting, useIsDefaultWhitelabel } from '../../../../../providers/whitelabel.provider';\nimport { useSubscriptionFlows } from '../../../../../store/useSubscriptionFlows';\nimport { parseCurrencyToNumber } from '../../../../../utils/format/currency';\nimport { cn } from '../../../../../infra/utils/clsx';\n\nfunction InfoTooltip({ tooltipKey, disabled }: { tooltipKey: keyof PlanTooltips; disabled?: boolean }) {\n const translate = useTranslations();\n const planTooltips = getPlanTooltips(translate);\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button type=\"button\" className=\"flex items-center justify-center size-6 shrink-0\">\n <IconInfoCircle\n size={16}\n className={disabled ? 'text-zinc-500 opacity-40' : 'text-zinc-950'}\n />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\" className=\"max-w-53.75 p-3\">\n {planTooltips[tooltipKey]}\n </TooltipContent>\n </Tooltip>\n );\n}\n\ninterface PlanCardProps {\n plan: UiPlan;\n billingPeriod: BillingPeriod;\n couponStripeData?: CouponStripeData | null;\n onBeforeAction?: () => void;\n}\n\n/** Card do catálogo: recursos do plano, preço no período escolhido e a ação de contratar/trocar. */\nexport function PlanCard({ plan, billingPeriod, couponStripeData, onBeforeAction }: PlanCardProps) {\n const translate = useTranslations();\n const translateCard = useTranslations('common.plans.card');\n const translateCatalog = useTranslations('common.account.workspace.subscription.plansCatalog');\n const isDefaultWhitelabel = useIsDefaultWhitelabel();\n const { redirectToExternal } = useExternalContracting();\n const { isOwnerOrAdmin } = useManagementPermissions();\n const { formatCurrencyNumber } = useCurrencyFormatter();\n\n const openChangePlan = useSubscriptionFlows((state) => state.openChangePlan);\n const openDowngradeReason = useSubscriptionFlows((state) => state.openDowngradeReason);\n const openCannotDowngrade = useSubscriptionFlows((state) => state.openCannotDowngrade);\n\n const aiCreditOptions = buildAiCreditOptions(plan.items);\n const defaultCredit = aiCreditOptions[0];\n // Créditos de IA inclusos no plano = item AI (id_addon 6) com value 0 (base/incluso).\n // Lido do live plan.items; a quantidade varia por plano (não hardcodar).\n const includedAiCredits =\n plan.items.find((item) => item.id_addon === ADDON_IDS.AI && (item.value ?? 0) === 0)?.quantity ?? 0;\n // Plano inclui Teste A/B quando há item AB_TEST (id_addon 4) — espelha a lógica do\n // PlanDetailsSheet (item da assinatura com quantity > 0). Agência exibe como incluso.\n const includesAbTest = plan.items.some(\n (item) => item.id_addon === ADDON_IDS.AB_TEST && item.quantity > 0\n );\n\n const { data: plans = [], subscriptionId } = useEnrichedPlans();\n const { data: allPlans = [] } = useUiPlans();\n const currentPlan = plans.find((item) => item.isCurrentPlan);\n\n const { data: subscriptionData, isPending: isLoadingSubscription } = useCurrentSubscription();\n const { data: registeredDomains = 0 } = useCountDomains();\n\n const activeSubscription = subscriptionData?.data?.[0] ?? null;\n const isFirstPurchase =\n !activeSubscription ||\n !activeSubscription.active ||\n isFreeSubscription(activeSubscription) ||\n activeSubscription.type === 'trial';\n const isSubscriptionLoaded = !isLoadingSubscription;\n\n const priceUnavailable = !!plan.priceUnavailable;\n\n // Cupom da campanha: badge + preço promocional só no(s) plano(s) e periodicidade que ele\n // cobre, e só na primeira contratação (regra da oferta). O desconto é calculado a partir\n // do stripe_data do cupom (mesma fonte usada pela troca de plano via getCouponByCode).\n const couponApplies = isCouponApplicableToPlan(couponStripeData, plan.planId);\n const couponPeriod = couponAllowedBillingPeriod(couponStripeData?.periodicity);\n const couponActiveForCard =\n !!couponStripeData &&\n isFirstPurchase &&\n !priceUnavailable &&\n couponApplies &&\n (couponPeriod === null || couponPeriod === billingPeriod);\n const couponPercentOff = couponStripeData?.percent_off ?? 0;\n const couponAmountOff = couponStripeData?.amount_off ?? 0; // centavos (Stripe)\n\n const computePriceData = () => {\n if (priceUnavailable) {\n return {\n creditLabel: '',\n creditPrice: '',\n totalFormatted: plan.price,\n promoTotalFormatted: '',\n promoActive: false,\n periodLabel: '',\n upfrontNote: '',\n badgePercent: 0,\n };\n }\n\n const planPriceMonthly = parseCurrencyToNumber(plan.price);\n const creditPriceMonthly = isDefaultWhitelabel ? (defaultCredit.price ?? 0) : 0;\n const baseMonthly = planPriceMonthly + creditPriceMonthly;\n\n // O desconto de periodicidade varia por plano e por moeda, então sai da razão entre o\n // mensal do período e o mensal avulso, ambos já resolvidos pela API.\n const periodDiscountFactor = (period: 'semiannual' | 'annual') => {\n const listMonthly = plan.pricingByPeriod?.monthly ?? 0;\n const periodMonthly = plan.pricingByPeriod?.[period];\n if (!listMonthly || periodMonthly == null) return 1;\n return periodMonthly / listMonthly;\n };\n\n const periodPricingKey =\n billingPeriod === 'annual' ? 'annual' : billingPeriod === 'semiannual' ? 'semester' : 'monthly';\n const periodPricing = plan.pricing?.[periodPricingKey];\n\n let months = 1;\n let discountFactor = 1;\n if (billingPeriod === 'semiannual') {\n months = 6;\n discountFactor = periodDiscountFactor('semiannual');\n } else if (billingPeriod === 'annual') {\n months = 12;\n discountFactor = periodDiscountFactor('annual');\n }\n\n const badgePercent = periodPricing ? roundDiscountPercent(periodPricing.discount_percent) : 0;\n const total = baseMonthly * months * discountFactor;\n\n const promoTotal = couponActiveForCard\n ? couponPercentOff > 0\n ? total * (1 - couponPercentOff / 100)\n : couponAmountOff > 0\n ? Math.max(0, total - couponAmountOff / 100)\n : total\n : total;\n\n // O card anuncia o equivalente mensal e repete embaixo o valor à vista; o cálculo acima\n // continua no total do período porque cupom de valor fixo desconta sobre ele.\n const chargedTotal = couponActiveForCard && promoTotal < total ? promoTotal : total;\n let upfrontNote = '';\n if (billingPeriod === 'annual') {\n upfrontNote = translateCard('upfrontNoteAnnual', { price: formatCurrencyNumber(chargedTotal) });\n } else if (billingPeriod === 'semiannual') {\n upfrontNote = translateCard('upfrontNoteSemiannual', {\n price: formatCurrencyNumber(chargedTotal),\n });\n }\n\n return {\n creditLabel:\n isDefaultWhitelabel && defaultCredit.credits !== AI_CREDIT_SIZES[0]\n ? translateCard('aiCreditsLabel', { credits: defaultCredit.credits.toLocaleString('pt-BR') })\n : '',\n creditPrice:\n defaultCredit.price === 0\n ? translateCard('defaultPrice')\n : formatCurrencyNumber(defaultCredit.price),\n totalFormatted: formatCurrencyNumber(total / months),\n promoTotalFormatted: formatCurrencyNumber(promoTotal / months),\n promoActive: couponActiveForCard && promoTotal < total,\n periodLabel: translate('common.periodicity.suffixMonthly'),\n upfrontNote,\n badgePercent,\n };\n };\n\n const handleSelectPlan = () => {\n if (priceUnavailable || !isSubscriptionLoaded) return;\n\n // Contratação externa do whitelabel tem prioridade sobre qualquer fluxo interno.\n if (redirectToExternal(isFirstPurchase ? 'plans' : 'contracting')) return;\n\n const targetPlan = allPlans.find((item) => item.planId === plan.planId);\n const targetDomainItem = targetPlan?.items.find((item) => item.id_addon === ADDON_IDS.DOMAINS);\n const targetIncludedDomains = targetDomainItem?.quantity ?? 0;\n const targetSupportsExtraDomains = !!targetDomainItem && targetDomainItem.quantity > 1;\n\n // Limite de páginas publicadas do plano alvo (0/ausente = ilimitadas).\n const targetPagesItem = targetPlan?.items.find((item) => item.id_addon === ADDON_IDS.PAGES);\n const targetIncludedPages =\n targetPagesItem && targetPagesItem.quantity > 0 ? targetPagesItem.quantity : null;\n\n const newPlanMonthly = plan.pricingByPeriod?.monthly ?? parseCurrencyToNumber(plan.price);\n const currentPlanMonthly = currentPlan\n ? (currentPlan.pricingByPeriod?.monthly ?? parseCurrencyToNumber(currentPlan.price))\n : 0;\n const isDowngrade = !isFirstPurchase && newPlanMonthly < currentPlanMonthly;\n\n const downgradeData = {\n targetPlan: plan,\n planName: plan.name,\n billingPeriod,\n planIncludedDomains: targetIncludedDomains,\n planIncludedPages: targetIncludedPages,\n registeredDomains,\n };\n\n onBeforeAction?.();\n\n // Downgrade coleta o motivo primeiro; conflitos de domínio/página são conferidos lá.\n if (isDowngrade) {\n openDowngradeReason(downgradeData);\n return;\n }\n\n // O plano alvo não vende domínios extras e a conta tem mais do que o incluso: abre o\n // roteiro de ajuste em vez de deixar a troca falhar no pagamento.\n if (!targetSupportsExtraDomains && registeredDomains > targetIncludedDomains) {\n openCannotDowngrade({ ...downgradeData, domainsExceeded: true, pagesExceeded: false });\n return;\n }\n\n\n // Sem assinatura paga corrente a troca é uma contratação: o fluxo de reativação já cria a\n // assinatura do zero (mesmo caminho do checkout do gapps), com o plano escolhido aqui.\n if (isFirstPurchase) {\n openChangePlan({ targetPlan: plan, billingPeriod, isReactivation: true, selectedCreditIndex: 0 });\n return;\n }\n\n if (subscriptionId == null) return;\n\n openChangePlan({ targetPlan: plan, billingPeriod, isDowngrade, selectedCreditIndex: 0 });\n };\n\n const priceData = computePriceData();\n const isCurrentForPeriod = plan.isCurrentPlan && plan.currentPeriodicity === billingPeriod;\n const shouldShowCurrentPlanBadge =\n isCurrentForPeriod &&\n !isFreeSubscription(activeSubscription) &&\n activeSubscription?.type !== 'trial' &&\n !activeSubscription?.date_cancellation;\n\n return (\n <div\n className={cn(\n 'flex flex-col flex-1 min-w-0 rounded-lg overflow-hidden relative',\n plan.isPopular ? 'bg-primary' : 'border border-zinc-200'\n )}\n >\n {plan.isPopular && (\n <div className=\"flex items-center justify-center h-8 px-1.5 shrink-0 bg-primary\">\n <span className=\"paragraph-xsmall-semibold text-zinc-950\">\n {translateCard('mostPopular')}\n </span>\n </div>\n )}\n\n <div\n className={cn(\n 'flex flex-col flex-1 bg-white overflow-hidden relative',\n plan.isPopular && 'border-2 border-primary rounded-lg'\n )}\n >\n <div className=\"pt-2 px-2 bg-white shrink-0\">\n <div className=\"flex flex-col gap-6 p-5 bg-zinc-50 rounded\">\n <div className=\"flex items-start justify-between gap-2\">\n <span className=\"paragraph-medium-semibold text-zinc-950 font-outfit\">{plan.name}</span>\n {priceData.promoActive && (\n <span className=\"shrink-0 rounded-md bg-cyan-50 px-2 py-1 paragraph-xsmall-semibold text-cyan-700\">\n {translateCard('promoBadge')}\n </span>\n )}\n </div>\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex items-center gap-2\">\n <IconStack2 size={16} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-medium text-zinc-950\">{plan.mainFeatures.pages}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <IconWorld size={16} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-medium text-zinc-950\">\n {plan.mainFeatures.domains}\n </span>\n <InfoTooltip tooltipKey=\"domains\" />\n </div>\n <div className=\"flex items-center gap-2\">\n <IconUsers size={16} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-medium text-zinc-950\">{plan.mainFeatures.users}</span>\n <InfoTooltip tooltipKey=\"users\" />\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"flex-1 p-6 bg-white\">\n <div className=\"flex flex-col gap-3\">\n {plan.features.map((feature, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {feature.icon === 'check' ? (\n <IconCheck size={16} className=\"text-zinc-950 shrink-0\" />\n ) : (\n <IconX size={16} className=\"text-zinc-950 shrink-0\" />\n )}\n <span\n className={cn(\n 'paragraph-small-medium text-zinc-500',\n feature.disabled && 'opacity-40'\n )}\n >\n {feature.text}\n </span>\n {feature.tooltip && (\n <InfoTooltip tooltipKey={feature.tooltip} disabled={feature.disabled} />\n )}\n </div>\n ))}\n {includesAbTest && (\n <div className=\"flex items-center gap-2\">\n <IconCheck size={16} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-medium text-zinc-500\">\n {translateCard('abTestIncluded')}\n </span>\n </div>\n )}\n {isDefaultWhitelabel && includedAiCredits > 0 && (\n <div className=\"flex items-center gap-2\">\n <IconCheck size={16} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-medium text-zinc-500\">\n {translateCard('aiCreditsIncluded', {\n credits: includedAiCredits.toLocaleString('pt-BR'),\n })}\n </span>\n </div>\n )}\n </div>\n </div>\n\n <div className=\"shrink-0 relative\">\n <div className=\"absolute -top-6 left-0 right-0 h-6 bg-linear-to-t from-white to-transparent pointer-events-none\" />\n <div className=\"flex flex-col gap-6 p-6 border-t border-zinc-200 bg-white\">\n <div className=\"flex flex-col gap-2\">\n {priceData.promoActive ? (\n <span className=\"paragraph-xsmall-medium text-zinc-500 line-through\">\n {translateCard('promoFrom')} {priceData.totalFormatted}\n </span>\n ) : (\n priceData.badgePercent > 0 && (\n <span className=\"w-fit paragraph-xsmall-semibold h-5 flex items-center px-1.5 rounded bg-green-50 text-green-600 border border-green-100\">\n {translateCatalog('discountBadge', { percent: String(priceData.badgePercent) })}\n </span>\n )\n )}\n <p className=\"paragraph-xlarge-semibold text-zinc-950 tracking-[-0.24px] font-outfit\">\n {priceData.promoActive ? priceData.promoTotalFormatted : priceData.totalFormatted}\n <span className=\"paragraph-xsmall-medium text-zinc-500\"> {priceData.periodLabel}</span>\n </p>\n </div>\n <div className=\"flex flex-col gap-2\">\n {shouldShowCurrentPlanBadge ? (\n <div className=\"flex items-center gap-3 h-12\">\n <div className=\"flex items-center justify-center size-6 bg-zinc-200 rounded-full shrink-0\">\n <IconCheck size={16} className=\"text-zinc-950\" />\n </div>\n <span className=\"paragraph-small-semibold text-zinc-950\">\n {translateCard('currentPlan')}\n </span>\n </div>\n ) : isOwnerOrAdmin ? (\n <Button\n className={cn(\n 'w-full h-12 paragraph-small-semibold',\n plan.buttonVariant === 'brand'\n ? 'bg-primary hover:bg-primary text-zinc-950'\n : 'bg-zinc-950 hover:bg-zinc-950 text-white'\n )}\n onClick={handleSelectPlan}\n disabled={priceUnavailable}\n >\n {translateCard('selectPlan')}\n </Button>\n ) : null}\n {priceData.upfrontNote && (\n <span className=\"paragraph-xsmall-medium text-zinc-500 text-center text-balance\">\n {priceData.upfrontNote}\n </span>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";AAqCI,SAGM,KAHN;AAnCJ,SAAS,WAAW,gBAAgB,YAAY,WAAW,WAAW,aAAa;AACnF,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AAEvC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,wBAAwB,8BAA8B;AAC/D,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,UAAU;AAEnB,SAAS,YAAY,EAAE,YAAY,SAAS,GAA2D;AACrG,QAAM,YAAY,gBAAgB;AAClC,QAAM,eAAe,g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AAsB,UAAU;AAAA,sBACnE,qBAAC,UAAK,WAAU,yCAAwC;AAAA;AAAA,wBAAE,UAAU;AAAA,yBAAY;AAAA,uBAClF;AAAA,qBACF;AAAA,kBACA,qBAAC,SAAI,WAAU,uBACZ;AAAA,iDACC,qBAAC,SAAI,WAAU,gCACb;AAAA,0CAAC,SAAI,WAAU,6EACb,8BAAC,aAAU,MAAM,IAAI,WAAU,iBAAgB,GACjD;AAAA,sBACA,oBAAC,UAAK,WAAU,0CACb,wBAAc,aAAa,GAC9B;AAAA,uBACF,IACE,iBACF;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAW;AAAA,0BACT;AAAA,0BACA,KAAK,kBAAkB,UACnB,8CACA;AAAA,wBACN;AAAA,wBACA,SAAS;AAAA,wBACT,UAAU;AAAA,wBAET,wBAAc,YAAY;AAAA;AAAA,oBAC7B,IACE;AAAA,oBACH,UAAU,eACT,oBAAC,UAAK,WAAU,kEACb,oBAAU,aACb;AAAA,qBAEJ;AAAA,mBACF;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton } from "../../../../ui/feedback/Skeleton";
|
|
3
|
+
import { cn } from "../../../../../infra/utils/clsx";
|
|
4
|
+
function PlanCardSkeleton({ isPopular, isDefaultWhitelabel = true }) {
|
|
5
|
+
const accentBg = isDefaultWhitelabel ? "bg-cyan-300" : "bg-zinc-300";
|
|
6
|
+
const accentBorder = isDefaultWhitelabel ? "border-cyan-300" : "border-zinc-300";
|
|
7
|
+
const skeletonBg = isDefaultWhitelabel ? "bg-cyan-200" : "bg-zinc-200";
|
|
8
|
+
return /* @__PURE__ */ jsxs(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: cn(
|
|
12
|
+
"flex flex-col flex-1 min-w-0 rounded-lg overflow-hidden relative",
|
|
13
|
+
isPopular ? accentBg : "border border-zinc-200"
|
|
14
|
+
),
|
|
15
|
+
children: [
|
|
16
|
+
isPopular && /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center h-8 px-1.5 shrink-0", accentBg), children: /* @__PURE__ */ jsx(Skeleton, { className: cn("h-3 w-20", skeletonBg) }) }),
|
|
17
|
+
/* @__PURE__ */ jsxs(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
className: cn(
|
|
21
|
+
"flex flex-col flex-1 bg-white overflow-hidden relative",
|
|
22
|
+
isPopular && `border-2 ${accentBorder} rounded-lg`
|
|
23
|
+
),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "pt-2 px-2 bg-white shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-5 bg-zinc-50 rounded", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" }),
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: [1, 2, 3].map((row) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
28
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "size-4 rounded shrink-0" }),
|
|
29
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3.5 w-32" })
|
|
30
|
+
] }, row)) })
|
|
31
|
+
] }) }),
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 p-6 bg-white", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: [120, 110, 140, 125, 130, 100, 145, 115].map((width, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "size-4 rounded shrink-0" }),
|
|
34
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3.5", style: { width } })
|
|
35
|
+
] }, index)) }) }),
|
|
36
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-6 border-t border-zinc-200 bg-white", children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16" }),
|
|
39
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-36" })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-full rounded-lg" })
|
|
42
|
+
] }) })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
PlanCardSkeleton
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=PlanCardSkeleton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/account/sections/subscription/plans/PlanCardSkeleton.tsx"],"sourcesContent":["import { Skeleton } from '../../../../ui/feedback/Skeleton';\nimport { cn } from '../../../../../infra/utils/clsx';\n\ninterface PlanCardSkeletonProps {\n isPopular?: boolean;\n isDefaultWhitelabel?: boolean;\n}\n\n/** Esqueleto do card enquanto o catálogo (e o cupom da campanha) carrega. */\nexport function PlanCardSkeleton({ isPopular, isDefaultWhitelabel = true }: PlanCardSkeletonProps) {\n const accentBg = isDefaultWhitelabel ? 'bg-cyan-300' : 'bg-zinc-300';\n const accentBorder = isDefaultWhitelabel ? 'border-cyan-300' : 'border-zinc-300';\n const skeletonBg = isDefaultWhitelabel ? 'bg-cyan-200' : 'bg-zinc-200';\n\n return (\n <div\n className={cn(\n 'flex flex-col flex-1 min-w-0 rounded-lg overflow-hidden relative',\n isPopular ? accentBg : 'border border-zinc-200'\n )}\n >\n {isPopular && (\n <div className={cn('flex items-center justify-center h-8 px-1.5 shrink-0', accentBg)}>\n <Skeleton className={cn('h-3 w-20', skeletonBg)} />\n </div>\n )}\n <div\n className={cn(\n 'flex flex-col flex-1 bg-white overflow-hidden relative',\n isPopular && `border-2 ${accentBorder} rounded-lg`\n )}\n >\n <div className=\"pt-2 px-2 bg-white shrink-0\">\n <div className=\"flex flex-col gap-6 p-5 bg-zinc-50 rounded\">\n <Skeleton className=\"h-4 w-24\" />\n <div className=\"flex flex-col gap-3\">\n {[1, 2, 3].map((row) => (\n <div key={row} className=\"flex items-center gap-2\">\n <Skeleton className=\"size-4 rounded shrink-0\" />\n <Skeleton className=\"h-3.5 w-32\" />\n </div>\n ))}\n </div>\n </div>\n </div>\n\n <div className=\"flex-1 p-6 bg-white\">\n <div className=\"flex flex-col gap-3\">\n {[120, 110, 140, 125, 130, 100, 145, 115].map((width, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n <Skeleton className=\"size-4 rounded shrink-0\" />\n <Skeleton className=\"h-3.5\" style={{ width }} />\n </div>\n ))}\n </div>\n </div>\n\n <div className=\"shrink-0\">\n <div className=\"flex flex-col gap-6 p-6 border-t border-zinc-200 bg-white\">\n <div className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-3 w-16\" />\n <Skeleton className=\"h-5 w-36\" />\n </div>\n <Skeleton className=\"h-12 w-full rounded-lg\" />\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":"AAuBU,cAcM,YAdN;AAvBV,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAQZ,SAAS,iBAAiB,EAAE,WAAW,sBAAsB,KAAK,GAA0B;AACjG,QAAM,WAAW,sBAAsB,gBAAgB;AACvD,QAAM,eAAe,sBAAsB,oBAAoB;AAC/D,QAAM,aAAa,sBAAsB,gBAAgB;AAEzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,YAAY,WAAW;AAAA,MACzB;AAAA,MAEC;AAAA,qBACC,oBAAC,SAAI,WAAW,GAAG,wDAAwD,QAAQ,GACjF,8BAAC,YAAS,WAAW,GAAG,YAAY,UAAU,GAAG,GACnD;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,aAAa,YAAY,YAAY;AAAA,YACvC;AAAA,YAEA;AAAA,kCAAC,SAAI,WAAU,+BACb,+BAAC,SAAI,WAAU,8CACb;AAAA,oCAAC,YAAS,WAAU,YAAW;AAAA,gBAC/B,oBAAC,SAAI,WAAU,uBACZ,WAAC,GAAG,GAAG,CAAC,EAAE,IAAI,CAAC,QACd,qBAAC,SAAc,WAAU,2BACvB;AAAA,sCAAC,YAAS,WAAU,2BAA0B;AAAA,kBAC9C,oBAAC,YAAS,WAAU,cAAa;AAAA,qBAFzB,GAGV,CACD,GACH;AAAA,iBACF,GACF;AAAA,cAEA,oBAAC,SAAI,WAAU,uBACb,8BAAC,SAAI,WAAU,uBACZ,WAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG,EAAE,IAAI,CAAC,OAAO,UACpD,qBAAC,SAAgB,WAAU,2BACzB;AAAA,oCAAC,YAAS,WAAU,2BAA0B;AAAA,gBAC9C,oBAAC,YAAS,WAAU,SAAQ,OAAO,EAAE,MAAM,GAAG;AAAA,mBAFtC,KAGV,CACD,GACH,GACF;AAAA,cAEA,oBAAC,SAAI,WAAU,YACb,+BAAC,SAAI,WAAU,6DACb;AAAA,qCAAC,SAAI,WAAU,uBACb;AAAA,sCAAC,YAAS,WAAU,YAAW;AAAA,kBAC/B,oBAAC,YAAS,WAAU,YAAW;AAAA,mBACjC;AAAA,gBACA,oBAAC,YAAS,WAAU,0BAAyB;AAAA,iBAC/C,GACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { IconX } from "@tabler/icons-react";
|
|
5
|
+
import { useTranslations } from "next-intl";
|
|
6
|
+
import { Dialog, DialogContent, DialogTitle } from "../../../../ui/overlay/Dialog";
|
|
7
|
+
import { SegmentedControl } from "../../../../ui/form/SegmentedControl";
|
|
8
|
+
import { useCurrencyFormatter } from "../../../../../modules/accounts/hooks/use-currency-formatter.hook";
|
|
9
|
+
import { couponAllowedBillingPeriod } from "../../../../../modules/coupons/utils/coupon-restrictions";
|
|
10
|
+
import { HIDDEN_PLAN_IDS } from "../../../../../modules/plans/constants/plan-tooltips.constants";
|
|
11
|
+
import { useEnrichedPlans } from "../../../../../modules/plans/hooks/use-enriched-plans.hook";
|
|
12
|
+
import { STARTER_PLAN_ID } from "../../../../../modules/subscriptions/constants/addons.constants";
|
|
13
|
+
import { useCurrentSubscription } from "../../../../../modules/subscriptions/hooks/use-current-subscription.hook";
|
|
14
|
+
import { isFreeSubscription } from "../../../../../modules/subscriptions/utils/is-free-subscription";
|
|
15
|
+
import {
|
|
16
|
+
getCatalogBadgePercents,
|
|
17
|
+
periodicityToBillingPeriod,
|
|
18
|
+
USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT
|
|
19
|
+
} from "../../../../../modules/subscriptions/utils/periodicity";
|
|
20
|
+
import { useIsDefaultWhitelabel } from "../../../../../providers/whitelabel.provider";
|
|
21
|
+
import { useSubscriptionFlows } from "../../../../../store/useSubscriptionFlows";
|
|
22
|
+
import { PlanCard } from "./PlanCard";
|
|
23
|
+
import { PlanCardSkeleton } from "./PlanCardSkeleton";
|
|
24
|
+
const PERIOD_DISCOUNT_BADGE_CLASS = "absolute -top-4.5 whitespace-nowrap text-[10px] font-semibold leading-none px-1.5 py-1 rounded text-green-600 bg-green-50 border border-green-100 lg:static lg:whitespace-normal lg:text-xs lg:leading-4 lg:px-1.5 lg:h-6 lg:flex lg:items-center lg:rounded-lg";
|
|
25
|
+
function PlansCatalogContent({ onClose }) {
|
|
26
|
+
const translate = useTranslations("common.account.workspace.subscription.plansCatalog");
|
|
27
|
+
const { currency } = useCurrencyFormatter();
|
|
28
|
+
const isUsd = currency === "usd";
|
|
29
|
+
const isDefaultWhitelabel = useIsDefaultWhitelabel();
|
|
30
|
+
const appliedCouponStripeData = useSubscriptionFlows((state) => state.plansCatalog?.appliedCouponStripeData) ?? null;
|
|
31
|
+
const { data: plans = [], isPending: isLoadingPlans } = useEnrichedPlans();
|
|
32
|
+
const { data: subscriptionData } = useCurrentSubscription();
|
|
33
|
+
const activeSubscription = subscriptionData?.data?.[0] ?? null;
|
|
34
|
+
const defaultPeriod = periodicityToBillingPeriod(activeSubscription?.periodicity) ?? "monthly";
|
|
35
|
+
const requestedPeriod = couponAllowedBillingPeriod(appliedCouponStripeData?.periodicity) ?? defaultPeriod;
|
|
36
|
+
const [billingPeriod, setBillingPeriod] = useState(
|
|
37
|
+
requestedPeriod === "semiannual" ? "annual" : requestedPeriod
|
|
38
|
+
);
|
|
39
|
+
const badgePercents = getCatalogBadgePercents(plans);
|
|
40
|
+
const periodOptions = [
|
|
41
|
+
{ value: "monthly", label: translate("periodMonthly") },
|
|
42
|
+
{
|
|
43
|
+
value: "annual",
|
|
44
|
+
label: /* @__PURE__ */ jsxs("span", { className: "relative lg:flex lg:items-center lg:gap-1", children: [
|
|
45
|
+
translate("periodAnnual"),
|
|
46
|
+
isUsd ? /* @__PURE__ */ jsx("span", { className: `${PERIOD_DISCOUNT_BADGE_CLASS} -right-8`, children: translate("discountCatalog", {
|
|
47
|
+
percent: String(USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT)
|
|
48
|
+
}) }) : badgePercents ? /* @__PURE__ */ jsx("span", { className: `${PERIOD_DISCOUNT_BADGE_CLASS} -right-5`, children: translate("discountBadge", { percent: String(badgePercents.annual) }) }) : null
|
|
49
|
+
] })
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
const isFree = !activeSubscription || isFreeSubscription(activeSubscription);
|
|
53
|
+
const visiblePlans = isFree || activeSubscription?.id_plan === STARTER_PLAN_ID ? plans : plans.filter((plan) => plan.planId !== STARTER_PLAN_ID).filter((plan) => !HIDDEN_PLAN_IDS.includes(plan.planId));
|
|
54
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center h-14 px-4 py-3 bg-white relative border-b border-zinc-200 shrink-0", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-zinc-950 text-center", children: translate("title") }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
onClick: onClose,
|
|
62
|
+
className: "absolute right-4 size-8 flex items-center justify-center rounded-lg cursor-pointer hover:bg-zinc-100 transition-colors",
|
|
63
|
+
children: /* @__PURE__ */ jsx(IconX, { size: 18, className: "text-zinc-400" })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 items-center pt-4 lg:pt-6 pb-4 lg:pb-6 px-4 lg:px-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", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
SegmentedControl,
|
|
70
|
+
{
|
|
71
|
+
value: billingPeriod,
|
|
72
|
+
onChange: setBillingPeriod,
|
|
73
|
+
className: "w-85.75 lg:w-auto",
|
|
74
|
+
optionClassName: "flex-1 lg:flex-none",
|
|
75
|
+
options: periodOptions
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
isLoadingPlans ? /* @__PURE__ */ jsx("div", { className: "flex flex-col lg:flex-row gap-4 w-full lg:items-end items-stretch lg:justify-center lg:mx-auto", children: [1, 2, 3].map((index) => /* @__PURE__ */ jsx(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: "shrink-0 min-w-[85%] sm:min-w-[85%] md:min-w-[calc(50%-0.5rem)] lg:flex-1 lg:shrink lg:min-w-0 lg:max-w-107.5",
|
|
82
|
+
children: /* @__PURE__ */ jsx(PlanCardSkeleton, { isPopular: index === 2, isDefaultWhitelabel })
|
|
83
|
+
},
|
|
84
|
+
index
|
|
85
|
+
)) }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col lg:flex-row gap-4 w-full lg:items-end items-stretch lg:justify-center lg:mx-auto", children: visiblePlans.map((plan) => /* @__PURE__ */ jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "shrink-0 min-w-[85%] sm:min-w-[85%] md:min-w-[calc(50%-0.5rem)] lg:flex-1 lg:shrink lg:min-w-0 lg:max-w-107.5",
|
|
89
|
+
children: /* @__PURE__ */ jsx(
|
|
90
|
+
PlanCard,
|
|
91
|
+
{
|
|
92
|
+
plan,
|
|
93
|
+
billingPeriod,
|
|
94
|
+
couponStripeData: appliedCouponStripeData,
|
|
95
|
+
onBeforeAction: onClose
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
},
|
|
99
|
+
plan.name
|
|
100
|
+
)) })
|
|
101
|
+
] })
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
function PlansCatalogDialog() {
|
|
105
|
+
const plansCatalog = useSubscriptionFlows((state) => state.plansCatalog);
|
|
106
|
+
const close = useSubscriptionFlows((state) => state.closePlansCatalog);
|
|
107
|
+
return /* @__PURE__ */ jsx(Dialog, { open: !!plansCatalog, onOpenChange: (nextOpen) => !nextOpen && close(), children: /* @__PURE__ */ jsx(
|
|
108
|
+
DialogContent,
|
|
109
|
+
{
|
|
110
|
+
showCloseButton: false,
|
|
111
|
+
className: "flex flex-col p-0 gap-0 inset-0 w-dvw h-dvh max-w-none sm:max-w-none translate-x-0 translate-y-0 border-0 rounded-none shadow-none",
|
|
112
|
+
children: !!plansCatalog && /* @__PURE__ */ jsx(PlansCatalogContent, { onClose: close })
|
|
113
|
+
}
|
|
114
|
+
) });
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
PlansCatalogDialog
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=PlansCatalogDialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/account/sections/subscription/plans/PlansCatalogDialog.tsx"],"sourcesContent":["'use client';\n\nimport { useState, type ReactNode } from 'react';\nimport { IconX } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Dialog, DialogContent, DialogTitle } from '../../../../ui/overlay/Dialog';\nimport { SegmentedControl } from '../../../../ui/form/SegmentedControl';\nimport { useCurrencyFormatter } from '../../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { couponAllowedBillingPeriod } from '../../../../../modules/coupons/utils/coupon-restrictions';\nimport { HIDDEN_PLAN_IDS } from '../../../../../modules/plans/constants/plan-tooltips.constants';\nimport { useEnrichedPlans } from '../../../../../modules/plans/hooks/use-enriched-plans.hook';\nimport { STARTER_PLAN_ID } from '../../../../../modules/subscriptions/constants/addons.constants';\nimport { useCurrentSubscription } from '../../../../../modules/subscriptions/hooks/use-current-subscription.hook';\nimport type { BillingPeriod } from '../../../../../modules/subscriptions/types/billing-period.type';\nimport { isFreeSubscription } from '../../../../../modules/subscriptions/utils/is-free-subscription';\nimport {\n getCatalogBadgePercents,\n periodicityToBillingPeriod,\n USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT,\n} from '../../../../../modules/subscriptions/utils/periodicity';\nimport { useIsDefaultWhitelabel } from '../../../../../providers/whitelabel.provider';\nimport { useSubscriptionFlows } from '../../../../../store/useSubscriptionFlows';\nimport { PlanCard } from './PlanCard';\nimport { PlanCardSkeleton } from './PlanCardSkeleton';\n\nconst PERIOD_DISCOUNT_BADGE_CLASS =\n 'absolute -top-4.5 whitespace-nowrap text-[10px] font-semibold leading-none px-1.5 py-1 rounded text-green-600 bg-green-50 border border-green-100 lg:static lg:whitespace-normal lg:text-xs lg:leading-4 lg:px-1.5 lg:h-6 lg:flex lg:items-center lg:rounded-lg';\n\nfunction PlansCatalogContent({ onClose }: { onClose: () => void }) {\n const translate = useTranslations('common.account.workspace.subscription.plansCatalog');\n const { currency } = useCurrencyFormatter();\n const isUsd = currency === 'usd';\n const isDefaultWhitelabel = useIsDefaultWhitelabel();\n\n const appliedCouponStripeData =\n useSubscriptionFlows((state) => state.plansCatalog?.appliedCouponStripeData) ?? null;\n\n const { data: plans = [], isPending: isLoadingPlans } = useEnrichedPlans();\n const { data: subscriptionData } = useCurrentSubscription();\n const activeSubscription = subscriptionData?.data?.[0] ?? null;\n\n const defaultPeriod = periodicityToBillingPeriod(activeSubscription?.periodicity) ?? 'monthly';\n const requestedPeriod =\n couponAllowedBillingPeriod(appliedCouponStripeData?.periodicity) ?? defaultPeriod;\n // Semestral não tem coluna própria na vitrine: cai no anual, que é o período com desconto.\n const [billingPeriod, setBillingPeriod] = useState<BillingPeriod>(\n requestedPeriod === 'semiannual' ? 'annual' : requestedPeriod\n );\n\n const badgePercents = getCatalogBadgePercents(plans);\n\n const periodOptions: Array<{ value: BillingPeriod; label: ReactNode }> = [\n { value: 'monthly', label: translate('periodMonthly') },\n {\n value: 'annual',\n label: (\n <span className=\"relative lg:flex lg:items-center lg:gap-1\">\n {translate('periodAnnual')}\n {isUsd ? (\n <span className={`${PERIOD_DISCOUNT_BADGE_CLASS} -right-8`}>\n {translate('discountCatalog', {\n percent: String(USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT),\n })}\n </span>\n ) : badgePercents ? (\n <span className={`${PERIOD_DISCOUNT_BADGE_CLASS} -right-5`}>\n {translate('discountBadge', { percent: String(badgePercents.annual) })}\n </span>\n ) : null}\n </span>\n ),\n },\n ];\n\n // Iniciante só aparece para quem ainda não assina (ou já está nele): é plano de entrada.\n const isFree = !activeSubscription || isFreeSubscription(activeSubscription);\n const visiblePlans =\n isFree || activeSubscription?.id_plan === STARTER_PLAN_ID\n ? plans\n : plans\n .filter((plan) => plan.planId !== STARTER_PLAN_ID)\n .filter((plan) => !HIDDEN_PLAN_IDS.includes(plan.planId));\n\n return (\n <>\n <div className=\"flex items-center justify-center h-14 px-4 py-3 bg-white relative border-b border-zinc-200 shrink-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950 text-center\">\n {translate('title')}\n </DialogTitle>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"absolute right-4 size-8 flex items-center justify-center rounded-lg cursor-pointer hover:bg-zinc-100 transition-colors\"\n >\n <IconX size={18} className=\"text-zinc-400\" />\n </button>\n </div>\n\n <div className=\"flex flex-col gap-5 items-center pt-4 lg:pt-6 pb-4 lg:pb-6 px-4 lg:px-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\">\n <SegmentedControl<BillingPeriod>\n value={billingPeriod}\n onChange={setBillingPeriod}\n className=\"w-85.75 lg:w-auto\"\n optionClassName=\"flex-1 lg:flex-none\"\n options={periodOptions}\n />\n\n {isLoadingPlans ? (\n <div className=\"flex flex-col lg:flex-row gap-4 w-full lg:items-end items-stretch lg:justify-center lg:mx-auto\">\n {[1, 2, 3].map((index) => (\n <div\n key={index}\n className=\"shrink-0 min-w-[85%] sm:min-w-[85%] md:min-w-[calc(50%-0.5rem)] lg:flex-1 lg:shrink lg:min-w-0 lg:max-w-107.5\"\n >\n <PlanCardSkeleton isPopular={index === 2} isDefaultWhitelabel={isDefaultWhitelabel} />\n </div>\n ))}\n </div>\n ) : (\n <div className=\"flex flex-col lg:flex-row gap-4 w-full lg:items-end items-stretch lg:justify-center lg:mx-auto\">\n {visiblePlans.map((plan) => (\n <div\n key={plan.name}\n className=\"shrink-0 min-w-[85%] sm:min-w-[85%] md:min-w-[calc(50%-0.5rem)] lg:flex-1 lg:shrink lg:min-w-0 lg:max-w-107.5\"\n >\n <PlanCard\n plan={plan}\n billingPeriod={billingPeriod}\n couponStripeData={appliedCouponStripeData}\n onBeforeAction={onClose}\n />\n </div>\n ))}\n </div>\n )}\n </div>\n </>\n );\n}\n\n/** Vitrine de planos em tela cheia, por cima do modal Minha conta. */\nexport function PlansCatalogDialog() {\n const plansCatalog = useSubscriptionFlows((state) => state.plansCatalog);\n const close = useSubscriptionFlows((state) => state.closePlansCatalog);\n\n return (\n <Dialog open={!!plansCatalog} onOpenChange={(nextOpen) => !nextOpen && close()}>\n <DialogContent\n showCloseButton={false}\n className=\"flex flex-col p-0 gap-0 inset-0 w-dvw h-dvh max-w-none sm:max-w-none translate-x-0 translate-y-0 border-0 rounded-none shadow-none\"\n >\n {!!plansCatalog && <PlansCatalogContent onClose={close} />}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAwDQ,SA4BJ,UAzBQ,KAHJ;AAtDR,SAAS,gBAAgC;AACzC,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AAEvC,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAEjC,MAAM,8BACJ;AAEF,SAAS,oBAAoB,EAAE,QAAQ,GAA4B;AACjE,QAAM,YAAY,gBAAgB,oDAAoD;AACtF,QAAM,EAAE,SAAS,IAAI,qBAAqB;AAC1C,QAAM,QAAQ,aAAa;AAC3B,QAAM,sBAAsB,uBAAuB;AAEnD,QAAM,0BACJ,qBAAqB,CAAC,UAAU,MAAM,cAAc,uBAAuB,KAAK;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