@greatapps/common 1.1.789 → 1.1.791
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/AccountHubLinkHandler.mjs +36 -0
- package/dist/components/account/AccountHubLinkHandler.mjs.map +1 -0
- package/dist/components/account/AccountModalLayout.mjs +137 -0
- package/dist/components/account/AccountModalLayout.mjs.map +1 -0
- package/dist/components/account/AccountModals.mjs +10 -3
- package/dist/components/account/AccountModals.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +1 -1
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +8 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/MyAccountModal.mjs +167 -0
- package/dist/components/account/MyAccountModal.mjs.map +1 -0
- package/dist/components/account/TwoFactorAuthModal.mjs +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/hooks/useAccountHubActions.mjs +85 -0
- package/dist/components/account/hooks/useAccountHubActions.mjs.map +1 -0
- package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs +44 -0
- package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs.map +1 -0
- package/dist/components/account/hooks/useAffiliatesActions.mjs +69 -0
- package/dist/components/account/hooks/useAffiliatesActions.mjs.map +1 -0
- package/dist/components/account/hooks/useMyAccountModal.mjs +27 -0
- package/dist/components/account/hooks/useMyAccountModal.mjs.map +1 -0
- package/dist/components/account/hooks/useProjectsActions.mjs +40 -0
- package/dist/components/account/hooks/useProjectsActions.mjs.map +1 -0
- package/dist/components/account/hooks/useSubscriptionActions.mjs +87 -0
- package/dist/components/account/hooks/useSubscriptionActions.mjs.map +1 -0
- package/dist/components/account/hooks/useTeamActions.mjs +31 -0
- package/dist/components/account/hooks/useTeamActions.mjs.map +1 -0
- package/dist/components/account/sections/AffiliatesSection.mjs +313 -0
- package/dist/components/account/sections/AffiliatesSection.mjs.map +1 -0
- package/dist/components/account/sections/ChangePasswordSection.mjs +5 -5
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +194 -144
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +60 -49
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/ProjectsSection.mjs +77 -0
- package/dist/components/account/sections/ProjectsSection.mjs.map +1 -0
- package/dist/components/account/sections/SecuritySection.mjs +55 -36
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/account/sections/SubscriptionSection.mjs +29 -0
- package/dist/components/account/sections/SubscriptionSection.mjs.map +1 -0
- package/dist/components/account/sections/TeamSection.mjs +119 -0
- package/dist/components/account/sections/TeamSection.mjs.map +1 -0
- package/dist/components/account/sections/TokenSection.mjs +41 -43
- package/dist/components/account/sections/TokenSection.mjs.map +1 -1
- package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs +73 -0
- package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateFlows.mjs +20 -0
- package/dist/components/account/sections/affiliates/AffiliateFlows.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs +99 -0
- package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs +31 -0
- package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs +15 -0
- package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs +108 -0
- package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs +49 -0
- package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs +182 -0
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs +476 -0
- package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs +34 -0
- package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs +27 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs +30 -0
- package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs.map +1 -0
- package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs +120 -0
- package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs.map +1 -0
- package/dist/components/account/sections/projects/DeleteProjectModal.mjs +205 -0
- package/dist/components/account/sections/projects/DeleteProjectModal.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectFlows.mjs +16 -0
- package/dist/components/account/sections/projects/ProjectFlows.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectMembersStack.mjs +53 -0
- package/dist/components/account/sections/projects/ProjectMembersStack.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectRow.mjs +85 -0
- package/dist/components/account/sections/projects/ProjectRow.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectSheet.mjs +499 -0
- package/dist/components/account/sections/projects/ProjectSheet.mjs.map +1 -0
- package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs +55 -0
- package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs.map +1 -0
- package/dist/components/account/sections/projects/project-form.schema.mjs +28 -0
- package/dist/components/account/sections/projects/project-form.schema.mjs.map +1 -0
- package/dist/components/account/sections/shared/ConnectListRow.mjs +45 -0
- package/dist/components/account/sections/shared/ConnectListRow.mjs.map +1 -0
- package/dist/components/account/sections/shared/DateFilterPopover.mjs +51 -0
- package/dist/components/account/sections/shared/DateFilterPopover.mjs.map +1 -0
- package/dist/components/account/sections/shared/EntityAvatar.mjs +41 -0
- package/dist/components/account/sections/shared/EntityAvatar.mjs.map +1 -0
- package/dist/components/account/sections/shared/FilterPopover.mjs +62 -0
- package/dist/components/account/sections/shared/FilterPopover.mjs.map +1 -0
- package/dist/components/account/sections/shared/FormSection.mjs +14 -0
- package/dist/components/account/sections/shared/FormSection.mjs.map +1 -0
- package/dist/components/account/sections/shared/IconBox.mjs +18 -0
- package/dist/components/account/sections/shared/IconBox.mjs.map +1 -0
- package/dist/components/account/sections/shared/InfiniteScrollList.mjs +36 -0
- package/dist/components/account/sections/shared/InfiniteScrollList.mjs.map +1 -0
- package/dist/components/account/sections/shared/ListPagination.mjs +69 -0
- package/dist/components/account/sections/shared/ListPagination.mjs.map +1 -0
- package/dist/components/account/sections/shared/RowActionsMenu.mjs +52 -0
- package/dist/components/account/sections/shared/RowActionsMenu.mjs.map +1 -0
- package/dist/components/account/sections/shared/SectionLoadError.mjs +20 -0
- package/dist/components/account/sections/shared/SectionLoadError.mjs.map +1 -0
- package/dist/components/account/sections/shared/StatusBadge.mjs +26 -0
- package/dist/components/account/sections/shared/StatusBadge.mjs.map +1 -0
- package/dist/components/account/sections/shared/WorkspaceSection.mjs +10 -0
- package/dist/components/account/sections/shared/WorkspaceSection.mjs.map +1 -0
- package/dist/components/account/sections/subscription/AiCreditsUsage.mjs +106 -0
- package/dist/components/account/sections/subscription/AiCreditsUsage.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BillingAddressSheet.mjs +407 -0
- package/dist/components/account/sections/subscription/BillingAddressSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs +73 -0
- package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs +22 -0
- package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/CancelPlanDialog.mjs +161 -0
- package/dist/components/account/sections/subscription/CancelPlanDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargeRow.mjs +127 -0
- package/dist/components/account/sections/subscription/ChargeRow.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs +27 -0
- package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ChargesList.mjs +88 -0
- package/dist/components/account/sections/subscription/ChargesList.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ManageCardsSheet.mjs +49 -0
- package/dist/components/account/sections/subscription/ManageCardsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs +26 -0
- package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PayChargeDialog.mjs +222 -0
- package/dist/components/account/sections/subscription/PayChargeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs +61 -0
- package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs +72 -0
- package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PendingChangeDialog.mjs +117 -0
- package/dist/components/account/sections/subscription/PendingChangeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PixDetailsDialog.mjs +165 -0
- package/dist/components/account/sections/subscription/PixDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PixPaymentDialog.mjs +155 -0
- package/dist/components/account/sections/subscription/PixPaymentDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs +253 -0
- package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs +237 -0
- package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/SubscriptionFlows.mjs +40 -0
- package/dist/components/account/sections/subscription/SubscriptionFlows.mjs.map +1 -0
- package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs +303 -0
- package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/UsageReportSheet.mjs +163 -0
- package/dist/components/account/sections/subscription/UsageReportSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs +75 -0
- package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs +55 -0
- package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs +188 -0
- package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs +66 -0
- package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs +42 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs +119 -0
- package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs +17 -0
- package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs +130 -0
- package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs +38 -0
- package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs +127 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs +111 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs +69 -0
- package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs +88 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs +115 -0
- package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs.map +1 -0
- package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs +918 -0
- package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs.map +1 -0
- package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs +216 -0
- package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs +128 -0
- package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlanCard.mjs +281 -0
- package/dist/components/account/sections/subscription/plans/PlanCard.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs +53 -0
- package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs.map +1 -0
- package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs +119 -0
- package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs.map +1 -0
- package/dist/components/account/sections/team/DeleteUserModal.mjs +116 -0
- package/dist/components/account/sections/team/DeleteUserModal.mjs.map +1 -0
- package/dist/components/account/sections/team/TeamFlows.mjs +14 -0
- package/dist/components/account/sections/team/TeamFlows.mjs.map +1 -0
- package/dist/components/account/sections/team/TeamMemberRow.mjs +99 -0
- package/dist/components/account/sections/team/TeamMemberRow.mjs.map +1 -0
- package/dist/components/account/sections/team/UserSheet.mjs +570 -0
- package/dist/components/account/sections/team/UserSheet.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/NotificationsStep.mjs +80 -0
- package/dist/components/account/sections/team/steps/NotificationsStep.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs +180 -0
- package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs.map +1 -0
- package/dist/components/account/sections/team/steps/UserInformationStep.mjs +371 -0
- package/dist/components/account/sections/team/steps/UserInformationStep.mjs.map +1 -0
- package/dist/components/account/sections/team/user-form.schema.mjs +37 -0
- package/dist/components/account/sections/team/user-form.schema.mjs.map +1 -0
- package/dist/components/account/types/workspace-actions.type.mjs +1 -0
- package/dist/components/account/types/workspace-actions.type.mjs.map +1 -0
- package/dist/components/layouts/ProfilePopover.mjs +10 -12
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +7 -4
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/AccountDeletionWarningModal.mjs +4 -5
- package/dist/components/modals/AccountDeletionWarningModal.mjs.map +1 -1
- package/dist/components/modals/AccountFrozenModal.mjs +6 -3
- package/dist/components/modals/AccountFrozenModal.mjs.map +1 -1
- package/dist/components/modals/Modals.mjs +3 -3
- package/dist/components/modals/Modals.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +4 -5
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddFirstCardWarningModal.mjs +63 -0
- package/dist/components/modals/cards/AddFirstCardWarningModal.mjs.map +1 -0
- package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs +187 -0
- package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs.map +1 -0
- package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs +5 -4
- package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +9 -1
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentMethodIcons.mjs +50 -0
- package/dist/components/ui/data-display/PaymentMethodIcons.mjs.map +1 -0
- package/dist/components/ui/form/BillingPeriodSelector.mjs +108 -0
- package/dist/components/ui/form/BillingPeriodSelector.mjs.map +1 -0
- package/dist/components/ui/form/PaymentMethodToggle.mjs +82 -0
- package/dist/components/ui/form/PaymentMethodToggle.mjs.map +1 -0
- package/dist/components/ui/form/RadioOptionFieldIcon.mjs +57 -0
- package/dist/components/ui/form/RadioOptionFieldIcon.mjs.map +1 -0
- package/dist/components/ui/form/SegmentedControl.mjs +56 -0
- package/dist/components/ui/form/SegmentedControl.mjs.map +1 -0
- package/dist/components/ui/overlay/Dialog.mjs +41 -6
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -1
- package/dist/components/ui/overlay/Sheet.mjs +43 -13
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
- package/dist/components/ui/overlay/layers.mjs +72 -26
- package/dist/components/ui/overlay/layers.mjs.map +1 -1
- package/dist/enums/AccountHubFlow.mjs +13 -0
- package/dist/enums/AccountHubFlow.mjs.map +1 -0
- package/dist/enums/DateFilterPeriod.mjs +22 -0
- package/dist/enums/DateFilterPeriod.mjs.map +1 -0
- package/dist/enums/WorkspaceSectionType.mjs +11 -0
- package/dist/enums/WorkspaceSectionType.mjs.map +1 -0
- package/dist/handlers.mjs +24 -0
- package/dist/handlers.mjs.map +1 -1
- package/dist/hooks/useDebounce.mjs +5 -3
- package/dist/hooks/useDebounce.mjs.map +1 -1
- package/dist/hooks/useUploadProgress.mjs +33 -0
- package/dist/hooks/useUploadProgress.mjs.map +1 -0
- package/dist/i18n/messages/en-us.mjs +863 -3
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +863 -3
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +863 -3
- package/dist/i18n/messages/pt-br.mjs.map +1 -1
- package/dist/index.mjs +87 -7
- package/dist/index.mjs.map +1 -1
- package/dist/infra/http/paged.mjs +20 -0
- package/dist/infra/http/paged.mjs.map +1 -0
- package/dist/middleware.mjs +2 -0
- package/dist/middleware.mjs.map +1 -1
- package/dist/middlewares/create-auth-middleware.mjs +1 -3
- package/dist/middlewares/create-auth-middleware.mjs.map +1 -1
- package/dist/middlewares/create-legacy-account-routes-middleware.mjs +44 -0
- package/dist/middlewares/create-legacy-account-routes-middleware.mjs.map +1 -0
- package/dist/middlewares/is-route-equals.mjs +7 -0
- package/dist/middlewares/is-route-equals.mjs.map +1 -0
- package/dist/modules/accounts/actions/account-management.action.mjs +20 -1
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -1
- package/dist/modules/accounts/constants/account-hub-link.constants.mjs +9 -0
- package/dist/modules/accounts/constants/account-hub-link.constants.mjs.map +1 -0
- package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs +5 -0
- package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs.map +1 -0
- package/dist/modules/accounts/handlers/list-account-members.handler.mjs +22 -0
- package/dist/modules/accounts/handlers/list-account-members.handler.mjs.map +1 -0
- package/dist/modules/accounts/hooks/add-user-projects.hook.mjs +51 -0
- package/dist/modules/accounts/hooks/add-user-projects.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/create-account-user.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/create-account-user.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs +47 -0
- package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs.map +1 -0
- package/dist/modules/accounts/hooks/use-account-members.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/use-account-members.hook.mjs.map +1 -0
- package/dist/modules/accounts/services/account.service.mjs +59 -0
- package/dist/modules/accounts/services/account.service.mjs.map +1 -1
- package/dist/modules/accounts/types/account-hub-link.type.mjs +1 -0
- package/dist/modules/accounts/types/account-hub-link.type.mjs.map +1 -0
- package/dist/modules/accounts/utils/build-account-hub-url.mjs +16 -0
- package/dist/modules/accounts/utils/build-account-hub-url.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-account-hub-flow.mjs +9 -0
- package/dist/modules/accounts/utils/is-account-hub-flow.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-account-section.mjs +9 -0
- package/dist/modules/accounts/utils/is-account-section.mjs.map +1 -0
- package/dist/modules/accounts/utils/is-my-account-section.mjs +13 -0
- package/dist/modules/accounts/utils/is-my-account-section.mjs.map +1 -0
- package/dist/modules/accounts/utils/map-legacy-account-route.mjs +93 -0
- package/dist/modules/accounts/utils/map-legacy-account-route.mjs.map +1 -0
- package/dist/modules/accounts/utils/parse-account-hub-link.mjs +20 -0
- package/dist/modules/accounts/utils/parse-account-hub-link.mjs.map +1 -0
- package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs +10 -0
- package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs.map +1 -0
- package/dist/modules/affiliates/actions/request-deposit.action.mjs +10 -0
- package/dist/modules/affiliates/actions/request-deposit.action.mjs.map +1 -0
- package/dist/modules/affiliates/actions/update-affiliate.action.mjs +10 -0
- package/dist/modules/affiliates/actions/update-affiliate.action.mjs.map +1 -0
- package/dist/modules/affiliates/constants/affiliate.constants.mjs +11 -0
- package/dist/modules/affiliates/constants/affiliate.constants.mjs.map +1 -0
- package/dist/modules/affiliates/constants/query-keys.constants.mjs +15 -0
- package/dist/modules/affiliates/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs +16 -0
- package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs +12 -0
- package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs +22 -0
- package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs.map +1 -0
- package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs +22 -0
- package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs +22 -0
- package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs +20 -0
- package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs +23 -0
- package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs +28 -0
- package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs +22 -0
- package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs.map +1 -0
- package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs +17 -0
- package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs.map +1 -0
- package/dist/modules/affiliates/services/affiliates.service.mjs +183 -0
- package/dist/modules/affiliates/services/affiliates.service.mjs.map +1 -0
- package/dist/modules/affiliates/types/affiliate.type.mjs +100 -0
- package/dist/modules/affiliates/types/affiliate.type.mjs.map +1 -0
- package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs +9 -0
- package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs.map +1 -0
- package/dist/modules/charges/actions/get-nota-fiscal.action.mjs +10 -0
- package/dist/modules/charges/actions/get-nota-fiscal.action.mjs.map +1 -0
- package/dist/modules/charges/actions/refresh-pix.action.mjs +10 -0
- package/dist/modules/charges/actions/refresh-pix.action.mjs.map +1 -0
- package/dist/modules/charges/hooks/nota-fiscal.hook.mjs +13 -0
- package/dist/modules/charges/hooks/nota-fiscal.hook.mjs.map +1 -0
- package/dist/modules/charges/hooks/refresh-pix.hook.mjs +13 -0
- package/dist/modules/charges/hooks/refresh-pix.hook.mjs.map +1 -0
- package/dist/modules/charges/services/charges.service.mjs +67 -0
- package/dist/modules/charges/services/charges.service.mjs.map +1 -1
- package/dist/modules/charges/types/nota-fiscal.type.mjs +1 -0
- package/dist/modules/charges/types/nota-fiscal.type.mjs.map +1 -0
- package/dist/modules/charges/types/refresh-pix.type.mjs +1 -0
- package/dist/modules/charges/types/refresh-pix.type.mjs.map +1 -0
- package/dist/modules/charges/utils/get-charge-download-url.mjs +8 -0
- package/dist/modules/charges/utils/get-charge-download-url.mjs.map +1 -0
- package/dist/modules/coupons/constants/query-keys.constants.mjs +5 -0
- package/dist/modules/coupons/constants/query-keys.constants.mjs.map +1 -0
- package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs +17 -0
- package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs.map +1 -0
- package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs +16 -0
- package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs.map +1 -0
- package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs +15 -0
- package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs.map +1 -0
- package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs +18 -0
- package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs.map +1 -0
- package/dist/modules/coupons/services/coupons.service.mjs +44 -0
- package/dist/modules/coupons/services/coupons.service.mjs.map +1 -0
- package/dist/modules/coupons/types/coupon.type.mjs +61 -0
- package/dist/modules/coupons/types/coupon.type.mjs.map +1 -0
- package/dist/modules/coupons/utils/coupon-restrictions.mjs +60 -0
- package/dist/modules/coupons/utils/coupon-restrictions.mjs.map +1 -0
- package/dist/modules/domains/handlers/count-domains.handler.mjs +12 -0
- package/dist/modules/domains/handlers/count-domains.handler.mjs.map +1 -0
- package/dist/modules/domains/hooks/count-domains.hook.mjs +17 -0
- package/dist/modules/domains/hooks/count-domains.hook.mjs.map +1 -0
- package/dist/modules/domains/services/domains.service.mjs +18 -0
- package/dist/modules/domains/services/domains.service.mjs.map +1 -0
- package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs +15 -0
- package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs.map +1 -0
- package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs +28 -0
- package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs.map +1 -0
- package/dist/modules/ia-credits/services/ia-credits.service.mjs +23 -2
- package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -1
- package/dist/modules/pages/handlers/count-pages.handler.mjs +4 -2
- package/dist/modules/pages/handlers/count-pages.handler.mjs.map +1 -1
- package/dist/modules/pages/hooks/count-published-pages.hook.mjs +26 -0
- package/dist/modules/pages/hooks/count-published-pages.hook.mjs.map +1 -0
- package/dist/modules/pages/services/pages.service.mjs +3 -2
- package/dist/modules/pages/services/pages.service.mjs.map +1 -1
- package/dist/modules/plans/constants/plan-tooltips.constants.mjs +14 -0
- package/dist/modules/plans/constants/plan-tooltips.constants.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs +28 -0
- package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs.map +1 -0
- package/dist/modules/plans/hooks/use-ui-plans.hook.mjs +20 -0
- package/dist/modules/plans/hooks/use-ui-plans.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/add-project-users.hook.mjs +25 -0
- package/dist/modules/projects/hooks/add-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs +3 -6
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/remove-project-users.hook.mjs +25 -0
- package/dist/modules/projects/hooks/remove-project-users.hook.mjs.map +1 -0
- package/dist/modules/projects/services/project-users.service.mjs +5 -0
- package/dist/modules/projects/services/project-users.service.mjs.map +1 -1
- package/dist/modules/projects/types.mjs +3 -2
- package/dist/modules/projects/types.mjs.map +1 -1
- package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/create-subscription.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/create-subscription.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs.map +1 -0
- package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs +10 -0
- package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs +35 -0
- package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/constants/downgrade.constants.mjs +25 -0
- package/dist/modules/subscriptions/constants/downgrade.constants.mjs.map +1 -0
- package/dist/modules/subscriptions/constants/subscription.constants.mjs +2 -0
- package/dist/modules/subscriptions/constants/subscription.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs +15 -0
- package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs +25 -0
- package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs +33 -0
- package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs +18 -0
- package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs +25 -0
- package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs.map +1 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs +71 -0
- package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -1
- package/dist/modules/subscriptions/types/cancel-subscription.type.mjs +9 -0
- package/dist/modules/subscriptions/types/cancel-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/create-subscription.type.mjs +62 -0
- package/dist/modules/subscriptions/types/create-subscription.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/pending-pix-status.type.mjs +28 -0
- package/dist/modules/subscriptions/types/pending-pix-status.type.mjs.map +1 -0
- package/dist/modules/subscriptions/types/subscription.type.mjs +9 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/addon-buckets.mjs +69 -0
- package/dist/modules/subscriptions/utils/addon-buckets.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs +8 -2
- package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/first-period-pricing.mjs +25 -0
- package/dist/modules/subscriptions/utils/first-period-pricing.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-api-subscription.mjs +8 -0
- package/dist/modules/subscriptions/utils/is-api-subscription.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-boleto-payer.mjs +17 -0
- package/dist/modules/subscriptions/utils/is-boleto-payer.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/is-free-subscription.mjs +8 -0
- package/dist/modules/subscriptions/utils/is-free-subscription.mjs.map +1 -0
- package/dist/modules/subscriptions/utils/periodicity.mjs +55 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs +27 -0
- package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs.map +1 -0
- package/dist/modules/users/hooks/messages.hook.mjs +3 -5
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
- package/dist/server.mjs +6 -0
- package/dist/server.mjs.map +1 -1
- package/dist/store/useAccountModals.mjs +9 -2
- package/dist/store/useAccountModals.mjs.map +1 -1
- package/dist/store/useAffiliateFlows.mjs +23 -0
- package/dist/store/useAffiliateFlows.mjs.map +1 -0
- package/dist/store/useProjectFlows.mjs +18 -0
- package/dist/store/useProjectFlows.mjs.map +1 -0
- package/dist/store/useSubscriptionFlows.mjs +58 -0
- package/dist/store/useSubscriptionFlows.mjs.map +1 -0
- package/dist/store/useTeamFlows.mjs +15 -0
- package/dist/store/useTeamFlows.mjs.map +1 -0
- package/dist/testing/factories/coupon.factory.mjs +19 -0
- package/dist/testing/factories/coupon.factory.mjs.map +1 -0
- package/dist/testing/factories/index.mjs +6 -0
- package/dist/testing/factories/index.mjs.map +1 -1
- package/dist/testing/factories/project-user.factory.mjs +17 -0
- package/dist/testing/factories/project-user.factory.mjs.map +1 -0
- package/dist/testing/factories/project.factory.mjs +21 -0
- package/dist/testing/factories/project.factory.mjs.map +1 -0
- package/dist/testing/react/providers.mjs +1 -1
- package/dist/testing/react/providers.mjs.map +1 -1
- package/dist/utils/browser/chart-custom-tooltip.mjs +69 -0
- package/dist/utils/browser/chart-custom-tooltip.mjs.map +1 -0
- package/dist/utils/browser/get-css-variable.mjs +9 -0
- package/dist/utils/browser/get-css-variable.mjs.map +1 -0
- package/dist/utils/constants/scrollbar.mjs +5 -0
- package/dist/utils/constants/scrollbar.mjs.map +1 -0
- package/dist/utils/date-filter-period.mjs +34 -0
- package/dist/utils/date-filter-period.mjs.map +1 -0
- package/dist/utils/file/index.mjs +11 -1
- package/dist/utils/file/index.mjs.map +1 -1
- package/dist/utils/format/initials.mjs +8 -0
- package/dist/utils/format/initials.mjs.map +1 -0
- package/dist/utils/format/masks.mjs +32 -1
- package/dist/utils/format/masks.mjs.map +1 -1
- package/dist/utils/qrcode/to-data-url.mjs +12 -0
- package/dist/utils/qrcode/to-data-url.mjs.map +1 -0
- package/dist/utils/validators/account.mjs +1 -7
- package/dist/utils/validators/account.mjs.map +1 -1
- package/package.json +20 -8
- package/src/components/account/AccountHubLinkHandler.tsx +39 -0
- package/src/components/account/AccountModalLayout.tsx +190 -0
- package/src/components/account/AccountModals.tsx +12 -2
- package/src/components/account/DeleteAccountModal.tsx +1 -1
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +9 -1
- package/src/components/account/MyAccountModal.tsx +215 -0
- package/src/components/account/TwoFactorAuthModal.tsx +1 -1
- package/src/components/account/hooks/useAccountHubActions.ts +95 -0
- package/src/components/account/hooks/useAddCardWithPaymentSwitch.ts +70 -0
- package/src/components/account/hooks/useAffiliatesActions.tsx +78 -0
- package/src/components/account/hooks/useMyAccountModal.ts +40 -0
- package/src/components/account/hooks/useProjectsActions.ts +44 -0
- package/src/components/account/hooks/useSubscriptionActions.ts +99 -0
- package/src/components/account/hooks/useTeamActions.ts +35 -0
- package/src/components/account/sections/AffiliatesSection.tsx +342 -0
- package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
- package/src/components/account/sections/MyProfileSection.tsx +207 -143
- package/src/components/account/sections/PreferencesSection.tsx +55 -51
- package/src/components/account/sections/ProjectsSection.tsx +110 -0
- package/src/components/account/sections/SecuritySection.tsx +72 -62
- package/src/components/account/sections/SubscriptionSection.tsx +36 -0
- package/src/components/account/sections/TeamSection.tsx +161 -0
- package/src/components/account/sections/TokenSection.tsx +4 -8
- package/src/components/account/sections/affiliates/AffiliateCommissionCard.tsx +83 -0
- package/src/components/account/sections/affiliates/AffiliateFlows.tsx +20 -0
- package/src/components/account/sections/affiliates/AffiliateLeadsSheet.tsx +143 -0
- package/src/components/account/sections/affiliates/AffiliateStatsCard.tsx +56 -0
- package/src/components/account/sections/affiliates/AffiliateStepCard.tsx +20 -0
- package/src/components/account/sections/affiliates/AffiliateTransactionsList.tsx +194 -0
- package/src/components/account/sections/affiliates/NoReceivingAccountModal.tsx +63 -0
- package/src/components/account/sections/affiliates/ReceivingAccountModal.tsx +213 -0
- package/src/components/account/sections/affiliates/RequestWithdrawalSheet.tsx +586 -0
- package/src/components/account/sections/affiliates/ViewAttachmentModal.tsx +47 -0
- package/src/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.tsx +45 -0
- package/src/components/account/sections/affiliates/reports/AffiliatesReportsTab.tsx +44 -0
- package/src/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.ts +148 -0
- package/src/components/account/sections/projects/DeleteProjectModal.tsx +246 -0
- package/src/components/account/sections/projects/ProjectFlows.tsx +16 -0
- package/src/components/account/sections/projects/ProjectMembersStack.tsx +75 -0
- package/src/components/account/sections/projects/ProjectRow.tsx +96 -0
- package/src/components/account/sections/projects/ProjectSheet.tsx +603 -0
- package/src/components/account/sections/projects/ProjectsDisabledModal.tsx +69 -0
- package/src/components/account/sections/projects/project-form.schema.ts +30 -0
- package/src/components/account/sections/shared/ConnectListRow.tsx +68 -0
- package/src/components/account/sections/shared/DateFilterPopover.tsx +58 -0
- package/src/components/account/sections/shared/EntityAvatar.tsx +54 -0
- package/src/components/account/sections/shared/FilterPopover.tsx +79 -0
- package/src/components/account/sections/shared/FormSection.tsx +23 -0
- package/src/components/account/sections/shared/IconBox.tsx +21 -0
- package/src/components/account/sections/shared/InfiniteScrollList.tsx +57 -0
- package/src/components/account/sections/shared/ListPagination.tsx +84 -0
- package/src/components/account/sections/shared/RowActionsMenu.tsx +66 -0
- package/src/components/account/sections/shared/SectionLoadError.tsx +27 -0
- package/src/components/account/sections/shared/StatusBadge.tsx +33 -0
- package/src/components/account/sections/shared/WorkspaceSection.tsx +22 -0
- package/src/components/account/sections/subscription/AiCreditsUsage.tsx +152 -0
- package/src/components/account/sections/subscription/BillingAddressSheet.tsx +460 -0
- package/src/components/account/sections/subscription/BoletoDetailsDialog.tsx +104 -0
- package/src/components/account/sections/subscription/BoletoGeneratedDialog.tsx +24 -0
- package/src/components/account/sections/subscription/CancelPlanDialog.tsx +221 -0
- package/src/components/account/sections/subscription/ChargeRow.tsx +161 -0
- package/src/components/account/sections/subscription/ChargeStatusBadge.tsx +29 -0
- package/src/components/account/sections/subscription/ChargesList.tsx +125 -0
- package/src/components/account/sections/subscription/ManageCardsSheet.tsx +93 -0
- package/src/components/account/sections/subscription/OverdueReceiptOpener.tsx +29 -0
- package/src/components/account/sections/subscription/PayChargeDialog.tsx +306 -0
- package/src/components/account/sections/subscription/PaymentConfirmationDialog.tsx +70 -0
- package/src/components/account/sections/subscription/PaymentMethodsCard.tsx +117 -0
- package/src/components/account/sections/subscription/PendingChangeDialog.tsx +168 -0
- package/src/components/account/sections/subscription/PixDetailsDialog.tsx +246 -0
- package/src/components/account/sections/subscription/PixPaymentDialog.tsx +242 -0
- package/src/components/account/sections/subscription/PlanDetailsSheet.tsx +380 -0
- package/src/components/account/sections/subscription/ReceiptDetailsSheet.tsx +318 -0
- package/src/components/account/sections/subscription/SubscriptionFlows.tsx +40 -0
- package/src/components/account/sections/subscription/SubscriptionPlanCard.tsx +433 -0
- package/src/components/account/sections/subscription/UsageReportSheet.tsx +244 -0
- package/src/components/account/sections/subscription/change-plan/ChangePlanSheet.tsx +95 -0
- package/src/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.tsx +57 -0
- package/src/components/account/sections/subscription/change-plan/components/AddonsBlock.tsx +214 -0
- package/src/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.tsx +92 -0
- package/src/components/account/sections/subscription/change-plan/components/CouponBlock.tsx +42 -0
- package/src/components/account/sections/subscription/change-plan/components/CouponDialog.tsx +134 -0
- package/src/components/account/sections/subscription/change-plan/components/PricePreview.tsx +28 -0
- package/src/components/account/sections/subscription/change-plan/components/SummaryBlock.tsx +194 -0
- package/src/components/account/sections/subscription/change-plan/plan-comparison.ts +52 -0
- package/src/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.tsx +161 -0
- package/src/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.tsx +165 -0
- package/src/components/account/sections/subscription/change-plan/steps/PlanViewStep.tsx +89 -0
- package/src/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.tsx +117 -0
- package/src/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.tsx +139 -0
- package/src/components/account/sections/subscription/change-plan/useChangePlanState.tsx +1158 -0
- package/src/components/account/sections/subscription/downgrade/CannotDowngradeDialog.tsx +297 -0
- package/src/components/account/sections/subscription/downgrade/DowngradeReasonDialog.tsx +154 -0
- package/src/components/account/sections/subscription/plans/PlanCard.tsx +417 -0
- package/src/components/account/sections/subscription/plans/PlanCardSkeleton.tsx +70 -0
- package/src/components/account/sections/subscription/plans/PlansCatalogDialog.tsx +156 -0
- package/src/components/account/sections/team/DeleteUserModal.tsx +134 -0
- package/src/components/account/sections/team/TeamFlows.tsx +14 -0
- package/src/components/account/sections/team/TeamMemberRow.tsx +151 -0
- package/src/components/account/sections/team/UserSheet.tsx +688 -0
- package/src/components/account/sections/team/steps/NotificationsStep.tsx +109 -0
- package/src/components/account/sections/team/steps/ProjectSelectionStep.tsx +219 -0
- package/src/components/account/sections/team/steps/UserInformationStep.tsx +423 -0
- package/src/components/account/sections/team/user-form.schema.ts +43 -0
- package/src/components/account/types/workspace-actions.type.ts +56 -0
- package/src/components/layouts/ProfilePopover.tsx +11 -12
- package/src/components/layouts/UsersSelectorPopover.tsx +7 -4
- package/src/components/modals/AccountDeletionWarningModal.tsx +4 -5
- package/src/components/modals/AccountFrozenModal.tsx +6 -3
- package/src/components/modals/Modals.tsx +6 -3
- package/src/components/modals/PaidPlanRequiredModal.tsx +4 -5
- package/src/components/modals/cards/AddFirstCardWarningModal.tsx +72 -0
- package/src/components/modals/cards/SwitchPaymentToCardModal.tsx +232 -0
- package/src/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.tsx +5 -4
- package/src/components/ui/data-display/CardItem.tsx +9 -5
- package/src/components/ui/data-display/PaymentMethodIcons.tsx +43 -0
- package/src/components/ui/form/BillingPeriodSelector.tsx +173 -0
- package/src/components/ui/form/PaymentMethodToggle.tsx +119 -0
- package/src/components/ui/form/RadioOptionFieldIcon.tsx +64 -0
- package/src/components/ui/form/SegmentedControl.tsx +77 -0
- package/src/components/ui/overlay/Dialog.tsx +70 -33
- package/src/components/ui/overlay/Sheet.tsx +89 -56
- package/src/components/ui/overlay/layers.tsx +114 -27
- package/src/enums/AccountHubFlow.ts +8 -0
- package/src/enums/DateFilterPeriod.ts +17 -0
- package/src/enums/WorkspaceSectionType.ts +6 -0
- package/src/handlers.ts +14 -0
- package/src/hooks/useDebounce.ts +5 -3
- package/src/hooks/useUploadProgress.ts +42 -0
- package/src/i18n/messages/en-us.ts +904 -2
- package/src/i18n/messages/es-es.ts +908 -2
- package/src/i18n/messages/pt-br.ts +908 -2
- package/src/index.ts +56 -1
- package/src/infra/http/paged.ts +24 -0
- package/src/middleware.ts +1 -0
- package/src/middlewares/create-auth-middleware.ts +1 -4
- package/src/middlewares/create-legacy-account-routes-middleware.ts +54 -0
- package/src/middlewares/is-route-equals.ts +3 -0
- package/src/modules/accounts/actions/account-management.action.ts +22 -1
- package/src/modules/accounts/constants/account-hub-link.constants.ts +3 -0
- package/src/modules/accounts/constants/legacy-account-routes.constants.ts +1 -0
- package/src/modules/accounts/handlers/list-account-members.handler.ts +23 -0
- package/src/modules/accounts/hooks/add-user-projects.hook.ts +72 -0
- package/src/modules/accounts/hooks/create-account-user.hook.ts +21 -0
- package/src/modules/accounts/hooks/remove-user-projects.hook.ts +68 -0
- package/src/modules/accounts/hooks/use-account-members.hook.ts +31 -0
- package/src/modules/accounts/services/account.service.ts +71 -0
- package/src/modules/accounts/types/account-hub-link.type.ts +13 -0
- package/src/modules/accounts/types.ts +9 -0
- package/src/modules/accounts/utils/build-account-hub-url.ts +14 -0
- package/src/modules/accounts/utils/is-account-hub-flow.ts +7 -0
- package/src/modules/accounts/utils/is-account-section.ts +7 -0
- package/src/modules/accounts/utils/is-my-account-section.ts +12 -0
- package/src/modules/accounts/utils/map-legacy-account-route.ts +108 -0
- package/src/modules/accounts/utils/parse-account-hub-link.ts +21 -0
- package/src/modules/affiliates/actions/ensure-affiliate.action.ts +9 -0
- package/src/modules/affiliates/actions/request-deposit.action.ts +9 -0
- package/src/modules/affiliates/actions/update-affiliate.action.ts +9 -0
- package/src/modules/affiliates/constants/affiliate.constants.ts +11 -0
- package/src/modules/affiliates/constants/query-keys.constants.ts +7 -0
- package/src/modules/affiliates/handlers/affiliate-report-analytics.handler.ts +16 -0
- package/src/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.ts +10 -0
- package/src/modules/affiliates/handlers/current-affiliate.handler.ts +10 -0
- package/src/modules/affiliates/handlers/list-affiliate-coupons.handler.ts +10 -0
- package/src/modules/affiliates/handlers/list-affiliate-leads.handler.ts +23 -0
- package/src/modules/affiliates/handlers/list-affiliate-transactions.handler.ts +23 -0
- package/src/modules/affiliates/hooks/use-affiliate-coupons.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-affiliate-leads.hook.ts +27 -0
- package/src/modules/affiliates/hooks/use-affiliate-report-analytics.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-affiliate-transactions.hook.ts +25 -0
- package/src/modules/affiliates/hooks/use-current-affiliate.hook.ts +19 -0
- package/src/modules/affiliates/hooks/use-ensure-affiliate.hook.ts +24 -0
- package/src/modules/affiliates/hooks/use-request-deposit.hook.ts +29 -0
- package/src/modules/affiliates/hooks/use-update-affiliate.hook.ts +24 -0
- package/src/modules/affiliates/hooks/use-withdrawal-limits.hook.ts +20 -0
- package/src/modules/affiliates/services/affiliates.service.ts +240 -0
- package/src/modules/affiliates/types/affiliate.type.ts +180 -0
- package/src/modules/affiliates/utils/get-affiliate-share-link.ts +8 -0
- package/src/modules/charges/actions/get-nota-fiscal.action.ts +8 -0
- package/src/modules/charges/actions/refresh-pix.action.ts +8 -0
- package/src/modules/charges/hooks/nota-fiscal.hook.ts +13 -0
- package/src/modules/charges/hooks/refresh-pix.hook.ts +13 -0
- package/src/modules/charges/services/charges.service.ts +121 -0
- package/src/modules/charges/types/nota-fiscal.type.ts +20 -0
- package/src/modules/charges/types/refresh-pix.type.ts +14 -0
- package/src/modules/charges/utils/get-charge-download-url.ts +10 -0
- package/src/modules/coupons/constants/query-keys.constants.ts +1 -0
- package/src/modules/coupons/handlers/find-coupon-by-code.handler.ts +16 -0
- package/src/modules/coupons/handlers/find-coupon-by-id.handler.ts +15 -0
- package/src/modules/coupons/hooks/use-coupon-by-code.hook.ts +16 -0
- package/src/modules/coupons/hooks/use-coupon-by-id.hook.ts +20 -0
- package/src/modules/coupons/services/coupons.service.ts +54 -0
- package/src/modules/coupons/types/coupon.type.ts +70 -0
- package/src/modules/coupons/utils/coupon-restrictions.ts +112 -0
- package/src/modules/domains/handlers/count-domains.handler.ts +10 -0
- package/src/modules/domains/hooks/count-domains.hook.ts +17 -0
- package/src/modules/domains/services/domains.service.ts +18 -0
- package/src/modules/ia-credits/handlers/list-ia-credit-operations.handler.ts +14 -0
- package/src/modules/ia-credits/hooks/ia-credit-operations.hook.ts +33 -0
- package/src/modules/ia-credits/services/ia-credits.service.ts +32 -1
- package/src/modules/pages/handlers/count-pages.handler.ts +5 -2
- package/src/modules/pages/hooks/count-published-pages.hook.ts +26 -0
- package/src/modules/pages/services/pages.service.ts +3 -2
- package/src/modules/plans/constants/plan-tooltips.constants.ts +16 -0
- package/src/modules/plans/hooks/use-enriched-plans.hook.ts +31 -0
- package/src/modules/plans/hooks/use-ui-plans.hook.ts +22 -0
- package/src/modules/projects/hooks/add-project-users.hook.ts +29 -0
- package/src/modules/projects/hooks/list-all-account-users.hook.ts +3 -6
- package/src/modules/projects/hooks/list-available-users.hook.ts +3 -6
- package/src/modules/projects/hooks/list-infinite-projects.hook.ts +3 -6
- package/src/modules/projects/hooks/list-project-users.hook.ts +3 -6
- package/src/modules/projects/hooks/remove-project-users.hook.ts +29 -0
- package/src/modules/projects/services/project-users.service.ts +135 -130
- package/src/modules/projects/types.ts +89 -88
- package/src/modules/subscriptions/actions/cancel-subscription.action.ts +12 -0
- package/src/modules/subscriptions/actions/create-subscription.action.ts +9 -0
- package/src/modules/subscriptions/actions/find-pending-pix-status.action.ts +8 -0
- package/src/modules/subscriptions/actions/find-subscription-by-id.action.ts +8 -0
- package/src/modules/subscriptions/constants/addons.constants.ts +50 -0
- package/src/modules/subscriptions/constants/downgrade.constants.ts +30 -0
- package/src/modules/subscriptions/constants/subscription.constants.ts +3 -0
- package/src/modules/subscriptions/handlers/pending-pix-status.handler.ts +17 -0
- package/src/modules/subscriptions/hooks/cancel-subscription.hook.ts +28 -0
- package/src/modules/subscriptions/hooks/create-subscription.hook.ts +34 -0
- package/src/modules/subscriptions/hooks/find-subscription-by-id.hook.ts +17 -0
- package/src/modules/subscriptions/hooks/pending-pix-status.hook.ts +30 -0
- package/src/modules/subscriptions/services/subscriptions.service.ts +401 -301
- package/src/modules/subscriptions/types/cancel-subscription.type.ts +8 -0
- package/src/modules/subscriptions/types/create-subscription.type.ts +79 -0
- package/src/modules/subscriptions/types/pending-pix-status.type.ts +33 -0
- package/src/modules/subscriptions/types/subscription.type.ts +157 -147
- package/src/modules/subscriptions/utils/addon-buckets.ts +129 -0
- package/src/modules/subscriptions/utils/confirm-payment-if-required.ts +9 -2
- package/src/modules/subscriptions/utils/first-period-pricing.ts +63 -0
- package/src/modules/subscriptions/utils/is-api-subscription.ts +6 -0
- package/src/modules/subscriptions/utils/is-boleto-payer.ts +21 -0
- package/src/modules/subscriptions/utils/is-free-subscription.ts +6 -0
- package/src/modules/subscriptions/utils/periodicity.ts +101 -0
- package/src/modules/subscriptions/utils/resolve-subscription-plan-name.ts +44 -0
- package/src/modules/users/hooks/messages.hook.ts +3 -5
- package/src/server.ts +102 -99
- package/src/store/useAccountModals.ts +22 -5
- package/src/store/useAffiliateFlows.ts +46 -0
- package/src/store/useProjectFlows.ts +42 -0
- package/src/store/useSubscriptionFlows.ts +176 -0
- package/src/store/useTeamFlows.ts +34 -0
- package/src/testing/factories/coupon.factory.ts +17 -0
- package/src/testing/factories/index.ts +3 -0
- package/src/testing/factories/project-user.factory.ts +15 -0
- package/src/testing/factories/project.factory.ts +19 -0
- package/src/testing/react/providers.tsx +2 -1
- package/src/utils/browser/chart-custom-tooltip.ts +85 -0
- package/src/utils/browser/get-css-variable.ts +6 -0
- package/src/utils/constants/scrollbar.ts +10 -0
- package/src/utils/date-filter-period.ts +34 -0
- package/src/utils/file/index.ts +13 -0
- package/src/utils/format/initials.ts +10 -0
- package/src/utils/format/masks.ts +41 -0
- package/src/utils/qrcode/to-data-url.ts +23 -0
- package/src/utils/validators/account.ts +0 -8
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -143
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
- package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -34
- package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
- package/src/components/account/ConfigurationsMyAccountModal.tsx +0 -179
- package/src/components/account/hooks/useConfigurationsModal.ts +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/projects/ProjectRow.tsx"],"sourcesContent":["'use client';\n\nimport { IconTrash } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Button } from '../../../ui/buttons/Button';\nimport type { Project } from '../../../../modules/projects/types';\nimport { EntityAvatar } from '../shared/EntityAvatar';\nimport { RowActionsMenu, type RowActionsMenuItem } from '../shared/RowActionsMenu';\nimport { ProjectMembersStack } from './ProjectMembersStack';\n\ntype ProjectRowProps = {\n project: Project;\n canManage: boolean;\n onOpen: (project: Project) => void;\n onDelete: (project: Project) => void;\n};\n\nfunction useProjectRow({ project, canManage, onOpen, onDelete }: ProjectRowProps) {\n const translate = useTranslations();\n\n const menuItems: RowActionsMenuItem[] = canManage\n ? [\n {\n icon: <IconTrash size={20} className=\"text-zinc-400\" />,\n label: translate('common.account.workspace.projects.delete'),\n onClick: () => onDelete(project),\n },\n ]\n : [];\n\n const handleOpen = () => onOpen(project);\n\n const detailsButton = (\n <Button\n variant=\"secondary\"\n className=\"h-10! shrink-0\"\n onClick={(event) => {\n event.stopPropagation();\n handleOpen();\n }}\n >\n {translate('common.account.workspace.projects.details')}\n </Button>\n );\n\n return { menuItems, handleOpen, detailsButton };\n}\n\nexport function ProjectRow(props: ProjectRowProps) {\n const { project } = props;\n const { menuItems, handleOpen, detailsButton } = useProjectRow(props);\n\n return (\n <div\n className=\"flex items-center gap-4 px-5 py-4 cursor-pointer hover:bg-zinc-50 transition-colors\"\n onClick={handleOpen}\n >\n <EntityAvatar name={project.title} photo={project.photo} />\n <span className=\"flex-1 min-w-0 truncate paragraph-small-semibold text-zinc-600\" title={project.title}>\n {project.title}\n </span>\n <ProjectMembersStack\n projectId={project.id}\n totalUsers={project.total_users}\n onSeeMore={handleOpen}\n className=\"w-32 justify-end shrink-0\"\n />\n {detailsButton}\n <div className=\"w-10 shrink-0\">\n <RowActionsMenu items={menuItems} width={140} />\n </div>\n </div>\n );\n}\n\nexport function ProjectCard(props: ProjectRowProps) {\n const { project } = props;\n const { menuItems, handleOpen, detailsButton } = useProjectRow(props);\n\n return (\n <div\n className=\"flex flex-col gap-4 rounded-lg border border-zinc-200 bg-white px-3 py-4 cursor-pointer\"\n onClick={handleOpen}\n >\n <div className=\"flex items-center gap-3 min-w-0\">\n <EntityAvatar name={project.title} photo={project.photo} />\n <span className=\"flex-1 min-w-0 truncate paragraph-small-semibold text-zinc-600\">{project.title}</span>\n <RowActionsMenu items={menuItems} width={140} />\n </div>\n <div className=\"flex items-center justify-between gap-3\">\n <ProjectMembersStack projectId={project.id} totalUsers={project.total_users} onSeeMore={handleOpen} />\n {detailsButton}\n </div>\n </div>\n );\n}\n"],"mappings":";AAuBgB,cA8BZ,YA9BY;AArBhB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,SAAS,cAAc;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,sBAA+C;AACxD,SAAS,2BAA2B;AASpC,SAAS,cAAc,EAAE,SAAS,WAAW,QAAQ,SAAS,GAAoB;AAChF,QAAM,YAAY,gBAAgB;AAElC,QAAM,YAAkC,YACpC;AAAA,IACE;AAAA,MACE,MAAM,oBAAC,aAAU,MAAM,IAAI,WAAU,iBAAgB;AAAA,MACrD,OAAO,UAAU,0CAA0C;AAAA,MAC3D,SAAS,MAAM,SAAS,OAAO;AAAA,IACjC;AAAA,EACF,IACA,CAAC;AAEL,QAAM,aAAa,MAAM,OAAO,OAAO;AAEvC,QAAM,gBACJ;AAAA,IAAC;AAAA;AAAA,MACC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QAAQ,aAAa,WAAW,YAAY;AAAA,UACnG;AAAA,WACH;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
import { useForm } from "react-hook-form";
|
|
11
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
12
|
+
import { IconChevronDown, IconChevronUp, IconSearch, IconUpload } from "@tabler/icons-react";
|
|
13
|
+
import { useTranslations } from "next-intl";
|
|
14
|
+
import { toast } from "sonner";
|
|
15
|
+
import { Button } from "../../../ui/buttons/Button";
|
|
16
|
+
import { Separator } from "../../../ui/data-display/Separator";
|
|
17
|
+
import { Toast } from "../../../ui/feedback/Toast";
|
|
18
|
+
import { FormField } from "../../../ui/form/FormField";
|
|
19
|
+
import { Sheet, SheetContent, SheetFooter, SheetHeader, SheetTitle } from "../../../ui/overlay/Sheet";
|
|
20
|
+
import { ImageCropModal } from "../../../widgets/ImageUpload/ImageCropModal";
|
|
21
|
+
import { ACCEPTED_IMAGE_FORMATS_STRING } from "../../../../modules/images/constants/image.constants";
|
|
22
|
+
import { useImageUpload } from "../../../../modules/images/hooks/use-image-upload.hook";
|
|
23
|
+
import { useAccountMembers } from "../../../../modules/accounts/hooks/use-account-members.hook";
|
|
24
|
+
import { useManagementPermissions } from "../../../../modules/auth/hooks/useManagementPermissions";
|
|
25
|
+
import { useCreateProject } from "../../../../modules/projects/hooks/create-project.hook";
|
|
26
|
+
import { useUpdateProject } from "../../../../modules/projects/hooks/update-project.hook";
|
|
27
|
+
import { useAddProjectUsers } from "../../../../modules/projects/hooks/add-project-users.hook";
|
|
28
|
+
import { useRemoveProjectUsers } from "../../../../modules/projects/hooks/remove-project-users.hook";
|
|
29
|
+
import { useListProjectUsers } from "../../../../modules/projects/hooks/list-project-users.hook";
|
|
30
|
+
import { useCancelledSubscriptionGuard } from "../../../../modules/subscriptions/hooks/use-cancelled-subscription-guard";
|
|
31
|
+
import { UserProfile } from "../../../../modules/users/schema";
|
|
32
|
+
import { useAuth } from "../../../../providers/auth.provider";
|
|
33
|
+
import { useDebounce } from "../../../../hooks/useDebounce";
|
|
34
|
+
import useIsMobile from "../../../../hooks/useIsMobile";
|
|
35
|
+
import { cn } from "../../../../infra/utils/clsx";
|
|
36
|
+
import { useProjectFlows } from "../../../../store/useProjectFlows";
|
|
37
|
+
import { ConnectListRow } from "../shared/ConnectListRow";
|
|
38
|
+
import { SectionLoadError } from "../shared/SectionLoadError";
|
|
39
|
+
import { buildProjectFormSchema } from "./project-form.schema";
|
|
40
|
+
const PROJECT_LOGO_CONFIG = { width: 200, height: 200, aspectRatio: 1 };
|
|
41
|
+
const STORAGE_URL = process.env.NEXT_PUBLIC_STORAGE_URL || "";
|
|
42
|
+
function toFormUser(user) {
|
|
43
|
+
return {
|
|
44
|
+
id: user.id,
|
|
45
|
+
name: user.name ?? "",
|
|
46
|
+
email: user.email ?? "",
|
|
47
|
+
profile: user.profile ?? UserProfile.viewer,
|
|
48
|
+
photo: user.photo ?? null
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function ProjectSheetUI({
|
|
52
|
+
open,
|
|
53
|
+
title,
|
|
54
|
+
submitLabel,
|
|
55
|
+
form,
|
|
56
|
+
projectId,
|
|
57
|
+
handleClose,
|
|
58
|
+
handleSubmit,
|
|
59
|
+
isLoading,
|
|
60
|
+
readOnly = false,
|
|
61
|
+
membersLoadFailed = false,
|
|
62
|
+
onRetryMembers
|
|
63
|
+
}) {
|
|
64
|
+
const translate = useTranslations();
|
|
65
|
+
const translateProfile = useTranslations("common.account.workspace.team.profiles");
|
|
66
|
+
const isMobile = useIsMobile();
|
|
67
|
+
const fileInputRef = useRef(null);
|
|
68
|
+
const usersListRef = useRef(null);
|
|
69
|
+
const [showUserSearch, setShowUserSearch] = useState(false);
|
|
70
|
+
const [failedLogoSrc, setFailedLogoSrc] = useState(null);
|
|
71
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
72
|
+
const debouncedSearch = useDebounce(searchQuery, 400);
|
|
73
|
+
const { user: currentUser } = useAuth();
|
|
74
|
+
const { data: usersOutProject, isPending: isLoadingUsers } = useAccountMembers(
|
|
75
|
+
projectId ? { name: debouncedSearch, notInProject: projectId } : { name: debouncedSearch, profiles: [UserProfile.collaborator, UserProfile.viewer] }
|
|
76
|
+
);
|
|
77
|
+
const { originalImage, showCropModal, setShowCropModal, fileName, handleFileSelect, handleCropConfirm } = useImageUpload({
|
|
78
|
+
config: PROJECT_LOGO_CONFIG,
|
|
79
|
+
onSuccess: (base64) => form.setValue("logo", base64)
|
|
80
|
+
});
|
|
81
|
+
const logo = form.watch("logo");
|
|
82
|
+
const selectedUsers = form.watch("users");
|
|
83
|
+
const availableUsers = (usersOutProject?.users ?? []).filter(
|
|
84
|
+
(user) => !selectedUsers.some((selected) => selected.id === user.id)
|
|
85
|
+
);
|
|
86
|
+
const handleFileChange = (event) => {
|
|
87
|
+
const file = event.target.files?.[0];
|
|
88
|
+
if (!file) return;
|
|
89
|
+
handleFileSelect(file);
|
|
90
|
+
event.target.value = "";
|
|
91
|
+
};
|
|
92
|
+
const addUser = (user) => {
|
|
93
|
+
const current = form.getValues("users");
|
|
94
|
+
if (current.some((selected) => selected.id === user.id)) return;
|
|
95
|
+
form.setValue("users", [...current, toFormUser(user)]);
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
usersListRef.current?.scrollTo({ top: usersListRef.current.scrollHeight, behavior: "smooth" });
|
|
98
|
+
}, 50);
|
|
99
|
+
};
|
|
100
|
+
const removeUser = (userId) => {
|
|
101
|
+
form.setValue(
|
|
102
|
+
"users",
|
|
103
|
+
form.getValues("users").filter((user) => user.id !== userId)
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
const canRemove = (userId, profile) => {
|
|
107
|
+
if (readOnly) return false;
|
|
108
|
+
if (!currentUser) return false;
|
|
109
|
+
if (currentUser.id === userId) return false;
|
|
110
|
+
if (currentUser.profile !== UserProfile.owner && currentUser.profile !== UserProfile.admin) return false;
|
|
111
|
+
if (profile === UserProfile.owner || profile === UserProfile.admin) return false;
|
|
112
|
+
return true;
|
|
113
|
+
};
|
|
114
|
+
const fixedUsers = selectedUsers.filter((user) => !canRemove(user.id, user.profile));
|
|
115
|
+
const removableUsers = selectedUsers.filter((user) => canRemove(user.id, user.profile));
|
|
116
|
+
const sortedUsers = [...fixedUsers, ...removableUsers];
|
|
117
|
+
const rawLogoSrc = logo ? logo.startsWith("data:") ? logo : `${STORAGE_URL}/${logo}` : null;
|
|
118
|
+
const logoSrc = rawLogoSrc && failedLogoSrc !== rawLogoSrc ? rawLogoSrc : null;
|
|
119
|
+
return /* @__PURE__ */ jsx(Sheet, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
|
|
120
|
+
SheetContent,
|
|
121
|
+
{
|
|
122
|
+
side: isMobile ? "bottom" : "right",
|
|
123
|
+
className: cn(
|
|
124
|
+
isMobile ? "h-dvh w-full max-w-full rounded-none pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]" : "h-screen max-w-120! w-120!",
|
|
125
|
+
"data-[state=open]:max-h-none data-[state=open]:h-dvh overflow-hidden"
|
|
126
|
+
),
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-zinc-200", children: /* @__PURE__ */ jsx(SheetTitle, { className: "text-zinc-950 paragraph-medium-semibold", children: title }) }),
|
|
129
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col flex-1 min-h-0", children: [
|
|
130
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 px-5 pb-5 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300 flex-1 min-h-0", children: [
|
|
131
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"input",
|
|
134
|
+
{
|
|
135
|
+
type: "file",
|
|
136
|
+
ref: fileInputRef,
|
|
137
|
+
onChange: handleFileChange,
|
|
138
|
+
accept: ACCEPTED_IMAGE_FORMATS_STRING,
|
|
139
|
+
className: "hidden"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
logoSrc ? (
|
|
143
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
"img",
|
|
146
|
+
{
|
|
147
|
+
alt: translate("common.account.workspace.projects.sheet.projectName"),
|
|
148
|
+
src: logoSrc,
|
|
149
|
+
className: cn("size-12 rounded-full object-cover shrink-0", !readOnly && "cursor-pointer"),
|
|
150
|
+
onClick: readOnly ? void 0 : () => fileInputRef.current?.click(),
|
|
151
|
+
onError: () => setFailedLogoSrc(logoSrc)
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
) : /* @__PURE__ */ jsx(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: cn(
|
|
158
|
+
"flex items-center justify-center size-12 shrink-0 rounded-full bg-zinc-50 border border-zinc-200 text-zinc-400 border-dashed",
|
|
159
|
+
!readOnly && "cursor-pointer hover:bg-zinc-100 transition-colors"
|
|
160
|
+
),
|
|
161
|
+
onClick: readOnly ? void 0 : () => fileInputRef.current?.click(),
|
|
162
|
+
children: /* @__PURE__ */ jsx(IconUpload, { size: 16 })
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
!readOnly && /* @__PURE__ */ jsxs(
|
|
166
|
+
Button,
|
|
167
|
+
{
|
|
168
|
+
variant: "secondary",
|
|
169
|
+
className: "h-8!",
|
|
170
|
+
type: "button",
|
|
171
|
+
onClick: () => fileInputRef.current?.click(),
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ jsx(IconUpload, { size: 16 }),
|
|
174
|
+
translate("common.account.workspace.projects.sheet.changeLogo")
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsx(
|
|
180
|
+
FormField,
|
|
181
|
+
{
|
|
182
|
+
label: translate("common.account.workspace.projects.sheet.projectName"),
|
|
183
|
+
placeholder: translate("common.account.workspace.projects.sheet.namePlaceholder"),
|
|
184
|
+
error: !!form.formState.errors.name,
|
|
185
|
+
errorMessage: form.formState.errors.name?.message,
|
|
186
|
+
...form.register("name"),
|
|
187
|
+
disabled: readOnly
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
191
|
+
/* @__PURE__ */ jsx("span", { className: "text-zinc-950 paragraph-medium-semibold", children: translate("common.account.workspace.projects.sheet.selectUsers") }),
|
|
192
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
193
|
+
membersLoadFailed && onRetryMembers && /* @__PURE__ */ jsx(
|
|
194
|
+
SectionLoadError,
|
|
195
|
+
{
|
|
196
|
+
message: translate("common.account.workspace.loadFailed"),
|
|
197
|
+
onRetry: onRetryMembers
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
sortedUsers.length > 0 && /* @__PURE__ */ jsx(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
ref: usersListRef,
|
|
204
|
+
className: "flex flex-col border border-zinc-200 rounded-lg overflow-hidden max-h-73 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300",
|
|
205
|
+
children: sortedUsers.map((user, index) => /* @__PURE__ */ jsx(
|
|
206
|
+
ConnectListRow,
|
|
207
|
+
{
|
|
208
|
+
photo: user.photo,
|
|
209
|
+
name: user.name,
|
|
210
|
+
badge: translateProfile(user.profile),
|
|
211
|
+
variant: "selected",
|
|
212
|
+
hideBorder: index === sortedUsers.length - 1,
|
|
213
|
+
onAction: () => removeUser(user.id),
|
|
214
|
+
showAction: canRemove(user.id, user.profile)
|
|
215
|
+
},
|
|
216
|
+
user.id
|
|
217
|
+
))
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
!readOnly && /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
variant: "ghost",
|
|
224
|
+
className: "h-10! text-zinc-600",
|
|
225
|
+
type: "button",
|
|
226
|
+
onClick: () => setShowUserSearch((previous) => !previous),
|
|
227
|
+
children: [
|
|
228
|
+
translate("common.account.workspace.projects.sheet.connectAnotherUser"),
|
|
229
|
+
showUserSearch ? /* @__PURE__ */ jsx(IconChevronUp, { size: 20 }) : /* @__PURE__ */ jsx(IconChevronDown, { size: 20 })
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
) }),
|
|
233
|
+
showUserSearch && !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
234
|
+
/* @__PURE__ */ jsx(
|
|
235
|
+
FormField,
|
|
236
|
+
{
|
|
237
|
+
placeholder: translate("common.account.workspace.projects.sheet.searchUsers"),
|
|
238
|
+
leftIcon: IconSearch,
|
|
239
|
+
classnameContainer: "h-10!",
|
|
240
|
+
value: searchQuery,
|
|
241
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
242
|
+
onKeyDown: (event) => event.key === "Enter" && event.preventDefault()
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
isLoadingUsers ? /* @__PURE__ */ jsx("div", { className: "flex flex-col border border-zinc-200 rounded-lg overflow-hidden", children: Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
className: cn(
|
|
249
|
+
"px-4 py-4 flex items-center justify-between w-full gap-4",
|
|
250
|
+
index < 2 && "border-b border-zinc-200"
|
|
251
|
+
),
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsx("div", { className: "size-8 rounded-full bg-zinc-200 animate-pulse shrink-0" }),
|
|
254
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-24 bg-zinc-200 rounded animate-pulse" }) }),
|
|
255
|
+
/* @__PURE__ */ jsx("div", { className: "h-10 w-[100px] bg-zinc-100 rounded-lg animate-pulse shrink-0" })
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
index
|
|
259
|
+
)) }) : availableUsers.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8 text-zinc-400 paragraph-small-regular", children: debouncedSearch ? translate("common.account.workspace.projects.sheet.noUsersFound") : translate("common.account.workspace.projects.sheet.allUsersAdded") }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col border border-zinc-200 rounded-lg overflow-hidden max-h-65 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300", children: availableUsers.map((user, index) => /* @__PURE__ */ jsx(
|
|
260
|
+
ConnectListRow,
|
|
261
|
+
{
|
|
262
|
+
photo: user.photo,
|
|
263
|
+
name: user.name,
|
|
264
|
+
variant: "default",
|
|
265
|
+
hideBorder: index === availableUsers.length - 1,
|
|
266
|
+
onAction: () => addUser(user)
|
|
267
|
+
},
|
|
268
|
+
user.id
|
|
269
|
+
)) })
|
|
270
|
+
] })
|
|
271
|
+
] })
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ jsxs(SheetFooter, { className: "flex-row items-center justify-between border-t border-zinc-200", children: [
|
|
274
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: readOnly ? translate("common.actions.close") : translate("common.actions.cancel") }),
|
|
275
|
+
!readOnly && /* @__PURE__ */ jsx(Button, { className: "h-10!", type: "submit", loading: isLoading, children: submitLabel })
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
originalImage && /* @__PURE__ */ jsx(
|
|
279
|
+
ImageCropModal,
|
|
280
|
+
{
|
|
281
|
+
open: showCropModal,
|
|
282
|
+
onOpenChange: setShowCropModal,
|
|
283
|
+
imageSrc: originalImage,
|
|
284
|
+
aspectRatio: PROJECT_LOGO_CONFIG.aspectRatio,
|
|
285
|
+
onConfirm: handleCropConfirm,
|
|
286
|
+
minWidth: PROJECT_LOGO_CONFIG.width,
|
|
287
|
+
minHeight: PROJECT_LOGO_CONFIG.height,
|
|
288
|
+
fileName,
|
|
289
|
+
onSelectAnother: () => fileInputRef.current?.click()
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
) });
|
|
295
|
+
}
|
|
296
|
+
function CreateProjectSheet({ open, onClose }) {
|
|
297
|
+
const translate = useTranslations();
|
|
298
|
+
const createProject = useCreateProject();
|
|
299
|
+
const { guardAction } = useCancelledSubscriptionGuard();
|
|
300
|
+
const { data: adminUsers, refetch: refetchAdminUsers } = useAccountMembers({
|
|
301
|
+
profiles: [UserProfile.owner, UserProfile.admin]
|
|
302
|
+
});
|
|
303
|
+
const projectSchema = useMemo(
|
|
304
|
+
() => buildProjectFormSchema(translate("common.account.workspace.projects.form.nameRequired")),
|
|
305
|
+
[translate]
|
|
306
|
+
);
|
|
307
|
+
const form = useForm({
|
|
308
|
+
resolver: zodResolver(projectSchema),
|
|
309
|
+
defaultValues: { name: "", logo: null, users: [] }
|
|
310
|
+
});
|
|
311
|
+
const handleClose = useCallback(() => {
|
|
312
|
+
form.reset({ name: "", logo: null, users: [] });
|
|
313
|
+
onClose();
|
|
314
|
+
}, [form, onClose]);
|
|
315
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
316
|
+
if (!guardAction()) return;
|
|
317
|
+
try {
|
|
318
|
+
await createProject.mutateAsync({
|
|
319
|
+
title: data.name,
|
|
320
|
+
photo: data.logo ?? void 0,
|
|
321
|
+
users: data.users.map((user) => user.id)
|
|
322
|
+
});
|
|
323
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
324
|
+
Toast,
|
|
325
|
+
{
|
|
326
|
+
variant: "success",
|
|
327
|
+
message: translate("common.account.workspace.projects.sheet.created", { name: data.name }),
|
|
328
|
+
toastId
|
|
329
|
+
}
|
|
330
|
+
));
|
|
331
|
+
handleClose();
|
|
332
|
+
} catch (error) {
|
|
333
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
334
|
+
Toast,
|
|
335
|
+
{
|
|
336
|
+
variant: "error",
|
|
337
|
+
message: error instanceof Error ? error.message : translate("common.account.workspace.projects.sheet.createError"),
|
|
338
|
+
toastId
|
|
339
|
+
}
|
|
340
|
+
));
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
form.reset({ name: "", logo: null, users: (adminUsers?.users ?? []).map(toFormUser) });
|
|
345
|
+
refetchAdminUsers();
|
|
346
|
+
}, []);
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
if (!adminUsers?.users) return;
|
|
349
|
+
form.setValue("users", adminUsers.users.map(toFormUser));
|
|
350
|
+
}, [adminUsers, form]);
|
|
351
|
+
return /* @__PURE__ */ jsx(
|
|
352
|
+
ProjectSheetUI,
|
|
353
|
+
{
|
|
354
|
+
open,
|
|
355
|
+
title: translate("common.account.workspace.projects.sheet.addProject"),
|
|
356
|
+
submitLabel: translate("common.account.workspace.projects.sheet.addProject"),
|
|
357
|
+
form,
|
|
358
|
+
handleClose,
|
|
359
|
+
handleSubmit,
|
|
360
|
+
isLoading: createProject.isPending
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
function EditProjectSheet({
|
|
365
|
+
open,
|
|
366
|
+
project,
|
|
367
|
+
onClose
|
|
368
|
+
}) {
|
|
369
|
+
const translate = useTranslations();
|
|
370
|
+
const { isOwnerOrAdmin: canManageUsers } = useManagementPermissions();
|
|
371
|
+
const projectId = project.id;
|
|
372
|
+
const { data, hasNextPage, isFetchingNextPage, isError, fetchNextPage, refetch } = useListProjectUsers(projectId);
|
|
373
|
+
const projectUsers = useMemo(() => data?.pages.flatMap((page) => page.data) ?? [], [data]);
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
if (hasNextPage && !isFetchingNextPage && !isError) fetchNextPage();
|
|
376
|
+
}, [hasNextPage, isFetchingNextPage, isError, fetchNextPage]);
|
|
377
|
+
const updateProject = useUpdateProject();
|
|
378
|
+
const addProjectUsers = useAddProjectUsers();
|
|
379
|
+
const removeProjectUsers = useRemoveProjectUsers();
|
|
380
|
+
const { guardAction } = useCancelledSubscriptionGuard();
|
|
381
|
+
const projectSchema = useMemo(
|
|
382
|
+
() => buildProjectFormSchema(translate("common.account.workspace.projects.form.nameRequired")),
|
|
383
|
+
[translate]
|
|
384
|
+
);
|
|
385
|
+
const form = useForm({
|
|
386
|
+
resolver: zodResolver(projectSchema),
|
|
387
|
+
defaultValues: { name: project.title, logo: project.photo ?? null, users: [] }
|
|
388
|
+
});
|
|
389
|
+
const seededPagesRef = useRef(0);
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
const pages = data?.pages ?? [];
|
|
392
|
+
if (pages.length <= seededPagesRef.current) return;
|
|
393
|
+
const arrived = pages.slice(seededPagesRef.current).flatMap((page) => page.data);
|
|
394
|
+
seededPagesRef.current = pages.length;
|
|
395
|
+
form.setValue("users", [
|
|
396
|
+
...form.getValues("users"),
|
|
397
|
+
...arrived.map(
|
|
398
|
+
(user) => toFormUser({
|
|
399
|
+
id: user.id_user,
|
|
400
|
+
name: user.name ?? "",
|
|
401
|
+
email: user.email ?? "",
|
|
402
|
+
profile: user.profile,
|
|
403
|
+
photo: user.photo ?? null
|
|
404
|
+
})
|
|
405
|
+
)
|
|
406
|
+
]);
|
|
407
|
+
}, [data, form]);
|
|
408
|
+
const handleSubmit = form.handleSubmit(async (data2) => {
|
|
409
|
+
if (!canManageUsers) return;
|
|
410
|
+
if (!guardAction()) return;
|
|
411
|
+
try {
|
|
412
|
+
await updateProject.mutateAsync({
|
|
413
|
+
projectId,
|
|
414
|
+
data: { title: data2.name, photo: data2.logo ?? void 0 }
|
|
415
|
+
});
|
|
416
|
+
} catch (error) {
|
|
417
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
418
|
+
Toast,
|
|
419
|
+
{
|
|
420
|
+
variant: "error",
|
|
421
|
+
message: error instanceof Error ? error.message : translate("common.account.workspace.projects.sheet.updateError"),
|
|
422
|
+
toastId
|
|
423
|
+
}
|
|
424
|
+
));
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const originalIds = new Set(projectUsers.map((user) => user.id_user));
|
|
428
|
+
const currentIds = new Set(data2.users.map((user) => user.id));
|
|
429
|
+
const toAdd = data2.users.filter((user) => !originalIds.has(user.id)).map((user) => user.id);
|
|
430
|
+
const toRemove = [...originalIds].filter((id) => !currentIds.has(id));
|
|
431
|
+
try {
|
|
432
|
+
await Promise.all([
|
|
433
|
+
toAdd.length ? addProjectUsers.mutateAsync({ projectId, userIds: toAdd }) : null,
|
|
434
|
+
toRemove.length ? removeProjectUsers.mutateAsync({ projectId, userIds: toRemove }) : null
|
|
435
|
+
]);
|
|
436
|
+
} catch (error) {
|
|
437
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
438
|
+
Toast,
|
|
439
|
+
{
|
|
440
|
+
variant: "error",
|
|
441
|
+
message: error instanceof Error ? error.message : translate("common.account.workspace.projects.sheet.updateError"),
|
|
442
|
+
toastId
|
|
443
|
+
}
|
|
444
|
+
));
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
448
|
+
Toast,
|
|
449
|
+
{
|
|
450
|
+
variant: "success",
|
|
451
|
+
message: translate("common.account.workspace.projects.sheet.changesSaved"),
|
|
452
|
+
toastId
|
|
453
|
+
}
|
|
454
|
+
));
|
|
455
|
+
onClose();
|
|
456
|
+
});
|
|
457
|
+
return /* @__PURE__ */ jsx(
|
|
458
|
+
ProjectSheetUI,
|
|
459
|
+
{
|
|
460
|
+
open,
|
|
461
|
+
title: form.watch("name") || project.title,
|
|
462
|
+
submitLabel: translate("common.account.workspace.projects.sheet.saveChanges"),
|
|
463
|
+
form,
|
|
464
|
+
projectId,
|
|
465
|
+
handleClose: onClose,
|
|
466
|
+
handleSubmit,
|
|
467
|
+
isLoading: updateProject.isPending || addProjectUsers.isPending || removeProjectUsers.isPending,
|
|
468
|
+
readOnly: !canManageUsers,
|
|
469
|
+
membersLoadFailed: isError,
|
|
470
|
+
onRetryMembers: refetch
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
function ProjectSheet() {
|
|
475
|
+
const sheet = useProjectFlows((state) => state.sheet);
|
|
476
|
+
const closeProjectSheet = useProjectFlows((state) => state.closeProjectSheet);
|
|
477
|
+
const [lastSheet, setLastSheet] = useState(sheet);
|
|
478
|
+
useEffect(() => {
|
|
479
|
+
if (sheet) setLastSheet(sheet);
|
|
480
|
+
}, [sheet]);
|
|
481
|
+
if (!lastSheet) return null;
|
|
482
|
+
const open = !!sheet;
|
|
483
|
+
if (lastSheet.mode === "details") {
|
|
484
|
+
return /* @__PURE__ */ jsx(
|
|
485
|
+
EditProjectSheet,
|
|
486
|
+
{
|
|
487
|
+
open,
|
|
488
|
+
project: lastSheet.project,
|
|
489
|
+
onClose: closeProjectSheet
|
|
490
|
+
},
|
|
491
|
+
`details-${lastSheet.project.id}`
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
return /* @__PURE__ */ jsx(CreateProjectSheet, { open, onClose: closeProjectSheet }, "create");
|
|
495
|
+
}
|
|
496
|
+
export {
|
|
497
|
+
ProjectSheet
|
|
498
|
+
};
|
|
499
|
+
//# sourceMappingURL=ProjectSheet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/projects/ProjectSheet.tsx"],"sourcesContent":["'use client';\n\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type FormEventHandler,\n} from 'react';\nimport { useForm, type UseFormReturn } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { IconChevronDown, IconChevronUp, IconSearch, IconUpload } from '@tabler/icons-react';\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 { FormField } from '../../../ui/form/FormField';\nimport { Sheet, SheetContent, SheetFooter, SheetHeader, SheetTitle } from '../../../ui/overlay/Sheet';\nimport { ImageCropModal } from '../../../widgets/ImageUpload/ImageCropModal';\nimport { ACCEPTED_IMAGE_FORMATS_STRING } from '../../../../modules/images/constants/image.constants';\nimport { useImageUpload } from '../../../../modules/images/hooks/use-image-upload.hook';\nimport { useAccountMembers } from '../../../../modules/accounts/hooks/use-account-members.hook';\nimport { useManagementPermissions } from '../../../../modules/auth/hooks/useManagementPermissions';\nimport { useCreateProject } from '../../../../modules/projects/hooks/create-project.hook';\nimport { useUpdateProject } from '../../../../modules/projects/hooks/update-project.hook';\nimport { useAddProjectUsers } from '../../../../modules/projects/hooks/add-project-users.hook';\nimport { useRemoveProjectUsers } from '../../../../modules/projects/hooks/remove-project-users.hook';\nimport { useListProjectUsers } from '../../../../modules/projects/hooks/list-project-users.hook';\nimport { useCancelledSubscriptionGuard } from '../../../../modules/subscriptions/hooks/use-cancelled-subscription-guard';\nimport { UserProfile, type User } from '../../../../modules/users/schema';\nimport type { Project } from '../../../../modules/projects/types';\nimport { useAuth } from '../../../../providers/auth.provider';\nimport { useDebounce } from '../../../../hooks/useDebounce';\nimport useIsMobile from '../../../../hooks/useIsMobile';\nimport { cn } from '../../../../infra/utils/clsx';\nimport { useProjectFlows, type ProjectSheetState } from '../../../../store/useProjectFlows';\nimport { ConnectListRow } from '../shared/ConnectListRow';\nimport { SectionLoadError } from '../shared/SectionLoadError';\nimport { buildProjectFormSchema, type ProjectFormData, type ProjectFormUser } from './project-form.schema';\n\nconst PROJECT_LOGO_CONFIG = { width: 200, height: 200, aspectRatio: 1 };\n\nconst STORAGE_URL = process.env.NEXT_PUBLIC_STORAGE_URL || '';\n\nfunction toFormUser(user: Pick<User, 'id' | 'name' | 'email' | 'profile' | 'photo'>): ProjectFormUser {\n return {\n id: user.id,\n name: user.name ?? '',\n email: user.email ?? '',\n profile: user.profile ?? UserProfile.viewer,\n photo: user.photo ?? null,\n };\n}\n\ntype ProjectSheetUIProps = {\n open: boolean;\n title: string;\n submitLabel: string;\n projectId?: number;\n form: UseFormReturn<ProjectFormData>;\n handleClose: () => void;\n handleSubmit: FormEventHandler;\n isLoading: boolean;\n readOnly?: boolean;\n membersLoadFailed?: boolean;\n onRetryMembers?: () => void;\n};\n\nfunction ProjectSheetUI({\n open,\n title,\n submitLabel,\n form,\n projectId,\n handleClose,\n handleSubmit,\n isLoading,\n readOnly = false,\n membersLoadFailed = false,\n onRetryMembers,\n}: ProjectSheetUIProps) {\n const translate = useTranslations();\n const translateProfile = useTranslations('common.account.workspace.team.profiles');\n const isMobile = useIsMobile();\n const fileInputRef = useRef<HTMLInputElement>(null);\n const usersListRef = useRef<HTMLDivElement>(null);\n const [showUserSearch, setShowUserSearch] = useState(false);\n const [failedLogoSrc, setFailedLogoSrc] = useState<string | null>(null);\n const [searchQuery, setSearchQuery] = useState('');\n const debouncedSearch = useDebounce(searchQuery, 400);\n\n const { user: currentUser } = useAuth();\n const { data: usersOutProject, isPending: isLoadingUsers } = useAccountMembers(\n projectId\n ? { name: debouncedSearch, notInProject: projectId }\n : { name: debouncedSearch, profiles: [UserProfile.collaborator, UserProfile.viewer] }\n );\n\n const { originalImage, showCropModal, setShowCropModal, fileName, handleFileSelect, handleCropConfirm } =\n useImageUpload({\n config: PROJECT_LOGO_CONFIG,\n onSuccess: (base64) => form.setValue('logo', base64),\n });\n\n const logo = form.watch('logo');\n const selectedUsers = form.watch('users');\n const availableUsers = (usersOutProject?.users ?? []).filter(\n (user) => !selectedUsers.some((selected) => selected.id === user.id)\n );\n\n const handleFileChange = (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n if (!file) return;\n handleFileSelect(file);\n event.target.value = '';\n };\n\n const addUser = (user: User) => {\n const current = form.getValues('users');\n if (current.some((selected) => selected.id === user.id)) return;\n\n form.setValue('users', [...current, toFormUser(user)]);\n setTimeout(() => {\n usersListRef.current?.scrollTo({ top: usersListRef.current.scrollHeight, behavior: 'smooth' });\n }, 50);\n };\n\n const removeUser = (userId: number) => {\n form.setValue(\n 'users',\n form.getValues('users').filter((user) => user.id !== userId)\n );\n };\n\n /** Proprietário e administrador ficam fixos no projeto; o próprio usuário não se remove. */\n const canRemove = (userId: number, profile: UserProfile): boolean => {\n if (readOnly) return false;\n if (!currentUser) return false;\n if (currentUser.id === userId) return false;\n if (currentUser.profile !== UserProfile.owner && currentUser.profile !== UserProfile.admin) return false;\n if (profile === UserProfile.owner || profile === UserProfile.admin) return false;\n\n return true;\n };\n\n const fixedUsers = selectedUsers.filter((user) => !canRemove(user.id, user.profile));\n const removableUsers = selectedUsers.filter((user) => canRemove(user.id, user.profile));\n const sortedUsers = [...fixedUsers, ...removableUsers];\n\n const rawLogoSrc = logo ? (logo.startsWith('data:') ? logo : `${STORAGE_URL}/${logo}`) : null;\n // Logo que não carrega cai no placeholder de upload, em vez da imagem quebrada.\n const logoSrc = rawLogoSrc && failedLogoSrc !== rawLogoSrc ? rawLogoSrc : null;\n\n return (\n <Sheet open={open} onOpenChange={handleClose}>\n <SheetContent\n side={isMobile ? 'bottom' : 'right'}\n className={cn(\n isMobile\n ? 'h-dvh w-full max-w-full rounded-none pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]'\n : 'h-screen max-w-120! w-120!',\n 'data-[state=open]:max-h-none data-[state=open]:h-dvh overflow-hidden'\n )}\n >\n <SheetHeader className=\"border-b border-zinc-200\">\n <SheetTitle className=\"text-zinc-950 paragraph-medium-semibold\">{title}</SheetTitle>\n </SheetHeader>\n\n <form onSubmit={handleSubmit} className=\"flex flex-col flex-1 min-h-0\">\n <div className=\"flex flex-col gap-6 px-5 pb-5 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300 flex-1 min-h-0\">\n <div className=\"flex items-center gap-3\">\n <input\n type=\"file\"\n ref={fileInputRef}\n onChange={handleFileChange}\n accept={ACCEPTED_IMAGE_FORMATS_STRING}\n className=\"hidden\"\n />\n {logoSrc ? (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n alt={translate('common.account.workspace.projects.sheet.projectName')}\n src={logoSrc}\n className={cn('size-12 rounded-full object-cover shrink-0', !readOnly && 'cursor-pointer')}\n onClick={readOnly ? undefined : () => fileInputRef.current?.click()}\n onError={() => setFailedLogoSrc(logoSrc)}\n />\n ) : (\n <div\n className={cn(\n 'flex items-center justify-center size-12 shrink-0 rounded-full bg-zinc-50 border border-zinc-200 text-zinc-400 border-dashed',\n !readOnly && 'cursor-pointer hover:bg-zinc-100 transition-colors'\n )}\n onClick={readOnly ? undefined : () => fileInputRef.current?.click()}\n >\n <IconUpload size={16} />\n </div>\n )}\n {!readOnly && (\n <Button\n variant=\"secondary\"\n className=\"h-8!\"\n type=\"button\"\n onClick={() => fileInputRef.current?.click()}\n >\n <IconUpload size={16} />\n {translate('common.account.workspace.projects.sheet.changeLogo')}\n </Button>\n )}\n </div>\n\n <FormField\n label={translate('common.account.workspace.projects.sheet.projectName')}\n placeholder={translate('common.account.workspace.projects.sheet.namePlaceholder')}\n error={!!form.formState.errors.name}\n errorMessage={form.formState.errors.name?.message}\n {...form.register('name')}\n disabled={readOnly}\n />\n\n <Separator />\n\n <span className=\"text-zinc-950 paragraph-medium-semibold\">\n {translate('common.account.workspace.projects.sheet.selectUsers')}\n </span>\n\n <div className=\"flex flex-col gap-3\">\n {membersLoadFailed && onRetryMembers && (\n <SectionLoadError\n message={translate('common.account.workspace.loadFailed')}\n onRetry={onRetryMembers}\n />\n )}\n\n {sortedUsers.length > 0 && (\n <div\n ref={usersListRef}\n className=\"flex flex-col border border-zinc-200 rounded-lg overflow-hidden max-h-73 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300\"\n >\n {sortedUsers.map((user, index) => (\n <ConnectListRow\n key={user.id}\n photo={user.photo}\n name={user.name}\n badge={translateProfile(user.profile)}\n variant=\"selected\"\n hideBorder={index === sortedUsers.length - 1}\n onAction={() => removeUser(user.id)}\n showAction={canRemove(user.id, user.profile)}\n />\n ))}\n </div>\n )}\n\n {!readOnly && (\n <div className=\"flex justify-center\">\n <Button\n variant=\"ghost\"\n className=\"h-10! text-zinc-600\"\n type=\"button\"\n onClick={() => setShowUserSearch((previous) => !previous)}\n >\n {translate('common.account.workspace.projects.sheet.connectAnotherUser')}\n {showUserSearch ? <IconChevronUp size={20} /> : <IconChevronDown size={20} />}\n </Button>\n </div>\n )}\n\n {showUserSearch && !readOnly && (\n <>\n <FormField\n placeholder={translate('common.account.workspace.projects.sheet.searchUsers')}\n leftIcon={IconSearch}\n classnameContainer=\"h-10!\"\n value={searchQuery}\n onChange={(event) => setSearchQuery(event.target.value)}\n onKeyDown={(event) => event.key === 'Enter' && event.preventDefault()}\n />\n {isLoadingUsers ? (\n <div className=\"flex flex-col border border-zinc-200 rounded-lg overflow-hidden\">\n {Array.from({ length: 3 }).map((_, index) => (\n <div\n key={index}\n className={cn(\n 'px-4 py-4 flex items-center justify-between w-full gap-4',\n index < 2 && 'border-b border-zinc-200'\n )}\n >\n <div className=\"size-8 rounded-full bg-zinc-200 animate-pulse shrink-0\" />\n <div className=\"flex items-center gap-2 flex-1 min-w-0\">\n <div className=\"h-4 w-24 bg-zinc-200 rounded animate-pulse\" />\n </div>\n <div className=\"h-10 w-[100px] bg-zinc-100 rounded-lg animate-pulse shrink-0\" />\n </div>\n ))}\n </div>\n ) : availableUsers.length === 0 ? (\n <div className=\"flex items-center justify-center py-8 text-zinc-400 paragraph-small-regular\">\n {debouncedSearch\n ? translate('common.account.workspace.projects.sheet.noUsersFound')\n : translate('common.account.workspace.projects.sheet.allUsersAdded')}\n </div>\n ) : (\n <div className=\"flex flex-col border border-zinc-200 rounded-lg overflow-hidden max-h-65 overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300\">\n {availableUsers.map((user, index) => (\n <ConnectListRow\n key={user.id}\n photo={user.photo}\n name={user.name}\n variant=\"default\"\n hideBorder={index === availableUsers.length - 1}\n onAction={() => addUser(user)}\n />\n ))}\n </div>\n )}\n </>\n )}\n </div>\n </div>\n\n <SheetFooter className=\"flex-row items-center justify-between border-t border-zinc-200\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n {readOnly ? translate('common.actions.close') : translate('common.actions.cancel')}\n </Button>\n {!readOnly && (\n <Button className=\"h-10!\" type=\"submit\" loading={isLoading}>\n {submitLabel}\n </Button>\n )}\n </SheetFooter>\n </form>\n\n {/* Modal de crop (trata internamente a variante \"imagem muito pequena\"). */}\n {originalImage && (\n <ImageCropModal\n open={showCropModal}\n onOpenChange={setShowCropModal}\n imageSrc={originalImage}\n aspectRatio={PROJECT_LOGO_CONFIG.aspectRatio}\n onConfirm={handleCropConfirm}\n minWidth={PROJECT_LOGO_CONFIG.width}\n minHeight={PROJECT_LOGO_CONFIG.height}\n fileName={fileName}\n onSelectAnother={() => fileInputRef.current?.click()}\n />\n )}\n </SheetContent>\n </Sheet>\n );\n}\n\nfunction CreateProjectSheet({ open, onClose }: { open: boolean; onClose: () => void }) {\n const translate = useTranslations();\n const createProject = useCreateProject();\n const { guardAction } = useCancelledSubscriptionGuard();\n\n // Proprietários e administradores entram no projeto por padrão, como na tela de projetos.\n const { data: adminUsers, refetch: refetchAdminUsers } = useAccountMembers({\n profiles: [UserProfile.owner, UserProfile.admin],\n });\n\n const projectSchema = useMemo(\n () => buildProjectFormSchema(translate('common.account.workspace.projects.form.nameRequired')),\n [translate]\n );\n\n const form = useForm<ProjectFormData>({\n resolver: zodResolver(projectSchema),\n defaultValues: { name: '', logo: null, users: [] },\n });\n\n const handleClose = useCallback(() => {\n form.reset({ name: '', logo: null, users: [] });\n onClose();\n }, [form, onClose]);\n\n const handleSubmit = form.handleSubmit(async (data) => {\n if (!guardAction()) return;\n\n try {\n await createProject.mutateAsync({\n title: data.name,\n photo: data.logo ?? undefined,\n users: data.users.map((user) => user.id),\n });\n toast.custom((toastId) => (\n <Toast\n variant=\"success\"\n message={translate('common.account.workspace.projects.sheet.created', { name: data.name })}\n toastId={toastId}\n />\n ));\n handleClose();\n } catch (error) {\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={\n error instanceof Error\n ? error.message\n : translate('common.account.workspace.projects.sheet.createError')\n }\n toastId={toastId}\n />\n ));\n }\n });\n\n useEffect(() => {\n form.reset({ name: '', logo: null, users: (adminUsers?.users ?? []).map(toFormUser) });\n refetchAdminUsers();\n // Roda na montagem: o sheet é remontado a cada abertura pela `key` em ProjectSheet.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (!adminUsers?.users) return;\n form.setValue('users', adminUsers.users.map(toFormUser));\n }, [adminUsers, form]);\n\n return (\n <ProjectSheetUI\n open={open}\n title={translate('common.account.workspace.projects.sheet.addProject')}\n submitLabel={translate('common.account.workspace.projects.sheet.addProject')}\n form={form}\n handleClose={handleClose}\n handleSubmit={handleSubmit}\n isLoading={createProject.isPending}\n />\n );\n}\n\nfunction EditProjectSheet({\n open,\n project,\n onClose,\n}: {\n open: boolean;\n project: Project;\n onClose: () => void;\n}) {\n const translate = useTranslations();\n const { isOwnerOrAdmin: canManageUsers } = useManagementPermissions();\n const projectId = project.id;\n\n const { data, hasNextPage, isFetchingNextPage, isError, fetchNextPage, refetch } =\n useListProjectUsers(projectId);\n const projectUsers = useMemo(() => data?.pages.flatMap((page) => page.data) ?? [], [data]);\n\n // A lista precisa mostrar todos os membros, não só a primeira página.\n useEffect(() => {\n if (hasNextPage && !isFetchingNextPage && !isError) fetchNextPage();\n }, [hasNextPage, isFetchingNextPage, isError, fetchNextPage]);\n\n const updateProject = useUpdateProject();\n const addProjectUsers = useAddProjectUsers();\n const removeProjectUsers = useRemoveProjectUsers();\n const { guardAction } = useCancelledSubscriptionGuard();\n\n const projectSchema = useMemo(\n () => buildProjectFormSchema(translate('common.account.workspace.projects.form.nameRequired')),\n [translate]\n );\n\n const form = useForm<ProjectFormData>({\n resolver: zodResolver(projectSchema),\n defaultValues: { name: project.title, logo: project.photo ?? null, users: [] },\n });\n\n const seededPagesRef = useRef(0);\n\n useEffect(() => {\n const pages = data?.pages ?? [];\n if (pages.length <= seededPagesRef.current) return;\n\n const arrived = pages.slice(seededPagesRef.current).flatMap((page) => page.data);\n seededPagesRef.current = pages.length;\n\n form.setValue('users', [\n ...form.getValues('users'),\n ...arrived.map((user) =>\n toFormUser({\n id: user.id_user,\n name: user.name ?? '',\n email: user.email ?? '',\n profile: user.profile,\n photo: user.photo ?? null,\n })\n ),\n ]);\n }, [data, form]);\n\n const handleSubmit = form.handleSubmit(async (data) => {\n if (!canManageUsers) return;\n if (!guardAction()) return;\n\n try {\n await updateProject.mutateAsync({\n projectId,\n data: { title: data.name, photo: data.logo ?? undefined },\n });\n } catch (error) {\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={\n error instanceof Error\n ? error.message\n : translate('common.account.workspace.projects.sheet.updateError')\n }\n toastId={toastId}\n />\n ));\n return;\n }\n\n const originalIds = new Set(projectUsers.map((user) => user.id_user));\n const currentIds = new Set(data.users.map((user) => user.id));\n const toAdd = data.users.filter((user) => !originalIds.has(user.id)).map((user) => user.id);\n const toRemove = [...originalIds].filter((id) => !currentIds.has(id));\n\n try {\n await Promise.all([\n toAdd.length ? addProjectUsers.mutateAsync({ projectId, userIds: toAdd }) : null,\n toRemove.length ? removeProjectUsers.mutateAsync({ projectId, userIds: toRemove }) : null,\n ]);\n } catch (error) {\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={\n error instanceof Error\n ? error.message\n : translate('common.account.workspace.projects.sheet.updateError')\n }\n toastId={toastId}\n />\n ));\n return;\n }\n\n toast.custom((toastId) => (\n <Toast\n variant=\"success\"\n message={translate('common.account.workspace.projects.sheet.changesSaved')}\n toastId={toastId}\n />\n ));\n onClose();\n });\n\n return (\n <ProjectSheetUI\n open={open}\n title={form.watch('name') || project.title}\n submitLabel={translate('common.account.workspace.projects.sheet.saveChanges')}\n form={form}\n projectId={projectId}\n handleClose={onClose}\n handleSubmit={handleSubmit}\n isLoading={updateProject.isPending || addProjectUsers.isPending || removeProjectUsers.isPending}\n readOnly={!canManageUsers}\n membersLoadFailed={isError}\n onRetryMembers={refetch}\n />\n );\n}\n\n/**\n * Sheet de criação e de detalhes do projeto, aberto por cima do modal Minha conta.\n * Mantém o último estado enquanto fecha para não perder o conteúdo durante a animação.\n */\nexport function ProjectSheet() {\n const sheet = useProjectFlows((state) => state.sheet);\n const closeProjectSheet = useProjectFlows((state) => state.closeProjectSheet);\n const [lastSheet, setLastSheet] = useState<ProjectSheetState>(sheet);\n\n useEffect(() => {\n if (sheet) setLastSheet(sheet);\n }, [sheet]);\n\n if (!lastSheet) return null;\n\n const open = !!sheet;\n\n if (lastSheet.mode === 'details') {\n return (\n <EditProjectSheet\n key={`details-${lastSheet.project.id}`}\n open={open}\n project={lastSheet.project}\n onClose={closeProjectSheet}\n />\n );\n }\n\n return <CreateProjectSheet key=\"create\" open={open} onClose={closeProjectSheet} />;\n}\n"],"mappings":";AAwKU,SAwGM,UAxGN,KAkCM,YAlCN;AAtKV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,eAAmC;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB,eAAe,YAAY,kBAAkB;AACvE,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,OAAO,cAAc,aAAa,aAAa,kBAAkB;AAC1E,SAAS,sBAAsB;AAC/B,SAAS,qCAAqC;AAC9C,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,qCAAqC;AAC9C,SAAS,mBAA8B;AAEvC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,OAAO,iBAAiB;AACxB,SAAS,UAAU;AACnB,SAAS,uBAA+C;AACxD,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,8BAA0E;AAEnF,MAAM,sBAAsB,EAAE,OAAO,KAAK,QAAQ,KAAK,aAAa,EAAE;AAEtE,MAAM,cAAc,QAAQ,IAAI,2BAA2B;AAE3D,SAAS,WAAW,MAAkF;AACpG,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,MAAM,KAAK,Q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YACZ;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,SAAS,UAAU,sDAAsD;AAAA,QACzE;AAAA;AAAA,IACF,CACD;AACD,YAAQ;AAAA,EACV,CAAC;AAED,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO,KAAK,MAAM,MAAM,KAAK,QAAQ;AAAA,MACrC,aAAa,UAAU,qDAAqD;AAAA,MAC5E;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA,WAAW,cAAc,aAAa,gBAAgB,aAAa,mBAAmB;AAAA,MACtF,UAAU,CAAC;AAAA,MACX,mBAAmB;AAAA,MACnB,gBAAgB;AAAA;AAAA,EAClB;AAEJ;AAMO,SAAS,eAAe;AAC7B,QAAM,QAAQ,gBAAgB,CAAC,UAAU,MAAM,KAAK;AACpD,QAAM,oBAAoB,gBAAgB,CAAC,UAAU,MAAM,iBAAiB;AAC5E,QAAM,CAAC,WAAW,YAAY,IAAI,SAA4B,KAAK;AAEnE,YAAU,MAAM;AACd,QAAI,MAAO,cAAa,KAAK;AAAA,EAC/B,GAAG,CAAC,KAAK,CAAC;AAEV,MAAI,CAAC,UAAW,QAAO;AAEvB,QAAM,OAAO,CAAC,CAAC;AAEf,MAAI,UAAU,SAAS,WAAW;AAChC,WACE;AAAA,MAAC;AAAA;AAAA,QAEC;AAAA,QACA,SAAS,UAAU;AAAA,QACnB,SAAS;AAAA;AAAA,MAHJ,WAAW,UAAU,QAAQ,EAAE;AAAA,IAItC;AAAA,EAEJ;AAEA,SAAO,oBAAC,sBAAgC,MAAY,SAAS,qBAA9B,QAAiD;AAClF;","names":["data"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { useManagementPermissions } from "../../../../modules/auth/hooks/useManagementPermissions";
|
|
15
|
+
import { useProjectFlows } from "../../../../store/useProjectFlows";
|
|
16
|
+
import useSubscriptionActions from "../../hooks/useSubscriptionActions";
|
|
17
|
+
function ProjectsDisabledModal() {
|
|
18
|
+
const translate = useTranslations();
|
|
19
|
+
const { isOwnerOrAdmin } = useManagementPermissions();
|
|
20
|
+
const isOpen = useProjectFlows((state) => state.isProjectsDisabledOpen);
|
|
21
|
+
const closeProjectsDisabled = useProjectFlows((state) => state.closeProjectsDisabled);
|
|
22
|
+
const subscriptionActions = useSubscriptionActions();
|
|
23
|
+
const handleUpgrade = () => {
|
|
24
|
+
closeProjectsDisabled();
|
|
25
|
+
subscriptionActions.choosePlan();
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (nextOpen) => !nextOpen && closeProjectsDisabled(), children: /* @__PURE__ */ jsxs(
|
|
28
|
+
DialogContent,
|
|
29
|
+
{
|
|
30
|
+
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
31
|
+
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!",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "gap-3 text-left p-5", children: [
|
|
34
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-10 h-10 bg-gray-100 rounded-lg", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-gray-950" }) }),
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-zinc-950", children: translate("common.account.workspace.projects.disabledModal.title") }),
|
|
37
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-zinc-600", asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("p", { children: translate("common.account.workspace.projects.disabledModal.description1") }),
|
|
39
|
+
/* @__PURE__ */ jsx("p", { children: translate("common.account.workspace.projects.disabledModal.description2") })
|
|
40
|
+
] }) })
|
|
41
|
+
] })
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ jsx(Separator, {}),
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-5", children: [
|
|
45
|
+
isOwnerOrAdmin && /* @__PURE__ */ jsx(Button, { className: "h-10! transition-colors", onClick: handleUpgrade, children: translate("common.account.workspace.projects.disabledModal.upgrade") }),
|
|
46
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10! transition-colors", onClick: closeProjectsDisabled, children: translate("common.actions.cancel") })
|
|
47
|
+
] })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
ProjectsDisabledModal
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=ProjectsDisabledModal.mjs.map
|