@greatapps/common 1.1.790 → 1.1.792

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (791) hide show
  1. package/dist/components/account/AccountHubLinkHandler.mjs +36 -0
  2. package/dist/components/account/AccountHubLinkHandler.mjs.map +1 -0
  3. package/dist/components/account/AccountModalLayout.mjs +137 -0
  4. package/dist/components/account/AccountModalLayout.mjs.map +1 -0
  5. package/dist/components/account/AccountModals.mjs +10 -3
  6. package/dist/components/account/AccountModals.mjs.map +1 -1
  7. package/dist/components/account/AccountUnsavedChangesDialog.mjs +34 -0
  8. package/dist/components/account/AccountUnsavedChangesDialog.mjs.map +1 -0
  9. package/dist/components/account/DeleteAccountModal.mjs +1 -1
  10. package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
  11. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +8 -1
  12. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
  13. package/dist/components/account/MyAccountModal.mjs +173 -0
  14. package/dist/components/account/MyAccountModal.mjs.map +1 -0
  15. package/dist/components/account/TwoFactorAuthModal.mjs +1 -1
  16. package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
  17. package/dist/components/account/hooks/useAccountHubActions.mjs +85 -0
  18. package/dist/components/account/hooks/useAccountHubActions.mjs.map +1 -0
  19. package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs +44 -0
  20. package/dist/components/account/hooks/useAddCardWithPaymentSwitch.mjs.map +1 -0
  21. package/dist/components/account/hooks/useAffiliatesActions.mjs +69 -0
  22. package/dist/components/account/hooks/useAffiliatesActions.mjs.map +1 -0
  23. package/dist/components/account/hooks/useMyAccountModal.mjs +27 -0
  24. package/dist/components/account/hooks/useMyAccountModal.mjs.map +1 -0
  25. package/dist/components/account/hooks/useProjectsActions.mjs +40 -0
  26. package/dist/components/account/hooks/useProjectsActions.mjs.map +1 -0
  27. package/dist/components/account/hooks/useSubscriptionActions.mjs +87 -0
  28. package/dist/components/account/hooks/useSubscriptionActions.mjs.map +1 -0
  29. package/dist/components/account/hooks/useTeamActions.mjs +31 -0
  30. package/dist/components/account/hooks/useTeamActions.mjs.map +1 -0
  31. package/dist/components/account/sections/AffiliatesSection.mjs +313 -0
  32. package/dist/components/account/sections/AffiliatesSection.mjs.map +1 -0
  33. package/dist/components/account/sections/ChangePasswordSection.mjs +5 -5
  34. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
  35. package/dist/components/account/sections/MyProfileSection.mjs +212 -164
  36. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
  37. package/dist/components/account/sections/PreferencesSection.mjs +74 -68
  38. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
  39. package/dist/components/account/sections/ProjectsSection.mjs +77 -0
  40. package/dist/components/account/sections/ProjectsSection.mjs.map +1 -0
  41. package/dist/components/account/sections/SecuritySection.mjs +55 -36
  42. package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
  43. package/dist/components/account/sections/SubscriptionSection.mjs +29 -0
  44. package/dist/components/account/sections/SubscriptionSection.mjs.map +1 -0
  45. package/dist/components/account/sections/TeamSection.mjs +119 -0
  46. package/dist/components/account/sections/TeamSection.mjs.map +1 -0
  47. package/dist/components/account/sections/TokenSection.mjs +41 -43
  48. package/dist/components/account/sections/TokenSection.mjs.map +1 -1
  49. package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs +73 -0
  50. package/dist/components/account/sections/affiliates/AffiliateCommissionCard.mjs.map +1 -0
  51. package/dist/components/account/sections/affiliates/AffiliateFlows.mjs +20 -0
  52. package/dist/components/account/sections/affiliates/AffiliateFlows.mjs.map +1 -0
  53. package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs +99 -0
  54. package/dist/components/account/sections/affiliates/AffiliateLeadsSheet.mjs.map +1 -0
  55. package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs +31 -0
  56. package/dist/components/account/sections/affiliates/AffiliateStatsCard.mjs.map +1 -0
  57. package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs +15 -0
  58. package/dist/components/account/sections/affiliates/AffiliateStepCard.mjs.map +1 -0
  59. package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs +108 -0
  60. package/dist/components/account/sections/affiliates/AffiliateTransactionsList.mjs.map +1 -0
  61. package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs +49 -0
  62. package/dist/components/account/sections/affiliates/NoReceivingAccountModal.mjs.map +1 -0
  63. package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs +182 -0
  64. package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs.map +1 -0
  65. package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs +476 -0
  66. package/dist/components/account/sections/affiliates/RequestWithdrawalSheet.mjs.map +1 -0
  67. package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs +34 -0
  68. package/dist/components/account/sections/affiliates/ViewAttachmentModal.mjs.map +1 -0
  69. package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs +27 -0
  70. package/dist/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.mjs.map +1 -0
  71. package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs +30 -0
  72. package/dist/components/account/sections/affiliates/reports/AffiliatesReportsTab.mjs.map +1 -0
  73. package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs +120 -0
  74. package/dist/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.mjs.map +1 -0
  75. package/dist/components/account/sections/projects/DeleteProjectModal.mjs +205 -0
  76. package/dist/components/account/sections/projects/DeleteProjectModal.mjs.map +1 -0
  77. package/dist/components/account/sections/projects/ProjectFlows.mjs +16 -0
  78. package/dist/components/account/sections/projects/ProjectFlows.mjs.map +1 -0
  79. package/dist/components/account/sections/projects/ProjectMembersStack.mjs +53 -0
  80. package/dist/components/account/sections/projects/ProjectMembersStack.mjs.map +1 -0
  81. package/dist/components/account/sections/projects/ProjectRow.mjs +85 -0
  82. package/dist/components/account/sections/projects/ProjectRow.mjs.map +1 -0
  83. package/dist/components/account/sections/projects/ProjectSheet.mjs +499 -0
  84. package/dist/components/account/sections/projects/ProjectSheet.mjs.map +1 -0
  85. package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs +55 -0
  86. package/dist/components/account/sections/projects/ProjectsDisabledModal.mjs.map +1 -0
  87. package/dist/components/account/sections/projects/project-form.schema.mjs +28 -0
  88. package/dist/components/account/sections/projects/project-form.schema.mjs.map +1 -0
  89. package/dist/components/account/sections/shared/ConnectListRow.mjs +45 -0
  90. package/dist/components/account/sections/shared/ConnectListRow.mjs.map +1 -0
  91. package/dist/components/account/sections/shared/DateFilterPopover.mjs +51 -0
  92. package/dist/components/account/sections/shared/DateFilterPopover.mjs.map +1 -0
  93. package/dist/components/account/sections/shared/EntityAvatar.mjs +41 -0
  94. package/dist/components/account/sections/shared/EntityAvatar.mjs.map +1 -0
  95. package/dist/components/account/sections/shared/FilterPopover.mjs +62 -0
  96. package/dist/components/account/sections/shared/FilterPopover.mjs.map +1 -0
  97. package/dist/components/account/sections/shared/FormSection.mjs +14 -0
  98. package/dist/components/account/sections/shared/FormSection.mjs.map +1 -0
  99. package/dist/components/account/sections/shared/IconBox.mjs +18 -0
  100. package/dist/components/account/sections/shared/IconBox.mjs.map +1 -0
  101. package/dist/components/account/sections/shared/InfiniteScrollList.mjs +36 -0
  102. package/dist/components/account/sections/shared/InfiniteScrollList.mjs.map +1 -0
  103. package/dist/components/account/sections/shared/ListPagination.mjs +69 -0
  104. package/dist/components/account/sections/shared/ListPagination.mjs.map +1 -0
  105. package/dist/components/account/sections/shared/RowActionsMenu.mjs +52 -0
  106. package/dist/components/account/sections/shared/RowActionsMenu.mjs.map +1 -0
  107. package/dist/components/account/sections/shared/SectionLoadError.mjs +20 -0
  108. package/dist/components/account/sections/shared/SectionLoadError.mjs.map +1 -0
  109. package/dist/components/account/sections/shared/StatusBadge.mjs +26 -0
  110. package/dist/components/account/sections/shared/StatusBadge.mjs.map +1 -0
  111. package/dist/components/account/sections/shared/WorkspaceSection.mjs +10 -0
  112. package/dist/components/account/sections/shared/WorkspaceSection.mjs.map +1 -0
  113. package/dist/components/account/sections/subscription/AiCreditsUsage.mjs +106 -0
  114. package/dist/components/account/sections/subscription/AiCreditsUsage.mjs.map +1 -0
  115. package/dist/components/account/sections/subscription/BillingAddressSheet.mjs +407 -0
  116. package/dist/components/account/sections/subscription/BillingAddressSheet.mjs.map +1 -0
  117. package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs +73 -0
  118. package/dist/components/account/sections/subscription/BoletoDetailsDialog.mjs.map +1 -0
  119. package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs +22 -0
  120. package/dist/components/account/sections/subscription/BoletoGeneratedDialog.mjs.map +1 -0
  121. package/dist/components/account/sections/subscription/CancelPlanDialog.mjs +161 -0
  122. package/dist/components/account/sections/subscription/CancelPlanDialog.mjs.map +1 -0
  123. package/dist/components/account/sections/subscription/ChargeRow.mjs +127 -0
  124. package/dist/components/account/sections/subscription/ChargeRow.mjs.map +1 -0
  125. package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs +27 -0
  126. package/dist/components/account/sections/subscription/ChargeStatusBadge.mjs.map +1 -0
  127. package/dist/components/account/sections/subscription/ChargesList.mjs +88 -0
  128. package/dist/components/account/sections/subscription/ChargesList.mjs.map +1 -0
  129. package/dist/components/account/sections/subscription/ManageCardsSheet.mjs +49 -0
  130. package/dist/components/account/sections/subscription/ManageCardsSheet.mjs.map +1 -0
  131. package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs +26 -0
  132. package/dist/components/account/sections/subscription/OverdueReceiptOpener.mjs.map +1 -0
  133. package/dist/components/account/sections/subscription/PayChargeDialog.mjs +222 -0
  134. package/dist/components/account/sections/subscription/PayChargeDialog.mjs.map +1 -0
  135. package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs +61 -0
  136. package/dist/components/account/sections/subscription/PaymentConfirmationDialog.mjs.map +1 -0
  137. package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs +72 -0
  138. package/dist/components/account/sections/subscription/PaymentMethodsCard.mjs.map +1 -0
  139. package/dist/components/account/sections/subscription/PendingChangeDialog.mjs +117 -0
  140. package/dist/components/account/sections/subscription/PendingChangeDialog.mjs.map +1 -0
  141. package/dist/components/account/sections/subscription/PixDetailsDialog.mjs +165 -0
  142. package/dist/components/account/sections/subscription/PixDetailsDialog.mjs.map +1 -0
  143. package/dist/components/account/sections/subscription/PixPaymentDialog.mjs +155 -0
  144. package/dist/components/account/sections/subscription/PixPaymentDialog.mjs.map +1 -0
  145. package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs +253 -0
  146. package/dist/components/account/sections/subscription/PlanDetailsSheet.mjs.map +1 -0
  147. package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs +237 -0
  148. package/dist/components/account/sections/subscription/ReceiptDetailsSheet.mjs.map +1 -0
  149. package/dist/components/account/sections/subscription/SubscriptionFlows.mjs +40 -0
  150. package/dist/components/account/sections/subscription/SubscriptionFlows.mjs.map +1 -0
  151. package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs +303 -0
  152. package/dist/components/account/sections/subscription/SubscriptionPlanCard.mjs.map +1 -0
  153. package/dist/components/account/sections/subscription/UsageReportSheet.mjs +163 -0
  154. package/dist/components/account/sections/subscription/UsageReportSheet.mjs.map +1 -0
  155. package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs +75 -0
  156. package/dist/components/account/sections/subscription/change-plan/ChangePlanSheet.mjs.map +1 -0
  157. package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs +55 -0
  158. package/dist/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.mjs.map +1 -0
  159. package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs +188 -0
  160. package/dist/components/account/sections/subscription/change-plan/components/AddonsBlock.mjs.map +1 -0
  161. package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs +66 -0
  162. package/dist/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.mjs.map +1 -0
  163. package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs +42 -0
  164. package/dist/components/account/sections/subscription/change-plan/components/CouponBlock.mjs.map +1 -0
  165. package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs +119 -0
  166. package/dist/components/account/sections/subscription/change-plan/components/CouponDialog.mjs.map +1 -0
  167. package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs +17 -0
  168. package/dist/components/account/sections/subscription/change-plan/components/PricePreview.mjs.map +1 -0
  169. package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs +130 -0
  170. package/dist/components/account/sections/subscription/change-plan/components/SummaryBlock.mjs.map +1 -0
  171. package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs +38 -0
  172. package/dist/components/account/sections/subscription/change-plan/plan-comparison.mjs.map +1 -0
  173. package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs +127 -0
  174. package/dist/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.mjs.map +1 -0
  175. package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs +111 -0
  176. package/dist/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.mjs.map +1 -0
  177. package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs +69 -0
  178. package/dist/components/account/sections/subscription/change-plan/steps/PlanViewStep.mjs.map +1 -0
  179. package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs +88 -0
  180. package/dist/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.mjs.map +1 -0
  181. package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs +115 -0
  182. package/dist/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.mjs.map +1 -0
  183. package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs +918 -0
  184. package/dist/components/account/sections/subscription/change-plan/useChangePlanState.mjs.map +1 -0
  185. package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs +216 -0
  186. package/dist/components/account/sections/subscription/downgrade/CannotDowngradeDialog.mjs.map +1 -0
  187. package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs +128 -0
  188. package/dist/components/account/sections/subscription/downgrade/DowngradeReasonDialog.mjs.map +1 -0
  189. package/dist/components/account/sections/subscription/plans/PlanCard.mjs +281 -0
  190. package/dist/components/account/sections/subscription/plans/PlanCard.mjs.map +1 -0
  191. package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs +53 -0
  192. package/dist/components/account/sections/subscription/plans/PlanCardSkeleton.mjs.map +1 -0
  193. package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs +119 -0
  194. package/dist/components/account/sections/subscription/plans/PlansCatalogDialog.mjs.map +1 -0
  195. package/dist/components/account/sections/team/DeleteUserModal.mjs +116 -0
  196. package/dist/components/account/sections/team/DeleteUserModal.mjs.map +1 -0
  197. package/dist/components/account/sections/team/TeamFlows.mjs +14 -0
  198. package/dist/components/account/sections/team/TeamFlows.mjs.map +1 -0
  199. package/dist/components/account/sections/team/TeamMemberRow.mjs +99 -0
  200. package/dist/components/account/sections/team/TeamMemberRow.mjs.map +1 -0
  201. package/dist/components/account/sections/team/UserSheet.mjs +570 -0
  202. package/dist/components/account/sections/team/UserSheet.mjs.map +1 -0
  203. package/dist/components/account/sections/team/steps/NotificationsStep.mjs +80 -0
  204. package/dist/components/account/sections/team/steps/NotificationsStep.mjs.map +1 -0
  205. package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs +180 -0
  206. package/dist/components/account/sections/team/steps/ProjectSelectionStep.mjs.map +1 -0
  207. package/dist/components/account/sections/team/steps/UserInformationStep.mjs +371 -0
  208. package/dist/components/account/sections/team/steps/UserInformationStep.mjs.map +1 -0
  209. package/dist/components/account/sections/team/user-form.schema.mjs +37 -0
  210. package/dist/components/account/sections/team/user-form.schema.mjs.map +1 -0
  211. package/dist/components/account/types/workspace-actions.type.mjs +1 -0
  212. package/dist/components/account/types/workspace-actions.type.mjs.map +1 -0
  213. package/dist/components/layouts/ProfilePopover.mjs +10 -12
  214. package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
  215. package/dist/components/layouts/UsersSelectorPopover.mjs +7 -4
  216. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
  217. package/dist/components/modals/AccountDeletionWarningModal.mjs +4 -5
  218. package/dist/components/modals/AccountDeletionWarningModal.mjs.map +1 -1
  219. package/dist/components/modals/AccountFrozenModal.mjs +6 -3
  220. package/dist/components/modals/AccountFrozenModal.mjs.map +1 -1
  221. package/dist/components/modals/Modals.mjs +3 -3
  222. package/dist/components/modals/Modals.mjs.map +1 -1
  223. package/dist/components/modals/PaidPlanRequiredModal.mjs +4 -5
  224. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
  225. package/dist/components/modals/cards/AddFirstCardWarningModal.mjs +63 -0
  226. package/dist/components/modals/cards/AddFirstCardWarningModal.mjs.map +1 -0
  227. package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs +187 -0
  228. package/dist/components/modals/cards/SwitchPaymentToCardModal.mjs.map +1 -0
  229. package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs +5 -4
  230. package/dist/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.mjs.map +1 -1
  231. package/dist/components/ui/data-display/CardItem.mjs +9 -1
  232. package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
  233. package/dist/components/ui/data-display/PaymentMethodIcons.mjs +50 -0
  234. package/dist/components/ui/data-display/PaymentMethodIcons.mjs.map +1 -0
  235. package/dist/components/ui/form/BillingPeriodSelector.mjs +108 -0
  236. package/dist/components/ui/form/BillingPeriodSelector.mjs.map +1 -0
  237. package/dist/components/ui/form/PaymentMethodToggle.mjs +82 -0
  238. package/dist/components/ui/form/PaymentMethodToggle.mjs.map +1 -0
  239. package/dist/components/ui/form/RadioOptionFieldIcon.mjs +57 -0
  240. package/dist/components/ui/form/RadioOptionFieldIcon.mjs.map +1 -0
  241. package/dist/components/ui/form/SegmentedControl.mjs +56 -0
  242. package/dist/components/ui/form/SegmentedControl.mjs.map +1 -0
  243. package/dist/components/ui/overlay/Dialog.mjs +21 -4
  244. package/dist/components/ui/overlay/Dialog.mjs.map +1 -1
  245. package/dist/components/ui/overlay/Sheet.mjs +26 -8
  246. package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
  247. package/dist/components/ui/overlay/layers.mjs +52 -5
  248. package/dist/components/ui/overlay/layers.mjs.map +1 -1
  249. package/dist/enums/AccountHubFlow.mjs +13 -0
  250. package/dist/enums/AccountHubFlow.mjs.map +1 -0
  251. package/dist/enums/DateFilterPeriod.mjs +22 -0
  252. package/dist/enums/DateFilterPeriod.mjs.map +1 -0
  253. package/dist/enums/WorkspaceSectionType.mjs +11 -0
  254. package/dist/enums/WorkspaceSectionType.mjs.map +1 -0
  255. package/dist/handlers.mjs +24 -0
  256. package/dist/handlers.mjs.map +1 -1
  257. package/dist/hooks/useDebounce.mjs +5 -3
  258. package/dist/hooks/useDebounce.mjs.map +1 -1
  259. package/dist/hooks/useUploadProgress.mjs +33 -0
  260. package/dist/hooks/useUploadProgress.mjs.map +1 -0
  261. package/dist/i18n/messages/en-us.mjs +868 -3
  262. package/dist/i18n/messages/en-us.mjs.map +1 -1
  263. package/dist/i18n/messages/es-es.mjs +868 -3
  264. package/dist/i18n/messages/es-es.mjs.map +1 -1
  265. package/dist/i18n/messages/pt-br.mjs +868 -3
  266. package/dist/i18n/messages/pt-br.mjs.map +1 -1
  267. package/dist/index.mjs +87 -7
  268. package/dist/index.mjs.map +1 -1
  269. package/dist/infra/http/paged.mjs +20 -0
  270. package/dist/infra/http/paged.mjs.map +1 -0
  271. package/dist/middleware.mjs +2 -0
  272. package/dist/middleware.mjs.map +1 -1
  273. package/dist/middlewares/create-auth-middleware.mjs +2 -4
  274. package/dist/middlewares/create-auth-middleware.mjs.map +1 -1
  275. package/dist/middlewares/create-legacy-account-routes-middleware.mjs +44 -0
  276. package/dist/middlewares/create-legacy-account-routes-middleware.mjs.map +1 -0
  277. package/dist/middlewares/is-route-equals.mjs +7 -0
  278. package/dist/middlewares/is-route-equals.mjs.map +1 -0
  279. package/dist/modules/accounts/actions/account-management.action.mjs +20 -1
  280. package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -1
  281. package/dist/modules/accounts/constants/account-hub-link.constants.mjs +9 -0
  282. package/dist/modules/accounts/constants/account-hub-link.constants.mjs.map +1 -0
  283. package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs +5 -0
  284. package/dist/modules/accounts/constants/legacy-account-routes.constants.mjs.map +1 -0
  285. package/dist/modules/accounts/handlers/list-account-members.handler.mjs +22 -0
  286. package/dist/modules/accounts/handlers/list-account-members.handler.mjs.map +1 -0
  287. package/dist/modules/accounts/hooks/add-user-projects.hook.mjs +51 -0
  288. package/dist/modules/accounts/hooks/add-user-projects.hook.mjs.map +1 -0
  289. package/dist/modules/accounts/hooks/create-account-user.hook.mjs +20 -0
  290. package/dist/modules/accounts/hooks/create-account-user.hook.mjs.map +1 -0
  291. package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs +47 -0
  292. package/dist/modules/accounts/hooks/remove-user-projects.hook.mjs.map +1 -0
  293. package/dist/modules/accounts/hooks/use-account-members.hook.mjs +20 -0
  294. package/dist/modules/accounts/hooks/use-account-members.hook.mjs.map +1 -0
  295. package/dist/modules/accounts/services/account.service.mjs +59 -0
  296. package/dist/modules/accounts/services/account.service.mjs.map +1 -1
  297. package/dist/modules/accounts/types/account-hub-link.type.mjs +1 -0
  298. package/dist/modules/accounts/types/account-hub-link.type.mjs.map +1 -0
  299. package/dist/modules/accounts/utils/build-account-hub-url.mjs +16 -0
  300. package/dist/modules/accounts/utils/build-account-hub-url.mjs.map +1 -0
  301. package/dist/modules/accounts/utils/is-account-hub-flow.mjs +9 -0
  302. package/dist/modules/accounts/utils/is-account-hub-flow.mjs.map +1 -0
  303. package/dist/modules/accounts/utils/is-account-section.mjs +9 -0
  304. package/dist/modules/accounts/utils/is-account-section.mjs.map +1 -0
  305. package/dist/modules/accounts/utils/is-my-account-section.mjs +13 -0
  306. package/dist/modules/accounts/utils/is-my-account-section.mjs.map +1 -0
  307. package/dist/modules/accounts/utils/map-legacy-account-route.mjs +93 -0
  308. package/dist/modules/accounts/utils/map-legacy-account-route.mjs.map +1 -0
  309. package/dist/modules/accounts/utils/parse-account-hub-link.mjs +20 -0
  310. package/dist/modules/accounts/utils/parse-account-hub-link.mjs.map +1 -0
  311. package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs +10 -0
  312. package/dist/modules/affiliates/actions/ensure-affiliate.action.mjs.map +1 -0
  313. package/dist/modules/affiliates/actions/request-deposit.action.mjs +10 -0
  314. package/dist/modules/affiliates/actions/request-deposit.action.mjs.map +1 -0
  315. package/dist/modules/affiliates/actions/update-affiliate.action.mjs +10 -0
  316. package/dist/modules/affiliates/actions/update-affiliate.action.mjs.map +1 -0
  317. package/dist/modules/affiliates/constants/affiliate.constants.mjs +11 -0
  318. package/dist/modules/affiliates/constants/affiliate.constants.mjs.map +1 -0
  319. package/dist/modules/affiliates/constants/query-keys.constants.mjs +15 -0
  320. package/dist/modules/affiliates/constants/query-keys.constants.mjs.map +1 -0
  321. package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs +16 -0
  322. package/dist/modules/affiliates/handlers/affiliate-report-analytics.handler.mjs.map +1 -0
  323. package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs +12 -0
  324. package/dist/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.mjs.map +1 -0
  325. package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs +12 -0
  326. package/dist/modules/affiliates/handlers/current-affiliate.handler.mjs.map +1 -0
  327. package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs +12 -0
  328. package/dist/modules/affiliates/handlers/list-affiliate-coupons.handler.mjs.map +1 -0
  329. package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs +22 -0
  330. package/dist/modules/affiliates/handlers/list-affiliate-leads.handler.mjs.map +1 -0
  331. package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs +22 -0
  332. package/dist/modules/affiliates/handlers/list-affiliate-transactions.handler.mjs.map +1 -0
  333. package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs +17 -0
  334. package/dist/modules/affiliates/hooks/use-affiliate-coupons.hook.mjs.map +1 -0
  335. package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs +22 -0
  336. package/dist/modules/affiliates/hooks/use-affiliate-leads.hook.mjs.map +1 -0
  337. package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs +17 -0
  338. package/dist/modules/affiliates/hooks/use-affiliate-report-analytics.hook.mjs.map +1 -0
  339. package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs +20 -0
  340. package/dist/modules/affiliates/hooks/use-affiliate-transactions.hook.mjs.map +1 -0
  341. package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs +17 -0
  342. package/dist/modules/affiliates/hooks/use-current-affiliate.hook.mjs.map +1 -0
  343. package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs +23 -0
  344. package/dist/modules/affiliates/hooks/use-ensure-affiliate.hook.mjs.map +1 -0
  345. package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs +28 -0
  346. package/dist/modules/affiliates/hooks/use-request-deposit.hook.mjs.map +1 -0
  347. package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs +22 -0
  348. package/dist/modules/affiliates/hooks/use-update-affiliate.hook.mjs.map +1 -0
  349. package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs +17 -0
  350. package/dist/modules/affiliates/hooks/use-withdrawal-limits.hook.mjs.map +1 -0
  351. package/dist/modules/affiliates/services/affiliates.service.mjs +183 -0
  352. package/dist/modules/affiliates/services/affiliates.service.mjs.map +1 -0
  353. package/dist/modules/affiliates/types/affiliate.type.mjs +100 -0
  354. package/dist/modules/affiliates/types/affiliate.type.mjs.map +1 -0
  355. package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs +9 -0
  356. package/dist/modules/affiliates/utils/get-affiliate-share-link.mjs.map +1 -0
  357. package/dist/modules/charges/actions/get-nota-fiscal.action.mjs +10 -0
  358. package/dist/modules/charges/actions/get-nota-fiscal.action.mjs.map +1 -0
  359. package/dist/modules/charges/actions/refresh-pix.action.mjs +10 -0
  360. package/dist/modules/charges/actions/refresh-pix.action.mjs.map +1 -0
  361. package/dist/modules/charges/hooks/nota-fiscal.hook.mjs +13 -0
  362. package/dist/modules/charges/hooks/nota-fiscal.hook.mjs.map +1 -0
  363. package/dist/modules/charges/hooks/refresh-pix.hook.mjs +13 -0
  364. package/dist/modules/charges/hooks/refresh-pix.hook.mjs.map +1 -0
  365. package/dist/modules/charges/services/charges.service.mjs +67 -0
  366. package/dist/modules/charges/services/charges.service.mjs.map +1 -1
  367. package/dist/modules/charges/types/nota-fiscal.type.mjs +1 -0
  368. package/dist/modules/charges/types/nota-fiscal.type.mjs.map +1 -0
  369. package/dist/modules/charges/types/refresh-pix.type.mjs +1 -0
  370. package/dist/modules/charges/types/refresh-pix.type.mjs.map +1 -0
  371. package/dist/modules/charges/utils/get-charge-download-url.mjs +8 -0
  372. package/dist/modules/charges/utils/get-charge-download-url.mjs.map +1 -0
  373. package/dist/modules/coupons/constants/query-keys.constants.mjs +5 -0
  374. package/dist/modules/coupons/constants/query-keys.constants.mjs.map +1 -0
  375. package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs +17 -0
  376. package/dist/modules/coupons/handlers/find-coupon-by-code.handler.mjs.map +1 -0
  377. package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs +16 -0
  378. package/dist/modules/coupons/handlers/find-coupon-by-id.handler.mjs.map +1 -0
  379. package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs +15 -0
  380. package/dist/modules/coupons/hooks/use-coupon-by-code.hook.mjs.map +1 -0
  381. package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs +18 -0
  382. package/dist/modules/coupons/hooks/use-coupon-by-id.hook.mjs.map +1 -0
  383. package/dist/modules/coupons/services/coupons.service.mjs +44 -0
  384. package/dist/modules/coupons/services/coupons.service.mjs.map +1 -0
  385. package/dist/modules/coupons/types/coupon.type.mjs +61 -0
  386. package/dist/modules/coupons/types/coupon.type.mjs.map +1 -0
  387. package/dist/modules/coupons/utils/coupon-restrictions.mjs +60 -0
  388. package/dist/modules/coupons/utils/coupon-restrictions.mjs.map +1 -0
  389. package/dist/modules/domains/handlers/count-domains.handler.mjs +12 -0
  390. package/dist/modules/domains/handlers/count-domains.handler.mjs.map +1 -0
  391. package/dist/modules/domains/hooks/count-domains.hook.mjs +17 -0
  392. package/dist/modules/domains/hooks/count-domains.hook.mjs.map +1 -0
  393. package/dist/modules/domains/services/domains.service.mjs +18 -0
  394. package/dist/modules/domains/services/domains.service.mjs.map +1 -0
  395. package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs +15 -0
  396. package/dist/modules/ia-credits/handlers/list-ia-credit-operations.handler.mjs.map +1 -0
  397. package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs +28 -0
  398. package/dist/modules/ia-credits/hooks/ia-credit-operations.hook.mjs.map +1 -0
  399. package/dist/modules/ia-credits/services/ia-credits.service.mjs +23 -2
  400. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -1
  401. package/dist/modules/pages/handlers/count-pages.handler.mjs +4 -2
  402. package/dist/modules/pages/handlers/count-pages.handler.mjs.map +1 -1
  403. package/dist/modules/pages/hooks/count-published-pages.hook.mjs +26 -0
  404. package/dist/modules/pages/hooks/count-published-pages.hook.mjs.map +1 -0
  405. package/dist/modules/pages/services/pages.service.mjs +3 -2
  406. package/dist/modules/pages/services/pages.service.mjs.map +1 -1
  407. package/dist/modules/plans/constants/plan-tooltips.constants.mjs +14 -0
  408. package/dist/modules/plans/constants/plan-tooltips.constants.mjs.map +1 -0
  409. package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs +28 -0
  410. package/dist/modules/plans/hooks/use-enriched-plans.hook.mjs.map +1 -0
  411. package/dist/modules/plans/hooks/use-ui-plans.hook.mjs +20 -0
  412. package/dist/modules/plans/hooks/use-ui-plans.hook.mjs.map +1 -0
  413. package/dist/modules/projects/hooks/add-project-users.hook.mjs +25 -0
  414. package/dist/modules/projects/hooks/add-project-users.hook.mjs.map +1 -0
  415. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +3 -6
  416. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
  417. package/dist/modules/projects/hooks/list-available-users.hook.mjs +3 -6
  418. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
  419. package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs +3 -6
  420. package/dist/modules/projects/hooks/list-infinite-projects.hook.mjs.map +1 -1
  421. package/dist/modules/projects/hooks/list-project-users.hook.mjs +3 -6
  422. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
  423. package/dist/modules/projects/hooks/remove-project-users.hook.mjs +25 -0
  424. package/dist/modules/projects/hooks/remove-project-users.hook.mjs.map +1 -0
  425. package/dist/modules/projects/services/project-users.service.mjs +5 -0
  426. package/dist/modules/projects/services/project-users.service.mjs.map +1 -1
  427. package/dist/modules/projects/types.mjs +3 -2
  428. package/dist/modules/projects/types.mjs.map +1 -1
  429. package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs +10 -0
  430. package/dist/modules/subscriptions/actions/cancel-subscription.action.mjs.map +1 -0
  431. package/dist/modules/subscriptions/actions/create-subscription.action.mjs +10 -0
  432. package/dist/modules/subscriptions/actions/create-subscription.action.mjs.map +1 -0
  433. package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs +10 -0
  434. package/dist/modules/subscriptions/actions/find-pending-pix-status.action.mjs.map +1 -0
  435. package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs +10 -0
  436. package/dist/modules/subscriptions/actions/find-subscription-by-id.action.mjs.map +1 -0
  437. package/dist/modules/subscriptions/constants/addons.constants.mjs +35 -0
  438. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -1
  439. package/dist/modules/subscriptions/constants/downgrade.constants.mjs +25 -0
  440. package/dist/modules/subscriptions/constants/downgrade.constants.mjs.map +1 -0
  441. package/dist/modules/subscriptions/constants/subscription.constants.mjs +2 -0
  442. package/dist/modules/subscriptions/constants/subscription.constants.mjs.map +1 -1
  443. package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs +15 -0
  444. package/dist/modules/subscriptions/handlers/pending-pix-status.handler.mjs.map +1 -0
  445. package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs +25 -0
  446. package/dist/modules/subscriptions/hooks/cancel-subscription.hook.mjs.map +1 -0
  447. package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs +33 -0
  448. package/dist/modules/subscriptions/hooks/create-subscription.hook.mjs.map +1 -0
  449. package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs +18 -0
  450. package/dist/modules/subscriptions/hooks/find-subscription-by-id.hook.mjs.map +1 -0
  451. package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs +25 -0
  452. package/dist/modules/subscriptions/hooks/pending-pix-status.hook.mjs.map +1 -0
  453. package/dist/modules/subscriptions/services/subscriptions.service.mjs +71 -0
  454. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -1
  455. package/dist/modules/subscriptions/types/cancel-subscription.type.mjs +9 -0
  456. package/dist/modules/subscriptions/types/cancel-subscription.type.mjs.map +1 -0
  457. package/dist/modules/subscriptions/types/create-subscription.type.mjs +62 -0
  458. package/dist/modules/subscriptions/types/create-subscription.type.mjs.map +1 -0
  459. package/dist/modules/subscriptions/types/pending-pix-status.type.mjs +28 -0
  460. package/dist/modules/subscriptions/types/pending-pix-status.type.mjs.map +1 -0
  461. package/dist/modules/subscriptions/types/subscription.type.mjs +9 -1
  462. package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -1
  463. package/dist/modules/subscriptions/utils/addon-buckets.mjs +69 -0
  464. package/dist/modules/subscriptions/utils/addon-buckets.mjs.map +1 -0
  465. package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs +8 -2
  466. package/dist/modules/subscriptions/utils/confirm-payment-if-required.mjs.map +1 -1
  467. package/dist/modules/subscriptions/utils/first-period-pricing.mjs +25 -0
  468. package/dist/modules/subscriptions/utils/first-period-pricing.mjs.map +1 -0
  469. package/dist/modules/subscriptions/utils/is-api-subscription.mjs +8 -0
  470. package/dist/modules/subscriptions/utils/is-api-subscription.mjs.map +1 -0
  471. package/dist/modules/subscriptions/utils/is-boleto-payer.mjs +17 -0
  472. package/dist/modules/subscriptions/utils/is-boleto-payer.mjs.map +1 -0
  473. package/dist/modules/subscriptions/utils/is-free-subscription.mjs +8 -0
  474. package/dist/modules/subscriptions/utils/is-free-subscription.mjs.map +1 -0
  475. package/dist/modules/subscriptions/utils/periodicity.mjs +55 -1
  476. package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
  477. package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs +27 -0
  478. package/dist/modules/subscriptions/utils/resolve-subscription-plan-name.mjs.map +1 -0
  479. package/dist/modules/users/hooks/messages.hook.mjs +3 -5
  480. package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
  481. package/dist/server.mjs +6 -0
  482. package/dist/server.mjs.map +1 -1
  483. package/dist/store/useAccountModals.mjs +9 -2
  484. package/dist/store/useAccountModals.mjs.map +1 -1
  485. package/dist/store/useAccountUnsavedChanges.mjs +31 -0
  486. package/dist/store/useAccountUnsavedChanges.mjs.map +1 -0
  487. package/dist/store/useAffiliateFlows.mjs +23 -0
  488. package/dist/store/useAffiliateFlows.mjs.map +1 -0
  489. package/dist/store/useProjectFlows.mjs +18 -0
  490. package/dist/store/useProjectFlows.mjs.map +1 -0
  491. package/dist/store/useSubscriptionFlows.mjs +58 -0
  492. package/dist/store/useSubscriptionFlows.mjs.map +1 -0
  493. package/dist/store/useTeamFlows.mjs +15 -0
  494. package/dist/store/useTeamFlows.mjs.map +1 -0
  495. package/dist/testing/factories/coupon.factory.mjs +19 -0
  496. package/dist/testing/factories/coupon.factory.mjs.map +1 -0
  497. package/dist/testing/factories/index.mjs +6 -0
  498. package/dist/testing/factories/index.mjs.map +1 -1
  499. package/dist/testing/factories/project-user.factory.mjs +17 -0
  500. package/dist/testing/factories/project-user.factory.mjs.map +1 -0
  501. package/dist/testing/factories/project.factory.mjs +21 -0
  502. package/dist/testing/factories/project.factory.mjs.map +1 -0
  503. package/dist/testing/react/providers.mjs +1 -1
  504. package/dist/testing/react/providers.mjs.map +1 -1
  505. package/dist/utils/browser/chart-custom-tooltip.mjs +69 -0
  506. package/dist/utils/browser/chart-custom-tooltip.mjs.map +1 -0
  507. package/dist/utils/browser/get-css-variable.mjs +9 -0
  508. package/dist/utils/browser/get-css-variable.mjs.map +1 -0
  509. package/dist/utils/constants/scrollbar.mjs +5 -0
  510. package/dist/utils/constants/scrollbar.mjs.map +1 -0
  511. package/dist/utils/date-filter-period.mjs +34 -0
  512. package/dist/utils/date-filter-period.mjs.map +1 -0
  513. package/dist/utils/file/index.mjs +11 -1
  514. package/dist/utils/file/index.mjs.map +1 -1
  515. package/dist/utils/format/initials.mjs +8 -0
  516. package/dist/utils/format/initials.mjs.map +1 -0
  517. package/dist/utils/format/masks.mjs +32 -1
  518. package/dist/utils/format/masks.mjs.map +1 -1
  519. package/dist/utils/qrcode/to-data-url.mjs +12 -0
  520. package/dist/utils/qrcode/to-data-url.mjs.map +1 -0
  521. package/dist/utils/validators/account.mjs +1 -7
  522. package/dist/utils/validators/account.mjs.map +1 -1
  523. package/package.json +15 -2
  524. package/src/components/account/AccountHubLinkHandler.tsx +39 -0
  525. package/src/components/account/AccountModalLayout.tsx +190 -0
  526. package/src/components/account/AccountModals.tsx +12 -2
  527. package/src/components/account/AccountUnsavedChangesDialog.tsx +49 -0
  528. package/src/components/account/DeleteAccountModal.tsx +1 -1
  529. package/src/components/account/IsntPossibleDeleteAccountModal.tsx +9 -1
  530. package/src/components/account/MyAccountModal.tsx +222 -0
  531. package/src/components/account/TwoFactorAuthModal.tsx +1 -1
  532. package/src/components/account/hooks/useAccountHubActions.ts +95 -0
  533. package/src/components/account/hooks/useAddCardWithPaymentSwitch.ts +70 -0
  534. package/src/components/account/hooks/useAffiliatesActions.tsx +78 -0
  535. package/src/components/account/hooks/useMyAccountModal.ts +40 -0
  536. package/src/components/account/hooks/useProjectsActions.ts +44 -0
  537. package/src/components/account/hooks/useSubscriptionActions.ts +99 -0
  538. package/src/components/account/hooks/useTeamActions.ts +35 -0
  539. package/src/components/account/sections/AffiliatesSection.tsx +342 -0
  540. package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
  541. package/src/components/account/sections/MyProfileSection.tsx +215 -147
  542. package/src/components/account/sections/PreferencesSection.tsx +71 -71
  543. package/src/components/account/sections/ProjectsSection.tsx +110 -0
  544. package/src/components/account/sections/SecuritySection.tsx +72 -62
  545. package/src/components/account/sections/SubscriptionSection.tsx +36 -0
  546. package/src/components/account/sections/TeamSection.tsx +161 -0
  547. package/src/components/account/sections/TokenSection.tsx +4 -8
  548. package/src/components/account/sections/affiliates/AffiliateCommissionCard.tsx +83 -0
  549. package/src/components/account/sections/affiliates/AffiliateFlows.tsx +20 -0
  550. package/src/components/account/sections/affiliates/AffiliateLeadsSheet.tsx +143 -0
  551. package/src/components/account/sections/affiliates/AffiliateStatsCard.tsx +56 -0
  552. package/src/components/account/sections/affiliates/AffiliateStepCard.tsx +20 -0
  553. package/src/components/account/sections/affiliates/AffiliateTransactionsList.tsx +194 -0
  554. package/src/components/account/sections/affiliates/NoReceivingAccountModal.tsx +63 -0
  555. package/src/components/account/sections/affiliates/ReceivingAccountModal.tsx +213 -0
  556. package/src/components/account/sections/affiliates/RequestWithdrawalSheet.tsx +586 -0
  557. package/src/components/account/sections/affiliates/ViewAttachmentModal.tsx +47 -0
  558. package/src/components/account/sections/affiliates/reports/AffiliatesIndicatorsChart.tsx +45 -0
  559. package/src/components/account/sections/affiliates/reports/AffiliatesReportsTab.tsx +44 -0
  560. package/src/components/account/sections/affiliates/reports/useAffiliatesIndicatorsChart.ts +148 -0
  561. package/src/components/account/sections/projects/DeleteProjectModal.tsx +246 -0
  562. package/src/components/account/sections/projects/ProjectFlows.tsx +16 -0
  563. package/src/components/account/sections/projects/ProjectMembersStack.tsx +75 -0
  564. package/src/components/account/sections/projects/ProjectRow.tsx +96 -0
  565. package/src/components/account/sections/projects/ProjectSheet.tsx +603 -0
  566. package/src/components/account/sections/projects/ProjectsDisabledModal.tsx +69 -0
  567. package/src/components/account/sections/projects/project-form.schema.ts +30 -0
  568. package/src/components/account/sections/shared/ConnectListRow.tsx +68 -0
  569. package/src/components/account/sections/shared/DateFilterPopover.tsx +58 -0
  570. package/src/components/account/sections/shared/EntityAvatar.tsx +54 -0
  571. package/src/components/account/sections/shared/FilterPopover.tsx +79 -0
  572. package/src/components/account/sections/shared/FormSection.tsx +23 -0
  573. package/src/components/account/sections/shared/IconBox.tsx +21 -0
  574. package/src/components/account/sections/shared/InfiniteScrollList.tsx +57 -0
  575. package/src/components/account/sections/shared/ListPagination.tsx +84 -0
  576. package/src/components/account/sections/shared/RowActionsMenu.tsx +66 -0
  577. package/src/components/account/sections/shared/SectionLoadError.tsx +27 -0
  578. package/src/components/account/sections/shared/StatusBadge.tsx +33 -0
  579. package/src/components/account/sections/shared/WorkspaceSection.tsx +22 -0
  580. package/src/components/account/sections/subscription/AiCreditsUsage.tsx +152 -0
  581. package/src/components/account/sections/subscription/BillingAddressSheet.tsx +460 -0
  582. package/src/components/account/sections/subscription/BoletoDetailsDialog.tsx +104 -0
  583. package/src/components/account/sections/subscription/BoletoGeneratedDialog.tsx +24 -0
  584. package/src/components/account/sections/subscription/CancelPlanDialog.tsx +221 -0
  585. package/src/components/account/sections/subscription/ChargeRow.tsx +161 -0
  586. package/src/components/account/sections/subscription/ChargeStatusBadge.tsx +29 -0
  587. package/src/components/account/sections/subscription/ChargesList.tsx +125 -0
  588. package/src/components/account/sections/subscription/ManageCardsSheet.tsx +93 -0
  589. package/src/components/account/sections/subscription/OverdueReceiptOpener.tsx +29 -0
  590. package/src/components/account/sections/subscription/PayChargeDialog.tsx +306 -0
  591. package/src/components/account/sections/subscription/PaymentConfirmationDialog.tsx +70 -0
  592. package/src/components/account/sections/subscription/PaymentMethodsCard.tsx +117 -0
  593. package/src/components/account/sections/subscription/PendingChangeDialog.tsx +168 -0
  594. package/src/components/account/sections/subscription/PixDetailsDialog.tsx +246 -0
  595. package/src/components/account/sections/subscription/PixPaymentDialog.tsx +242 -0
  596. package/src/components/account/sections/subscription/PlanDetailsSheet.tsx +380 -0
  597. package/src/components/account/sections/subscription/ReceiptDetailsSheet.tsx +318 -0
  598. package/src/components/account/sections/subscription/SubscriptionFlows.tsx +40 -0
  599. package/src/components/account/sections/subscription/SubscriptionPlanCard.tsx +433 -0
  600. package/src/components/account/sections/subscription/UsageReportSheet.tsx +244 -0
  601. package/src/components/account/sections/subscription/change-plan/ChangePlanSheet.tsx +95 -0
  602. package/src/components/account/sections/subscription/change-plan/components/AbTestDetailsDialog.tsx +57 -0
  603. package/src/components/account/sections/subscription/change-plan/components/AddonsBlock.tsx +214 -0
  604. package/src/components/account/sections/subscription/change-plan/components/AlternativeBucketsSection.tsx +92 -0
  605. package/src/components/account/sections/subscription/change-plan/components/CouponBlock.tsx +42 -0
  606. package/src/components/account/sections/subscription/change-plan/components/CouponDialog.tsx +134 -0
  607. package/src/components/account/sections/subscription/change-plan/components/PricePreview.tsx +28 -0
  608. package/src/components/account/sections/subscription/change-plan/components/SummaryBlock.tsx +194 -0
  609. package/src/components/account/sections/subscription/change-plan/plan-comparison.ts +52 -0
  610. package/src/components/account/sections/subscription/change-plan/steps/PaymentSummaryStep.tsx +161 -0
  611. package/src/components/account/sections/subscription/change-plan/steps/PlanComparisonStep.tsx +165 -0
  612. package/src/components/account/sections/subscription/change-plan/steps/PlanViewStep.tsx +89 -0
  613. package/src/components/account/sections/subscription/change-plan/steps/ReactivationConfigStep.tsx +117 -0
  614. package/src/components/account/sections/subscription/change-plan/steps/ReactivationPaymentStep.tsx +139 -0
  615. package/src/components/account/sections/subscription/change-plan/useChangePlanState.tsx +1158 -0
  616. package/src/components/account/sections/subscription/downgrade/CannotDowngradeDialog.tsx +297 -0
  617. package/src/components/account/sections/subscription/downgrade/DowngradeReasonDialog.tsx +154 -0
  618. package/src/components/account/sections/subscription/plans/PlanCard.tsx +417 -0
  619. package/src/components/account/sections/subscription/plans/PlanCardSkeleton.tsx +70 -0
  620. package/src/components/account/sections/subscription/plans/PlansCatalogDialog.tsx +156 -0
  621. package/src/components/account/sections/team/DeleteUserModal.tsx +134 -0
  622. package/src/components/account/sections/team/TeamFlows.tsx +14 -0
  623. package/src/components/account/sections/team/TeamMemberRow.tsx +151 -0
  624. package/src/components/account/sections/team/UserSheet.tsx +688 -0
  625. package/src/components/account/sections/team/steps/NotificationsStep.tsx +109 -0
  626. package/src/components/account/sections/team/steps/ProjectSelectionStep.tsx +219 -0
  627. package/src/components/account/sections/team/steps/UserInformationStep.tsx +423 -0
  628. package/src/components/account/sections/team/user-form.schema.ts +43 -0
  629. package/src/components/account/types/workspace-actions.type.ts +56 -0
  630. package/src/components/layouts/ProfilePopover.tsx +11 -12
  631. package/src/components/layouts/UsersSelectorPopover.tsx +7 -4
  632. package/src/components/modals/AccountDeletionWarningModal.tsx +4 -5
  633. package/src/components/modals/AccountFrozenModal.tsx +6 -3
  634. package/src/components/modals/Modals.tsx +6 -3
  635. package/src/components/modals/PaidPlanRequiredModal.tsx +4 -5
  636. package/src/components/modals/cards/AddFirstCardWarningModal.tsx +72 -0
  637. package/src/components/modals/cards/SwitchPaymentToCardModal.tsx +232 -0
  638. package/src/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.tsx +5 -4
  639. package/src/components/ui/data-display/CardItem.tsx +9 -5
  640. package/src/components/ui/data-display/PaymentMethodIcons.tsx +43 -0
  641. package/src/components/ui/form/BillingPeriodSelector.tsx +173 -0
  642. package/src/components/ui/form/PaymentMethodToggle.tsx +119 -0
  643. package/src/components/ui/form/RadioOptionFieldIcon.tsx +64 -0
  644. package/src/components/ui/form/SegmentedControl.tsx +77 -0
  645. package/src/components/ui/overlay/Dialog.tsx +21 -2
  646. package/src/components/ui/overlay/Sheet.tsx +26 -5
  647. package/src/components/ui/overlay/layers.tsx +88 -4
  648. package/src/enums/AccountHubFlow.ts +8 -0
  649. package/src/enums/DateFilterPeriod.ts +17 -0
  650. package/src/enums/WorkspaceSectionType.ts +6 -0
  651. package/src/handlers.ts +14 -0
  652. package/src/hooks/useDebounce.ts +5 -3
  653. package/src/hooks/useUploadProgress.ts +42 -0
  654. package/src/i18n/messages/en-us.ts +909 -2
  655. package/src/i18n/messages/es-es.ts +913 -2
  656. package/src/i18n/messages/pt-br.ts +913 -2
  657. package/src/index.ts +56 -1
  658. package/src/infra/http/paged.ts +24 -0
  659. package/src/middleware.ts +1 -0
  660. package/src/middlewares/create-auth-middleware.ts +2 -5
  661. package/src/middlewares/create-legacy-account-routes-middleware.ts +54 -0
  662. package/src/middlewares/is-route-equals.ts +3 -0
  663. package/src/modules/accounts/actions/account-management.action.ts +22 -1
  664. package/src/modules/accounts/constants/account-hub-link.constants.ts +3 -0
  665. package/src/modules/accounts/constants/legacy-account-routes.constants.ts +1 -0
  666. package/src/modules/accounts/handlers/list-account-members.handler.ts +23 -0
  667. package/src/modules/accounts/hooks/add-user-projects.hook.ts +72 -0
  668. package/src/modules/accounts/hooks/create-account-user.hook.ts +21 -0
  669. package/src/modules/accounts/hooks/remove-user-projects.hook.ts +68 -0
  670. package/src/modules/accounts/hooks/use-account-members.hook.ts +31 -0
  671. package/src/modules/accounts/services/account.service.ts +71 -0
  672. package/src/modules/accounts/types/account-hub-link.type.ts +13 -0
  673. package/src/modules/accounts/types.ts +9 -0
  674. package/src/modules/accounts/utils/build-account-hub-url.ts +14 -0
  675. package/src/modules/accounts/utils/is-account-hub-flow.ts +7 -0
  676. package/src/modules/accounts/utils/is-account-section.ts +7 -0
  677. package/src/modules/accounts/utils/is-my-account-section.ts +12 -0
  678. package/src/modules/accounts/utils/map-legacy-account-route.ts +108 -0
  679. package/src/modules/accounts/utils/parse-account-hub-link.ts +21 -0
  680. package/src/modules/affiliates/actions/ensure-affiliate.action.ts +9 -0
  681. package/src/modules/affiliates/actions/request-deposit.action.ts +9 -0
  682. package/src/modules/affiliates/actions/update-affiliate.action.ts +9 -0
  683. package/src/modules/affiliates/constants/affiliate.constants.ts +11 -0
  684. package/src/modules/affiliates/constants/query-keys.constants.ts +7 -0
  685. package/src/modules/affiliates/handlers/affiliate-report-analytics.handler.ts +16 -0
  686. package/src/modules/affiliates/handlers/affiliate-withdrawal-limits.handler.ts +10 -0
  687. package/src/modules/affiliates/handlers/current-affiliate.handler.ts +10 -0
  688. package/src/modules/affiliates/handlers/list-affiliate-coupons.handler.ts +10 -0
  689. package/src/modules/affiliates/handlers/list-affiliate-leads.handler.ts +23 -0
  690. package/src/modules/affiliates/handlers/list-affiliate-transactions.handler.ts +23 -0
  691. package/src/modules/affiliates/hooks/use-affiliate-coupons.hook.ts +19 -0
  692. package/src/modules/affiliates/hooks/use-affiliate-leads.hook.ts +27 -0
  693. package/src/modules/affiliates/hooks/use-affiliate-report-analytics.hook.ts +19 -0
  694. package/src/modules/affiliates/hooks/use-affiliate-transactions.hook.ts +25 -0
  695. package/src/modules/affiliates/hooks/use-current-affiliate.hook.ts +19 -0
  696. package/src/modules/affiliates/hooks/use-ensure-affiliate.hook.ts +24 -0
  697. package/src/modules/affiliates/hooks/use-request-deposit.hook.ts +29 -0
  698. package/src/modules/affiliates/hooks/use-update-affiliate.hook.ts +24 -0
  699. package/src/modules/affiliates/hooks/use-withdrawal-limits.hook.ts +20 -0
  700. package/src/modules/affiliates/services/affiliates.service.ts +240 -0
  701. package/src/modules/affiliates/types/affiliate.type.ts +180 -0
  702. package/src/modules/affiliates/utils/get-affiliate-share-link.ts +8 -0
  703. package/src/modules/charges/actions/get-nota-fiscal.action.ts +8 -0
  704. package/src/modules/charges/actions/refresh-pix.action.ts +8 -0
  705. package/src/modules/charges/hooks/nota-fiscal.hook.ts +13 -0
  706. package/src/modules/charges/hooks/refresh-pix.hook.ts +13 -0
  707. package/src/modules/charges/services/charges.service.ts +121 -0
  708. package/src/modules/charges/types/nota-fiscal.type.ts +20 -0
  709. package/src/modules/charges/types/refresh-pix.type.ts +14 -0
  710. package/src/modules/charges/utils/get-charge-download-url.ts +10 -0
  711. package/src/modules/coupons/constants/query-keys.constants.ts +1 -0
  712. package/src/modules/coupons/handlers/find-coupon-by-code.handler.ts +16 -0
  713. package/src/modules/coupons/handlers/find-coupon-by-id.handler.ts +15 -0
  714. package/src/modules/coupons/hooks/use-coupon-by-code.hook.ts +16 -0
  715. package/src/modules/coupons/hooks/use-coupon-by-id.hook.ts +20 -0
  716. package/src/modules/coupons/services/coupons.service.ts +54 -0
  717. package/src/modules/coupons/types/coupon.type.ts +70 -0
  718. package/src/modules/coupons/utils/coupon-restrictions.ts +112 -0
  719. package/src/modules/domains/handlers/count-domains.handler.ts +10 -0
  720. package/src/modules/domains/hooks/count-domains.hook.ts +17 -0
  721. package/src/modules/domains/services/domains.service.ts +18 -0
  722. package/src/modules/ia-credits/handlers/list-ia-credit-operations.handler.ts +14 -0
  723. package/src/modules/ia-credits/hooks/ia-credit-operations.hook.ts +33 -0
  724. package/src/modules/ia-credits/services/ia-credits.service.ts +32 -1
  725. package/src/modules/pages/handlers/count-pages.handler.ts +5 -2
  726. package/src/modules/pages/hooks/count-published-pages.hook.ts +26 -0
  727. package/src/modules/pages/services/pages.service.ts +3 -2
  728. package/src/modules/plans/constants/plan-tooltips.constants.ts +16 -0
  729. package/src/modules/plans/hooks/use-enriched-plans.hook.ts +31 -0
  730. package/src/modules/plans/hooks/use-ui-plans.hook.ts +22 -0
  731. package/src/modules/projects/hooks/add-project-users.hook.ts +29 -0
  732. package/src/modules/projects/hooks/list-all-account-users.hook.ts +3 -6
  733. package/src/modules/projects/hooks/list-available-users.hook.ts +3 -6
  734. package/src/modules/projects/hooks/list-infinite-projects.hook.ts +3 -6
  735. package/src/modules/projects/hooks/list-project-users.hook.ts +3 -6
  736. package/src/modules/projects/hooks/remove-project-users.hook.ts +29 -0
  737. package/src/modules/projects/services/project-users.service.ts +135 -130
  738. package/src/modules/projects/types.ts +89 -88
  739. package/src/modules/subscriptions/actions/cancel-subscription.action.ts +12 -0
  740. package/src/modules/subscriptions/actions/create-subscription.action.ts +9 -0
  741. package/src/modules/subscriptions/actions/find-pending-pix-status.action.ts +8 -0
  742. package/src/modules/subscriptions/actions/find-subscription-by-id.action.ts +8 -0
  743. package/src/modules/subscriptions/constants/addons.constants.ts +50 -0
  744. package/src/modules/subscriptions/constants/downgrade.constants.ts +30 -0
  745. package/src/modules/subscriptions/constants/subscription.constants.ts +3 -0
  746. package/src/modules/subscriptions/handlers/pending-pix-status.handler.ts +17 -0
  747. package/src/modules/subscriptions/hooks/cancel-subscription.hook.ts +28 -0
  748. package/src/modules/subscriptions/hooks/create-subscription.hook.ts +34 -0
  749. package/src/modules/subscriptions/hooks/find-subscription-by-id.hook.ts +17 -0
  750. package/src/modules/subscriptions/hooks/pending-pix-status.hook.ts +30 -0
  751. package/src/modules/subscriptions/services/subscriptions.service.ts +401 -301
  752. package/src/modules/subscriptions/types/cancel-subscription.type.ts +8 -0
  753. package/src/modules/subscriptions/types/create-subscription.type.ts +79 -0
  754. package/src/modules/subscriptions/types/pending-pix-status.type.ts +33 -0
  755. package/src/modules/subscriptions/types/subscription.type.ts +157 -147
  756. package/src/modules/subscriptions/utils/addon-buckets.ts +129 -0
  757. package/src/modules/subscriptions/utils/confirm-payment-if-required.ts +9 -2
  758. package/src/modules/subscriptions/utils/first-period-pricing.ts +63 -0
  759. package/src/modules/subscriptions/utils/is-api-subscription.ts +6 -0
  760. package/src/modules/subscriptions/utils/is-boleto-payer.ts +21 -0
  761. package/src/modules/subscriptions/utils/is-free-subscription.ts +6 -0
  762. package/src/modules/subscriptions/utils/periodicity.ts +101 -0
  763. package/src/modules/subscriptions/utils/resolve-subscription-plan-name.ts +44 -0
  764. package/src/modules/users/hooks/messages.hook.ts +3 -5
  765. package/src/server.ts +102 -99
  766. package/src/store/useAccountModals.ts +22 -5
  767. package/src/store/useAccountUnsavedChanges.ts +52 -0
  768. package/src/store/useAffiliateFlows.ts +46 -0
  769. package/src/store/useProjectFlows.ts +42 -0
  770. package/src/store/useSubscriptionFlows.ts +176 -0
  771. package/src/store/useTeamFlows.ts +34 -0
  772. package/src/testing/factories/coupon.factory.ts +17 -0
  773. package/src/testing/factories/index.ts +3 -0
  774. package/src/testing/factories/project-user.factory.ts +15 -0
  775. package/src/testing/factories/project.factory.ts +19 -0
  776. package/src/testing/react/providers.tsx +2 -1
  777. package/src/utils/browser/chart-custom-tooltip.ts +85 -0
  778. package/src/utils/browser/get-css-variable.ts +6 -0
  779. package/src/utils/constants/scrollbar.ts +10 -0
  780. package/src/utils/date-filter-period.ts +34 -0
  781. package/src/utils/file/index.ts +13 -0
  782. package/src/utils/format/initials.ts +10 -0
  783. package/src/utils/format/masks.ts +41 -0
  784. package/src/utils/qrcode/to-data-url.ts +23 -0
  785. package/src/utils/validators/account.ts +0 -8
  786. package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -143
  787. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
  788. package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -34
  789. package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
  790. package/src/components/account/ConfigurationsMyAccountModal.tsx +0 -179
  791. package/src/components/account/hooks/useConfigurationsModal.ts +0 -45
