@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/layouts/UsersSelectorPopover.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useTranslations } from \"next-intl\";\nimport { IconPlus, IconUser, IconUsers } from '@tabler/icons-react';\nimport { UserAvatar } from \"../ui/data-display/UserAvatar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay/Popover\";\nimport { Button } from \"../ui/buttons/Button\";\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"../ui/overlay/Command\";\nimport { Checkbox } from \"../ui/form/Checkbox\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/overlay/Tooltip\";\nimport { cn } from \"../../infra/utils/clsx\";\nimport { useListProjectUsers } from \"../../modules/projects/hooks/list-project-users.hook\";\nimport { useListAllAccountUsers } from \"../../modules/projects/hooks/list-all-account-users.hook\";\nimport { useAddProjectUser } from \"../../modules/projects/hooks/add-project-user.hook\";\nimport { useRemoveProjectUser } from \"../../modules/projects/hooks/remove-project-user.hook\";\nimport { useWhitelabelUrls } from \"../../providers/whitelabel.provider\";\n\nexport interface UsersSelectorPopoverProps {\n projectId?: number;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n align?: \"start\" | \"center\" | \"end\";\n contentClassName?: string;\n}\n\nfunction UserItemSkeleton() {\n return (\n <div className=\"flex items-center justify-between px-2 py-1.5 gap-2\">\n <div className=\"flex items-center gap-2 flex-1\">\n <div className=\"skeleton size-8 rounded-full shrink-0\" />\n <div className=\"skeleton h-3.5 w-28 rounded\" />\n </div>\n <div className=\"skeleton size-4 rounded shrink-0\" />\n </div>\n );\n}\n\nexport function UsersSelectorPopover({\n projectId,\n side,\n align,\n contentClassName,\n}: UsersSelectorPopoverProps) {\n const translate = useTranslations();\n const { accountsUrl } = useWhitelabelUrls();\n const [open, setOpen] = useState(false);\n const [hoveredId, setHoveredId] = useState<number | null>(null);\n const [searchInput, setSearchInput] = useState(\"\");\n const [search, setSearch] = useState(\"\");\n\n const id = projectId ?? 0;\n\n useEffect(() => {\n const timer = setTimeout(() => setSearch(searchInput), 300);\n return () => clearTimeout(timer);\n }, [searchInput]);\n\n const accountUsers = useListAllAccountUsers(search, id || undefined);\n const projectUsers = useListProjectUsers(id, \"\");\n const addMutation = useAddProjectUser(id);\n const removeMutation = useRemoveProjectUser(id);\n\n const allUsers = accountUsers.data?.pages.flatMap((p) => p.data) ?? [];\n const isLoading = accountUsers.isLoading;\n const isFetchingMore = accountUsers.isFetchingNextPage;\n const totalInProject = projectUsers.data?.pages[0]?.total ?? 0;\n\n const toggleUser = (userId: number, inProject: boolean, removable: boolean) => {\n if (inProject) {\n if (!removable) return;\n removeMutation.mutate(userId);\n } else {\n addMutation.mutate(userId);\n }\n };\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {\n const target = e.currentTarget;\n const nearBottom =\n target.scrollTop + target.clientHeight >= target.scrollHeight - 50;\n if (!nearBottom) return;\n if (accountUsers.hasNextPage && !accountUsers.isFetchingNextPage) {\n accountUsers.fetchNextPage();\n }\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger className=\"cursor-pointer\">\n <div className=\"flex items-center gap-2 text-gray-950 px-3 py-2 border border-gray-200 rounded-full hover:border-gray-950\">\n <span className=\"paragraph-small-semibold\">{totalInProject}</span>\n <IconUser size={16} />\n </div>\n </PopoverTrigger>\n\n <PopoverContent\n className={cn(\n \"absolute right-0 md:right-[-88px] w-[296px] p-0 bg-white rounded-2xl shadow-md border border-gray-200\",\n contentClassName,\n )}\n side={side}\n align={align}\n sideOffset={8}\n >\n <div className=\"flex flex-col p-3 gap-2\">\n <div className=\"flex items-center justify-between\">\n <span className=\"paragraph-small-semibold\">{translate('common.layout.usersSelector.title')}</span>\n <div className=\"flex items-center gap-1.5\">\n <Button\n variant=\"secondary\"\n className=\"h-8 paragraph-small-semibold text-gray-950\"\n onClick={() => {\n window.location.href = `${accountsUrl}/my-teams?createNew=true`;\n }}\n >\n <IconPlus size={16} />\n {translate('common.layout.usersSelector.add')}\n </Button>\n </div>\n </div>\n\n <Command shouldFilter={false} className=\"gap-2\" value=\"\">\n <CommandInput\n placeholder={translate('common.layout.usersSelector.searchPlaceholder')}\n value={searchInput}\n onValueChange={setSearchInput}\n />\n <CommandList\n className=\"custom-scrollbar paragraph-small-medium text-gray-600 h-[162px]\"\n onScroll={handleScroll}\n >\n {isLoading ? (\n <>\n <UserItemSkeleton />\n <UserItemSkeleton />\n <UserItemSkeleton />\n </>\n ) : allUsers.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center gap-2 h-full text-gray-400 py-4\">\n <IconUsers size={28} className=\"text-gray-300\" />\n <span className=\"paragraph-small-medium text-center text-gray-500\">\n {translate('common.layout.usersSelector.empty')}\n </span>\n </div>\n ) : (\n <>\n <CommandEmpty>{translate('common.layout.usersSelector.noResults')}</CommandEmpty>\n {allUsers.map((user) => {\n const inProject = user.in_project ?? false;\n const removable =\n inProject &&\n user.profile !== \"owner\" &&\n user.profile !== \"admin\";\n const interactive = !inProject || removable;\n\n return (\n <CommandItem\n key={user.id}\n value={user.name || String(user.id)}\n autoFocus={false}\n onPointerEnter={() => setHoveredId(user.id)}\n onPointerLeave={() => setHoveredId(null)}\n onFocus={() => setHoveredId(user.id)}\n onBlur={() => setHoveredId(null)}\n onSelect={() => toggleUser(user.id, inProject, removable)}\n className={interactive ? \"cursor-pointer\" : \"cursor-default\"}\n >\n <div className=\"flex items-center justify-between w-full\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <UserAvatar\n photo={user.photo}\n name={user.name ?? undefined}\n size={32}\n />\n <span className=\"truncate\">{user.name}</span>\n </div>\n <Tooltip open={interactive && hoveredId === user.id}>\n <TooltipTrigger asChild>\n <div\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n >\n <Checkbox\n checked={inProject}\n disabled={!interactive}\n onCheckedChange={() =>\n toggleUser(user.id, inProject, removable)\n }\n className={cn(\n interactive && hoveredId === user.id\n ? \"border-gray-950\"\n : \"\",\n \"disabled:opacity-10\",\n )}\n />\n </div>\n </TooltipTrigger>\n <TooltipContent>\n {inProject ? translate('common.layout.usersSelector.removeFromProject') : translate('common.layout.usersSelector.addToProject')}\n </TooltipContent>\n </Tooltip>\n </div>\n </CommandItem>\n );\n })}\n {isFetchingMore && (\n <>\n <UserItemSkeleton />\n <UserItemSkeleton />\n </>\n )}\n </>\n )}\n </CommandList>\n </Command>\n <div className=\"border-t border-gray-200\" />\n <Button\n variant=\"ghost\"\n className=\"h-10! paragraph-small-medium text-gray-600 hover:text-gray-950 hover:bg-zinc-50 w-full justify-center\"\n onClick={() => {\n window.location.href = `${accountsUrl}/my-teams`;\n }}\n >\n {translate('common.layout.usersSelector.manageTeam')}\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";AAkCM,SAwGU,UAvGR,KADF;AAhCN,SAAS,WAAW,gBAAgB;AACpC,SAAS,uBAAuB;AAChC,SAAS,UAAU,UAAU,iBAAiB;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AACnB,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,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,gCACC,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,gCAClC,eAAe,CAAC,MAAM,EAAE,gBAAgB;AAAA,gCAExC;AAAA,kCAAC;AAAA;AAAA,oCACC,SAAS;AAAA,oCACT,UAAU,CAAC;AAAA,oCACX,iBAAiB,MACf,WAAW,KAAK,IAAI,WAAW,SAAS;AAAA,oCAE1C,WAAW;AAAA,sCACT,eAAe,cAAc,KAAK,KAC9B,oBACA;AAAA,sCACJ;AAAA,oCACF;AAAA;AAAA,gCACF;AAAA;AAAA,4BACF,GACF;AAAA,4BACA,oBAAC,kBACE,sBAAY,UAAU,+CAA+C,IAAI,UAAU,0CAA0C,GAChI;AAAA,6BACF;AAAA,2BACF;AAAA;AAAA,sBA5CK,KAAK;AAAA,oBA6CZ;AAAA,kBAEJ,CAAC;AAAA,kBACA,kBACC,iCACE;AAAA,wCAAC,oBAAiB;AAAA,oBAClB,oBAAC,oBAAiB;AAAA,qBACpB;AAAA,mBAEJ;AAAA;AAAA,YAEJ;AAAA,aACF;AAAA,UACA,oBAAC,SAAI,WAAU,4BAA2B;AAAA,UAC1C;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,SAAS,MAAM;AACb,uBAAO,SAAS,OAAO,GAAG,WAAW;AAAA,cACvC;AAAA,cAEC,oBAAU,wCAAwC;AAAA;AAAA,UACrD;AAAA,WACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/layouts/UsersSelectorPopover.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useTranslations } from \"next-intl\";\nimport { IconPlus, IconUser, IconUsers } from '@tabler/icons-react';\nimport { UserAvatar } from \"../ui/data-display/UserAvatar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../ui/overlay/Popover\";\nimport { Button } from \"../ui/buttons/Button\";\nimport {\n Command,\n CommandEmpty,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"../ui/overlay/Command\";\nimport { Checkbox } from \"../ui/form/Checkbox\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/overlay/Tooltip\";\nimport { cn } from \"../../infra/utils/clsx\";\nimport { useListProjectUsers } from \"../../modules/projects/hooks/list-project-users.hook\";\nimport { useListAllAccountUsers } from \"../../modules/projects/hooks/list-all-account-users.hook\";\nimport { useAddProjectUser } from \"../../modules/projects/hooks/add-project-user.hook\";\nimport { useRemoveProjectUser } from \"../../modules/projects/hooks/remove-project-user.hook\";\nimport { WorkspaceSectionType } from \"../../enums/WorkspaceSectionType\";\nimport useAccountHubActions from \"../account/hooks/useAccountHubActions\";\n\nexport interface UsersSelectorPopoverProps {\n projectId?: number;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n align?: \"start\" | \"center\" | \"end\";\n contentClassName?: string;\n}\n\nfunction UserItemSkeleton() {\n return (\n <div className=\"flex items-center justify-between px-2 py-1.5 gap-2\">\n <div className=\"flex items-center gap-2 flex-1\">\n <div className=\"skeleton size-8 rounded-full shrink-0\" />\n <div className=\"skeleton h-3.5 w-28 rounded\" />\n </div>\n <div className=\"skeleton size-4 rounded shrink-0\" />\n </div>\n );\n}\n\nexport function UsersSelectorPopover({\n projectId,\n side,\n align,\n contentClassName,\n}: UsersSelectorPopoverProps) {\n const translate = useTranslations();\n const { openAddUser, openSection } = useAccountHubActions();\n const [open, setOpen] = useState(false);\n const [hoveredId, setHoveredId] = useState<number | null>(null);\n const [searchInput, setSearchInput] = useState(\"\");\n const [search, setSearch] = useState(\"\");\n\n const id = projectId ?? 0;\n\n useEffect(() => {\n const timer = setTimeout(() => setSearch(searchInput), 300);\n return () => clearTimeout(timer);\n }, [searchInput]);\n\n const accountUsers = useListAllAccountUsers(search, id || undefined);\n const projectUsers = useListProjectUsers(id, \"\");\n const addMutation = useAddProjectUser(id);\n const removeMutation = useRemoveProjectUser(id);\n\n const allUsers = accountUsers.data?.pages.flatMap((p) => p.data) ?? [];\n const isLoading = accountUsers.isLoading;\n const isFetchingMore = accountUsers.isFetchingNextPage;\n const totalInProject = projectUsers.data?.pages[0]?.total ?? 0;\n\n const toggleUser = (userId: number, inProject: boolean, removable: boolean) => {\n if (inProject) {\n if (!removable) return;\n removeMutation.mutate(userId);\n } else {\n addMutation.mutate(userId);\n }\n };\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {\n const target = e.currentTarget;\n const nearBottom =\n target.scrollTop + target.clientHeight >= target.scrollHeight - 50;\n if (!nearBottom) return;\n if (accountUsers.hasNextPage && !accountUsers.isFetchingNextPage) {\n accountUsers.fetchNextPage();\n }\n };\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger className=\"cursor-pointer\">\n <div className=\"flex items-center gap-2 text-gray-950 px-3 py-2 border border-gray-200 rounded-full hover:border-gray-950\">\n <span className=\"paragraph-small-semibold\">{totalInProject}</span>\n <IconUser size={16} />\n </div>\n </PopoverTrigger>\n\n <PopoverContent\n className={cn(\n \"absolute right-0 md:right-[-88px] w-[296px] p-0 bg-white rounded-2xl shadow-md border border-gray-200\",\n contentClassName,\n )}\n side={side}\n align={align}\n sideOffset={8}\n >\n <div className=\"flex flex-col p-3 gap-2\">\n <div className=\"flex items-center justify-between\">\n <span className=\"paragraph-small-semibold\">{translate('common.layout.usersSelector.title')}</span>\n <div className=\"flex items-center gap-1.5\">\n <Button\n variant=\"secondary\"\n className=\"h-8 paragraph-small-semibold text-gray-950\"\n onClick={() => {\n setOpen(false);\n openAddUser();\n }}\n >\n <IconPlus size={16} />\n {translate('common.layout.usersSelector.add')}\n </Button>\n </div>\n </div>\n\n <Command shouldFilter={false} className=\"gap-2\" value=\"\">\n <CommandInput\n placeholder={translate('common.layout.usersSelector.searchPlaceholder')}\n value={searchInput}\n onValueChange={setSearchInput}\n />\n <CommandList\n className=\"custom-scrollbar paragraph-small-medium text-gray-600 h-[162px]\"\n onScroll={handleScroll}\n >\n {isLoading ? (\n <>\n <UserItemSkeleton />\n <UserItemSkeleton />\n <UserItemSkeleton />\n </>\n ) : allUsers.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center gap-2 h-full text-gray-400 py-4\">\n <IconUsers size={28} className=\"text-gray-300\" />\n <span className=\"paragraph-small-medium text-center text-gray-500\">\n {translate('common.layout.usersSelector.empty')}\n </span>\n </div>\n ) : (\n <>\n <CommandEmpty>{translate('common.layout.usersSelector.noResults')}</CommandEmpty>\n {allUsers.map((user) => {\n const inProject = user.in_project ?? false;\n const removable =\n inProject &&\n user.profile !== \"owner\" &&\n user.profile !== \"admin\";\n const interactive = !inProject || removable;\n\n return (\n <CommandItem\n key={user.id}\n value={user.name || String(user.id)}\n autoFocus={false}\n onPointerEnter={() => setHoveredId(user.id)}\n onPointerLeave={() => setHoveredId(null)}\n onFocus={() => setHoveredId(user.id)}\n onBlur={() => setHoveredId(null)}\n onSelect={() => toggleUser(user.id, inProject, removable)}\n className={interactive ? \"cursor-pointer\" : \"cursor-default\"}\n >\n <div className=\"flex items-center justify-between w-full\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <UserAvatar\n photo={user.photo}\n name={user.name ?? undefined}\n size={32}\n />\n <span className=\"truncate\">{user.name}</span>\n </div>\n <Tooltip open={interactive && hoveredId === user.id}>\n <TooltipTrigger asChild>\n <div\n onClick={(e) => e.stopPropagation()}\n onPointerDown={(e) => e.stopPropagation()}\n >\n <Checkbox\n checked={inProject}\n disabled={!interactive}\n onCheckedChange={() =>\n toggleUser(user.id, inProject, removable)\n }\n className={cn(\n interactive && hoveredId === user.id\n ? \"border-gray-950\"\n : \"\",\n \"disabled:opacity-10\",\n )}\n />\n </div>\n </TooltipTrigger>\n <TooltipContent>\n {inProject ? translate('common.layout.usersSelector.removeFromProject') : translate('common.layout.usersSelector.addToProject')}\n </TooltipContent>\n </Tooltip>\n </div>\n </CommandItem>\n );\n })}\n {isFetchingMore && (\n <>\n <UserItemSkeleton />\n <UserItemSkeleton />\n </>\n )}\n </>\n )}\n </CommandList>\n </Command>\n <div className=\"border-t border-gray-200\" />\n <Button\n variant=\"ghost\"\n className=\"h-10! paragraph-small-medium text-gray-600 hover:text-gray-950 hover:bg-zinc-50 w-full justify-center\"\n onClick={() => {\n setOpen(false);\n openSection(WorkspaceSectionType.TEAM);\n }}\n >\n {translate('common.layout.usersSelector.manageTeam')}\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";AAmCM,SAyGU,UAxGR,KADF;AAjCN,SAAS,WAAW,gBAAgB;AACpC,SAAS,uBAAuB;AAChC,SAAS,UAAU,UAAU,iBAAiB;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AACnB,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,OAAO,0BAA0B;AASjC,SAAS,mBAAmB;AAC1B,SACE,qBAAC,SAAI,WAAU,uDACb;AAAA,yBAAC,SAAI,WAAU,kCACb;AAAA,0BAAC,SAAI,WAAU,yCAAwC;AAAA,MACvD,oBAAC,SAAI,WAAU,+BAA8B;AAAA,OAC/C;AAAA,IACA,oBAAC,SAAI,WAAU,oCAAmC;AAAA,KACpD;AAEJ;AAEO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA8B;AAC5B,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAAE,aAAa,YAAY,IAAI,qBAAqB;AAC1D,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAwB,IAAI;AAC9D,QAAM,CAAC,aAAa,cAAc,IAAI,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iB;AAAA,oBAClB,oBAAC,oBAAiB;AAAA,qBACpB;AAAA,mBAEJ;AAAA;AAAA,YAEJ;AAAA,aACF;AAAA,UACA,oBAAC,SAAI,WAAU,4BAA2B;AAAA,UAC1C;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,SAAS,MAAM;AACb,wBAAQ,KAAK;AACb,4BAAY,qBAAqB,IAAI;AAAA,cACvC;AAAA,cAEC,oBAAU,wCAAwC;AAAA;AAAA,UACrD;AAAA,WACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -11,21 +11,20 @@ import {
|
|
|
11
11
|
DialogHeader,
|
|
12
12
|
DialogTitle
|
|
13
13
|
} from "../ui/overlay/Dialog";
|
|
14
|
-
import { useExternalContracting, useWhitelabelUrls } from "../../providers/whitelabel.provider";
|
|
15
14
|
import { useAccountDeletionWarningModal } from "../../store/useAccountDeletionWarningModal";
|
|
15
|
+
import useAccountHubActions from "../account/hooks/useAccountHubActions";
|
|
16
16
|
function AccountDeletionWarningModal() {
|
|
17
17
|
const translate = useTranslations();
|
|
18
18
|
const { open, onReactivate, closeModal } = useAccountDeletionWarningModal();
|
|
19
|
-
const {
|
|
20
|
-
const { redirectToExternal } = useExternalContracting();
|
|
19
|
+
const { openPlansCatalog } = useAccountHubActions();
|
|
21
20
|
const handleReactivate = () => {
|
|
22
21
|
if (onReactivate) {
|
|
23
22
|
onReactivate();
|
|
24
23
|
closeModal();
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
closeModal();
|
|
27
|
+
openPlansCatalog();
|
|
29
28
|
};
|
|
30
29
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (nextOpen) => !nextOpen && closeModal(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 md:w-[410px]! lg:w-[410px]! max-w-[410px]! max-[410px]:w-[calc(100%-32px)]", children: [
|
|
31
30
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "gap-3 text-left p-5", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/AccountDeletionWarningModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../ui/buttons/Button';\nimport { Separator } from '../ui/data-display/Separator';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modals/AccountDeletionWarningModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../ui/buttons/Button';\nimport { Separator } from '../ui/data-display/Separator';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { useAccountDeletionWarningModal } from '../../store/useAccountDeletionWarningModal';\nimport useAccountHubActions from '../account/hooks/useAccountHubActions';\n\nexport default function AccountDeletionWarningModal() {\n const translate = useTranslations();\n const { open, onReactivate, closeModal } = useAccountDeletionWarningModal();\n const { openPlansCatalog } = useAccountHubActions();\n\n const handleReactivate = () => {\n if (onReactivate) {\n onReactivate();\n closeModal();\n return;\n }\n\n closeModal();\n openPlansCatalog();\n };\n\n return (\n <Dialog open={open} onOpenChange={(nextOpen: boolean) => !nextOpen && closeModal()}>\n <DialogContent className=\"flex flex-col p-0 gap-0 md:w-[410px]! lg:w-[410px]! max-w-[410px]! max-[410px]:w-[calc(100%-32px)]\">\n <DialogHeader className=\"gap-3 text-left p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-red-50 rounded-lg\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {translate('common.account.deletionWarning.title')}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-600\" asChild>\n <div className=\"flex flex-col gap-3\">\n <p>{translate('common.account.deletionWarning.descriptionLine1')}</p>\n <p>{translate('common.account.deletionWarning.descriptionLine2')}</p>\n </div>\n </DialogDescription>\n </div>\n </DialogHeader>\n\n <Separator />\n\n <div className=\"flex items-center gap-2 p-5\">\n <Button className=\"w-fit h-10!\" onClick={handleReactivate}>\n {translate('common.account.deletionWarning.reactivate')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAqCY,cAOE,YAPF;AAnCZ,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sCAAsC;AAC/C,OAAO,0BAA0B;AAElB,SAAR,8BAA+C;AACpD,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAAE,MAAM,cAAc,WAAW,IAAI,+BAA+B;AAC1E,QAAM,EAAE,iBAAiB,IAAI,qBAAqB;AAElD,QAAM,mBAAmB,MAAM;AAC7B,QAAI,cAAc;AAChB,mBAAa;AACb,iBAAW;AACX;AAAA,IACF;AAEA,eAAW;AACX,qBAAiB;AAAA,EACnB;AAEA,SACE,oBAAC,UAAO,MAAY,cAAc,CAAC,aAAsB,CAAC,YAAY,WAAW,GAC/E,+BAAC,iBAAc,WAAU,sGACvB;AAAA,yBAAC,gBAAa,WAAU,uBACtB;AAAA,0BAAC,SAAI,WAAU,mEACb,8BAAC,qBAAkB,MAAM,IAAI,WAAU,gBAAe,GACxD;AAAA,MACA,qBAAC,SAAI,WAAU,uBACb;AAAA,4BAAC,eAAY,WAAU,2CACpB,oBAAU,sCAAsC,GACnD;AAAA,QACA,oBAAC,qBAAkB,WAAU,yCAAwC,SAAO,MAC1E,+BAAC,SAAI,WAAU,uBACb;AAAA,8BAAC,OAAG,oBAAU,iDAAiD,GAAE;AAAA,UACjE,oBAAC,OAAG,oBAAU,iDAAiD,GAAE;AAAA,WACnE,GACF;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,aAAU;AAAA,IAEX,oBAAC,SAAI,WAAU,+BACb,8BAAC,UAAO,WAAU,eAAc,SAAS,kBACtC,oBAAU,2CAA2C,GACxD,GACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
DialogTitle
|
|
17
17
|
} from "../ui/overlay/Dialog";
|
|
18
18
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/overlay/Tooltip";
|
|
19
|
-
import {
|
|
19
|
+
import { useExternalContracting } from "../../providers/whitelabel.provider";
|
|
20
20
|
import { useModalManager } from "../../store/useModalManager";
|
|
21
21
|
import { formatShortDate } from "../../infra/utils/date";
|
|
22
|
+
import { WorkspaceSectionType } from "../../enums/WorkspaceSectionType";
|
|
23
|
+
import useAccountHubActions from "../account/hooks/useAccountHubActions";
|
|
22
24
|
const RESOURCE_GROUPS = [
|
|
23
25
|
{
|
|
24
26
|
icon: IconFile,
|
|
@@ -40,8 +42,8 @@ function AccountFrozenModal() {
|
|
|
40
42
|
const translate = useTranslations();
|
|
41
43
|
const { activeModal, closeModal, modalData } = useModalManager();
|
|
42
44
|
const isOpen = activeModal === "accountFrozenModal";
|
|
43
|
-
const { accountsUrl } = useWhitelabelUrls();
|
|
44
45
|
const { redirectToExternal } = useExternalContracting();
|
|
46
|
+
const { openSection } = useAccountHubActions();
|
|
45
47
|
const data = modalData;
|
|
46
48
|
const freezeDate = data?.freezeDate ?? null;
|
|
47
49
|
const isWarning = Boolean(freezeDate);
|
|
@@ -56,7 +58,8 @@ function AccountFrozenModal() {
|
|
|
56
58
|
);
|
|
57
59
|
const handleRegularize = () => {
|
|
58
60
|
if (redirectToExternal("plans")) return;
|
|
59
|
-
|
|
61
|
+
closeModal();
|
|
62
|
+
openSection(WorkspaceSectionType.SUBSCRIPTION);
|
|
60
63
|
};
|
|
61
64
|
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: () => closeModal(), children: /* @__PURE__ */ jsxs(
|
|
62
65
|
DialogContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/AccountFrozenModal.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n IconLock,\n IconFile,\n IconFolder,\n IconWorld,\n IconInfoCircle,\n type IconProps,\n} from '@tabler/icons-react';\nimport type { ComponentType } from 'react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/overlay/Tooltip';\nimport { useWhitelabelUrls, useExternalContracting } from '../../providers/whitelabel.provider';\nimport { useModalManager } from '../../store/useModalManager';\nimport { formatShortDate } from '../../infra/utils/date';\n\nconst RESOURCE_GROUPS = [\n {\n icon: IconFile,\n titleKey: 'common.subscription.frozen.modal.resources.pages.title',\n descriptionKey: 'common.subscription.frozen.modal.resources.pages.description',\n },\n {\n icon: IconFolder,\n titleKey: 'common.subscription.frozen.modal.resources.projects.title',\n descriptionKey: 'common.subscription.frozen.modal.resources.projects.description',\n },\n {\n icon: IconWorld,\n titleKey: 'common.subscription.frozen.modal.resources.domains.title',\n descriptionKey: 'common.subscription.frozen.modal.resources.domains.description',\n },\n] as const satisfies readonly {\n icon: ComponentType<IconProps>;\n titleKey: string;\n descriptionKey: string;\n}[];\n\ninterface FrozenModalData {\n freezeDate?: Date | string | null;\n showResources?: boolean;\n}\n\nexport default function AccountFrozenModal() {\n const translate = useTranslations();\n const { activeModal, closeModal, modalData } = useModalManager();\n const isOpen = activeModal === 'accountFrozenModal';\n const { accountsUrl } = useWhitelabelUrls();\n const { redirectToExternal } = useExternalContracting();\n\n const data = modalData as FrozenModalData | undefined;\n const freezeDate = data?.freezeDate ?? null;\n const isWarning = Boolean(freezeDate);\n const showResources = Boolean(data?.showResources);\n\n const title = isWarning\n ? translate('common.subscription.frozen.modal.warningTitle', {\n freezeDate: formatShortDate(freezeDate ? new Date(freezeDate) : null),\n })\n : translate('common.subscription.frozen.modal.title');\n\n const description = isWarning\n ? translate(\n showResources\n ? 'common.subscription.frozen.modal.warningDescriptionWithResources'\n : 'common.subscription.frozen.modal.warningDescription',\n )\n : translate(\n showResources\n ? 'common.subscription.frozen.modal.descriptionWithResources'\n : 'common.subscription.frozen.modal.description',\n );\n\n const handleRegularize = () => {\n if (redirectToExternal('plans')) return;\n window.location.href = `${accountsUrl}/subscriptions`;\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={() => closeModal()}>\n <DialogContent\n showCloseButton\n onOpenAutoFocus={(event) => event.preventDefault()}\n className=\"flex flex-col p-0! gap-0! max-w-[calc(100%-2rem)]! w-full sm:max-w-[400px]! lg:max-w-[420px]! rounded-lg border\"\n >\n <div className=\"flex flex-col gap-5 p-4 lg:p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-zinc-50 rounded-lg\">\n <IconLock size={20} className=\"text-zinc-950\" />\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {title}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-500\">\n {description}\n </DialogDescription>\n </div>\n\n {showResources && (\n <>\n <div className=\"bg-white border border-zinc-100 rounded-lg\">\n {RESOURCE_GROUPS.map(({ titleKey, descriptionKey, icon: Icon }, index) => (\n <div key={titleKey}>\n {index > 0 && <div className=\"h-px bg-zinc-100\" />}\n <div className=\"flex items-center justify-between gap-3 p-4\">\n <div className=\"flex items-center gap-3\">\n <Icon size={20} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-semibold text-zinc-950\">\n {translate(titleKey)}\n </span>\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n aria-label={translate(titleKey)}\n className=\"flex items-center justify-center shrink-0 cursor-pointer\"\n >\n <IconInfoCircle className=\"size-4 text-zinc-400\" />\n </button>\n </TooltipTrigger>\n <TooltipContent\n side=\"top\"\n className=\"max-w-[240px]\"\n >\n {translate(descriptionKey)}\n </TooltipContent>\n </Tooltip>\n </div>\n </div>\n ))}\n </div>\n\n <div className=\"flex items-center gap-3 p-4 rounded-lg bg-cyan-50\">\n <IconInfoCircle className=\"size-4 text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-regular text-zinc-950\">\n {translate('common.subscription.frozen.modal.keepsWorking')}\n </span>\n </div>\n </>\n )}\n </div>\n\n <div className=\"h-px bg-zinc-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 w-fit\" onClick={handleRegularize}>\n {translate('common.subscription.frozen.modal.cta')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA+FwB,SAaA,UAbA,KAGJ,YAHI;AA7FxB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AAEP,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,mBAAmB,8BAA8B;AAC1D,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEhC,MAAM,kBAAkB;AAAA,EACpB;AAAA,IACI,MAAM;AAAA,IACN,UAAU;AAAA,IACV,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,UAAU;AAAA,IACV,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,UAAU;AAAA,IACV,gBAAgB;AAAA,EACpB;AACJ;AAWe,SAAR,qBAAsC;AACzC,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAA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+CACX;AAAA,qCAAC,SAAI,WAAU,2BACX;AAAA,sCAAC,QAAK,MAAM,IAAI,WAAU,0BAAyB;AAAA,kBACnD,oBAAC,UAAK,WAAU,0CACX,oBAAU,QAAQ,GACvB;AAAA,mBACJ;AAAA,gBACA,qBAAC,WACG;AAAA,sCAAC,kBAAe,SAAO,MACnB;AAAA,oBAAC;AAAA;AAAA,sBACG,MAAK;AAAA,sBACL,cAAY,UAAU,QAAQ;AAAA,sBAC9B,WAAU;AAAA,sBAEV,8BAAC,kBAAe,WAAU,wBAAuB;AAAA;AAAA,kBACrD,GACJ;AAAA,kBACA;AAAA,oBAAC;AAAA;AAAA,sBACG,MAAK;AAAA,sBACL,WAAU;AAAA,sBAET,oBAAU,cAAc;AAAA;AAAA,kBAC7B;AAAA,mBACJ;AAAA,iBACJ;AAAA,iBA1BM,QA2BV,CACH,GACL;AAAA,YAEA,qBAAC,SAAI,WAAU,qDACX;AAAA,kCAAC,kBAAe,WAAU,iCAAgC;AAAA,cAC1D,oBAAC,UAAK,WAAU,yCACX,oBAAU,+CAA+C,GAC9D;AAAA,eACJ;AAAA,aACJ;AAAA,WAER;AAAA,QAEA,oBAAC,SAAI,WAAU,oBAAmB;AAAA,QAElC,oBAAC,SAAI,WAAU,sCACX,8BAAC,UAAO,WAAU,cAAa,SAAS,kBACnC,oBAAU,sCAAsC,GACrD,GACJ;AAAA;AAAA;AAAA,EACJ,GACJ;AAER;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modals/AccountFrozenModal.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n IconLock,\n IconFile,\n IconFolder,\n IconWorld,\n IconInfoCircle,\n type IconProps,\n} from '@tabler/icons-react';\nimport type { ComponentType } from 'react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/overlay/Tooltip';\nimport { useExternalContracting } from '../../providers/whitelabel.provider';\nimport { useModalManager } from '../../store/useModalManager';\nimport { formatShortDate } from '../../infra/utils/date';\nimport { WorkspaceSectionType } from '../../enums/WorkspaceSectionType';\nimport useAccountHubActions from '../account/hooks/useAccountHubActions';\n\nconst RESOURCE_GROUPS = [\n {\n icon: IconFile,\n titleKey: 'common.subscription.frozen.modal.resources.pages.title',\n descriptionKey: 'common.subscription.frozen.modal.resources.pages.description',\n },\n {\n icon: IconFolder,\n titleKey: 'common.subscription.frozen.modal.resources.projects.title',\n descriptionKey: 'common.subscription.frozen.modal.resources.projects.description',\n },\n {\n icon: IconWorld,\n titleKey: 'common.subscription.frozen.modal.resources.domains.title',\n descriptionKey: 'common.subscription.frozen.modal.resources.domains.description',\n },\n] as const satisfies readonly {\n icon: ComponentType<IconProps>;\n titleKey: string;\n descriptionKey: string;\n}[];\n\ninterface FrozenModalData {\n freezeDate?: Date | string | null;\n showResources?: boolean;\n}\n\nexport default function AccountFrozenModal() {\n const translate = useTranslations();\n const { activeModal, closeModal, modalData } = useModalManager();\n const isOpen = activeModal === 'accountFrozenModal';\n const { redirectToExternal } = useExternalContracting();\n const { openSection } = useAccountHubActions();\n\n const data = modalData as FrozenModalData | undefined;\n const freezeDate = data?.freezeDate ?? null;\n const isWarning = Boolean(freezeDate);\n const showResources = Boolean(data?.showResources);\n\n const title = isWarning\n ? translate('common.subscription.frozen.modal.warningTitle', {\n freezeDate: formatShortDate(freezeDate ? new Date(freezeDate) : null),\n })\n : translate('common.subscription.frozen.modal.title');\n\n const description = isWarning\n ? translate(\n showResources\n ? 'common.subscription.frozen.modal.warningDescriptionWithResources'\n : 'common.subscription.frozen.modal.warningDescription',\n )\n : translate(\n showResources\n ? 'common.subscription.frozen.modal.descriptionWithResources'\n : 'common.subscription.frozen.modal.description',\n );\n\n const handleRegularize = () => {\n if (redirectToExternal('plans')) return;\n closeModal();\n openSection(WorkspaceSectionType.SUBSCRIPTION);\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={() => closeModal()}>\n <DialogContent\n showCloseButton\n onOpenAutoFocus={(event) => event.preventDefault()}\n className=\"flex flex-col p-0! gap-0! max-w-[calc(100%-2rem)]! w-full sm:max-w-[400px]! lg:max-w-[420px]! rounded-lg border\"\n >\n <div className=\"flex flex-col gap-5 p-4 lg:p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-zinc-50 rounded-lg\">\n <IconLock size={20} className=\"text-zinc-950\" />\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {title}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-500\">\n {description}\n </DialogDescription>\n </div>\n\n {showResources && (\n <>\n <div className=\"bg-white border border-zinc-100 rounded-lg\">\n {RESOURCE_GROUPS.map(({ titleKey, descriptionKey, icon: Icon }, index) => (\n <div key={titleKey}>\n {index > 0 && <div className=\"h-px bg-zinc-100\" />}\n <div className=\"flex items-center justify-between gap-3 p-4\">\n <div className=\"flex items-center gap-3\">\n <Icon size={20} className=\"text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-semibold text-zinc-950\">\n {translate(titleKey)}\n </span>\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n aria-label={translate(titleKey)}\n className=\"flex items-center justify-center shrink-0 cursor-pointer\"\n >\n <IconInfoCircle className=\"size-4 text-zinc-400\" />\n </button>\n </TooltipTrigger>\n <TooltipContent\n side=\"top\"\n className=\"max-w-[240px]\"\n >\n {translate(descriptionKey)}\n </TooltipContent>\n </Tooltip>\n </div>\n </div>\n ))}\n </div>\n\n <div className=\"flex items-center gap-3 p-4 rounded-lg bg-cyan-50\">\n <IconInfoCircle className=\"size-4 text-zinc-950 shrink-0\" />\n <span className=\"paragraph-small-regular text-zinc-950\">\n {translate('common.subscription.frozen.modal.keepsWorking')}\n </span>\n </div>\n </>\n )}\n </div>\n\n <div className=\"h-px bg-zinc-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 w-fit\" onClick={handleRegularize}>\n {translate('common.subscription.frozen.modal.cta')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAkGwB,SAaA,UAbA,KAGJ,YAHI;AAhGxB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AAEP,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,OAAO,0BAA0B;AAEjC,MAAM,kBAAkB;AAAA,EACpB;AAAA,IACI,MAAM;AAAA,IACN,UAAU;AAAA,IACV,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,UAAU;AAAA,IACV,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,UAAU;AAAA,IACV,gBAAgB;AAAA,EACpB;AACJ;AAWe,SAAR,qBAAsC;AACzC,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAAE,aAAa,YAAY,UAAU,IAAI,gBAAgB;AAC/D,QAAM,SAAS,gBAAgB;AAC/B,QAAM,EAAE,mBAAmB,IAAI,uBAAuB;AACtD,QAAM,EAAE,YAAY,IAAI,qBAAqB;AAE7C,QAAM,OAAO;AACb,QAAM,aAAa,MAAM,cAAc;AACvC,QAAM,YAAY,QAAQ,UAAU;AACpC,QAAM,gBAAgB,QAAQ,MAAM,aAAa;AAEjD,QAAM,QAAQ,YACR,UAAU,iDAAiD;AAAA,IACvD,YAAY,gBAAgB,aAAa,IAAI,KAAK,UAAU,IAAI,IAAI;AAAA,EACxE,CAAC,IACD,UAAU,wCAAwC;AAExD,QAAM,cA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K;AAAA,sBACL,WAAU;AAAA,sBAET,oBAAU,cAAc;AAAA;AAAA,kBAC7B;AAAA,mBACJ;AAAA,iBACJ;AAAA,iBA1BM,QA2BV,CACH,GACL;AAAA,YAEA,qBAAC,SAAI,WAAU,qDACX;AAAA,kCAAC,kBAAe,WAAU,iCAAgC;AAAA,cAC1D,oBAAC,UAAK,WAAU,yCACX,oBAAU,+CAA+C,GAC9D;AAAA,eACJ;AAAA,aACJ;AAAA,WAER;AAAA,QAEA,oBAAC,SAAI,WAAU,oBAAmB;AAAA,QAElC,oBAAC,SAAI,WAAU,sCACX,8BAAC,UAAO,WAAU,cAAa,SAAS,kBACnC,oBAAU,sCAAsC,GACrD,GACJ;AAAA;AAAA;AAAA,EACJ,GACJ;AAER;","names":[]}
|
|
@@ -4,11 +4,11 @@ import { useEffect } from "react";
|
|
|
4
4
|
import AccountModals from "../account/AccountModals";
|
|
5
5
|
import { ModalManager } from "./ModalManager";
|
|
6
6
|
import { useAccountModals } from "../../store/useAccountModals";
|
|
7
|
-
function Modals({ registry, onGoToSubscription }) {
|
|
7
|
+
function Modals({ registry, onGoToSubscription, workspaceActions }) {
|
|
8
8
|
const { updateConfig } = useAccountModals();
|
|
9
9
|
useEffect(() => {
|
|
10
|
-
updateConfig({ onGoToSubscription });
|
|
11
|
-
}, [onGoToSubscription, updateConfig]);
|
|
10
|
+
updateConfig({ onGoToSubscription, workspaceActions });
|
|
11
|
+
}, [onGoToSubscription, workspaceActions, updateConfig]);
|
|
12
12
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
13
|
/* @__PURE__ */ jsx(AccountModals, {}),
|
|
14
14
|
/* @__PURE__ */ jsx(ModalManager, { registry })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/Modals.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentType, useEffect } from 'react';\nimport AccountModals from '../account/AccountModals';\nimport { ModalManager } from './ModalManager';\nimport { useAccountModals } from '../../store/useAccountModals';\ninterface ModalsProps {\n registry: Record<string, ComponentType>;\n onGoToSubscription?: () => void;\n}\n\nexport function Modals({ registry, onGoToSubscription }: ModalsProps) {\n const { updateConfig } = useAccountModals();\n\n useEffect(() => {\n updateConfig({ onGoToSubscription });\n }, [onGoToSubscription, updateConfig]);\n\n return (\n <>\n <AccountModals />\n <ModalManager registry={registry} />\n </>\n );\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modals/Modals.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentType, useEffect } from 'react';\nimport AccountModals from '../account/AccountModals';\nimport { ModalManager } from './ModalManager';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport type { WorkspaceActions } from '../account/types/workspace-actions.type';\ninterface ModalsProps {\n registry: Record<string, ComponentType>;\n onGoToSubscription?: () => void;\n /** Fluxos do app usados pelas abas do modal Minha conta (ver `WorkspaceActions`). */\n workspaceActions?: WorkspaceActions;\n}\n\nexport function Modals({ registry, onGoToSubscription, workspaceActions }: ModalsProps) {\n const { updateConfig } = useAccountModals();\n\n useEffect(() => {\n updateConfig({ onGoToSubscription, workspaceActions });\n }, [onGoToSubscription, workspaceActions, updateConfig]);\n\n return (\n <>\n <AccountModals />\n <ModalManager registry={registry} />\n </>\n );\n}\n"],"mappings":";AAsBI,mBACE,KADF;AApBJ,SAAwB,iBAAiB;AACzC,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAS1B,SAAS,OAAO,EAAE,UAAU,oBAAoB,iBAAiB,GAAgB;AACtF,QAAM,EAAE,aAAa,IAAI,iBAAiB;AAE1C,YAAU,MAAM;AACd,iBAAa,EAAE,oBAAoB,iBAAiB,CAAC;AAAA,EACvD,GAAG,CAAC,oBAAoB,kBAAkB,YAAY,CAAC;AAEvD,SACE,iCACE;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,gBAAa,UAAoB;AAAA,KACpC;AAEJ;","names":[]}
|
|
@@ -10,20 +10,19 @@ import {
|
|
|
10
10
|
DialogHeader,
|
|
11
11
|
DialogTitle
|
|
12
12
|
} from "../ui/overlay/Dialog";
|
|
13
|
-
import { useWhitelabelUrls, useExternalContracting } from "../../providers/whitelabel.provider";
|
|
14
13
|
import { useModalManager } from "../../store/useModalManager";
|
|
14
|
+
import useAccountHubActions from "../account/hooks/useAccountHubActions";
|
|
15
15
|
function PaidPlanRequiredModal() {
|
|
16
16
|
const translate = useTranslations();
|
|
17
17
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
18
18
|
const isOpen = activeModal === "paidPlanRequiredModal";
|
|
19
19
|
const data = modalData;
|
|
20
|
-
const {
|
|
21
|
-
const { redirectToExternal } = useExternalContracting();
|
|
20
|
+
const { openPlansCatalog } = useAccountHubActions();
|
|
22
21
|
const title = data.title ?? translate("common.credits.paidPlanRequired.defaultTitle");
|
|
23
22
|
const description = data.description ?? translate("common.credits.paidPlanRequired.defaultDescription");
|
|
24
23
|
const handleKnowPlans = () => {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
closeModal();
|
|
25
|
+
openPlansCatalog();
|
|
27
26
|
};
|
|
28
27
|
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: () => closeModal(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 w-full md:w-[410px] lg:w-[410px]", children: [
|
|
29
28
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "gap-3 text-left p-5", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/PaidPlanRequiredModal.tsx"],"sourcesContent":["\"use client\";\n\nimport { IconLock } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modals/PaidPlanRequiredModal.tsx"],"sourcesContent":["\"use client\";\n\nimport { IconLock } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { useModalManager } from '../../store/useModalManager';\nimport type { ModalData } from '../../store/useModalManager';\nimport useAccountHubActions from '../account/hooks/useAccountHubActions';\n\nexport default function PaidPlanRequiredModal() {\n const translate = useTranslations();\n const { activeModal, modalData, closeModal } = useModalManager();\n const isOpen = activeModal === 'paidPlanRequiredModal';\n const data = modalData as ModalData & { title?: string; description?: string };\n const { openPlansCatalog } = useAccountHubActions();\n\n const title = (data.title as string) ?? translate('common.credits.paidPlanRequired.defaultTitle');\n const description = (data.description as string) ?? translate('common.credits.paidPlanRequired.defaultDescription');\n\n const handleKnowPlans = () => {\n closeModal();\n openPlansCatalog();\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={() => closeModal()}>\n <DialogContent className=\"flex flex-col p-0 gap-0 w-full md:w-[410px] lg:w-[410px]\">\n <DialogHeader className=\"gap-3 text-left p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-zinc-50 rounded-lg\">\n <IconLock size={24} className=\"text-zinc-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {title}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-600\">\n {description}\n </DialogDescription>\n </div>\n </DialogHeader>\n <div className=\"flex items-center gap-2 p-5 border-t border-zinc-200\">\n <Button\n className=\"w-fit h-10!\"\n onClick={handleKnowPlans}\n >\n {translate('common.credits.paidPlanRequired.knowPlans')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAoCwB,cAEJ,YAFI;AAlCxB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,uBAAuB;AAEhC,OAAO,0BAA0B;AAElB,SAAR,wBAAyC;AAC5C,QAAM,YAAY,gBAAgB;AAClC,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAC/D,QAAM,SAAS,gBAAgB;AAC/B,QAAM,OAAO;AACb,QAAM,EAAE,iBAAiB,IAAI,qBAAqB;AAElD,QAAM,QAAS,KAAK,SAAoB,UAAU,8CAA8C;AAChG,QAAM,cAAe,KAAK,eAA0B,UAAU,oDAAoD;AAElH,QAAM,kBAAkB,MAAM;AAC1B,eAAW;AACX,qBAAiB;AAAA,EACrB;AAEA,SACI,oBAAC,UAAO,MAAM,QAAQ,cAAc,MAAM,WAAW,GACjD,+BAAC,iBAAc,WAAU,4DACrB;AAAA,yBAAC,gBAAa,WAAU,uBACpB;AAAA,0BAAC,SAAI,WAAU,oEACX,8BAAC,YAAS,MAAM,IAAI,WAAU,iBAAgB,GAClD;AAAA,MACA,qBAAC,SAAI,WAAU,uBACX;AAAA,4BAAC,eAAY,WAAU,2CAClB,iBACL;AAAA,QACA,oBAAC,qBAAkB,WAAU,yCACxB,uBACL;AAAA,SACJ;AAAA,OACJ;AAAA,IACA,oBAAC,SAAI,WAAU,wDACX;AAAA,MAAC;AAAA;AAAA,QACG,WAAU;AAAA,QACV,SAAS;AAAA,QAER,oBAAU,2CAA2C;AAAA;AAAA,IAC1D,GACJ;AAAA,KACJ,GACJ;AAER;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { IconAlertTriangle } from "@tabler/icons-react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import { Button } from "../../ui/buttons/Button";
|
|
6
|
+
import { Separator } from "../../ui/data-display/Separator";
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle
|
|
13
|
+
} from "../../ui/overlay/Dialog";
|
|
14
|
+
import { useAddCardWithPaymentSwitch } from "../../account/hooks/useAddCardWithPaymentSwitch";
|
|
15
|
+
import { useModalManager } from "../../../store/useModalManager";
|
|
16
|
+
function AddFirstCardWarningModal() {
|
|
17
|
+
const translate = useTranslations();
|
|
18
|
+
const translateModal = useTranslations("common.account.workspace.subscription.addFirstCard");
|
|
19
|
+
const { activeModal, closeModal } = useModalManager();
|
|
20
|
+
const { openAddCard } = useAddCardWithPaymentSwitch();
|
|
21
|
+
const open = activeModal === "addFirstCardWarningModal";
|
|
22
|
+
const handleContinue = () => {
|
|
23
|
+
closeModal();
|
|
24
|
+
openAddCard();
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Dialog,
|
|
28
|
+
{
|
|
29
|
+
open,
|
|
30
|
+
onOpenChange: (nextOpen) => {
|
|
31
|
+
if (!nextOpen) closeModal();
|
|
32
|
+
},
|
|
33
|
+
children: /* @__PURE__ */ jsxs(
|
|
34
|
+
DialogContent,
|
|
35
|
+
{
|
|
36
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
37
|
+
className: "flex flex-col p-0 gap-0 md:w-[410px]! lg:w-[410px]! max-w-[410px]! max-[410px]:w-[calc(100%-32px)] duration-0!",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "gap-3 text-left p-5", children: [
|
|
40
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-10 h-10 bg-zinc-100 rounded-lg", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-zinc-950" }) }),
|
|
41
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
42
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-zinc-950", children: translateModal("title") }),
|
|
43
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-zinc-600", asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
44
|
+
/* @__PURE__ */ jsx("p", { children: translateModal("description1") }),
|
|
45
|
+
/* @__PURE__ */ jsx("p", { children: translateModal("description2") })
|
|
46
|
+
] }) })
|
|
47
|
+
] })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
50
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-5", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10! transition-colors", onClick: handleContinue, children: translateModal("continue") }),
|
|
52
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10! transition-colors", onClick: closeModal, children: translate("common.actions.cancel") })
|
|
53
|
+
] })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
AddFirstCardWarningModal as default
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=AddFirstCardWarningModal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modals/cards/AddFirstCardWarningModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../../ui/buttons/Button';\nimport { Separator } from '../../ui/data-display/Separator';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../../ui/overlay/Dialog';\nimport { useAddCardWithPaymentSwitch } from '../../account/hooks/useAddCardWithPaymentSwitch';\nimport { useModalManager } from '../../../store/useModalManager';\n\n/** Primeiro cartão da conta: avisa que ele passa a ser a forma de pagamento da assinatura. */\nexport default function AddFirstCardWarningModal() {\n const translate = useTranslations();\n const translateModal = useTranslations('common.account.workspace.subscription.addFirstCard');\n const { activeModal, closeModal } = useModalManager();\n const { openAddCard } = useAddCardWithPaymentSwitch();\n\n const open = activeModal === 'addFirstCardWarningModal';\n\n const handleContinue = () => {\n closeModal();\n openAddCard();\n };\n\n return (\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n if (!nextOpen) closeModal();\n }}\n >\n <DialogContent\n onOpenAutoFocus={(event) => event.preventDefault()}\n className=\"flex flex-col p-0 gap-0 md:w-[410px]! lg:w-[410px]! max-w-[410px]! max-[410px]:w-[calc(100%-32px)] duration-0!\"\n >\n <DialogHeader className=\"gap-3 text-left p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-zinc-100 rounded-lg\">\n <IconAlertTriangle size={20} className=\"text-zinc-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {translateModal('title')}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-600\" asChild>\n <div className=\"flex flex-col gap-3\">\n <p>{translateModal('description1')}</p>\n <p>{translateModal('description2')}</p>\n </div>\n </DialogDescription>\n </div>\n </DialogHeader>\n\n <Separator />\n\n <div className=\"flex items-center gap-2 p-5\">\n <Button className=\"h-10! transition-colors\" onClick={handleContinue}>\n {translateModal('continue')}\n </Button>\n <Button variant=\"secondary\" className=\"h-10! transition-colors\" onClick={closeModal}>\n {translate('common.actions.cancel')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2CY,cAOE,YAPF;AAzCZ,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAC5C,SAAS,uBAAuB;AAGjB,SAAR,2BAA4C;AACjD,QAAM,YAAY,gBAAgB;AAClC,QAAM,iBAAiB,gBAAgB,oDAAoD;AAC3F,QAAM,EAAE,aAAa,WAAW,IAAI,gBAAgB;AACpD,QAAM,EAAE,YAAY,IAAI,4BAA4B;AAEpD,QAAM,OAAO,gBAAgB;AAE7B,QAAM,iBAAiB,MAAM;AAC3B,eAAW;AACX,gBAAY;AAAA,EACd;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,cAAc,CAAC,aAAa;AAC1B,YAAI,CAAC,SAAU,YAAW;AAAA,MAC5B;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,iBAAiB,CAAC,UAAU,MAAM,eAAe;AAAA,UACjD,WAAU;AAAA,UAEV;AAAA,iCAAC,gBAAa,WAAU,uBACtB;AAAA,kCAAC,SAAI,WAAU,qEACb,8BAAC,qBAAkB,MAAM,IAAI,WAAU,iBAAgB,GACzD;AAAA,cACA,qBAAC,SAAI,WAAU,uBACb;AAAA,oCAAC,eAAY,WAAU,2CACpB,yBAAe,OAAO,GACzB;AAAA,gBACA,oBAAC,qBAAkB,WAAU,yCAAwC,SAAO,MAC1E,+BAAC,SAAI,WAAU,uBACb;AAAA,sCAAC,OAAG,yBAAe,cAAc,GAAE;AAAA,kBACnC,oBAAC,OAAG,yBAAe,cAAc,GAAE;AAAA,mBACrC,GACF;AAAA,iBACF;AAAA,eACF;AAAA,YAEA,oBAAC,aAAU;AAAA,YAEX,qBAAC,SAAI,WAAU,+BACb;AAAA,kCAAC,UAAO,WAAU,2BAA0B,SAAS,gBAClD,yBAAe,UAAU,GAC5B;AAAA,cACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,2BAA0B,SAAS,YACtE,oBAAU,uBAAuB,GACpC;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { IconCheck, IconCreditCard } from "@tabler/icons-react";
|
|
5
|
+
import { useStripe } from "@stripe/react-stripe-js";
|
|
6
|
+
import { useTranslations } from "next-intl";
|
|
7
|
+
import { toast } from "sonner";
|
|
8
|
+
import { Button } from "../../ui/buttons/Button";
|
|
9
|
+
import { Separator } from "../../ui/data-display/Separator";
|
|
10
|
+
import { Toast } from "../../ui/feedback/Toast";
|
|
11
|
+
import {
|
|
12
|
+
Dialog,
|
|
13
|
+
DialogContent,
|
|
14
|
+
DialogDescription,
|
|
15
|
+
DialogHeader,
|
|
16
|
+
DialogTitle
|
|
17
|
+
} from "../../ui/overlay/Dialog";
|
|
18
|
+
import { useCurrencyFormatter } from "../../../modules/accounts/hooks/use-currency-formatter.hook";
|
|
19
|
+
import { useUpdateSubscriptionPayment } from "../../../modules/subscriptions/hooks/update-subscription-payment.hook";
|
|
20
|
+
import {
|
|
21
|
+
confirmPaymentIfRequired,
|
|
22
|
+
PaymentAuthenticationError
|
|
23
|
+
} from "../../../modules/subscriptions/utils/confirm-payment-if-required";
|
|
24
|
+
import { useModalManager } from "../../../store/useModalManager";
|
|
25
|
+
function SwitchPaymentToCardModal() {
|
|
26
|
+
const translate = useTranslations("common.account.workspace.subscription.switchPaymentToCard");
|
|
27
|
+
const stripe = useStripe();
|
|
28
|
+
const { activeModal, modalData, closeModal } = useModalManager();
|
|
29
|
+
const { formatCurrencyNumber } = useCurrencyFormatter();
|
|
30
|
+
const { mutateAsync: updatePayment } = useUpdateSubscriptionPayment();
|
|
31
|
+
const [isSwitching, setIsSwitching] = useState(false);
|
|
32
|
+
const open = activeModal === "switchPaymentToCardModal";
|
|
33
|
+
const cardId = modalData.cardId;
|
|
34
|
+
const subscriptionId = modalData.subscriptionId;
|
|
35
|
+
const currentPaymentMethod = modalData.currentPaymentMethod;
|
|
36
|
+
const previousCardsCount = modalData.previousCardsCount ?? 0;
|
|
37
|
+
const isChangingMethod = currentPaymentMethod === 2 || currentPaymentMethod === 3;
|
|
38
|
+
const methodName = translate(currentPaymentMethod === 3 ? "methodPix" : "methodBoleto");
|
|
39
|
+
const handleConfirm = useCallback(async () => {
|
|
40
|
+
if (!cardId || subscriptionId == null) return;
|
|
41
|
+
if (!stripe) {
|
|
42
|
+
toast.custom(
|
|
43
|
+
(toastId) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: translate("errorToast"), toastId }),
|
|
44
|
+
{ duration: 5e3 }
|
|
45
|
+
);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setIsSwitching(true);
|
|
49
|
+
try {
|
|
50
|
+
const result = await updatePayment({
|
|
51
|
+
subscriptionId,
|
|
52
|
+
data: { payment_method: 1, id_card: cardId, charge_now: true }
|
|
53
|
+
});
|
|
54
|
+
if (result.applied === false) {
|
|
55
|
+
if (result.client_secret) {
|
|
56
|
+
await confirmPaymentIfRequired(
|
|
57
|
+
stripe,
|
|
58
|
+
{ client_secret: result.client_secret },
|
|
59
|
+
translate("authError")
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
closeModal();
|
|
63
|
+
toast.custom(
|
|
64
|
+
(toastId) => /* @__PURE__ */ jsx(Toast, { variant: "warning", message: translate("pendingBlocked"), toastId }),
|
|
65
|
+
{ duration: 8e3 }
|
|
66
|
+
);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let outcome = result.charge_now?.outcome ?? "none";
|
|
70
|
+
if (outcome === "requires_action" && result.charge_now?.client_secret) {
|
|
71
|
+
await confirmPaymentIfRequired(
|
|
72
|
+
stripe,
|
|
73
|
+
{ client_secret: result.charge_now.client_secret },
|
|
74
|
+
translate("authError")
|
|
75
|
+
);
|
|
76
|
+
outcome = "charged";
|
|
77
|
+
}
|
|
78
|
+
closeModal();
|
|
79
|
+
if (outcome === "declined") {
|
|
80
|
+
toast.custom(
|
|
81
|
+
(toastId) => /* @__PURE__ */ jsx(Toast, { variant: "warning", message: translate("switchedChargeFailed"), toastId }),
|
|
82
|
+
{ duration: 8e3 }
|
|
83
|
+
);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const amount = result.charge_now?.amount;
|
|
87
|
+
const successMessage = outcome === "charged" && typeof amount === "number" ? translate("successWithCharge", { value: formatCurrencyNumber(amount / 100) }) : translate("successToast");
|
|
88
|
+
toast.custom(
|
|
89
|
+
(toastId) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: successMessage, toastId }),
|
|
90
|
+
{ duration: 5e3 }
|
|
91
|
+
);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
const isAuthFailure = error instanceof PaymentAuthenticationError;
|
|
94
|
+
const message = error instanceof Error && error.message ? error.message : translate("errorToast");
|
|
95
|
+
toast.custom(
|
|
96
|
+
(toastId) => /* @__PURE__ */ jsx(
|
|
97
|
+
Toast,
|
|
98
|
+
{
|
|
99
|
+
variant: isAuthFailure ? "warning" : "error",
|
|
100
|
+
message,
|
|
101
|
+
toastId
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
{ duration: isAuthFailure ? 8e3 : 5e3 }
|
|
105
|
+
);
|
|
106
|
+
} finally {
|
|
107
|
+
setIsSwitching(false);
|
|
108
|
+
}
|
|
109
|
+
}, [
|
|
110
|
+
cardId,
|
|
111
|
+
subscriptionId,
|
|
112
|
+
updatePayment,
|
|
113
|
+
stripe,
|
|
114
|
+
translate,
|
|
115
|
+
closeModal,
|
|
116
|
+
formatCurrencyNumber
|
|
117
|
+
]);
|
|
118
|
+
return /* @__PURE__ */ jsx(
|
|
119
|
+
Dialog,
|
|
120
|
+
{
|
|
121
|
+
open,
|
|
122
|
+
onOpenChange: (nextOpen) => {
|
|
123
|
+
if (!nextOpen) closeModal();
|
|
124
|
+
},
|
|
125
|
+
children: /* @__PURE__ */ jsxs(
|
|
126
|
+
DialogContent,
|
|
127
|
+
{
|
|
128
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
129
|
+
className: "flex flex-col p-0 gap-0 md:w-[410px]! lg:w-[410px]! max-w-[410px]! max-[410px]:w-[calc(100%-32px)]",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "gap-3 text-left p-5", children: [
|
|
132
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-10 h-10 bg-zinc-100 rounded-lg", children: /* @__PURE__ */ jsx(IconCreditCard, { size: 20, className: "text-zinc-950" }) }),
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
134
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-zinc-950", children: translate("title") }),
|
|
135
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-zinc-600", asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
136
|
+
/* @__PURE__ */ jsx("p", { children: previousCardsCount === 0 ? translate("introFirstCard") : translate("intro") }),
|
|
137
|
+
/* @__PURE__ */ jsxs("ul", { className: "flex flex-col gap-2", children: [
|
|
138
|
+
isChangingMethod && /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
|
|
139
|
+
/* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 mt-0.5 shrink-0" }),
|
|
140
|
+
/* @__PURE__ */ jsx("span", { children: translate("changeMethod", { method: methodName }) })
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
|
|
143
|
+
/* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 mt-0.5 shrink-0" }),
|
|
144
|
+
/* @__PURE__ */ jsx("span", { children: translate("changeDefault") })
|
|
145
|
+
] }),
|
|
146
|
+
/* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
|
|
147
|
+
/* @__PURE__ */ jsx(IconCheck, { size: 16, className: "text-zinc-950 mt-0.5 shrink-0" }),
|
|
148
|
+
/* @__PURE__ */ jsx("span", { children: translate("chargeNow") })
|
|
149
|
+
] })
|
|
150
|
+
] }),
|
|
151
|
+
/* @__PURE__ */ jsx("p", { children: translate("declineHint") })
|
|
152
|
+
] }) })
|
|
153
|
+
] })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
156
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-5", children: [
|
|
157
|
+
/* @__PURE__ */ jsx(
|
|
158
|
+
Button,
|
|
159
|
+
{
|
|
160
|
+
className: "h-10! transition-colors",
|
|
161
|
+
onClick: handleConfirm,
|
|
162
|
+
disabled: isSwitching,
|
|
163
|
+
loading: isSwitching,
|
|
164
|
+
children: translate("confirm")
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ jsx(
|
|
168
|
+
Button,
|
|
169
|
+
{
|
|
170
|
+
variant: "secondary",
|
|
171
|
+
className: "h-10! transition-colors",
|
|
172
|
+
onClick: closeModal,
|
|
173
|
+
disabled: isSwitching,
|
|
174
|
+
children: translate("decline")
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] })
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
export {
|
|
185
|
+
SwitchPaymentToCardModal as default
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=SwitchPaymentToCardModal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modals/cards/SwitchPaymentToCardModal.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useState } from 'react';\nimport { IconCheck, IconCreditCard } from '@tabler/icons-react';\nimport { useStripe } from '@stripe/react-stripe-js';\nimport { useTranslations } from 'next-intl';\nimport { toast } from 'sonner';\nimport { Button } from '../../ui/buttons/Button';\nimport { Separator } from '../../ui/data-display/Separator';\nimport { Toast } from '../../ui/feedback/Toast';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../../ui/overlay/Dialog';\nimport { useCurrencyFormatter } from '../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { useUpdateSubscriptionPayment } from '../../../modules/subscriptions/hooks/update-subscription-payment.hook';\nimport {\n confirmPaymentIfRequired,\n PaymentAuthenticationError,\n} from '../../../modules/subscriptions/utils/confirm-payment-if-required';\nimport { useModalManager } from '../../../store/useModalManager';\n\n/**\n * Pergunta, logo depois do cadastro do cartão, se a assinatura passa a ser cobrada nele.\n *\n * Cadastrar cartão e trocar a forma de pagamento eram passos separados que o cliente tinha de\n * descobrir sozinho: o cartão entrava, a conta seguia em boleto/pix (ou no cartão problemático)\n * e a cobrança seguinte falhava de novo. A lista do \"o que vai mudar\" sai do estado real da\n * conta — confirmação genérica vira um sim às cegas.\n */\nexport default function SwitchPaymentToCardModal() {\n const translate = useTranslations('common.account.workspace.subscription.switchPaymentToCard');\n const stripe = useStripe();\n const { activeModal, modalData, closeModal } = useModalManager();\n const { formatCurrencyNumber } = useCurrencyFormatter();\n const { mutateAsync: updatePayment } = useUpdateSubscriptionPayment();\n const [isSwitching, setIsSwitching] = useState(false);\n\n const open = activeModal === 'switchPaymentToCardModal';\n\n const cardId = modalData.cardId as string | undefined;\n const subscriptionId = modalData.subscriptionId as string | number | undefined;\n const currentPaymentMethod = modalData.currentPaymentMethod as number | null | undefined;\n const previousCardsCount = (modalData.previousCardsCount as number | undefined) ?? 0;\n\n const isChangingMethod = currentPaymentMethod === 2 || currentPaymentMethod === 3;\n const methodName = translate(currentPaymentMethod === 3 ? 'methodPix' : 'methodBoleto');\n\n const handleConfirm = useCallback(async () => {\n if (!cardId || subscriptionId == null) return;\n\n // Sem Stripe carregado não há como concluir um desafio, e `confirmPaymentIfRequired` viraria\n // no-op silencioso — a tela anunciaria pagamento aprovado sem ninguém ter autenticado nada.\n if (!stripe) {\n toast.custom(\n (toastId) => <Toast variant=\"error\" message={translate('errorToast')} toastId={toastId} />,\n { duration: 5000 }\n );\n return;\n }\n\n setIsSwitching(true);\n try {\n const result = await updatePayment({\n subscriptionId,\n data: { payment_method: 1, id_card: cardId, charge_now: true },\n });\n\n // A troca não foi aplicada: há pagamento pendente travando a assinatura e o backend devolve\n // o desafio em vez de trocar. Concluir o 3DS destrava, mas a troca ainda não aconteceu.\n if (result.applied === false) {\n if (result.client_secret) {\n await confirmPaymentIfRequired(\n stripe,\n { client_secret: result.client_secret },\n translate('authError')\n );\n }\n closeModal();\n toast.custom(\n (toastId) => (\n <Toast variant=\"warning\" message={translate('pendingBlocked')} toastId={toastId} />\n ),\n { duration: 8000 }\n );\n return;\n }\n\n // O desfecho sai do `outcome`: ler um booleano capturado ANTES do desafio anunciava falha\n // para pagamento que tinha acabado de completar.\n let outcome = result.charge_now?.outcome ?? 'none';\n\n if (outcome === 'requires_action' && result.charge_now?.client_secret) {\n // `confirmPaymentIfRequired` só retorna sem lançar quando o pagamento foi capturado.\n await confirmPaymentIfRequired(\n stripe,\n { client_secret: result.charge_now.client_secret },\n translate('authError')\n );\n outcome = 'charged';\n }\n\n closeModal();\n\n // Troca e cobrança têm desfechos independentes: anunciar só \"tudo certo\" esconderia uma\n // fatura que continua aberta.\n if (outcome === 'declined') {\n toast.custom(\n (toastId) => (\n <Toast variant=\"warning\" message={translate('switchedChargeFailed')} toastId={toastId} />\n ),\n { duration: 8000 }\n );\n return;\n }\n\n const amount = result.charge_now?.amount;\n const successMessage =\n outcome === 'charged' && typeof amount === 'number'\n ? translate('successWithCharge', { value: formatCurrencyNumber(amount / 100) })\n : translate('successToast');\n\n toast.custom(\n (toastId) => <Toast variant=\"success\" message={successMessage} toastId={toastId} />,\n { duration: 5000 }\n );\n } catch (error) {\n // Falha de autenticação e falha de API têm causas diferentes: no 3DS a troca já aconteceu\n // e só o pagamento ficou pendente.\n const isAuthFailure = error instanceof PaymentAuthenticationError;\n const message =\n error instanceof Error && error.message ? error.message : translate('errorToast');\n\n toast.custom(\n (toastId) => (\n <Toast\n variant={isAuthFailure ? 'warning' : 'error'}\n message={message}\n toastId={toastId}\n />\n ),\n { duration: isAuthFailure ? 8000 : 5000 }\n );\n } finally {\n setIsSwitching(false);\n }\n }, [\n cardId,\n subscriptionId,\n updatePayment,\n stripe,\n translate,\n closeModal,\n formatCurrencyNumber,\n ]);\n\n return (\n <Dialog\n open={open}\n onOpenChange={(nextOpen) => {\n if (!nextOpen) closeModal();\n }}\n >\n <DialogContent\n onOpenAutoFocus={(event) => event.preventDefault()}\n className=\"flex flex-col p-0 gap-0 md:w-[410px]! lg:w-[410px]! max-w-[410px]! max-[410px]:w-[calc(100%-32px)]\"\n >\n <DialogHeader className=\"gap-3 text-left p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-zinc-100 rounded-lg\">\n <IconCreditCard size={20} className=\"text-zinc-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {translate('title')}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-600\" asChild>\n <div className=\"flex flex-col gap-3\">\n <p>{previousCardsCount === 0 ? translate('introFirstCard') : translate('intro')}</p>\n\n <ul className=\"flex flex-col gap-2\">\n {isChangingMethod && (\n <li className=\"flex items-start gap-2\">\n <IconCheck size={16} className=\"text-zinc-950 mt-0.5 shrink-0\" />\n <span>{translate('changeMethod', { method: methodName })}</span>\n </li>\n )}\n <li className=\"flex items-start gap-2\">\n <IconCheck size={16} className=\"text-zinc-950 mt-0.5 shrink-0\" />\n <span>{translate('changeDefault')}</span>\n </li>\n {/* Sem valor previsto: a consulta que alimentava a previsão era da conta\n inteira e incluía rascunho, então o modal anunciava um valor e a API cobrava\n outro. O valor cobrado vai no toast, vindo do `outcome`. */}\n <li className=\"flex items-start gap-2\">\n <IconCheck size={16} className=\"text-zinc-950 mt-0.5 shrink-0\" />\n <span>{translate('chargeNow')}</span>\n </li>\n </ul>\n\n <p>{translate('declineHint')}</p>\n </div>\n </DialogDescription>\n </div>\n </DialogHeader>\n\n <Separator />\n\n <div className=\"flex items-center gap-2 p-5\">\n <Button\n className=\"h-10! transition-colors\"\n onClick={handleConfirm}\n disabled={isSwitching}\n loading={isSwitching}\n >\n {translate('confirm')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! transition-colors\"\n onClick={closeModal}\n disabled={isSwitching}\n >\n {translate('decline')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA0DqB,cA8HD,YA9HC;AAxDrB,SAAS,aAAa,gBAAgB;AACtC,SAAS,WAAW,sBAAsB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,oCAAoC;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAUjB,SAAR,2BAA4C;AACjD,QAAM,YAAY,gBAAgB,2DAA2D;AAC7F,QAAM,SAAS,UAAU;AACzB,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAC/D,QAAM,EAAE,qBAAqB,IAAI,qBAAqB;AACtD,QAAM,EAAE,aAAa,cAAc,IAAI,6BAA6B;AACpE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,OAAO,gBAAgB;AAE7B,QAAM,SAAS,UAAU;AACzB,QAAM,iBAAiB,UAAU;AACjC,QAAM,uBAAuB,UAAU;AACvC,QAAM,qBAAsB,UAAU,sBAA6C;AAEnF,QAAM,mBAAmB,yBAAyB,KAAK,yBAAyB;AAChF,QAAM,aAAa,UAAU,yBAAyB,IAAI,cAAc,cAAc;AAEtF,QAAM,gBAAgB,YAAY,YAAY;AAC5C,QAAI,CAAC,UAAU,kBAAkB,KAAM;AAIvC,QAAI,CAAC,QAAQ;AACX,YAAM;AAAA,QACJ,CAAC,YAAY,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