@@ -9,7 +9,8 @@ import { Button } from "../../../ui/buttons/Button";
9
9
  import { Dialog, DialogContent, DialogTitle } from "../../../ui/overlay/Dialog";
10
10
  import { Toast } from "../../../ui/feedback/Toast";
11
11
  import { useAuth } from "../../../../providers/auth.provider";
12
- import { useWhitelabel, useWhitelabelUrls } from "../../../../providers/whitelabel.provider";
12
+ import { useWhitelabel } from "../../../../providers/whitelabel.provider";
13
+ import useAccountHubActions from "../../../account/hooks/useAccountHubActions";
13
14
  import { useActiveSubscription } from "../../../../modules/subscriptions/hooks/find-active-subscription.hook";
14
15
  import { useCards } from "../../../../modules/cards/hooks/cards.hook";
15
16
  import { useCurrencyFormatter } from "../../../../modules/accounts/hooks/use-currency-formatter.hook";
@@ -35,7 +36,7 @@ function AiCreditsOfferModal() {
35
36
  const { openModal } = useModalManager();
36
37
  const { user } = useAuth();
37
38
  const { whitelabel } = useWhitelabel();
38
- const { accountsUrl } = useWhitelabelUrls();
39
+ const { openPlansCatalog } = useAccountHubActions();
39
40
  const { formatCurrencyNumber } = useCurrencyFormatter();
40
41
  const [confirmingExit, setConfirmingExit] = useState(false);
41
42
  const [pickedCardId, setPickedCardId] = useState("");
@@ -65,7 +66,7 @@ function AiCreditsOfferModal() {
65
66
  async (cardId) => {
66
67
  if (subscriptionId == null) {
67
68
  closeModal();
68
- window.location.assign(`${accountsUrl}/subscriptions?tab=plans`);
69
+ openPlansCatalog();
69
70
  return;
70
71
  }
71
72
  const input = {
@@ -125,11 +126,11 @@ function AiCreditsOfferModal() {
125
126
  },
126
127
  [
127
128
  accountId,
128
- accountsUrl,
129
129
  closeModal,
130
130
  creditsLabel,
131
131
  dismiss,
132
132
  eligibility.data?.sessionIssuedAt,
133
+ openPlansCatalog,
133
134
  purchaseMutation,
134
135
  stripe,
135
136
  subscriptionId,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useState } from 'react';\nimport { useStripe } from '@stripe/react-stripe-js';\nimport { IconCheck, IconX } from '@tabler/icons-react';\nimport { useLocale, useTranslations } from 'next-intl';\nimport { toast } from 'sonner';\nimport { Button } from '../../../ui/buttons/Button';\nimport { Dialog, DialogContent, DialogTitle } from '../../../ui/overlay/Dialog';\nimport { Toast } from '../../../ui/feedback/Toast';\nimport { useAuth } from '../../../../providers/auth.provider';\nimport { useWhitelabel, useWhitelabelUrls } from '../../../../providers/whitelabel.provider';\nimport { useActiveSubscription } from '../../../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { useCards } from '../../../../modules/cards/hooks/cards.hook';\nimport { useCurrencyFormatter } from '../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { confirmPaymentIfRequired } from '../../../../modules/subscriptions/utils/confirm-payment-if-required';\nimport {\n AI_CREDITS_FIRST_PURCHASE_OFFER,\n AiCreditsOfferStage,\n PAYMENT_METHOD_CARD,\n} from '../../../../modules/ia-credits/constants/ai-credits-offer.constants';\nimport { useAiCreditsOfferEligibility } from '../../../../modules/ia-credits/hooks/use-offer-eligibility.hook';\nimport { usePurchaseIaCredits } from '../../../../modules/ia-credits/hooks/purchase-ia-credits.hook';\nimport type { PurchaseIaCreditsResult } from '../../../../modules/ia-credits/types/ai-credits-offer.type';\nimport { readOfferStageCookie, writeOfferStageCookie } from '../../../../modules/ia-credits/utils/offer-stage-cookie';\nimport { useAiCreditsOfferModal } from '../../../../store/useAiCreditsOfferModal';\nimport { useModalManager } from '../../../../store/useModalManager';\nimport { LoseOfferDialog } from './components/LoseOfferDialog';\nimport { OfferIllustration } from './components/OfferIllustration';\nimport { OfferPaymentField } from './components/OfferPaymentField';\n\n/**\n * Oferta de primeira compra de créditos de IA — a tela que a base gratuita vê quando o\n * `AiCreditsOfferGate` decide que é a vez dela.\n *\n * Duas colunas, como a referência de produto: à esquerda a oferta e o cartão (via\n * `OfferPaymentField`, que cadastra pelo `addCardModal` padrão da plataforma); à direita o\n * gradiente da tela de login com a ilustração do editor.\n *\n * Fechar não fecha: `X`, `Esc`, clique fora e \"Agora não\" caem todos no `LoseOfferDialog`, que\n * pergunta se a pessoa quer mesmo perder o desconto.\n *\n * ⚠️ PREÇO: o card manda só o SLUG da oferta (`AI_CREDITS_FIRST_PURCHASE_OFFER.slug`) — quem\n * resolve pacote, preço e elegibilidade é o backend (Asana ID-1217333331953496). O \"de/por\" desta\n * tela usa `AI_CREDITS_FIRST_PURCHASE_OFFER.price` (fixo, parte do contrato da oferta) contra\n * `anchorCents` do `useAiCreditsOfferEligibility` (derivado do preço real do addon no plano — nunca\n * hardcoded).\n *\n * ANIMAÇÃO: CSS puro, sem `motion/react` (a lib não depende dela). As classes `gp-offer-rise`,\n * `gp-offer-window-in`, `gp-offer-card-in` e `gp-offer-icon-pulse` vêm do `globals.css` de cada app\n * consumidor — bloco documentado abaixo, precisa estar presente nos 3 apps (gpages/gapps/editor):\n *\n * ```css\n * @keyframes gp-offer-rise {\n * from { opacity: 0; translate: 0 10px; }\n * to { opacity: 1; translate: 0 0; }\n * }\n * .gp-offer-rise { animation: gp-offer-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }\n *\n * @keyframes gp-offer-window-in {\n * from { opacity: 0; translate: 0 18px; scale: 0.985; }\n * to { opacity: 1; translate: 0 0; scale: 1; }\n * }\n * .gp-offer-window-in { animation: gp-offer-window-in 550ms cubic-bezier(0.22, 1, 0.36, 1) 50ms both; }\n *\n * @keyframes gp-offer-card-in {\n * from { opacity: 0; translate: 0 26px; scale: 0.97; }\n * to { opacity: 1; translate: 0 0; scale: 1; }\n * }\n * .gp-offer-card-in { animation: gp-offer-card-in 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 340ms both; }\n *\n * @keyframes gp-offer-icon-pulse {\n * 0%, 100% { scale: 1; }\n * 50% { scale: 1.06; }\n * }\n * .gp-offer-icon-pulse { animation: gp-offer-icon-pulse 2.6s ease-in-out 1.6s infinite; }\n *\n * @media (prefers-reduced-motion: reduce) {\n * .gp-offer-rise, .gp-offer-window-in, .gp-offer-card-in, .gp-offer-icon-pulse { animation: none; }\n * }\n * ```\n *\n * `translate`/`scale` (propriedades CSS independentes, não `transform`) pra conviver sem conflito\n * com utilitários de posicionamento do Tailwind (mesmo problema que já forçou o `.gp-offer-modal`\n * de entrada/saída a sair de `@layer` — ver `AiCreditsOfferGate`/`globals.css`).\n */\nexport default function AiCreditsOfferModal() {\n const translate = useTranslations();\n const locale = useLocale();\n const stripe = useStripe();\n const { open, closeModal } = useAiCreditsOfferModal();\n const { openModal } = useModalManager();\n const { user } = useAuth();\n const { whitelabel } = useWhitelabel();\n const { accountsUrl } = useWhitelabelUrls();\n const { formatCurrencyNumber } = useCurrencyFormatter();\n\n const [confirmingExit, setConfirmingExit] = useState(false);\n const [pickedCardId, setPickedCardId] = useState('');\n\n const { data: cardsData } = useCards();\n const { data: subscriptionData } = useActiveSubscription();\n const eligibility = useAiCreditsOfferEligibility();\n const purchaseMutation = usePurchaseIaCredits();\n\n const subscription = subscriptionData?.data?.[0] ?? null;\n const subscriptionId = subscription?.id;\n const accountId = user?.id_account;\n\n const defaultCardId =\n cardsData?.data?.find((card) => card.is_default)?.id?.toString() ??\n cardsData?.data?.[0]?.id?.toString() ??\n '';\n\n // Os cartões chegam depois da abertura (query no client). Derivar — em vez de sincronizar num\n // efeito — faz o padrão da conta já entrar selecionado no render em que a lista chega, e a\n // escolha explícita da pessoa continua mandando.\n const pickedCardExists = cardsData?.data?.some((card) => card.id.toString() === pickedCardId);\n const selectedCardId = pickedCardExists ? pickedCardId : defaultCardId;\n\n const offerPrice = AI_CREDITS_FIRST_PURCHASE_OFFER.price;\n const fullPrice = eligibility.data?.anchorCents != null ? eligibility.data.anchorCents / 100 : null;\n const discountPercent = fullPrice != null ? Math.round((1 - offerPrice / fullPrice) * 100) : null;\n\n const creditsLabel = AI_CREDITS_FIRST_PURCHASE_OFFER.credits.toLocaleString(locale);\n const discountLabel =\n discountPercent != null\n ? translate('common.promo.aiCreditsOffer.discountBadge', { percent: String(discountPercent) })\n : '';\n\n const hasCard = Boolean(selectedCardId);\n const isSubmitting = purchaseMutation.isPending;\n\n /** Fecha de verdade — só o `LoseOfferDialog` e a compra concluída chegam aqui. */\n const dismiss = useCallback(() => {\n setConfirmingExit(false);\n closeModal();\n }, [closeModal]);\n\n /** Toda tentativa de sair passa por aqui — X, Esc, clique fora e \"Agora não\". */\n const requestClose = useCallback(() => setConfirmingExit(true), []);\n\n /**\n * Cobra o cartão informado e credita — sem tocar na recorrência do plano. Chamado tanto pelo CTA\n * com cartão já selecionado quanto (encadeado, sem segundo clique) pelo `onCardAdded` do\n * `addCardModal` quando a pessoa ainda não tinha cartão.\n */\n const submitPurchase = useCallback(\n async (cardId: string) => {\n // Sem assinatura não dá pra cobrar aqui — o CTA vira a porta do checkout do accounts em vez\n // de virar um botão morto.\n if (subscriptionId == null) {\n closeModal();\n window.location.assign(`${accountsUrl}/subscriptions?tab=plans`);\n return;\n }\n\n const input = {\n subscriptionId,\n offer: AI_CREDITS_FIRST_PURCHASE_OFFER.slug,\n paymentMethod: PAYMENT_METHOD_CARD,\n idCard: cardId,\n };\n\n try {\n let result: PurchaseIaCreditsResult = await purchaseMutation.mutateAsync(input);\n\n // 3DS: confirma o desafio e RE-POSTA o MESMO input — a chave de idempotência do backend\n // devolve a mesma cobrança já paga, então o segundo POST fecha com status 1.\n if (result.status === 2) {\n await confirmPaymentIfRequired(stripe, result, translate('common.payment.authFailed'));\n result = await purchaseMutation.mutateAsync(input);\n }\n\n // O `message` do status 0 é código de máquina do backend (`offer_consumed`,\n // `offer_card_only`…), não copy — a tela mostra o erro genérico do catálogo.\n if (result.status !== 1) {\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={translate('common.promo.aiCreditsOffer.errorToast')}\n toastId={toastId}\n />\n ));\n return;\n }\n\n if (accountId != null) {\n const cookie = readOfferStageCookie(accountId);\n writeOfferStageCookie(\n accountId,\n {\n stage: AiCreditsOfferStage.CONVERTED,\n lastSessionIat: eligibility.data?.sessionIssuedAt ?? cookie.lastSessionIat,\n repeatCount: cookie.repeatCount,\n },\n whitelabel?.domain\n );\n }\n\n toast.custom((toastId) => (\n <Toast\n variant=\"success\"\n message={translate('common.promo.aiCreditsOffer.successToast', { credits: creditsLabel })}\n toastId={toastId}\n />\n ));\n dismiss();\n } catch {\n // Erro técnico (rede, HTTP não-JSON, resposta fora do `PurchaseIaCreditsResultSchema`) —\n // `error.message` aqui é texto de máquina (inclusive o dump do ZodError), nunca copy. Mesma\n // decisão do `status !== 1` acima: a tela mostra a mensagem genérica do catálogo.\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={translate('common.promo.aiCreditsOffer.errorToast')}\n toastId={toastId}\n />\n ));\n }\n },\n [\n accountId,\n accountsUrl,\n closeModal,\n creditsLabel,\n dismiss,\n eligibility.data?.sessionIssuedAt,\n purchaseMutation,\n stripe,\n subscriptionId,\n translate,\n whitelabel?.domain,\n ]\n );\n\n const handleOpenAddCard = useCallback(() => {\n openModal('addCardModal', {\n onCardAdded: (cardId: string) => {\n setPickedCardId(cardId);\n void submitPurchase(cardId);\n },\n });\n }, [openModal, submitPurchase]);\n\n const handleConfirm = useCallback(async () => {\n // 1º passo do fluxo: sem cartão, o CTA é o próprio cadastro — a compra encadeia sozinha\n // assim que o cartão é criado (ver `handleOpenAddCard`).\n if (!hasCard) {\n handleOpenAddCard();\n return;\n }\n await submitPurchase(selectedCardId);\n }, [handleOpenAddCard, hasCard, selectedCardId, submitPurchase]);\n\n const bullets = [\n translate('common.promo.aiCreditsOffer.bullets.first'),\n translate('common.promo.aiCreditsOffer.bullets.second'),\n translate('common.promo.aiCreditsOffer.bullets.third'),\n ];\n\n return (\n <>\n <Dialog open={open} onOpenChange={() => {}}>\n <DialogContent\n showCloseButton={false}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n requestClose();\n }}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n requestClose();\n }}\n onInteractOutside={(event) => event.preventDefault()}\n overlayClassName=\"duration-300\"\n className={[\n // mobile: folha de tela cheia (mesma geometria do BuyCreditsModal)\n 'flex flex-col gap-0 overflow-hidden rounded-t-2xl rounded-b-none border-0 p-0 shadow-elevated',\n 'top-0 right-0 bottom-0 left-0 h-dvh max-w-full translate-x-0 translate-y-0 sm:max-w-full',\n // desktop (≥ md): cartão de duas colunas, centralizado\n 'md:top-[50%] md:right-auto md:bottom-auto md:left-[50%] md:h-auto md:max-h-[92vh] md:w-[900px]! md:max-w-[900px]! md:translate-x-[-50%] md:translate-y-[-50%] md:rounded-xl md:border',\n // entrada de baixo pra cima: a classe (e não utilidade `animate-[...]`) porque o\n // `DialogContent` já traz `animate-in` e o merge do Tailwind não funde as duas — ver\n // `.gp-offer-modal` no globals.css.\n 'gp-offer-modal',\n ].join(' ')}\n >\n <div className=\"gm-scroll flex h-full flex-col overflow-y-auto md:h-auto md:min-h-[600px] md:flex-row md:items-stretch md:overflow-visible\">\n {/* Ilustração: topo no mobile, coluna da direita no desktop (`md:order-2`). */}\n <div className=\"relative h-[180px] w-full shrink-0 md:order-2 md:h-auto md:w-1/2\">\n <OfferIllustration credits={AI_CREDITS_FIRST_PURCHASE_OFFER.credits} locale={locale} />\n\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={translate('common.promo.aiCreditsOffer.close')}\n className=\"absolute top-4 right-4 z-10 flex size-8 cursor-pointer items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-950\"\n >\n <IconX className=\"size-[18px]\" />\n </button>\n </div>\n\n {/* Coluna da oferta */}\n <div className=\"flex flex-1 flex-col gap-6 p-6 md:order-1 md:w-1/2 md:shrink-0 md:gap-7 md:p-10\">\n <span\n className=\"gp-offer-rise paragraph-xsmall-semibold w-fit rounded-full bg-cyan-50 px-2.5 py-1 text-cyan-700\"\n style={{ animationDelay: '160ms' }}\n >\n {translate('common.promo.aiCreditsOffer.eyebrow')}\n </span>\n\n {/* 26px (2px acima do `title-large`) e Outfit 700: a oferta bate mais forte que um\n título de modal comum. A quebra vem do catálogo, pela tag `<break>`, então cada\n idioma escolhe onde partir a frase. */}\n <div className=\"gp-offer-rise\" style={{ animationDelay: '220ms' }}>\n <DialogTitle className=\"title-large-semibold text-[26px] leading-8 font-bold tracking-[-0.4px] text-zinc-950\">\n {translate.rich('common.promo.aiCreditsOffer.title', {\n credits: creditsLabel,\n discount: discountLabel,\n break: () => <br />,\n })}\n </DialogTitle>\n </div>\n\n <ul className=\"flex flex-col gap-3.5\">\n {bullets.map((bullet, index) => (\n <li\n key={bullet}\n className=\"gp-offer-rise flex items-start gap-2.5\"\n style={{ animationDelay: `${300 + index * 70}ms` }}\n >\n <span className=\"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-cyan-50\">\n <IconCheck size={13} stroke={3} className=\"text-cyan-700\" />\n </span>\n <span className=\"paragraph-small-medium text-zinc-600\">{bullet}</span>\n </li>\n ))}\n </ul>\n\n {/* Preço de tabela em cima, pequeno e riscado; o de campanha embaixo, na mesma\n tipografia do título (Outfit 700) pra os dois números não competirem entre si. Sem\n âncora resolvida (elegibilidade ainda carregando) some a linha do preço cheio em\n vez de mostrar um \"de\" vazio. */}\n <div className=\"gp-offer-rise flex flex-col gap-0.5\" style={{ animationDelay: '520ms' }}>\n {fullPrice != null && (\n <span className=\"paragraph-small-medium text-zinc-400 line-through\">\n {formatCurrencyNumber(fullPrice)}\n </span>\n )}\n <div className=\"flex items-center gap-2.5\">\n <span className=\"title-large-semibold font-bold tracking-[-0.4px] text-zinc-950\">\n {formatCurrencyNumber(offerPrice)}\n </span>\n {discountLabel && (\n <span className=\"paragraph-xsmall-semibold rounded-md bg-green-50 px-2 py-1 text-green-600\">\n {discountLabel}\n </span>\n )}\n </div>\n </div>\n\n <div className=\"gp-offer-rise mt-2\" style={{ animationDelay: '580ms' }}>\n <OfferPaymentField cardId={selectedCardId} onCardAdded={setPickedCardId} />\n </div>\n\n <div\n className=\"gp-offer-rise mt-auto flex flex-col gap-2\"\n style={{ animationDelay: '640ms' }}\n >\n <Button className=\"w-full\" loading={isSubmitting} onClick={handleConfirm}>\n {hasCard\n ? translate('common.promo.aiCreditsOffer.cta', { discount: discountLabel })\n : translate('common.promo.aiCreditsOffer.ctaAddCard')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! w-full\"\n disabled={isSubmitting}\n onClick={requestClose}\n >\n {translate('common.promo.aiCreditsOffer.later')}\n </Button>\n </div>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n\n <LoseOfferDialog\n open={confirmingExit}\n discountLabel={discountLabel}\n creditsLabel={creditsLabel}\n fullPriceLabel={fullPrice != null ? formatCurrencyNumber(fullPrice) : ''}\n onKeep={() => setConfirmingExit(false)}\n onLose={dismiss}\n />\n </>\n );\n}\n"],"mappings":";AAkLY,SAoFR,UApFQ,KAiHA,YAjHA;AAhLZ,SAAS,aAAa,gBAAgB;AACtC,SAAS,iBAAiB;AAC1B,SAAS,WAAW,aAAa;AACjC,SAAS,WAAW,uBAAuB;AAC3C,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,eAAe,yBAAyB;AACjD,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AAErC,SAAS,sBAAsB,6BAA6B;AAC5D,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAyDnB,SAAR,sBAAuC;AAC5C,QAAM,YAAY,gBAAgB;AAClC,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,UAAU;AACzB,QAAM,EAAE,MAAM,WAAW,IAAI,uBAAuB;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AAC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ACC,oBAAC,UAAK,WAAU,6EACb,yBACH;AAAA,iBAEJ;AAAA,eACF;AAAA,YAEA,oBAAC,SAAI,WAAU,sBAAqB,OAAO,EAAE,gBAAgB,QAAQ,GACnE,8BAAC,qBAAkB,QAAQ,gBAAgB,aAAa,iBAAiB,GAC3E;AAAA,YAEA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,OAAO,EAAE,gBAAgB,QAAQ;AAAA,gBAEjC;AAAA,sCAAC,UAAO,WAAU,UAAS,SAAS,cAAc,SAAS,eACxD,oBACG,UAAU,mCAAmC,EAAE,UAAU,cAAc,CAAC,IACxE,UAAU,wCAAwC,GACxD;AAAA,kBACA;AAAA,oBAAC;AAAA;AAAA,sBACC,SAAQ;AAAA,sBACR,WAAU;AAAA,sBACV,UAAU;AAAA,sBACV,SAAS;AAAA,sBAER,oBAAU,mCAAmC;AAAA;AAAA,kBAChD;AAAA;AAAA;AAAA,YACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA,IACF,GACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,gBAAgB,aAAa,OAAO,qBAAqB,SAAS,IAAI;AAAA,QACtE,QAAQ,MAAM,kBAAkB,KAAK;AAAA,QACrC,QAAQ;AAAA;AAAA,IACV;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/modals/promo/AiCreditsOfferModal/AiCreditsOfferModal.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useState } from 'react';\nimport { useStripe } from '@stripe/react-stripe-js';\nimport { IconCheck, IconX } from '@tabler/icons-react';\nimport { useLocale, useTranslations } from 'next-intl';\nimport { toast } from 'sonner';\nimport { Button } from '../../../ui/buttons/Button';\nimport { Dialog, DialogContent, DialogTitle } from '../../../ui/overlay/Dialog';\nimport { Toast } from '../../../ui/feedback/Toast';\nimport { useAuth } from '../../../../providers/auth.provider';\nimport { useWhitelabel } from '../../../../providers/whitelabel.provider';\nimport useAccountHubActions from '../../../account/hooks/useAccountHubActions';\nimport { useActiveSubscription } from '../../../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { useCards } from '../../../../modules/cards/hooks/cards.hook';\nimport { useCurrencyFormatter } from '../../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport { confirmPaymentIfRequired } from '../../../../modules/subscriptions/utils/confirm-payment-if-required';\nimport {\n AI_CREDITS_FIRST_PURCHASE_OFFER,\n AiCreditsOfferStage,\n PAYMENT_METHOD_CARD,\n} from '../../../../modules/ia-credits/constants/ai-credits-offer.constants';\nimport { useAiCreditsOfferEligibility } from '../../../../modules/ia-credits/hooks/use-offer-eligibility.hook';\nimport { usePurchaseIaCredits } from '../../../../modules/ia-credits/hooks/purchase-ia-credits.hook';\nimport type { PurchaseIaCreditsResult } from '../../../../modules/ia-credits/types/ai-credits-offer.type';\nimport { readOfferStageCookie, writeOfferStageCookie } from '../../../../modules/ia-credits/utils/offer-stage-cookie';\nimport { useAiCreditsOfferModal } from '../../../../store/useAiCreditsOfferModal';\nimport { useModalManager } from '../../../../store/useModalManager';\nimport { LoseOfferDialog } from './components/LoseOfferDialog';\nimport { OfferIllustration } from './components/OfferIllustration';\nimport { OfferPaymentField } from './components/OfferPaymentField';\n\n/**\n * Oferta de primeira compra de créditos de IA — a tela que a base gratuita vê quando o\n * `AiCreditsOfferGate` decide que é a vez dela.\n *\n * Duas colunas, como a referência de produto: à esquerda a oferta e o cartão (via\n * `OfferPaymentField`, que cadastra pelo `addCardModal` padrão da plataforma); à direita o\n * gradiente da tela de login com a ilustração do editor.\n *\n * Fechar não fecha: `X`, `Esc`, clique fora e \"Agora não\" caem todos no `LoseOfferDialog`, que\n * pergunta se a pessoa quer mesmo perder o desconto.\n *\n * ⚠️ PREÇO: o card manda só o SLUG da oferta (`AI_CREDITS_FIRST_PURCHASE_OFFER.slug`) — quem\n * resolve pacote, preço e elegibilidade é o backend (Asana ID-1217333331953496). O \"de/por\" desta\n * tela usa `AI_CREDITS_FIRST_PURCHASE_OFFER.price` (fixo, parte do contrato da oferta) contra\n * `anchorCents` do `useAiCreditsOfferEligibility` (derivado do preço real do addon no plano — nunca\n * hardcoded).\n *\n * ANIMAÇÃO: CSS puro, sem `motion/react` (a lib não depende dela). As classes `gp-offer-rise`,\n * `gp-offer-window-in`, `gp-offer-card-in` e `gp-offer-icon-pulse` vêm do `globals.css` de cada app\n * consumidor — bloco documentado abaixo, precisa estar presente nos 3 apps (gpages/gapps/editor):\n *\n * ```css\n * @keyframes gp-offer-rise {\n * from { opacity: 0; translate: 0 10px; }\n * to { opacity: 1; translate: 0 0; }\n * }\n * .gp-offer-rise { animation: gp-offer-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }\n *\n * @keyframes gp-offer-window-in {\n * from { opacity: 0; translate: 0 18px; scale: 0.985; }\n * to { opacity: 1; translate: 0 0; scale: 1; }\n * }\n * .gp-offer-window-in { animation: gp-offer-window-in 550ms cubic-bezier(0.22, 1, 0.36, 1) 50ms both; }\n *\n * @keyframes gp-offer-card-in {\n * from { opacity: 0; translate: 0 26px; scale: 0.97; }\n * to { opacity: 1; translate: 0 0; scale: 1; }\n * }\n * .gp-offer-card-in { animation: gp-offer-card-in 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 340ms both; }\n *\n * @keyframes gp-offer-icon-pulse {\n * 0%, 100% { scale: 1; }\n * 50% { scale: 1.06; }\n * }\n * .gp-offer-icon-pulse { animation: gp-offer-icon-pulse 2.6s ease-in-out 1.6s infinite; }\n *\n * @media (prefers-reduced-motion: reduce) {\n * .gp-offer-rise, .gp-offer-window-in, .gp-offer-card-in, .gp-offer-icon-pulse { animation: none; }\n * }\n * ```\n *\n * `translate`/`scale` (propriedades CSS independentes, não `transform`) pra conviver sem conflito\n * com utilitários de posicionamento do Tailwind (mesmo problema que já forçou o `.gp-offer-modal`\n * de entrada/saída a sair de `@layer` — ver `AiCreditsOfferGate`/`globals.css`).\n */\nexport default function AiCreditsOfferModal() {\n const translate = useTranslations();\n const locale = useLocale();\n const stripe = useStripe();\n const { open, closeModal } = useAiCreditsOfferModal();\n const { openModal } = useModalManager();\n const { user } = useAuth();\n const { whitelabel } = useWhitelabel();\n const { openPlansCatalog } = useAccountHubActions();\n const { formatCurrencyNumber } = useCurrencyFormatter();\n\n const [confirmingExit, setConfirmingExit] = useState(false);\n const [pickedCardId, setPickedCardId] = useState('');\n\n const { data: cardsData } = useCards();\n const { data: subscriptionData } = useActiveSubscription();\n const eligibility = useAiCreditsOfferEligibility();\n const purchaseMutation = usePurchaseIaCredits();\n\n const subscription = subscriptionData?.data?.[0] ?? null;\n const subscriptionId = subscription?.id;\n const accountId = user?.id_account;\n\n const defaultCardId =\n cardsData?.data?.find((card) => card.is_default)?.id?.toString() ??\n cardsData?.data?.[0]?.id?.toString() ??\n '';\n\n // Os cartões chegam depois da abertura (query no client). Derivar — em vez de sincronizar num\n // efeito — faz o padrão da conta já entrar selecionado no render em que a lista chega, e a\n // escolha explícita da pessoa continua mandando.\n const pickedCardExists = cardsData?.data?.some((card) => card.id.toString() === pickedCardId);\n const selectedCardId = pickedCardExists ? pickedCardId : defaultCardId;\n\n const offerPrice = AI_CREDITS_FIRST_PURCHASE_OFFER.price;\n const fullPrice = eligibility.data?.anchorCents != null ? eligibility.data.anchorCents / 100 : null;\n const discountPercent = fullPrice != null ? Math.round((1 - offerPrice / fullPrice) * 100) : null;\n\n const creditsLabel = AI_CREDITS_FIRST_PURCHASE_OFFER.credits.toLocaleString(locale);\n const discountLabel =\n discountPercent != null\n ? translate('common.promo.aiCreditsOffer.discountBadge', { percent: String(discountPercent) })\n : '';\n\n const hasCard = Boolean(selectedCardId);\n const isSubmitting = purchaseMutation.isPending;\n\n /** Fecha de verdade — só o `LoseOfferDialog` e a compra concluída chegam aqui. */\n const dismiss = useCallback(() => {\n setConfirmingExit(false);\n closeModal();\n }, [closeModal]);\n\n /** Toda tentativa de sair passa por aqui — X, Esc, clique fora e \"Agora não\". */\n const requestClose = useCallback(() => setConfirmingExit(true), []);\n\n /**\n * Cobra o cartão informado e credita — sem tocar na recorrência do plano. Chamado tanto pelo CTA\n * com cartão já selecionado quanto (encadeado, sem segundo clique) pelo `onCardAdded` do\n * `addCardModal` quando a pessoa ainda não tinha cartão.\n */\n const submitPurchase = useCallback(\n async (cardId: string) => {\n // Sem assinatura não dá pra cobrar aqui — o CTA vira a porta do checkout do accounts em vez\n // de virar um botão morto.\n if (subscriptionId == null) {\n closeModal();\n openPlansCatalog();\n return;\n }\n\n const input = {\n subscriptionId,\n offer: AI_CREDITS_FIRST_PURCHASE_OFFER.slug,\n paymentMethod: PAYMENT_METHOD_CARD,\n idCard: cardId,\n };\n\n try {\n let result: PurchaseIaCreditsResult = await purchaseMutation.mutateAsync(input);\n\n // 3DS: confirma o desafio e RE-POSTA o MESMO input — a chave de idempotência do backend\n // devolve a mesma cobrança já paga, então o segundo POST fecha com status 1.\n if (result.status === 2) {\n await confirmPaymentIfRequired(stripe, result, translate('common.payment.authFailed'));\n result = await purchaseMutation.mutateAsync(input);\n }\n\n // O `message` do status 0 é código de máquina do backend (`offer_consumed`,\n // `offer_card_only`…), não copy — a tela mostra o erro genérico do catálogo.\n if (result.status !== 1) {\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={translate('common.promo.aiCreditsOffer.errorToast')}\n toastId={toastId}\n />\n ));\n return;\n }\n\n if (accountId != null) {\n const cookie = readOfferStageCookie(accountId);\n writeOfferStageCookie(\n accountId,\n {\n stage: AiCreditsOfferStage.CONVERTED,\n lastSessionIat: eligibility.data?.sessionIssuedAt ?? cookie.lastSessionIat,\n repeatCount: cookie.repeatCount,\n },\n whitelabel?.domain\n );\n }\n\n toast.custom((toastId) => (\n <Toast\n variant=\"success\"\n message={translate('common.promo.aiCreditsOffer.successToast', { credits: creditsLabel })}\n toastId={toastId}\n />\n ));\n dismiss();\n } catch {\n // Erro técnico (rede, HTTP não-JSON, resposta fora do `PurchaseIaCreditsResultSchema`) —\n // `error.message` aqui é texto de máquina (inclusive o dump do ZodError), nunca copy. Mesma\n // decisão do `status !== 1` acima: a tela mostra a mensagem genérica do catálogo.\n toast.custom((toastId) => (\n <Toast\n variant=\"error\"\n message={translate('common.promo.aiCreditsOffer.errorToast')}\n toastId={toastId}\n />\n ));\n }\n },\n [\n accountId,\n closeModal,\n creditsLabel,\n dismiss,\n eligibility.data?.sessionIssuedAt,\n openPlansCatalog,\n purchaseMutation,\n stripe,\n subscriptionId,\n translate,\n whitelabel?.domain,\n ]\n );\n\n const handleOpenAddCard = useCallback(() => {\n openModal('addCardModal', {\n onCardAdded: (cardId: string) => {\n setPickedCardId(cardId);\n void submitPurchase(cardId);\n },\n });\n }, [openModal, submitPurchase]);\n\n const handleConfirm = useCallback(async () => {\n // 1º passo do fluxo: sem cartão, o CTA é o próprio cadastro — a compra encadeia sozinha\n // assim que o cartão é criado (ver `handleOpenAddCard`).\n if (!hasCard) {\n handleOpenAddCard();\n return;\n }\n await submitPurchase(selectedCardId);\n }, [handleOpenAddCard, hasCard, selectedCardId, submitPurchase]);\n\n const bullets = [\n translate('common.promo.aiCreditsOffer.bullets.first'),\n translate('common.promo.aiCreditsOffer.bullets.second'),\n translate('common.promo.aiCreditsOffer.bullets.third'),\n ];\n\n return (\n <>\n <Dialog open={open} onOpenChange={() => {}}>\n <DialogContent\n showCloseButton={false}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n requestClose();\n }}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n requestClose();\n }}\n onInteractOutside={(event) => event.preventDefault()}\n overlayClassName=\"duration-300\"\n className={[\n // mobile: folha de tela cheia (mesma geometria do BuyCreditsModal)\n 'flex flex-col gap-0 overflow-hidden rounded-t-2xl rounded-b-none border-0 p-0 shadow-elevated',\n 'top-0 right-0 bottom-0 left-0 h-dvh max-w-full translate-x-0 translate-y-0 sm:max-w-full',\n // desktop (≥ md): cartão de duas colunas, centralizado\n 'md:top-[50%] md:right-auto md:bottom-auto md:left-[50%] md:h-auto md:max-h-[92vh] md:w-[900px]! md:max-w-[900px]! md:translate-x-[-50%] md:translate-y-[-50%] md:rounded-xl md:border',\n // entrada de baixo pra cima: a classe (e não utilidade `animate-[...]`) porque o\n // `DialogContent` já traz `animate-in` e o merge do Tailwind não funde as duas — ver\n // `.gp-offer-modal` no globals.css.\n 'gp-offer-modal',\n ].join(' ')}\n >\n <div className=\"gm-scroll flex h-full flex-col overflow-y-auto md:h-auto md:min-h-[600px] md:flex-row md:items-stretch md:overflow-visible\">\n {/* Ilustração: topo no mobile, coluna da direita no desktop (`md:order-2`). */}\n <div className=\"relative h-[180px] w-full shrink-0 md:order-2 md:h-auto md:w-1/2\">\n <OfferIllustration credits={AI_CREDITS_FIRST_PURCHASE_OFFER.credits} locale={locale} />\n\n <button\n type=\"button\"\n onClick={requestClose}\n aria-label={translate('common.promo.aiCreditsOffer.close')}\n className=\"absolute top-4 right-4 z-10 flex size-8 cursor-pointer items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-950\"\n >\n <IconX className=\"size-[18px]\" />\n </button>\n </div>\n\n {/* Coluna da oferta */}\n <div className=\"flex flex-1 flex-col gap-6 p-6 md:order-1 md:w-1/2 md:shrink-0 md:gap-7 md:p-10\">\n <span\n className=\"gp-offer-rise paragraph-xsmall-semibold w-fit rounded-full bg-cyan-50 px-2.5 py-1 text-cyan-700\"\n style={{ animationDelay: '160ms' }}\n >\n {translate('common.promo.aiCreditsOffer.eyebrow')}\n </span>\n\n {/* 26px (2px acima do `title-large`) e Outfit 700: a oferta bate mais forte que um\n título de modal comum. A quebra vem do catálogo, pela tag `<break>`, então cada\n idioma escolhe onde partir a frase. */}\n <div className=\"gp-offer-rise\" style={{ animationDelay: '220ms' }}>\n <DialogTitle className=\"title-large-semibold text-[26px] leading-8 font-bold tracking-[-0.4px] text-zinc-950\">\n {translate.rich('common.promo.aiCreditsOffer.title', {\n credits: creditsLabel,\n discount: discountLabel,\n break: () => <br />,\n })}\n </DialogTitle>\n </div>\n\n <ul className=\"flex flex-col gap-3.5\">\n {bullets.map((bullet, index) => (\n <li\n key={bullet}\n className=\"gp-offer-rise flex items-start gap-2.5\"\n style={{ animationDelay: `${300 + index * 70}ms` }}\n >\n <span className=\"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-cyan-50\">\n <IconCheck size={13} stroke={3} className=\"text-cyan-700\" />\n </span>\n <span className=\"paragraph-small-medium text-zinc-600\">{bullet}</span>\n </li>\n ))}\n </ul>\n\n {/* Preço de tabela em cima, pequeno e riscado; o de campanha embaixo, na mesma\n tipografia do título (Outfit 700) pra os dois números não competirem entre si. Sem\n âncora resolvida (elegibilidade ainda carregando) some a linha do preço cheio em\n vez de mostrar um \"de\" vazio. */}\n <div className=\"gp-offer-rise flex flex-col gap-0.5\" style={{ animationDelay: '520ms' }}>\n {fullPrice != null && (\n <span className=\"paragraph-small-medium text-zinc-400 line-through\">\n {formatCurrencyNumber(fullPrice)}\n </span>\n )}\n <div className=\"flex items-center gap-2.5\">\n <span className=\"title-large-semibold font-bold tracking-[-0.4px] text-zinc-950\">\n {formatCurrencyNumber(offerPrice)}\n </span>\n {discountLabel && (\n <span className=\"paragraph-xsmall-semibold rounded-md bg-green-50 px-2 py-1 text-green-600\">\n {discountLabel}\n </span>\n )}\n </div>\n </div>\n\n <div className=\"gp-offer-rise mt-2\" style={{ animationDelay: '580ms' }}>\n <OfferPaymentField cardId={selectedCardId} onCardAdded={setPickedCardId} />\n </div>\n\n <div\n className=\"gp-offer-rise mt-auto flex flex-col gap-2\"\n style={{ animationDelay: '640ms' }}\n >\n <Button className=\"w-full\" loading={isSubmitting} onClick={handleConfirm}>\n {hasCard\n ? translate('common.promo.aiCreditsOffer.cta', { discount: discountLabel })\n : translate('common.promo.aiCreditsOffer.ctaAddCard')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! w-full\"\n disabled={isSubmitting}\n onClick={requestClose}\n >\n {translate('common.promo.aiCreditsOffer.later')}\n </Button>\n </div>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n\n <LoseOfferDialog\n open={confirmingExit}\n discountLabel={discountLabel}\n creditsLabel={creditsLabel}\n fullPriceLabel={fullPrice != null ? formatCurrencyNumber(fullPrice) : ''}\n onKeep={() => setConfirmingExit(false)}\n onLose={dismiss}\n />\n </>\n );\n}\n"],"mappings":";AAmLY,SAoFR,UApFQ,KAiHA,YAjHA;AAjLZ,SAAS,aAAa,gBAAgB;AACtC,SAAS,iBAAiB;AAC1B,SAAS,WAAW,aAAa;AACjC,SAAS,WAAW,uBAAuB;AAC3C,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,mBAAmB;AACnD,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,OAAO,0BAA0B;AACjC,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AAErC,SAAS,sBAAsB,6BAA6B;AAC5D,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAyDnB,SAAR,sBAAuC;AAC5C,QAAM,YAAY,gBAAgB;AAClC,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,UAAU;AACzB,QAAM,EAAE,MAAM,WAAW,IAAI,uBAAuB;AACpD,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,QAAM,EAAE,iBAAiB,IAAI,qBAAqB;AAClD,QAAM,EAAE,qBAAqB,IAAI,qBAAqB;AAEtD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAA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AAAA,gBACV,OAAO,EAAE,gBAAgB,QAAQ;AAAA,gBAEjC;AAAA,sCAAC,UAAO,WAAU,UAAS,SAAS,cAAc,SAAS,eACxD,oBACG,UAAU,mCAAmC,EAAE,UAAU,cAAc,CAAC,IACxE,UAAU,wCAAwC,GACxD;AAAA,kBACA;AAAA,oBAAC;AAAA;AAAA,sBACC,SAAQ;AAAA,sBACR,WAAU;AAAA,sBACV,UAAU;AAAA,sBACV,SAAS;AAAA,sBAER,oBAAU,mCAAmC;AAAA;AAAA,kBAChD;AAAA;AAAA;AAAA,YACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA,IACF,GACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,gBAAgB,aAAa,OAAO,qBAAqB,SAAS,IAAI;AAAA,QACtE,QAAQ,MAAM,kBAAkB,KAAK;AAAA,QACrC,QAAQ;AAAA;AAAA,IACV;AAAA,KACF;AAEJ;","names":[]}
@@ -7,6 +7,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "../overlay/Popover";
7
7
  import { NavBarItem } from "../../layouts/NavBarItem";
8
8
  import { Toast } from "../feedback/Toast";
9
9
  import { CardBrandIcon } from "./CardBrandIcons";
10
+ import { cn } from "../../../infra/utils/clsx";
10
11
  import { useSetDefaultCard } from "../../../modules/cards/hooks/set-default-card.hook";
11
12
  import { useHandleDeleteCard } from "../../../modules/cards/hooks/handle-delete-card.hook";
12
13
  import { useTranslations } from "next-intl";
@@ -57,7 +58,14 @@ function CardItem({
57
58
  return /* @__PURE__ */ jsxs(
58
59
  "div",
59
60
  {
60
- className: `flex items-center p-4 cursor-pointer transition-colors gap-3 rounded-lg border ${isSelected ? "bg-zinc-50 border-zinc-950" : "bg-white border-zinc-200 hover:bg-zinc-50"}`,
61
+ className: cn(
62
+ "flex items-center p-4 transition-colors gap-3 rounded-lg border",
63
+ // Sem `onSelect` a linha não faz nada no clique (lista de gerenciar cartões):
64
+ // só o botão de três pontinhos age ali, então nem mãozinha nem hover.
65
+ onSelect && "cursor-pointer",
66
+ isSelected ? "bg-zinc-50 border-zinc-950" : "bg-white border-zinc-200",
67
+ !isSelected && onSelect && "hover:bg-zinc-50"
68
+ ),
61
69
  onClick: onSelect,
62
70
  children: [
63
71
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/data-display/CardItem.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { toast } from 'sonner';\nimport { IconDotsVertical, IconStar, IconTrash } from '@tabler/icons-react';\nimport { Popover, PopoverContent, PopoverTrigger } from '../overlay/Popover';\nimport { NavBarItem } from '../../layouts/NavBarItem';\nimport { Toast } from '../feedback/Toast';\nimport { CardBrandIcon } from './CardBrandIcons';\nimport { useSetDefaultCard } from '../../../modules/cards/hooks/set-default-card.hook';\nimport { useHandleDeleteCard } from '../../../modules/cards/hooks/handle-delete-card.hook';\nimport type { Card } from '../../../modules/cards/types';\nimport { useTranslations } from 'next-intl';\n\ntype CardItemProps = {\n card: Card;\n isSelected?: boolean;\n onSelect?: () => void;\n showMenu?: boolean;\n hideDelete?: boolean;\n hideSetDefault?: boolean;\n onAfterDelete?: (card: Card) => void;\n onAfterSetDefault?: (card: Card) => void;\n};\n\nexport function CardItem({\n card,\n isSelected,\n onSelect,\n showMenu = true,\n hideDelete = false,\n hideSetDefault = false,\n onAfterDelete,\n onAfterSetDefault,\n}: CardItemProps) {\n const translate = useTranslations();\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n const lastDigits = (card.number ?? '').replaceAll(/\\D/g, '').slice(-4);\n\n const setDefaultCardMutation = useSetDefaultCard();\n\n const handleDeleteCard = useHandleDeleteCard({ onAfterDelete });\n\n const handleSetDefault = () => {\n setDefaultCardMutation.mutate(card.id.toString(), {\n onSuccess: () => {\n toast.custom((t) => (\n <Toast\n variant=\"success\"\n message={translate('common.cards.item.setDefaultSuccess')}\n toastId={t}\n />\n ));\n onAfterSetDefault?.(card);\n },\n onError: () => {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={translate('common.cards.item.setDefaultError')}\n toastId={t}\n />\n ));\n },\n });\n };\n\n /* Vindi não tem \"tornar padrão\": o backend não suporta update de cartão Vindi — a\n * troca de cartão da assinatura acontece pelo fluxo de exclusão/seleção. */\n const menuHasSetDefault = !hideSetDefault && !card.is_default && !card.is_vindi;\n const menuHasDelete = !hideDelete;\n const hasMenuItems = menuHasSetDefault || menuHasDelete;\n const renderMenu = showMenu && hasMenuItems;\n\n return (\n <div\n className={`flex items-center p-4 cursor-pointer transition-colors gap-3 rounded-lg border ${\n isSelected\n ? 'bg-zinc-50 border-zinc-950'\n : 'bg-white border-zinc-200 hover:bg-zinc-50'\n }`}\n onClick={onSelect}\n >\n <div className=\"flex flex-col gap-0.5 flex-1 min-w-0\">\n <span className=\"paragraph-small-semibold text-zinc-950 truncate\">\n {card.name}\n </span>\n {/* Cartão Vindi legado nem sempre tem os 4 dígitos gravados (21% dos que\n * cobram assinatura ativa) — sem isto renderizaria um \"•••• \" solto. */}\n {lastDigits ? (\n <span className=\"paragraph-small-medium text-zinc-950\">•••• {lastDigits}</span>\n ) : (\n <span className=\"paragraph-small-medium text-zinc-500\">\n {translate('common.cards.item.digitsUnavailable')}\n </span>\n )}\n </div>\n {card.is_default && (\n <span className=\"paragraph-xsmall-semibold text-zinc-600 bg-zinc-100 px-2 py-0.5 rounded-lg whitespace-nowrap\">\n {translate('common.cards.item.defaultBadge')}\n </span>\n )}\n <CardBrandIcon brand={card.brand} />\n {renderMenu && (\n <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>\n <PopoverTrigger asChild>\n <button\n className=\"size-10 flex items-center justify-center rounded-lg hover:bg-zinc-100 cursor-pointer\"\n onClick={(e) => e.stopPropagation()}\n >\n <IconDotsVertical className=\"size-5 text-zinc-500\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n align=\"end\"\n className=\"w-[180px] p-2 bg-white rounded-2xl border border-zinc-200\"\n onClick={(e) => e.stopPropagation()}\n >\n {menuHasSetDefault && (\n <NavBarItem\n icon={<IconStar size={18} className=\"text-zinc-400\" />}\n label={translate('common.cards.item.makeDefault')}\n onClick={() => {\n setPopoverOpen(false);\n handleSetDefault();\n }}\n />\n )}\n {menuHasDelete && (\n <NavBarItem\n icon={<IconTrash size={18} className=\"text-zinc-400\" />}\n label={translate('common.actions.delete')}\n onClick={() => {\n setPopoverOpen(false);\n handleDeleteCard(card);\n }}\n />\n )}\n </PopoverContent>\n </Popover>\n )}\n </div>\n );\n}\n"],"mappings":";AAgDU,cA2CA,YA3CA;AA9CV,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,kBAAkB,UAAU,iBAAiB;AACtD,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAEpC,SAAS,uBAAuB;AAazB,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB;AAAA,EACA;AACF,GAAkB;AAChB,QAAM,YAAY,gBAAgB;AAClC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,cAAc,KAAK,UAAU,IAAI,WAAW,OAAO,EAAE,EAAE,MAAM,EAAE;AAErE,QAAM,yBAAyB,kBAAkB;AAEjD,QAAM,mBAAmB,oBAAoB,EAAE,cAAc,CAAC;AAE9D,QAAM,mBAAmB,MAAM;AAC7B,2BAAuB,OAAO,KAAK,GAAG,SAAS,GAAG;AAAA,MAChD,WAAW,MAAM;AACf,cAAM,OAAO,CAAC,MACZ;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,SAAS,UAAU,qCAAqC;AAAA,YACxD,S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C,YAAS,MAAM,IAAI,WAAU,iBAAgB;AAAA,oBACpD,OAAO,UAAU,+BAA+B;AAAA,oBAChD,SAAS,MAAM;AACb,qCAAe,KAAK;AACpB,uCAAiB;AAAA,oBACnB;AAAA;AAAA,gBACF;AAAA,gBAED,iBACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAM,oBAAC,aAAU,MAAM,IAAI,WAAU,iBAAgB;AAAA,oBACrD,OAAO,UAAU,uBAAuB;AAAA,oBACxC,SAAS,MAAM;AACb,qCAAe,KAAK;AACpB,uCAAiB,IAAI;AAAA,oBACvB;AAAA;AAAA,gBACF;AAAA;AAAA;AAAA,UAEJ;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/ui/data-display/CardItem.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { toast } from 'sonner';\nimport { IconDotsVertical, IconStar, IconTrash } from '@tabler/icons-react';\nimport { Popover, PopoverContent, PopoverTrigger } from '../overlay/Popover';\nimport { NavBarItem } from '../../layouts/NavBarItem';\nimport { Toast } from '../feedback/Toast';\nimport { CardBrandIcon } from './CardBrandIcons';\nimport { cn } from '../../../infra/utils/clsx';\nimport { useSetDefaultCard } from '../../../modules/cards/hooks/set-default-card.hook';\nimport { useHandleDeleteCard } from '../../../modules/cards/hooks/handle-delete-card.hook';\nimport type { Card } from '../../../modules/cards/types';\nimport { useTranslations } from 'next-intl';\n\ntype CardItemProps = {\n card: Card;\n isSelected?: boolean;\n onSelect?: () => void;\n showMenu?: boolean;\n hideDelete?: boolean;\n hideSetDefault?: boolean;\n onAfterDelete?: (card: Card) => void;\n onAfterSetDefault?: (card: Card) => void;\n};\n\nexport function CardItem({\n card,\n isSelected,\n onSelect,\n showMenu = true,\n hideDelete = false,\n hideSetDefault = false,\n onAfterDelete,\n onAfterSetDefault,\n}: CardItemProps) {\n const translate = useTranslations();\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n const lastDigits = (card.number ?? '').replaceAll(/\\D/g, '').slice(-4);\n\n const setDefaultCardMutation = useSetDefaultCard();\n\n const handleDeleteCard = useHandleDeleteCard({ onAfterDelete });\n\n const handleSetDefault = () => {\n setDefaultCardMutation.mutate(card.id.toString(), {\n onSuccess: () => {\n toast.custom((t) => (\n <Toast\n variant=\"success\"\n message={translate('common.cards.item.setDefaultSuccess')}\n toastId={t}\n />\n ));\n onAfterSetDefault?.(card);\n },\n onError: () => {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={translate('common.cards.item.setDefaultError')}\n toastId={t}\n />\n ));\n },\n });\n };\n\n /* Vindi não tem \"tornar padrão\": o backend não suporta update de cartão Vindi — a\n * troca de cartão da assinatura acontece pelo fluxo de exclusão/seleção. */\n const menuHasSetDefault = !hideSetDefault && !card.is_default && !card.is_vindi;\n const menuHasDelete = !hideDelete;\n const hasMenuItems = menuHasSetDefault || menuHasDelete;\n const renderMenu = showMenu && hasMenuItems;\n\n return (\n <div\n className={cn(\n 'flex items-center p-4 transition-colors gap-3 rounded-lg border',\n // Sem `onSelect` a linha não faz nada no clique (lista de gerenciar cartões):\n // só o botão de três pontinhos age ali, então nem mãozinha nem hover.\n onSelect && 'cursor-pointer',\n isSelected ? 'bg-zinc-50 border-zinc-950' : 'bg-white border-zinc-200',\n !isSelected && onSelect && 'hover:bg-zinc-50'\n )}\n onClick={onSelect}\n >\n <div className=\"flex flex-col gap-0.5 flex-1 min-w-0\">\n <span className=\"paragraph-small-semibold text-zinc-950 truncate\">\n {card.name}\n </span>\n {/* Cartão Vindi legado nem sempre tem os 4 dígitos gravados (21% dos que\n * cobram assinatura ativa) — sem isto renderizaria um \"•••• \" solto. */}\n {lastDigits ? (\n <span className=\"paragraph-small-medium text-zinc-950\">•••• {lastDigits}</span>\n ) : (\n <span className=\"paragraph-small-medium text-zinc-500\">\n {translate('common.cards.item.digitsUnavailable')}\n </span>\n )}\n </div>\n {card.is_default && (\n <span className=\"paragraph-xsmall-semibold text-zinc-600 bg-zinc-100 px-2 py-0.5 rounded-lg whitespace-nowrap\">\n {translate('common.cards.item.defaultBadge')}\n </span>\n )}\n <CardBrandIcon brand={card.brand} />\n {renderMenu && (\n <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>\n <PopoverTrigger asChild>\n <button\n className=\"size-10 flex items-center justify-center rounded-lg hover:bg-zinc-100 cursor-pointer\"\n onClick={(e) => e.stopPropagation()}\n >\n <IconDotsVertical className=\"size-5 text-zinc-500\" />\n </button>\n </PopoverTrigger>\n <PopoverContent\n align=\"end\"\n className=\"w-[180px] p-2 bg-white rounded-2xl border border-zinc-200\"\n onClick={(e) => e.stopPropagation()}\n >\n {menuHasSetDefault && (\n <NavBarItem\n icon={<IconStar size={18} className=\"text-zinc-400\" />}\n label={translate('common.cards.item.makeDefault')}\n onClick={() => {\n setPopoverOpen(false);\n handleSetDefault();\n }}\n />\n )}\n {menuHasDelete && (\n <NavBarItem\n icon={<IconTrash size={18} className=\"text-zinc-400\" />}\n label={translate('common.actions.delete')}\n onClick={() => {\n setPopoverOpen(false);\n handleDeleteCard(card);\n }}\n />\n )}\n </PopoverContent>\n </Popover>\n )}\n </div>\n );\n}\n"],"mappings":";AAiDU,cA8CA,YA9CA;AA/CV,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,kBAAkB,UAAU,iBAAiB;AACtD,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAEpC,SAAS,uBAAuB;AAazB,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB;AAAA,EACA;AACF,GAAkB;AAChB,QAAM,YAAY,gBAAgB;AAClC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEp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EF,oBAAC,iBAAc,OAAO,KAAK,OAAO;AAAA,QACjC,cACC,qBAAC,WAAQ,MAAM,aAAa,cAAc,gBACxC;AAAA,8BAAC,kBAAe,SAAO,MACrB;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,cAElC,8BAAC,oBAAiB,WAAU,wBAAuB;AAAA;AAAA,UACrD,GACF;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,OAAM;AAAA,cACN,WAAU;AAAA,cACV,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,cAEjC;AAAA,qCACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAM,oBAAC,YAAS,MAAM,IAAI,WAAU,iBAAgB;AAAA,oBACpD,OAAO,UAAU,+BAA+B;AAAA,oBAChD,SAAS,MAAM;AACb,qCAAe,KAAK;AACpB,uCAAiB;AAAA,oBACnB;AAAA;AAAA,gBACF;AAAA,gBAED,iBACC;AAAA,kBAAC;AAAA;AAAA,oBACC,MAAM,oBAAC,aAAU,MAAM,IAAI,WAAU,iBAAgB;AAAA,oBACrD,OAAO,UAAU,uBAAuB;AAAA,oBACxC,SAAS,MAAM;AACb,qCAAe,KAAK;AACpB,uCAAiB,IAAI;AAAA,oBACvB;AAAA;AAAA,gBACF;AAAA;AAAA;AAAA,UAEJ;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -0,0 +1,50 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ function PixIcon({ className }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "svg",
5
+ {
6
+ width: "24",
7
+ height: "24",
8
+ viewBox: "0 0 20 20",
9
+ fill: "none",
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ className,
12
+ children: /* @__PURE__ */ jsx(
13
+ "path",
14
+ {
15
+ d: "M4.67762 6.40663L6.72547 6.40663C7.18162 6.40663 7.61803 6.59275 7.93377 6.92196L9.41592 8.4673C9.74782 8.81335 10.302 8.81045 10.6303 8.46094L12.0637 6.93469C12.3801 6.59774 12.8218 6.40663 13.2841 6.40663L15.1948 6.40663M15.3513 13.6115H13.2901C12.8243 13.6115 12.3797 13.4175 12.0629 13.0762L10.6318 11.5342C10.3028 11.1796 9.74254 11.1769 9.41011 11.5284L7.93498 13.0878C7.61875 13.4221 7.17887 13.6115 6.71871 13.6115H4.69301M2.67766 11.6375L8.36188 17.3217C9.26641 18.2262 10.7329 18.2262 11.6375 17.3217L17.3217 11.6375C18.2262 10.733 18.2262 9.26644 17.3217 8.36191L11.6375 2.67769C10.7329 1.77317 9.26641 1.77317 8.36188 2.67769L2.67766 8.36191C1.77314 9.26644 1.77314 10.733 2.67766 11.6375Z",
16
+ stroke: "currentColor",
17
+ strokeWidth: "1.6"
18
+ }
19
+ )
20
+ }
21
+ );
22
+ }
23
+ function BoletoIcon({ className }) {
24
+ return /* @__PURE__ */ jsx(
25
+ "svg",
26
+ {
27
+ width: "24",
28
+ height: "24",
29
+ viewBox: "0 0 20 20",
30
+ fill: "none",
31
+ xmlns: "http://www.w3.org/2000/svg",
32
+ className,
33
+ children: /* @__PURE__ */ jsx(
34
+ "path",
35
+ {
36
+ d: "M5.73921 4V15.4M14.2617 4.6V16M8.51539 4V16M3.01172 4V11.8M16.9892 8.2V16M3.01172 15.4V16M16.9892 4V4.6M11.3395 4V16",
37
+ stroke: "currentColor",
38
+ strokeWidth: "1.6",
39
+ strokeLinecap: "round",
40
+ strokeLinejoin: "round"
41
+ }
42
+ )
43
+ }
44
+ );
45
+ }
46
+ export {
47
+ BoletoIcon,
48
+ PixIcon
49
+ };
50
+ //# sourceMappingURL=PaymentMethodIcons.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/data-display/PaymentMethodIcons.tsx"],"sourcesContent":["type PaymentMethodIconProps = {\n className?: string;\n};\n\nexport function PixIcon({ className }: PaymentMethodIconProps) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M4.67762 6.40663L6.72547 6.40663C7.18162 6.40663 7.61803 6.59275 7.93377 6.92196L9.41592 8.4673C9.74782 8.81335 10.302 8.81045 10.6303 8.46094L12.0637 6.93469C12.3801 6.59774 12.8218 6.40663 13.2841 6.40663L15.1948 6.40663M15.3513 13.6115H13.2901C12.8243 13.6115 12.3797 13.4175 12.0629 13.0762L10.6318 11.5342C10.3028 11.1796 9.74254 11.1769 9.41011 11.5284L7.93498 13.0878C7.61875 13.4221 7.17887 13.6115 6.71871 13.6115H4.69301M2.67766 11.6375L8.36188 17.3217C9.26641 18.2262 10.7329 18.2262 11.6375 17.3217L17.3217 11.6375C18.2262 10.733 18.2262 9.26644 17.3217 8.36191L11.6375 2.67769C10.7329 1.77317 9.26641 1.77317 8.36188 2.67769L2.67766 8.36191C1.77314 9.26644 1.77314 10.733 2.67766 11.6375Z\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n />\n </svg>\n );\n}\n\nexport function BoletoIcon({ className }: PaymentMethodIconProps) {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n >\n <path\n d=\"M5.73921 4V15.4M14.2617 4.6V16M8.51539 4V16M3.01172 4V11.8M16.9892 8.2V16M3.01172 15.4V16M16.9892 4V4.6M11.3395 4V16\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n"],"mappings":"AAcM;AAVC,SAAS,QAAQ,EAAE,UAAU,GAA2B;AAC7D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAM;AAAA,MACN;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA;AAAA,MACd;AAAA;AAAA,EACF;AAEJ;AAEO,SAAS,WAAW,EAAE,UAAU,GAA2B;AAChE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAM;AAAA,MACN;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA;AAAA,MACjB;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,108 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useTranslations } from "next-intl";
4
+ import { Skeleton } from "../feedback/Skeleton";
5
+ import { useCurrencyFormatter } from "../../../modules/accounts/hooks/use-currency-formatter.hook";
6
+ import {
7
+ getFirstPeriodLabelKey
8
+ } from "../../../modules/subscriptions/utils/first-period-pricing";
9
+ import {
10
+ getPlanBadgePercents,
11
+ USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT
12
+ } from "../../../modules/subscriptions/utils/periodicity";
13
+ import { cn } from "../../../infra/utils/clsx";
14
+ const BILLING_OPTIONS = ["annual", "monthly"];
15
+ function BillingPeriodSelector({
16
+ value,
17
+ onChange,
18
+ disabledOptions = [],
19
+ calculatedPricing,
20
+ billingDiscounts,
21
+ firstPeriodPricingByPeriod,
22
+ planPricing
23
+ }) {
24
+ const translate = useTranslations("common.account.workspace.subscription.checkout.billing");
25
+ const translateFirstPeriod = useTranslations(
26
+ "common.account.workspace.subscription.checkout.firstPeriod"
27
+ );
28
+ const { currency, formatCurrencyNumber } = useCurrencyFormatter();
29
+ const isUsd = currency === "usd";
30
+ const catalogBadgePercents = getPlanBadgePercents(planPricing);
31
+ return /* @__PURE__ */ jsxs("div", { children: [
32
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold text-zinc-600 mb-3 block", children: translate("sectionLabel") }),
33
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col lg:flex-row gap-2 lg:gap-3", children: BILLING_OPTIONS.map((option) => {
34
+ const isSelected = value === option;
35
+ const isDisabled = disabledOptions.includes(option);
36
+ const price = calculatedPricing?.[option] ?? null;
37
+ const periodMonths = option === "annual" ? 12 : 1;
38
+ const displayPrice = price != null ? price / periodMonths : price;
39
+ const billedLabel = price != null && periodMonths > 1 ? translate("billedUpfront", { price: formatCurrencyNumber(price) }) : "";
40
+ const planFallbackDiscountPercent = catalogBadgePercents?.[option] ?? null;
41
+ const discountPercent = isUsd ? null : billingDiscounts?.[option] ?? planFallbackDiscountPercent;
42
+ const badgeLabel = discountPercent != null ? translate("discountBadge", { percent: String(discountPercent) }) : isUsd && option === "annual" ? translate("catalogDiscountBadge", {
43
+ percent: String(USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT)
44
+ }) : null;
45
+ const firstPeriod = firstPeriodPricingByPeriod?.[option] ?? null;
46
+ return /* @__PURE__ */ jsxs(
47
+ "button",
48
+ {
49
+ type: "button",
50
+ disabled: isDisabled,
51
+ onClick: () => !isDisabled && onChange(option),
52
+ className: cn(
53
+ "flex-1 text-left p-3 lg:p-4 rounded-lg border transition-all",
54
+ isDisabled ? "border-zinc-200 bg-zinc-50 cursor-not-allowed opacity-50" : isSelected ? "border-zinc-950 cursor-pointer" : "border-zinc-200 bg-white shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)] cursor-pointer"
55
+ ),
56
+ children: [
57
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center flex-wrap gap-1.5 lg:gap-2 mb-2", children: [
58
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold lg:paragraph-small-semibold text-zinc-950", children: translate(option) }),
59
+ badgeLabel && /* @__PURE__ */ jsx(
60
+ "span",
61
+ {
62
+ className: cn(
63
+ "paragraph-xsmall-semibold h-6 flex items-center justify-center px-1.5 rounded-lg",
64
+ discountPercent == null || discountPercent > 0 ? "bg-green-50 text-green-600 border border-green-100" : "bg-zinc-50 text-zinc-600"
65
+ ),
66
+ children: badgeLabel
67
+ }
68
+ ),
69
+ /* @__PURE__ */ jsx(
70
+ "div",
71
+ {
72
+ className: cn(
73
+ "size-[18px] rounded-full border-[1.6px] flex items-center justify-center ml-auto",
74
+ isSelected ? "border-zinc-950 bg-white" : "border-zinc-200"
75
+ ),
76
+ children: isSelected && /* @__PURE__ */ jsx("div", { className: "size-[10px] rounded-full bg-zinc-950" })
77
+ }
78
+ )
79
+ ] }),
80
+ price != null ? firstPeriod ? (
81
+ /* Cupom só da(s) primeira(s) fatura(s): o preço cheio na linha principal
82
+ * soaria permanente e contradiria o "depois" logo abaixo. */
83
+ /* @__PURE__ */ jsxs("span", { className: "paragraph-medium-medium text-zinc-500", children: [
84
+ translateFirstPeriod(getFirstPeriodLabelKey(option, firstPeriod), {
85
+ price: formatCurrencyNumber(price),
86
+ count: String(firstPeriod.durationMonths ?? "")
87
+ }),
88
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-zinc-500 block", children: translateFirstPeriod("then", {
89
+ price: formatCurrencyNumber(firstPeriod.recurringPrice),
90
+ suffix: translate(option === "annual" ? "suffixAnnual" : "suffixMonthly")
91
+ }) })
92
+ ] })
93
+ ) : /* @__PURE__ */ jsxs("span", { className: "paragraph-medium-medium text-zinc-500", children: [
94
+ formatCurrencyNumber(displayPrice ?? price),
95
+ /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold", children: translate("suffixMonthly") }),
96
+ billedLabel && /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium block", children: billedLabel })
97
+ ] }) : /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
98
+ ]
99
+ },
100
+ option
101
+ );
102
+ }) })
103
+ ] });
104
+ }
105
+ export {
106
+ BillingPeriodSelector
107
+ };
108
+ //# sourceMappingURL=BillingPeriodSelector.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/form/BillingPeriodSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport { Skeleton } from '../feedback/Skeleton';\nimport { useCurrencyFormatter } from '../../../modules/accounts/hooks/use-currency-formatter.hook';\nimport type { UiPlan } from '../../../modules/plans/types/plan.type';\nimport type { BillingPeriod } from '../../../modules/subscriptions/types/billing-period.type';\nimport {\n getFirstPeriodLabelKey,\n type FirstPeriodPricing,\n} from '../../../modules/subscriptions/utils/first-period-pricing';\nimport {\n getPlanBadgePercents,\n USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT,\n} from '../../../modules/subscriptions/utils/periodicity';\nimport { cn } from '../../../infra/utils/clsx';\n\ntype SelectablePeriod = Extract<BillingPeriod, 'annual' | 'monthly'>;\n\nconst BILLING_OPTIONS: SelectablePeriod[] = ['annual', 'monthly'];\n\ninterface BillingPeriodSelectorProps {\n value: BillingPeriod;\n onChange: (value: BillingPeriod) => void;\n disabledOptions?: BillingPeriod[];\n /** Totais por período vindos do calculate; null exibe skeleton. */\n calculatedPricing?: { monthly: number | null; annual: number | null } | null;\n /**\n * Percentual de desconto EFETIVO por período (periodicidade + cupom, já compostos).\n * null no período = calculate ainda sem resposta → usa a âncora do próprio plano.\n */\n billingDiscounts?: { monthly: number | null; annual: number | null } | null;\n /** Split 1º período × recorrente quando o cupom é de duração limitada. */\n firstPeriodPricingByPeriod?: {\n monthly: FirstPeriodPricing | null;\n annual: FirstPeriodPricing | null;\n } | null;\n /** Pricing do plano escolhido: alimenta o badge enquanto o calculate não responde. */\n planPricing?: UiPlan['pricing'] | null;\n}\n\n/** Mensal × anual do contrato, com o desconto e o total à vista de cada um. */\nexport function BillingPeriodSelector({\n value,\n onChange,\n disabledOptions = [],\n calculatedPricing,\n billingDiscounts,\n firstPeriodPricingByPeriod,\n planPricing,\n}: BillingPeriodSelectorProps) {\n const translate = useTranslations('common.account.workspace.subscription.checkout.billing');\n const translateFirstPeriod = useTranslations(\n 'common.account.workspace.subscription.checkout.firstPeriod'\n );\n const { currency, formatCurrencyNumber } = useCurrencyFormatter();\n const isUsd = currency === 'usd';\n\n // Badge enquanto o calculate não respondeu: âncora do próprio plano em contratação — o\n // percentual varia por whitelabel, então nada de tabela estática.\n const catalogBadgePercents = getPlanBadgePercents(planPricing);\n\n return (\n <div>\n <span className=\"paragraph-xsmall-semibold text-zinc-600 mb-3 block\">\n {translate('sectionLabel')}\n </span>\n\n <div className=\"flex flex-col lg:flex-row gap-2 lg:gap-3\">\n {BILLING_OPTIONS.map((option) => {\n const isSelected = value === option;\n const isDisabled = disabledOptions.includes(option);\n const price = calculatedPricing?.[option] ?? null;\n const periodMonths = option === 'annual' ? 12 : 1;\n // A opção anuncia o equivalente mensal e repete o total do período embaixo, para\n // não sugerir que a cobrança anual é mensal.\n const displayPrice = price != null ? price / periodMonths : price;\n const billedLabel =\n price != null && periodMonths > 1\n ? translate('billedUpfront', { price: formatCurrencyNumber(price) })\n : '';\n\n const planFallbackDiscountPercent = catalogBadgePercents?.[option] ?? null;\n const discountPercent = isUsd\n ? null\n : (billingDiscounts?.[option] ?? planFallbackDiscountPercent);\n const badgeLabel =\n discountPercent != null\n ? translate('discountBadge', { percent: String(discountPercent) })\n : isUsd && option === 'annual'\n ? translate('catalogDiscountBadge', {\n percent: String(USD_CATALOG_MAX_ANNUAL_DISCOUNT_PERCENT),\n })\n : null;\n\n const firstPeriod = firstPeriodPricingByPeriod?.[option] ?? null;\n\n return (\n <button\n key={option}\n type=\"button\"\n disabled={isDisabled}\n onClick={() => !isDisabled && onChange(option)}\n className={cn(\n 'flex-1 text-left p-3 lg:p-4 rounded-lg border transition-all',\n isDisabled\n ? 'border-zinc-200 bg-zinc-50 cursor-not-allowed opacity-50'\n : isSelected\n ? 'border-zinc-950 cursor-pointer'\n : 'border-zinc-200 bg-white shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)] cursor-pointer'\n )}\n >\n <div className=\"flex items-center flex-wrap gap-1.5 lg:gap-2 mb-2\">\n <span className=\"paragraph-xsmall-semibold lg:paragraph-small-semibold text-zinc-950\">\n {translate(option)}\n </span>\n {badgeLabel && (\n <span\n className={cn(\n 'paragraph-xsmall-semibold h-6 flex items-center justify-center px-1.5 rounded-lg',\n discountPercent == null || discountPercent > 0\n ? 'bg-green-50 text-green-600 border border-green-100'\n : 'bg-zinc-50 text-zinc-600'\n )}\n >\n {badgeLabel}\n </span>\n )}\n <div\n className={cn(\n 'size-[18px] rounded-full border-[1.6px] flex items-center justify-center ml-auto',\n isSelected ? 'border-zinc-950 bg-white' : 'border-zinc-200'\n )}\n >\n {isSelected && <div className=\"size-[10px] rounded-full bg-zinc-950\" />}\n </div>\n </div>\n\n {price != null ? (\n firstPeriod ? (\n /* Cupom só da(s) primeira(s) fatura(s): o preço cheio na linha principal\n * soaria permanente e contradiria o \"depois\" logo abaixo. */\n <span className=\"paragraph-medium-medium text-zinc-500\">\n {translateFirstPeriod(getFirstPeriodLabelKey(option, firstPeriod), {\n price: formatCurrencyNumber(price),\n count: String(firstPeriod.durationMonths ?? ''),\n })}\n <span className=\"paragraph-xsmall-medium text-zinc-500 block\">\n {translateFirstPeriod('then', {\n price: formatCurrencyNumber(firstPeriod.recurringPrice),\n suffix: translate(option === 'annual' ? 'suffixAnnual' : 'suffixMonthly'),\n })}\n </span>\n </span>\n ) : (\n <span className=\"paragraph-medium-medium text-zinc-500\">\n {formatCurrencyNumber(displayPrice ?? price)}\n <span className=\"paragraph-xsmall-semibold\">{translate('suffixMonthly')}</span>\n {billedLabel && (\n <span className=\"paragraph-xsmall-medium block\">{billedLabel}</span>\n )}\n </span>\n )\n ) : (\n <Skeleton className=\"h-5 w-24\" />\n )}\n </button>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";AAgEM,cAgDQ,YAhDR;AA9DN,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AAGrC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,GACH;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,82 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { IconBarcode, IconCreditCard, IconInfoCircle, IconQrcode } from "@tabler/icons-react";
4
+ import { useTranslations } from "next-intl";
5
+ import { Tooltip, TooltipContent, TooltipTrigger } from "../overlay/Tooltip";
6
+ import { cn } from "../../../infra/utils/clsx";
7
+ const selectedClass = "bg-white text-zinc-950 shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)]";
8
+ const optionClass = "flex items-center gap-1.5 px-3 py-1.5 rounded-lg paragraph-small-semibold transition-colors cursor-pointer";
9
+ const disabledClass = "flex items-center gap-1.5 px-3 py-1.5 rounded-lg paragraph-small-semibold text-zinc-950 opacity-40 cursor-not-allowed";
10
+ function PaymentMethodToggle({
11
+ value,
12
+ onChange,
13
+ disableBoleto = false,
14
+ disableCard = false,
15
+ disablePix = false,
16
+ hideBoleto = false,
17
+ hideCard = false,
18
+ hidePix = false,
19
+ boletoTooltip,
20
+ cardTooltip,
21
+ pixTooltip
22
+ }) {
23
+ const translate = useTranslations("common.payment.methodToggle");
24
+ const visibleMethods = [!hideCard, !hideBoleto, !hidePix].filter(Boolean).length;
25
+ if (visibleMethods <= 1) return null;
26
+ const options = [
27
+ {
28
+ method: "card",
29
+ hidden: hideCard,
30
+ disabled: disableCard,
31
+ tooltip: cardTooltip ?? translate("cardTooltip"),
32
+ label: translate("card"),
33
+ icon: IconCreditCard
34
+ },
35
+ {
36
+ method: "boleto",
37
+ hidden: hideBoleto,
38
+ disabled: disableBoleto,
39
+ tooltip: boletoTooltip ?? translate("boletoTooltip"),
40
+ label: translate("boleto"),
41
+ icon: IconBarcode
42
+ },
43
+ {
44
+ method: "pix",
45
+ hidden: hidePix,
46
+ disabled: disablePix,
47
+ tooltip: pixTooltip ?? translate("pixTooltip"),
48
+ label: translate("pix"),
49
+ icon: IconQrcode
50
+ }
51
+ ];
52
+ return /* @__PURE__ */ jsx("div", { className: "inline-flex items-stretch h-12 rounded-[12px] bg-zinc-100 p-1.5 gap-1 w-fit", children: options.map(({ method, hidden, disabled, tooltip, label, icon: Icon }) => {
53
+ if (hidden) return null;
54
+ if (disabled) {
55
+ return /* @__PURE__ */ jsxs("div", { className: disabledClass, children: [
56
+ /* @__PURE__ */ jsx(Icon, { size: 20, className: "shrink-0" }),
57
+ label,
58
+ /* @__PURE__ */ jsxs(Tooltip, { children: [
59
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 16, className: "shrink-0" }) }),
60
+ /* @__PURE__ */ jsx(TooltipContent, { side: "top", className: "max-w-65", children: tooltip })
61
+ ] })
62
+ ] }, method);
63
+ }
64
+ return /* @__PURE__ */ jsxs(
65
+ "button",
66
+ {
67
+ type: "button",
68
+ onClick: () => onChange(method),
69
+ className: cn(optionClass, value === method ? selectedClass : "text-zinc-950"),
70
+ children: [
71
+ /* @__PURE__ */ jsx(Icon, { size: 20, className: "shrink-0" }),
72
+ label
73
+ ]
74
+ },
75
+ method
76
+ );
77
+ }) });
78
+ }
79
+ export {
80
+ PaymentMethodToggle
81
+ };
82
+ //# sourceMappingURL=PaymentMethodToggle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/form/PaymentMethodToggle.tsx"],"sourcesContent":["'use client';\n\nimport { IconBarcode, IconCreditCard, IconInfoCircle, IconQrcode } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../overlay/Tooltip';\nimport { cn } from '../../../infra/utils/clsx';\n\nexport type PaymentMethodOption = 'card' | 'boleto' | 'pix';\n\ntype PaymentMethodToggleProps = {\n value: PaymentMethodOption;\n onChange: (method: PaymentMethodOption) => void;\n disableBoleto?: boolean;\n disableCard?: boolean;\n disablePix?: boolean;\n hideBoleto?: boolean;\n hideCard?: boolean;\n hidePix?: boolean;\n boletoTooltip?: string;\n cardTooltip?: string;\n pixTooltip?: string;\n};\n\nconst selectedClass = 'bg-white text-zinc-950 shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)]';\nconst optionClass =\n 'flex items-center gap-1.5 px-3 py-1.5 rounded-lg paragraph-small-semibold transition-colors cursor-pointer';\nconst disabledClass =\n 'flex items-center gap-1.5 px-3 py-1.5 rounded-lg paragraph-small-semibold text-zinc-950 opacity-40 cursor-not-allowed';\n\n/** Seletor de forma de pagamento (cartão, boleto e pix). Some quando só sobra uma opção. */\nexport function PaymentMethodToggle({\n value,\n onChange,\n disableBoleto = false,\n disableCard = false,\n disablePix = false,\n hideBoleto = false,\n hideCard = false,\n hidePix = false,\n boletoTooltip,\n cardTooltip,\n pixTooltip,\n}: PaymentMethodToggleProps) {\n const translate = useTranslations('common.payment.methodToggle');\n\n const visibleMethods = [!hideCard, !hideBoleto, !hidePix].filter(Boolean).length;\n if (visibleMethods <= 1) return null;\n\n const options: {\n method: PaymentMethodOption;\n hidden: boolean;\n disabled: boolean;\n tooltip: string;\n label: string;\n icon: typeof IconCreditCard;\n }[] = [\n {\n method: 'card',\n hidden: hideCard,\n disabled: disableCard,\n tooltip: cardTooltip ?? translate('cardTooltip'),\n label: translate('card'),\n icon: IconCreditCard,\n },\n {\n method: 'boleto',\n hidden: hideBoleto,\n disabled: disableBoleto,\n tooltip: boletoTooltip ?? translate('boletoTooltip'),\n label: translate('boleto'),\n icon: IconBarcode,\n },\n {\n method: 'pix',\n hidden: hidePix,\n disabled: disablePix,\n tooltip: pixTooltip ?? translate('pixTooltip'),\n label: translate('pix'),\n icon: IconQrcode,\n },\n ];\n\n return (\n <div className=\"inline-flex items-stretch h-12 rounded-[12px] bg-zinc-100 p-1.5 gap-1 w-fit\">\n {options.map(({ method, hidden, disabled, tooltip, label, icon: Icon }) => {\n if (hidden) return null;\n\n if (disabled) {\n return (\n <div key={method} className={disabledClass}>\n <Icon size={20} className=\"shrink-0\" />\n {label}\n <Tooltip>\n <TooltipTrigger asChild>\n <IconInfoCircle size={16} className=\"shrink-0\" />\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-65\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n </div>\n );\n }\n\n return (\n <button\n key={method}\n type=\"button\"\n onClick={() => onChange(method)}\n className={cn(optionClass, value === method ? selectedClass : 'text-zinc-950')}\n >\n <Icon size={20} className=\"shrink-0\" />\n {label}\n </button>\n );\n })}\n </div>\n );\n}\n"],"mappings":";AA0Fc,cAEA,YAFA;AAxFd,SAAS,aAAa,gBAAgB,gBAAgB,kBAAkB;AACxE,SAAS,uBAAuB;AAChC,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AAkBnB,MAAM,gBAAgB;AACtB,MAAM,cACJ;AACF,MAAM,gBACJ;AAGK,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,QAAM,YAAY,gBAAgB,6BAA6B;AAE/D,QAAM,iBAAiB,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,OAAO,EAAE;AAC1E,MAAI,kBAAkB,EAAG,QAAO;AAEhC,QAAM,UAOA;AAAA,IACJ;AAAA,MACE,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,SAAS,eAAe,UAAU,aAAa;AAAA,MAC/C,OAAO,UAAU,MAAM;AAAA,MACvB,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,SAAS,iBAAiB,UAAU,eAAe;AAAA,MACnD,OAAO,UAAU,QAAQ;AAAA,MACzB,MAAM;AAAA,IACR;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,SAAS,cAAc,UAAU,YAAY;AAAA,MAC7C,OAAO,UAAU,KAAK;AAAA,MACtB,MAAM;AAAA,IACR;AAAA,EACF;AAEA,SACE,oBAAC,SAAI,WAAU,+EACZ,kBAAQ,IAAI,CAAC,EAAE,QAAQ,QAAQ,UAAU,SAAS,OAAO,MAAM,KAAK,MAAM;AACzE,QAAI,OAAQ,QAAO;AAEnB,QAAI,UAAU;AACZ,aACE,qBAAC,SAAiB,WAAW,eAC3B;AAAA,4BAAC,QAAK,MAAM,IAAI,WAAU,YAAW;AAAA,QACpC;AAAA,QACD,qBAAC,WACC;AAAA,8BAAC,kBAAe,SAAO,MACrB,8BAAC,kBAAe,MAAM,IAAI,WAAU,YAAW,GACjD;AAAA,UACA,oBAAC,kBAAe,MAAK,OAAM,WAAU,YAClC,mBACH;AAAA,WACF;AAAA,WAVQ,MAWV;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,SAAS,MAAM,SAAS,MAAM;AAAA,QAC9B,WAAW,GAAG,aAAa,UAAU,SAAS,gBAAgB,eAAe;AAAA,QAE7E;AAAA,8BAAC,QAAK,MAAM,IAAI,WAAU,YAAW;AAAA,UACpC;AAAA;AAAA;AAAA,MANI;AAAA,IAOP;AAAA,EAEJ,CAAC,GACH;AAEJ;","names":[]}
@@ -0,0 +1,57 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { RadioGroupItem } from "./RadioGroup";
4
+ import { cn } from "../../../infra/utils/clsx";
5
+ function RadioOptionFieldIcon({
6
+ value,
7
+ label,
8
+ description,
9
+ isSelected,
10
+ icon,
11
+ id,
12
+ disabled = false
13
+ }) {
14
+ const htmlForId = id || value;
15
+ return /* @__PURE__ */ jsxs(
16
+ "label",
17
+ {
18
+ htmlFor: htmlForId,
19
+ className: cn(
20
+ "flex items-center gap-4 p-4 rounded-lg transition-colors",
21
+ disabled ? "border-0 cursor-not-allowed bg-zinc-50" : isSelected ? "border border-zinc-950 cursor-pointer" : "border border-zinc-200 hover:border-zinc-300 cursor-pointer"
22
+ ),
23
+ children: [
24
+ /* @__PURE__ */ jsx(
25
+ "div",
26
+ {
27
+ className: cn(
28
+ "shrink-0 mt-0.5 bg-zinc-50 size-10! rounded-lg flex items-center justify-center",
29
+ disabled && "opacity-80",
30
+ isSelected ? "text-zinc-950" : "text-zinc-600"
31
+ ),
32
+ children: icon
33
+ }
34
+ ),
35
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-5 flex-1", children: [
36
+ /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", disabled && "opacity-80"), children: [
37
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: label }),
38
+ description && /* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: description })
39
+ ] }),
40
+ /* @__PURE__ */ jsx(
41
+ RadioGroupItem,
42
+ {
43
+ value,
44
+ id: htmlForId,
45
+ disabled,
46
+ className: cn("size-[18px] border-[1.5px] shrink-0", isSelected && "border-zinc-950", disabled && "opacity-80")
47
+ }
48
+ )
49
+ ] })
50
+ ]
51
+ }
52
+ );
53
+ }
54
+ export {
55
+ RadioOptionFieldIcon
56
+ };
57
+ //# sourceMappingURL=RadioOptionFieldIcon.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/ui/form/RadioOptionFieldIcon.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { RadioGroupItem } from './RadioGroup';\nimport { cn } from '../../../infra/utils/clsx';\n\ntype RadioOptionFieldIconProps = {\n value: string;\n label: string;\n isSelected: boolean;\n icon: ReactNode;\n description?: string;\n id?: string;\n disabled?: boolean;\n};\n\n/** Opção de rádio em cartão, com ícone à esquerda e descrição — usada na escolha de função do usuário. */\nexport function RadioOptionFieldIcon({\n value,\n label,\n description,\n isSelected,\n icon,\n id,\n disabled = false,\n}: RadioOptionFieldIconProps) {\n const htmlForId = id || value;\n\n return (\n <label\n htmlFor={htmlForId}\n className={cn(\n 'flex items-center gap-4 p-4 rounded-lg transition-colors',\n disabled\n ? 'border-0 cursor-not-allowed bg-zinc-50'\n : isSelected\n ? 'border border-zinc-950 cursor-pointer'\n : 'border border-zinc-200 hover:border-zinc-300 cursor-pointer'\n )}\n >\n <div\n className={cn(\n 'shrink-0 mt-0.5 bg-zinc-50 size-10! rounded-lg flex items-center justify-center',\n disabled && 'opacity-80',\n isSelected ? 'text-zinc-950' : 'text-zinc-600'\n )}\n >\n {icon}\n </div>\n <div className=\"flex items-center justify-between gap-5 flex-1\">\n <div className={cn('flex flex-col gap-1', disabled && 'opacity-80')}>\n <span className=\"paragraph-small-semibold text-zinc-950\">{label}</span>\n {description && <span className=\"paragraph-small-regular text-zinc-600\">{description}</span>}\n </div>\n <RadioGroupItem\n value={value}\n id={htmlForId}\n disabled={disabled}\n className={cn('size-[18px] border-[1.5px] shrink-0', isSelected && 'border-zinc-950', disabled && 'opacity-80')}\n />\n </div>\n </label>\n );\n}\n"],"mappings":";AAwCM,cAUE,YAVF;AArCN,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AAaZ,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAA8B;AAC5B,QAAM,YAAY,MAAM;AAExB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,WAAW;AAAA,QACT;AAAA,QACA,WACI,2CACA,aACE,0CACA;AAAA,MACR;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,YAAY;AAAA,cACZ,aAAa,kBAAkB;AAAA,YACjC;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA,qBAAC,SAAI,WAAU,kDACb;AAAA,+BAAC,SAAI,WAAW,GAAG,uBAAuB,YAAY,YAAY,GAChE;AAAA,gCAAC,UAAK,WAAU,0CAA0C,iBAAM;AAAA,YAC/D,eAAe,oBAAC,UAAK,WAAU,yCAAyC,uBAAY;AAAA,aACvF;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,IAAI;AAAA,cACJ;AAAA,cACA,WAAW,GAAG,uCAAuC,cAAc,mBAAmB,YAAY,YAAY;AAAA;AAAA,UAChH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}