@arbidocs/blocks 0.5.129 → 0.5.131

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 (249) hide show
  1. package/dist/{ConnectedCallDock-XJOYVVAH.cjs → ConnectedCallDock-GJ4LO7I3.cjs} +27 -27
  2. package/dist/{ConnectedCallDock-XJOYVVAH.cjs.map → ConnectedCallDock-GJ4LO7I3.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-CUDYAPQK.cjs → ConnectedCallRoom-SL3GMHO7.cjs} +20 -20
  4. package/dist/{ConnectedCallRoom-CUDYAPQK.cjs.map → ConnectedCallRoom-SL3GMHO7.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxComparison-7KTAOUE3.cjs → ConnectedNativeDocxComparison-OY4RTJKA.cjs} +17 -17
  6. package/dist/{ConnectedNativeDocxComparison-7KTAOUE3.cjs.map → ConnectedNativeDocxComparison-OY4RTJKA.cjs.map} +1 -1
  7. package/dist/{ConnectedPresentation-SI3L77J4.cjs → ConnectedPresentation-5W26JTH6.cjs} +18 -18
  8. package/dist/{ConnectedPresentation-SI3L77J4.cjs.map → ConnectedPresentation-5W26JTH6.cjs.map} +1 -1
  9. package/dist/{ConnectedSlidesTab-E76OVY34.cjs → ConnectedSlidesTab-YS2XRWUC.cjs} +16 -16
  10. package/dist/{ConnectedSlidesTab-E76OVY34.cjs.map → ConnectedSlidesTab-YS2XRWUC.cjs.map} +1 -1
  11. package/dist/{ConnectedStreamedWordArtifact-J4MYBABA.cjs → ConnectedStreamedWordArtifact-6Y24NJON.cjs} +17 -17
  12. package/dist/{ConnectedStreamedWordArtifact-J4MYBABA.cjs.map → ConnectedStreamedWordArtifact-6Y24NJON.cjs.map} +1 -1
  13. package/dist/{DocumentReviewCard-M53XFLI2.cjs → DocumentReviewCard-DIUHU76E.cjs} +16 -16
  14. package/dist/{DocumentReviewCard-M53XFLI2.cjs.map → DocumentReviewCard-DIUHU76E.cjs.map} +1 -1
  15. package/dist/{FilesViewerDialog-GGF4WMU4.cjs → FilesViewerDialog-H6ZXLUO3.cjs} +46 -46
  16. package/dist/{FilesViewerDialog-GGF4WMU4.cjs.map → FilesViewerDialog-H6ZXLUO3.cjs.map} +1 -1
  17. package/dist/{StreamedArtifactEditor-7KJ2HLLU.cjs → StreamedArtifactEditor-RSPUSZ2B.cjs} +5 -5
  18. package/dist/{StreamedArtifactEditor-7KJ2HLLU.cjs.map → StreamedArtifactEditor-RSPUSZ2B.cjs.map} +1 -1
  19. package/dist/{WorkspaceTableView-CUCTCA2O.cjs → WorkspaceTableView-44555T3K.cjs} +9 -9
  20. package/dist/{WorkspaceTableView-CUCTCA2O.cjs.map → WorkspaceTableView-44555T3K.cjs.map} +1 -1
  21. package/dist/agents/index.cjs +377 -377
  22. package/dist/agents/workflows/StepParts.d.ts +3 -0
  23. package/dist/agents/workflows/StepParts.js +20 -3
  24. package/dist/agents/workflows/StepParts.js.map +2 -2
  25. package/dist/agents/workflows/WorkflowStepAction.js +14 -3
  26. package/dist/agents/workflows/WorkflowStepAction.js.map +2 -2
  27. package/dist/agents/workflows/planSteps.js +6 -1
  28. package/dist/agents/workflows/planSteps.js.map +2 -2
  29. package/dist/agents/workflows/workflow.d.ts +11 -2
  30. package/dist/agents/workflows/workflow.js +16 -1
  31. package/dist/agents/workflows/workflow.js.map +2 -2
  32. package/dist/{ai-IEIR7SC2.cjs → ai-V4X2E6Y4.cjs} +31 -31
  33. package/dist/ai-V4X2E6Y4.cjs.map +1 -0
  34. package/dist/artifacts/VersionTimeline.d.ts +5 -1
  35. package/dist/artifacts/VersionTimeline.js +15 -0
  36. package/dist/artifacts/VersionTimeline.js.map +2 -2
  37. package/dist/artifacts/index.cjs +24 -24
  38. package/dist/calls/index.cjs +120 -120
  39. package/dist/chat/index.cjs +58 -58
  40. package/dist/{chunk-SGYSDABK.cjs → chunk-2W5E62EY.cjs} +6 -6
  41. package/dist/{chunk-SGYSDABK.cjs.map → chunk-2W5E62EY.cjs.map} +1 -1
  42. package/dist/{chunk-NY3YUCOW.cjs → chunk-4NPCDS2X.cjs} +3 -3
  43. package/dist/{chunk-NY3YUCOW.cjs.map → chunk-4NPCDS2X.cjs.map} +1 -1
  44. package/dist/{chunk-MLA2BJ2Y.cjs → chunk-4RBQ44RY.cjs} +28 -28
  45. package/dist/{chunk-MLA2BJ2Y.cjs.map → chunk-4RBQ44RY.cjs.map} +1 -1
  46. package/dist/{chunk-BQ5RIWWT.cjs → chunk-4VZZWYEC.cjs} +3 -3
  47. package/dist/{chunk-BQ5RIWWT.cjs.map → chunk-4VZZWYEC.cjs.map} +1 -1
  48. package/dist/{chunk-7JLJH5CW.cjs → chunk-5A6T4W46.cjs} +7 -7
  49. package/dist/{chunk-7JLJH5CW.cjs.map → chunk-5A6T4W46.cjs.map} +1 -1
  50. package/dist/{chunk-WXUU3COI.cjs → chunk-6NT377PS.cjs} +12 -12
  51. package/dist/{chunk-WXUU3COI.cjs.map → chunk-6NT377PS.cjs.map} +1 -1
  52. package/dist/{chunk-ADDQKZ5I.cjs → chunk-734NPQNR.cjs} +4 -4
  53. package/dist/{chunk-ADDQKZ5I.cjs.map → chunk-734NPQNR.cjs.map} +1 -1
  54. package/dist/{chunk-XF355M7O.cjs → chunk-A2YUBDCO.cjs} +17 -17
  55. package/dist/{chunk-XF355M7O.cjs.map → chunk-A2YUBDCO.cjs.map} +1 -1
  56. package/dist/{chunk-IDCD5TEZ.cjs → chunk-A6GBPE5E.cjs} +18 -18
  57. package/dist/{chunk-IDCD5TEZ.cjs.map → chunk-A6GBPE5E.cjs.map} +1 -1
  58. package/dist/{chunk-HH5RDNO5.cjs → chunk-AFG7YCCJ.cjs} +82 -82
  59. package/dist/{chunk-HH5RDNO5.cjs.map → chunk-AFG7YCCJ.cjs.map} +1 -1
  60. package/dist/{chunk-KNGZZC4O.cjs → chunk-B3BZ6MNI.cjs} +6 -6
  61. package/dist/{chunk-KNGZZC4O.cjs.map → chunk-B3BZ6MNI.cjs.map} +1 -1
  62. package/dist/{chunk-I3A6KKWY.cjs → chunk-BAA44UEC.cjs} +114 -104
  63. package/dist/chunk-BAA44UEC.cjs.map +1 -0
  64. package/dist/{chunk-5QERK4PK.cjs → chunk-BVAT4EVC.cjs} +35 -35
  65. package/dist/{chunk-5QERK4PK.cjs.map → chunk-BVAT4EVC.cjs.map} +1 -1
  66. package/dist/{chunk-QGVOT7E4.cjs → chunk-EQTZQD66.cjs} +8 -8
  67. package/dist/{chunk-QGVOT7E4.cjs.map → chunk-EQTZQD66.cjs.map} +1 -1
  68. package/dist/{chunk-M2FOXGJU.cjs → chunk-F6CEPWIF.cjs} +7 -7
  69. package/dist/{chunk-M2FOXGJU.cjs.map → chunk-F6CEPWIF.cjs.map} +1 -1
  70. package/dist/{chunk-VWBYE3XY.cjs → chunk-GKMUXI4V.cjs} +6 -6
  71. package/dist/{chunk-VWBYE3XY.cjs.map → chunk-GKMUXI4V.cjs.map} +1 -1
  72. package/dist/{chunk-XCKHOXRP.cjs → chunk-H4ID6S4P.cjs} +6 -6
  73. package/dist/{chunk-XCKHOXRP.cjs.map → chunk-H4ID6S4P.cjs.map} +1 -1
  74. package/dist/{chunk-7OPOPYV6.cjs → chunk-H5OLHP2U.cjs} +3 -3
  75. package/dist/{chunk-7OPOPYV6.cjs.map → chunk-H5OLHP2U.cjs.map} +1 -1
  76. package/dist/{chunk-L4CIFLCU.cjs → chunk-IIYG542W.cjs} +9 -9
  77. package/dist/{chunk-L4CIFLCU.cjs.map → chunk-IIYG542W.cjs.map} +1 -1
  78. package/dist/{chunk-3IH55CDE.cjs → chunk-IZBAWZTB.cjs} +16 -2
  79. package/dist/chunk-IZBAWZTB.cjs.map +1 -0
  80. package/dist/{chunk-QRAQZTJE.cjs → chunk-JN5YMHGI.cjs} +18 -3
  81. package/dist/chunk-JN5YMHGI.cjs.map +1 -0
  82. package/dist/{chunk-ALK3PUUB.cjs → chunk-JQLWKNJO.cjs} +4 -4
  83. package/dist/{chunk-ALK3PUUB.cjs.map → chunk-JQLWKNJO.cjs.map} +1 -1
  84. package/dist/{chunk-I7J3ED6P.cjs → chunk-KAR326FU.cjs} +4 -4
  85. package/dist/{chunk-I7J3ED6P.cjs.map → chunk-KAR326FU.cjs.map} +1 -1
  86. package/dist/{chunk-GEZB3OEC.cjs → chunk-KUVGR5KE.cjs} +18 -17
  87. package/dist/chunk-KUVGR5KE.cjs.map +1 -0
  88. package/dist/{chunk-ZCU72Q76.cjs → chunk-MEZ7WSW3.cjs} +10 -10
  89. package/dist/{chunk-ZCU72Q76.cjs.map → chunk-MEZ7WSW3.cjs.map} +1 -1
  90. package/dist/{chunk-EG7EJFUE.cjs → chunk-MHIG6GGS.cjs} +17 -2
  91. package/dist/chunk-MHIG6GGS.cjs.map +1 -0
  92. package/dist/{chunk-ENOPKX7E.cjs → chunk-MXBXZXXQ.cjs} +3 -3
  93. package/dist/{chunk-ENOPKX7E.cjs.map → chunk-MXBXZXXQ.cjs.map} +1 -1
  94. package/dist/{chunk-IWHP7FAB.cjs → chunk-NZN7SK4W.cjs} +11 -11
  95. package/dist/{chunk-IWHP7FAB.cjs.map → chunk-NZN7SK4W.cjs.map} +1 -1
  96. package/dist/{chunk-U7D6ZDR2.cjs → chunk-PASJI6JZ.cjs} +140 -80
  97. package/dist/chunk-PASJI6JZ.cjs.map +1 -0
  98. package/dist/{chunk-UFT22LAB.cjs → chunk-PD23GDT7.cjs} +16 -16
  99. package/dist/{chunk-UFT22LAB.cjs.map → chunk-PD23GDT7.cjs.map} +1 -1
  100. package/dist/{chunk-325GVZE6.cjs → chunk-Q6DQGGP4.cjs} +3 -3
  101. package/dist/{chunk-325GVZE6.cjs.map → chunk-Q6DQGGP4.cjs.map} +1 -1
  102. package/dist/{chunk-TP5PGWIO.cjs → chunk-QFXOTJ6G.cjs} +20 -15
  103. package/dist/chunk-QFXOTJ6G.cjs.map +1 -0
  104. package/dist/{chunk-7L4X6QN2.cjs → chunk-QYX2U7TI.cjs} +8 -8
  105. package/dist/{chunk-7L4X6QN2.cjs.map → chunk-QYX2U7TI.cjs.map} +1 -1
  106. package/dist/{chunk-WAV762GP.cjs → chunk-R7IA2F2G.cjs} +6 -6
  107. package/dist/{chunk-WAV762GP.cjs.map → chunk-R7IA2F2G.cjs.map} +1 -1
  108. package/dist/{chunk-JJZOL5MG.cjs → chunk-RYVZDFVO.cjs} +3 -3
  109. package/dist/{chunk-JJZOL5MG.cjs.map → chunk-RYVZDFVO.cjs.map} +1 -1
  110. package/dist/{chunk-XGTMC54Q.cjs → chunk-SHPETTGW.cjs} +4 -4
  111. package/dist/{chunk-XGTMC54Q.cjs.map → chunk-SHPETTGW.cjs.map} +1 -1
  112. package/dist/{chunk-2F57IO7S.cjs → chunk-SZCDYKS4.cjs} +27 -27
  113. package/dist/{chunk-2F57IO7S.cjs.map → chunk-SZCDYKS4.cjs.map} +1 -1
  114. package/dist/{chunk-NQML7IUC.cjs → chunk-TW4RV3QK.cjs} +139 -112
  115. package/dist/chunk-TW4RV3QK.cjs.map +1 -0
  116. package/dist/{chunk-NG2EE7HR.cjs → chunk-UXBFXF26.cjs} +54 -54
  117. package/dist/{chunk-NG2EE7HR.cjs.map → chunk-UXBFXF26.cjs.map} +1 -1
  118. package/dist/{chunk-HSLPFBK2.cjs → chunk-VL7ZX4KQ.cjs} +6 -6
  119. package/dist/{chunk-HSLPFBK2.cjs.map → chunk-VL7ZX4KQ.cjs.map} +1 -1
  120. package/dist/{chunk-7PN3YENO.cjs → chunk-W6B3RYTX.cjs} +4 -4
  121. package/dist/{chunk-7PN3YENO.cjs.map → chunk-W6B3RYTX.cjs.map} +1 -1
  122. package/dist/{chunk-T73BHNQX.cjs → chunk-XKCIDXMP.cjs} +239 -89
  123. package/dist/chunk-XKCIDXMP.cjs.map +1 -0
  124. package/dist/{chunk-5GA65VBW.cjs → chunk-XX5SH4WE.cjs} +11 -11
  125. package/dist/{chunk-5GA65VBW.cjs.map → chunk-XX5SH4WE.cjs.map} +1 -1
  126. package/dist/{chunk-LXFCED4Z.cjs → chunk-Z4O324CO.cjs} +9 -9
  127. package/dist/{chunk-LXFCED4Z.cjs.map → chunk-Z4O324CO.cjs.map} +1 -1
  128. package/dist/{chunk-7NLO7ASW.cjs → chunk-ZEQE4I46.cjs} +18 -18
  129. package/dist/{chunk-7NLO7ASW.cjs.map → chunk-ZEQE4I46.cjs.map} +1 -1
  130. package/dist/connect/docx.cjs +20 -20
  131. package/dist/connect/index.cjs +2729 -1230
  132. package/dist/connect/index.cjs.map +1 -1
  133. package/dist/connect/index.d.ts +2 -0
  134. package/dist/connect/index.js +12 -0
  135. package/dist/connect/index.js.map +2 -2
  136. package/dist/connect/viewer.cjs +33 -33
  137. package/dist/connection/ConnectedWorkflowBuilder.d.ts +12 -0
  138. package/dist/connection/ConnectedWorkflowBuilder.js +6 -1
  139. package/dist/connection/ConnectedWorkflowBuilder.js.map +2 -2
  140. package/dist/connection/assistant/AssistantDrafts.d.ts +21 -0
  141. package/dist/connection/assistant/AssistantDrafts.js +158 -0
  142. package/dist/connection/assistant/AssistantDrafts.js.map +7 -0
  143. package/dist/connection/assistant/AssistantPlan.d.ts +16 -0
  144. package/dist/connection/assistant/AssistantPlan.js +72 -0
  145. package/dist/connection/assistant/AssistantPlan.js.map +7 -0
  146. package/dist/connection/assistant/AssistantStatusPanel.d.ts +28 -0
  147. package/dist/connection/assistant/AssistantStatusPanel.js +206 -0
  148. package/dist/connection/assistant/AssistantStatusPanel.js.map +7 -0
  149. package/dist/connection/assistant/ConnectedAssistantPage.d.ts +39 -0
  150. package/dist/connection/assistant/ConnectedAssistantPage.js +377 -0
  151. package/dist/connection/assistant/ConnectedAssistantPage.js.map +7 -0
  152. package/dist/connection/billing/ChangePlanDialog.d.ts +2 -1
  153. package/dist/connection/billing/ChangePlanDialog.js +8 -3
  154. package/dist/connection/billing/ChangePlanDialog.js.map +2 -2
  155. package/dist/connection/billing/ChangeProPlan.js +4 -4
  156. package/dist/connection/billing/ChangeProPlan.js.map +2 -2
  157. package/dist/connection/billing/CollaboratorPlan.js +5 -3
  158. package/dist/connection/billing/CollaboratorPlan.js.map +2 -2
  159. package/dist/connection/billing/ConnectedWelcomeDialog.d.ts +5 -13
  160. package/dist/connection/billing/ConnectedWelcomeDialog.js +38 -19
  161. package/dist/connection/billing/ConnectedWelcomeDialog.js.map +2 -2
  162. package/dist/connection/billing/MonthlySpendCap.d.ts +10 -3
  163. package/dist/connection/billing/MonthlySpendCap.js +103 -11
  164. package/dist/connection/billing/MonthlySpendCap.js.map +2 -2
  165. package/dist/connection/billing/NewProjectFlow.js +20 -7
  166. package/dist/connection/billing/NewProjectFlow.js.map +2 -2
  167. package/dist/connection/billing/ProjectDetail.js +1 -1
  168. package/dist/connection/billing/ProjectDetail.js.map +2 -2
  169. package/dist/connection/billing/ProjectPurchaseOptions.d.ts +14 -3
  170. package/dist/connection/billing/ProjectPurchaseOptions.js +472 -139
  171. package/dist/connection/billing/ProjectPurchaseOptions.js.map +2 -2
  172. package/dist/connection/billing/ProjectUsageCard.js +4 -4
  173. package/dist/connection/billing/ProjectUsageCard.js.map +2 -2
  174. package/dist/connection/billing/ReduceAddonDialog.js +2 -2
  175. package/dist/connection/billing/ReduceAddonDialog.js.map +2 -2
  176. package/dist/connection/billing/StripeCheckoutModal.js +3 -2
  177. package/dist/connection/billing/StripeCheckoutModal.js.map +2 -2
  178. package/dist/connection/billing/SubscriptionPlans.d.ts +5 -1
  179. package/dist/connection/billing/SubscriptionPlans.js +89 -6
  180. package/dist/connection/billing/SubscriptionPlans.js.map +2 -2
  181. package/dist/connection/billing/index.d.ts +1 -1
  182. package/dist/connection/billing/index.js +2 -2
  183. package/dist/connection/billing/index.js.map +2 -2
  184. package/dist/connection/billing/referral-reward.d.ts +2 -3
  185. package/dist/connection/billing/referral-reward.js +8 -3
  186. package/dist/connection/billing/referral-reward.js.map +2 -2
  187. package/dist/connection/billing/tax-quote.d.ts +2 -2
  188. package/dist/connection/billing/tax-quote.js +1 -0
  189. package/dist/connection/billing/tax-quote.js.map +2 -2
  190. package/dist/connection/contacts/ConnectedAddContacts.d.ts +7 -1
  191. package/dist/connection/contacts/ConnectedAddContacts.js +33 -17
  192. package/dist/connection/contacts/ConnectedAddContacts.js.map +2 -2
  193. package/dist/connection/contacts/ConnectedInviteContactsDialog.js +3 -2
  194. package/dist/connection/contacts/ConnectedInviteContactsDialog.js.map +2 -2
  195. package/dist/connection/contacts/ConnectedWelcomeInvitations.d.ts +6 -0
  196. package/dist/connection/contacts/ConnectedWelcomeInvitations.js +198 -0
  197. package/dist/connection/contacts/ConnectedWelcomeInvitations.js.map +7 -0
  198. package/dist/connection/conversation/AgentSteps.js +19 -2
  199. package/dist/connection/conversation/AgentSteps.js.map +2 -2
  200. package/dist/connection/viewer/ConnectedDocumentViewer.js +22 -2
  201. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  202. package/dist/connection/viewer/useDocumentVersionRestore.d.ts +14 -0
  203. package/dist/connection/viewer/useDocumentVersionRestore.js +48 -0
  204. package/dist/connection/viewer/useDocumentVersionRestore.js.map +7 -0
  205. package/dist/connection/viewer/useViewerTabs.d.ts +1 -1
  206. package/dist/connection/viewer/useViewerTabs.js +6 -3
  207. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  208. package/dist/dashboards/index.cjs +1 -1
  209. package/dist/document-tools/VersionSnapshotBar.d.ts +4 -1
  210. package/dist/document-tools/VersionSnapshotBar.js +14 -0
  211. package/dist/document-tools/VersionSnapshotBar.js.map +2 -2
  212. package/dist/document-tools/index.cjs +13 -13
  213. package/dist/embed/index.cjs +39 -39
  214. package/dist/facts/index.cjs +43 -43
  215. package/dist/files/index.cjs +224 -224
  216. package/dist/index.cjs +1409 -1409
  217. package/dist/office/index.cjs +5 -5
  218. package/dist/settings/Billing.d.ts +2 -2
  219. package/dist/settings/Billing.js +4 -3
  220. package/dist/settings/Billing.js.map +2 -2
  221. package/dist/settings/SubscriptionParts.d.ts +4 -2
  222. package/dist/settings/SubscriptionParts.js +22 -3
  223. package/dist/settings/SubscriptionParts.js.map +2 -2
  224. package/dist/settings/WelcomeDialog.d.ts +31 -4
  225. package/dist/settings/WelcomeDialog.js +221 -82
  226. package/dist/settings/WelcomeDialog.js.map +2 -2
  227. package/dist/settings/index.cjs +147 -147
  228. package/dist/shell/index.cjs +78 -78
  229. package/dist/site/index.cjs +5 -5
  230. package/dist/studio/index.cjs +31 -31
  231. package/dist/styles.css +1 -1
  232. package/dist/workflow-canvas/TriggerInspector.d.ts +7 -0
  233. package/dist/workflow-canvas/TriggerInspector.js +56 -0
  234. package/dist/workflow-canvas/TriggerInspector.js.map +2 -2
  235. package/dist/workflow-canvas/index.cjs +159 -98
  236. package/dist/workflow-canvas/index.cjs.map +1 -1
  237. package/node_modules/@arbidocs/coedit/package.json +1 -1
  238. package/package.json +5 -5
  239. package/src/connection/billing/project-purchase.css +518 -39
  240. package/dist/ai-IEIR7SC2.cjs.map +0 -1
  241. package/dist/chunk-3IH55CDE.cjs.map +0 -1
  242. package/dist/chunk-EG7EJFUE.cjs.map +0 -1
  243. package/dist/chunk-GEZB3OEC.cjs.map +0 -1
  244. package/dist/chunk-I3A6KKWY.cjs.map +0 -1
  245. package/dist/chunk-NQML7IUC.cjs.map +0 -1
  246. package/dist/chunk-QRAQZTJE.cjs.map +0 -1
  247. package/dist/chunk-T73BHNQX.cjs.map +0 -1
  248. package/dist/chunk-TP5PGWIO.cjs.map +0 -1
  249. package/dist/chunk-U7D6ZDR2.cjs.map +0 -1
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { ArrowRight, HardDrive, Minus, Plus, Sparkles, Users } from "lucide-react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from "react";
4
+ import { ArrowRight, ChevronDown, HardDrive, Minus, Plus, Sparkles, Tag, Users } from "lucide-react";
5
5
  import { MonthlySpendCap } from "./MonthlySpendCap.js";
6
6
  import { usePlanQuote } from "@arbidocs/react";
7
- import { Button } from "@arbidocs/react/ui";
7
+ import { Button, Input, Label, ToggleGroup, ToggleGroupItem } from "@arbidocs/react/ui";
8
8
  import {
9
9
  addonPrice,
10
10
  findProPrices,
@@ -13,6 +13,8 @@ import {
13
13
  } from "./plan-pricing.js";
14
14
  import { formatMoney, useRewardBalance } from "./reward-balance.js";
15
15
  import { applyReferralReward } from "./referral-reward.js";
16
+ import { quoteError } from "./tax-quote.js";
17
+ import { DailyCapField } from "../../settings/Billing.js";
16
18
  function purchaseNet(price, ai, storage, collaborators) {
17
19
  const base = packPrice(price)?.amount_ex_vat ?? price?.amount_ex_vat;
18
20
  if (base == null) return null;
@@ -39,10 +41,26 @@ function ProjectPurchaseOptions({
39
41
  onCollaboratorBlocksChange,
40
42
  disabled,
41
43
  busy,
44
+ busyLabel = "Opening payment\u2026",
42
45
  enabled = true,
43
- onChoose
46
+ onChoose,
47
+ onChooseFree,
48
+ promoCode = "",
49
+ onPromoCodeChange,
50
+ dailyCapValue,
51
+ onDailyCapChange,
52
+ onSaveDailyCap,
53
+ canSaveDailyCap,
54
+ dailyCapError,
55
+ currentQuotas
44
56
  }) {
45
57
  const [spendCap, setSpendCap] = useState(null);
58
+ const [adjustment, setAdjustment] = useState("max");
59
+ const [dailyCapOpen, setDailyCapOpen] = useState(false);
60
+ const dailyCapId = useId();
61
+ const promoId = useId();
62
+ const [promoOpen, setPromoOpen] = useState(false);
63
+ const [activePromo, setActivePromo] = useState("");
46
64
  const reward = useRewardBalance();
47
65
  const prices = findProPrices(products);
48
66
  const monthlyNet = purchaseNet(prices.monthly, aiBlocks, storageBlocks, collaboratorBlocks);
@@ -50,37 +68,85 @@ function ProjectPurchaseOptions({
50
68
  const extras = { ai_usage: aiBlocks, storage: storageBlocks, collaborators: collaboratorBlocks };
51
69
  const monthlyQuote = usePlanQuote(
52
70
  projectExtId,
53
- enabled && monthlyNet != null ? { plan: "pro", interval: "month", addons: extras } : null
71
+ enabled && monthlyNet != null ? {
72
+ plan: "pro",
73
+ interval: "month",
74
+ addons: extras,
75
+ ...activePromo ? { promo_code: activePromo } : {}
76
+ } : null
54
77
  );
55
78
  const annualQuote = usePlanQuote(
56
79
  projectExtId,
57
- enabled && annualNet != null ? { plan: "pro", interval: "year", addons: extras } : null
80
+ enabled && annualNet != null ? {
81
+ plan: "pro",
82
+ interval: "year",
83
+ addons: extras,
84
+ ...activePromo ? { promo_code: activePromo } : {}
85
+ } : null
86
+ );
87
+ const promoChecking = !!activePromo && (monthlyQuote.isFetching || annualQuote.isFetching);
88
+ const promoError = activePromo && (monthlyQuote.error || annualQuote.error);
89
+ const promoApplied = !!activePromo && [monthlyQuote, annualQuote].some(
90
+ (result) => result.data?.promo_code?.toLowerCase() === activePromo.toLowerCase()
58
91
  );
59
92
  const product = products?.[0];
93
+ if (!product || !(product.spend_cap_step_pence > 0))
94
+ return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Prices unavailable. Try again." });
60
95
  const currency = prices.monthly?.currency ?? prices.annual?.currency ?? "gbp";
61
96
  const money = (pence) => formatMoney(pence, currency);
62
- const ai = (product?.included_ai_gbp ?? 0) + aiBlocks * (addonPrice(prices.monthly, "ai_usage")?.ai_gbp ?? 0);
63
- const storage = (product?.included_storage_gb ?? 0) + storageBlocks * (addonPrice(prices.monthly, "storage")?.storage_gb ?? 0);
64
- const collaborators = (product?.included_collaborators ?? 0) + collaboratorBlocks * (prices.monthly?.addon_prices?.find((p) => p.kind === "collaborators")?.collaborators ?? 0);
97
+ const ai = product.included_ai_gbp + aiBlocks * (addonPrice(prices.monthly, "ai_usage")?.ai_gbp ?? 0);
98
+ const storage = product.included_storage_gb + storageBlocks * (addonPrice(prices.monthly, "storage")?.storage_gb ?? 0);
99
+ const collaborators = product.included_collaborators + collaboratorBlocks * (prices.monthly?.addon_prices?.find((p) => p.kind === "collaborators")?.collaborators ?? 0);
100
+ const currentAi = currentQuotas?.ai_usage.limit ?? product.free_ai_gbp;
101
+ const currentStorage = currentQuotas?.storage_gb.limit ?? product.free_storage_gb;
102
+ const currentCollaborators = currentQuotas?.collaborators.limit ?? product.free_collaborators;
103
+ const multiplier = (next, current, extra) => {
104
+ if (next === current) return "Same as now";
105
+ if (current <= 0) return extra;
106
+ const ratio = Number((next / current).toFixed(1));
107
+ return ratio > 1 ? `${ratio}\xD7 more` : `${ratio}\xD7 current`;
108
+ };
65
109
  const saving = monthlyNet && annualNet != null ? Math.max(0, Math.round(100 * (1 - annualNet / (monthlyNet * 12)))) : 0;
66
- const stepPence = product?.spend_cap_step_pence ?? 2e3;
67
- const defaultCap = product?.default_spend_cap_pence ?? 1e4;
68
- const maximumCap = product?.maximum_spend_cap_pence ?? 5e4;
110
+ const stepPence = product.spend_cap_step_pence;
111
+ const increment = (price) => {
112
+ const amounts = price?.addon_prices?.map((addon) => addon.amount_ex_vat) ?? [];
113
+ if (!amounts.length) return null;
114
+ const min = Math.min(...amounts);
115
+ const max = Math.max(...amounts);
116
+ return min === max ? money(min) : `${money(min)}\u2013${money(max)}`;
117
+ };
118
+ const monthlyIncrement = increment(prices.monthly);
119
+ const annualIncrement = increment(prices.annual);
120
+ const defaultCap = product.default_spend_cap_pence;
121
+ const maximumCap = product.maximum_spend_cap_pence;
69
122
  const cap = Math.max(
70
123
  0,
71
124
  Math.min(maximumCap, Math.floor((spendCap ?? defaultCap) / stepPence) * stepPence)
72
125
  );
73
- const monthlyBlock = prices.monthly?.addon_prices?.find(
74
- (p) => p.kind === "ai_usage"
75
- )?.amount_ex_vat;
76
- const annualBlock = prices.annual?.addon_prices?.find((p) => p.kind === "ai_usage")?.amount_ex_vat;
77
- const annualDefaultCap = monthlyBlock && annualBlock != null ? Math.max(
78
- 0,
79
- Math.floor(defaultCap * annualBlock / (monthlyBlock * 12) / stepPence) * stepPence
80
- ) : cap;
81
- const capFor = (interval) => interval === "year" && spendCap == null ? annualDefaultCap : cap;
126
+ const annualUpgradeRates = (prices.monthly?.addon_prices ?? []).flatMap((monthly) => {
127
+ if (!["ai_usage", "storage"].includes(monthly.kind) || monthly.amount_ex_vat <= 0) return [];
128
+ const annual = prices.annual?.addon_prices?.find((price) => price.kind === monthly.kind);
129
+ return annual ? [annual.amount_ex_vat / monthly.amount_ex_vat] : [];
130
+ });
131
+ const annualCeiling = annualNet != null && (cap === 0 || annualUpgradeRates.length > 0) ? annualNet + Math.ceil(cap * Math.max(0, ...annualUpgradeRates)) : void 0;
132
+ const changeSpendCap = (next) => setSpendCap(next);
133
+ const manualOpen = adjustment === "min";
134
+ const changeMinimum = (kind, count) => {
135
+ const nextAi = kind === "ai" ? count : aiBlocks;
136
+ const nextStorage = kind === "storage" ? count : storageBlocks;
137
+ const nextCollaborators = kind === "collaborator" ? count : collaboratorBlocks;
138
+ const nextMinimum = purchaseNet(prices.monthly, nextAi, nextStorage, nextCollaborators);
139
+ if (monthlyNet != null && nextMinimum != null) {
140
+ const overallMaximum = monthlyNet + cap;
141
+ setSpendCap(Math.max(0, Math.floor((overallMaximum - nextMinimum) / stepPence) * stepPence));
142
+ }
143
+ if (kind === "ai") onAiBlocksChange(count);
144
+ else if (kind === "storage") onStorageBlocksChange(count);
145
+ else onCollaboratorBlocksChange(count);
146
+ };
147
+ const dailyCapVisible = dailyCapOpen || !!dailyCapError;
82
148
  const quoteFor = (interval) => interval === "month" ? monthlyQuote.data : annualQuote.data;
83
- const controls = (kind, count, onChange, label, available) => /* @__PURE__ */ jsxs("dd", { className: "project-purchase-allowance-controls", children: [
149
+ const controls = (kind, count, onChange, label, available) => manualOpen ? /* @__PURE__ */ jsxs("div", { className: "project-purchase-allowance-controls", role: "group", "aria-label": label, children: [
84
150
  /* @__PURE__ */ jsx(
85
151
  Button,
86
152
  {
@@ -107,139 +173,406 @@ function ProjectPurchaseOptions({
107
173
  children: /* @__PURE__ */ jsx(Plus, { size: 14, "aria-hidden": "true" })
108
174
  }
109
175
  )
110
- ] });
176
+ ] }) : null;
111
177
  return /* @__PURE__ */ jsxs("div", { className: "project-purchase", "data-testid": "project-purchase-options", children: [
112
- /* @__PURE__ */ jsxs("dl", { className: "project-purchase-inclusions", "aria-live": "polite", children: [
113
- /* @__PURE__ */ jsxs("div", { children: [
114
- /* @__PURE__ */ jsx(Sparkles, { "aria-hidden": "true", className: "project-purchase-icon" }),
115
- /* @__PURE__ */ jsx("dd", { className: "text-xl font-semibold tabular-nums", "data-testid": "purchase-ai-allowance", children: money(ai * 100) }),
116
- /* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: "AI credits / month" }),
117
- controls(
118
- "ai",
119
- aiBlocks,
120
- onAiBlocksChange,
121
- "AI credits",
122
- !!addonPrice(prices.monthly, "ai_usage")
123
- )
178
+ /* @__PURE__ */ jsxs("section", { className: "project-purchase-inclusions-panel", "aria-label": "Plan allowances", children: [
179
+ /* @__PURE__ */ jsxs("dl", { className: "project-purchase-inclusions", "aria-live": "polite", children: [
180
+ /* @__PURE__ */ jsxs("div", { children: [
181
+ /* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: "AI credits / month" }),
182
+ /* @__PURE__ */ jsxs(
183
+ "dd",
184
+ {
185
+ className: "project-purchase-allowance-value text-xl font-semibold tabular-nums",
186
+ "data-testid": "purchase-ai-allowance",
187
+ children: [
188
+ /* @__PURE__ */ jsx(Sparkles, { "aria-hidden": "true", className: "project-purchase-icon" }),
189
+ money(ai * 100)
190
+ ]
191
+ }
192
+ ),
193
+ currentAi != null && /* @__PURE__ */ jsx(
194
+ "dd",
195
+ {
196
+ className: "project-purchase-current",
197
+ "data-increased": ai > currentAi,
198
+ title: `Compared with ${money(currentAi * 100)}/month on your current plan`,
199
+ children: multiplier(ai, currentAi, `+${money((ai - currentAi) * 100)}`)
200
+ }
201
+ )
202
+ ] }),
203
+ /* @__PURE__ */ jsxs("div", { children: [
204
+ /* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: "Storage" }),
205
+ /* @__PURE__ */ jsxs(
206
+ "dd",
207
+ {
208
+ className: "project-purchase-allowance-value text-xl font-semibold tabular-nums",
209
+ "data-testid": "purchase-storage-allowance",
210
+ children: [
211
+ /* @__PURE__ */ jsx(HardDrive, { "aria-hidden": "true", className: "project-purchase-icon" }),
212
+ storage,
213
+ " GB"
214
+ ]
215
+ }
216
+ ),
217
+ currentStorage != null && /* @__PURE__ */ jsx(
218
+ "dd",
219
+ {
220
+ className: "project-purchase-current",
221
+ "data-increased": storage > currentStorage,
222
+ title: `Compared with ${currentStorage} GB on your current plan`,
223
+ children: multiplier(storage, currentStorage, `+${storage - currentStorage} GB`)
224
+ }
225
+ )
226
+ ] }),
227
+ /* @__PURE__ */ jsxs("div", { children: [
228
+ /* @__PURE__ */ jsxs("dt", { className: "text-xs text-muted-foreground", children: [
229
+ collaborators === 1 ? "Collaborator" : "Collaborators",
230
+ " + you"
231
+ ] }),
232
+ /* @__PURE__ */ jsxs(
233
+ "dd",
234
+ {
235
+ className: "project-purchase-allowance-value text-xl font-semibold tabular-nums",
236
+ "data-testid": "purchase-collaborator-allowance",
237
+ children: [
238
+ /* @__PURE__ */ jsx(Users, { "aria-hidden": "true", className: "project-purchase-icon" }),
239
+ collaborators
240
+ ]
241
+ }
242
+ ),
243
+ currentCollaborators != null && /* @__PURE__ */ jsx(
244
+ "dd",
245
+ {
246
+ className: "project-purchase-current",
247
+ "data-increased": collaborators > currentCollaborators,
248
+ title: `Compared with ${currentCollaborators} collaborators on your current plan`,
249
+ children: collaborators === currentCollaborators ? "Same as now" : `${collaborators > currentCollaborators ? "+" : "\u2212"}${Math.abs(collaborators - currentCollaborators)} collaborator${Math.abs(collaborators - currentCollaborators) === 1 ? "" : "s"}`
250
+ }
251
+ )
252
+ ] })
124
253
  ] }),
125
- /* @__PURE__ */ jsxs("div", { children: [
126
- /* @__PURE__ */ jsx(HardDrive, { "aria-hidden": "true", className: "project-purchase-icon" }),
127
- /* @__PURE__ */ jsxs(
128
- "dd",
254
+ /* @__PURE__ */ jsxs("section", { className: "project-purchase-settings", "aria-label": "Allowance settings", children: [
255
+ /* @__PURE__ */ jsxs("div", { className: "project-purchase-settings-row", children: [
256
+ /* @__PURE__ */ jsx("h3", { className: "project-purchase-settings-heading", children: "Extra usage upgrades:" }),
257
+ /* @__PURE__ */ jsxs(
258
+ ToggleGroup,
259
+ {
260
+ type: "single",
261
+ value: adjustment,
262
+ onValueChange: (value) => {
263
+ if (value === "min" || value === "max") setAdjustment(value);
264
+ },
265
+ disabled: busy,
266
+ className: "project-purchase-mode",
267
+ "aria-label": "Allowance adjustment",
268
+ children: [
269
+ /* @__PURE__ */ jsx(ToggleGroupItem, { value: "min", children: "Manual" }),
270
+ /* @__PURE__ */ jsx(ToggleGroupItem, { value: "max", children: "Automatic" })
271
+ ]
272
+ }
273
+ )
274
+ ] }),
275
+ !manualOpen && /* @__PURE__ */ jsx("div", { "data-testid": "auto-upgrade-section", children: /* @__PURE__ */ jsx(
276
+ MonthlySpendCap,
129
277
  {
130
- className: "text-xl font-semibold tabular-nums",
131
- "data-testid": "purchase-storage-allowance",
132
- children: [
133
- storage,
134
- " GB"
135
- ]
278
+ value: cap,
279
+ minimum: 0,
280
+ basePence: monthlyNet ?? 0,
281
+ annualMaximumPence: annualCeiling,
282
+ control: "purchase",
283
+ stepPence,
284
+ maximum: maximumCap,
285
+ onChange: changeSpendCap,
286
+ disabled: busy,
287
+ compact: true
136
288
  }
137
- ),
138
- /* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: "Storage" }),
139
- controls(
140
- "storage",
141
- storageBlocks,
142
- onStorageBlocksChange,
143
- "storage",
144
- !!addonPrice(prices.monthly, "storage")
145
- )
146
- ] }),
147
- /* @__PURE__ */ jsxs("div", { children: [
148
- /* @__PURE__ */ jsx(Users, { "aria-hidden": "true", className: "project-purchase-icon" }),
289
+ ) }),
290
+ manualOpen && /* @__PURE__ */ jsxs("div", { className: "project-purchase-adjustments", children: [
291
+ /* @__PURE__ */ jsxs("p", { className: "project-purchase-manual-intro", children: [
292
+ "Purchase only what you need",
293
+ (monthlyIncrement || annualIncrement) && /* @__PURE__ */ jsxs(Fragment, { children: [
294
+ " ",
295
+ "(increments of ",
296
+ monthlyIncrement && `${monthlyIncrement}/monthly`,
297
+ monthlyIncrement && annualIncrement && " \xB7 ",
298
+ annualIncrement && `${annualIncrement}/annual`,
299
+ ")"
300
+ ] })
301
+ ] }),
302
+ controls(
303
+ "ai",
304
+ aiBlocks,
305
+ (count) => changeMinimum("ai", count),
306
+ "AI credits",
307
+ !!addonPrice(prices.monthly, "ai_usage")
308
+ ),
309
+ controls(
310
+ "storage",
311
+ storageBlocks,
312
+ (count) => changeMinimum("storage", count),
313
+ "storage",
314
+ !!addonPrice(prices.monthly, "storage")
315
+ ),
316
+ controls(
317
+ "collaborator",
318
+ collaboratorBlocks,
319
+ (count) => changeMinimum("collaborator", count),
320
+ "collaborator places",
321
+ !!prices.monthly?.addon_prices?.find((p) => p.kind === "collaborators")
322
+ )
323
+ ] })
324
+ ] })
325
+ ] }),
326
+ onDailyCapChange && /* @__PURE__ */ jsxs("section", { className: "project-purchase-daily-foldout", children: [
327
+ /* @__PURE__ */ jsxs(
328
+ "button",
329
+ {
330
+ type: "button",
331
+ className: "project-purchase-setting-toggle",
332
+ "aria-expanded": dailyCapVisible,
333
+ "aria-controls": dailyCapId,
334
+ onClick: () => setDailyCapOpen(!dailyCapVisible),
335
+ disabled: busy,
336
+ children: [
337
+ /* @__PURE__ */ jsx(Users, { "aria-hidden": "true", className: "h-4 w-4" }),
338
+ "Set collaborator spend limit",
339
+ /* @__PURE__ */ jsx(
340
+ ChevronDown,
341
+ {
342
+ "aria-hidden": "true",
343
+ className: `h-4 w-4 transition-transform ${dailyCapVisible ? "rotate-180" : ""}`
344
+ }
345
+ )
346
+ ]
347
+ }
348
+ ),
349
+ dailyCapVisible && /* @__PURE__ */ jsxs(
350
+ "div",
351
+ {
352
+ id: dailyCapId,
353
+ className: "project-purchase-daily-cap",
354
+ role: "region",
355
+ "aria-label": "Collaborator daily AI limit",
356
+ children: [
357
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Collaborators share your project's quota." }),
358
+ /* @__PURE__ */ jsx(
359
+ DailyCapField,
360
+ {
361
+ value: dailyCapValue ?? "",
362
+ onChange: onDailyCapChange,
363
+ onSave: onSaveDailyCap,
364
+ canSave: canSaveDailyCap,
365
+ isSaving: busy,
366
+ labels: { unit: "\xA3 / day each" }
367
+ }
368
+ ),
369
+ dailyCapError && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive", children: dailyCapError })
370
+ ]
371
+ }
372
+ )
373
+ ] }),
374
+ onPromoCodeChange && /* @__PURE__ */ jsxs("div", { className: "project-purchase-promo project-purchase-daily-foldout", children: [
375
+ /* @__PURE__ */ jsxs(
376
+ "button",
377
+ {
378
+ type: "button",
379
+ className: "project-purchase-setting-toggle",
380
+ "aria-expanded": promoOpen,
381
+ "aria-controls": `${promoId}-panel`,
382
+ onClick: () => setPromoOpen((value) => !value),
383
+ disabled: busy,
384
+ children: [
385
+ /* @__PURE__ */ jsx(Tag, { "aria-hidden": "true", className: "h-4 w-4" }),
386
+ "Have a promo code?",
387
+ /* @__PURE__ */ jsx(
388
+ ChevronDown,
389
+ {
390
+ "aria-hidden": "true",
391
+ className: `h-4 w-4 transition-transform ${promoOpen ? "rotate-180" : ""}`
392
+ }
393
+ )
394
+ ]
395
+ }
396
+ ),
397
+ promoOpen && /* @__PURE__ */ jsxs("div", { id: `${promoId}-panel`, className: "space-y-1.5 pb-3", children: [
398
+ /* @__PURE__ */ jsx(Label, { htmlFor: promoId, children: "Promo code (optional)" }),
399
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
400
+ /* @__PURE__ */ jsx(
401
+ Input,
402
+ {
403
+ id: promoId,
404
+ value: promoCode,
405
+ onChange: (event) => {
406
+ onPromoCodeChange(event.target.value);
407
+ setActivePromo("");
408
+ },
409
+ disabled: busy,
410
+ autoComplete: "off",
411
+ placeholder: "Enter promo code",
412
+ "aria-describedby": `${promoId}-status`
413
+ }
414
+ ),
415
+ /* @__PURE__ */ jsx(
416
+ Button,
417
+ {
418
+ type: "button",
419
+ disabled: busy || promoChecking || !promoCode.trim(),
420
+ onClick: () => {
421
+ if (activePromo === promoCode.trim()) {
422
+ void monthlyQuote.refetch();
423
+ void annualQuote.refetch();
424
+ } else setActivePromo(promoCode.trim());
425
+ },
426
+ children: promoChecking ? "Checking\u2026" : "Apply"
427
+ }
428
+ )
429
+ ] }),
149
430
  /* @__PURE__ */ jsx(
150
- "dd",
431
+ "p",
151
432
  {
152
- className: "text-xl font-semibold tabular-nums",
153
- "data-testid": "purchase-collaborator-allowance",
154
- children: collaborators
433
+ id: `${promoId}-status`,
434
+ role: "status",
435
+ className: `text-sm ${promoError && !promoApplied ? "text-destructive" : "text-muted-foreground"}`,
436
+ children: promoChecking ? "Checking your code\u2026" : promoError && !promoApplied ? quoteError(promoError).message ?? "This promo code could not be applied." : promoApplied ? `${activePromo} applied \xB7 ${monthlyQuote.data?.discount_label ?? annualQuote.data?.discount_label ?? "discount included below"}` : "Apply your code to see the updated price."
155
437
  }
156
- ),
157
- /* @__PURE__ */ jsxs("dt", { className: "text-xs text-muted-foreground", children: [
158
- collaborators === 1 ? "Collaborator" : "Collaborators",
159
- " + you"
160
- ] }),
161
- controls(
162
- "collaborator",
163
- collaboratorBlocks,
164
- onCollaboratorBlocksChange,
165
- "collaborator places",
166
- !!prices.monthly?.addon_prices?.find((p) => p.kind === "collaborators")
167
438
  )
168
439
  ] })
169
440
  ] }),
170
- /* @__PURE__ */ jsx("div", { className: "project-purchase-cap", children: /* @__PURE__ */ jsx(
171
- MonthlySpendCap,
441
+ /* @__PURE__ */ jsxs(
442
+ "div",
172
443
  {
173
- value: cap,
174
- minimum: 0,
175
- stepPence,
176
- maximum: product?.maximum_spend_cap_pence,
177
- onChange: setSpendCap,
178
- compact: true
179
- }
180
- ) }),
181
- /* @__PURE__ */ jsx("div", { className: "project-purchase-prices", children: ["month", "year"].map((interval) => {
182
- const net = interval === "month" ? monthlyNet : annualNet;
183
- const quote = quoteFor(interval);
184
- const recurring = quote?.total_pence ?? net;
185
- const credit = recurring != null ? applyReferralReward(recurring, reward, currency) : null;
186
- const amount = credit?.youPay ?? recurring;
187
- return /* @__PURE__ */ jsxs(
188
- "button",
189
- {
190
- type: "button",
191
- disabled: disabled || busy || amount == null,
192
- onClick: () => onChoose(interval, capFor(interval), quote),
193
- "data-testid": `purchase-${interval}`,
194
- className: `project-purchase-price ${interval === "year" ? "project-purchase-price-annual" : ""}`,
195
- children: [
196
- /* @__PURE__ */ jsxs("span", { className: "project-purchase-price-heading", children: [
197
- /* @__PURE__ */ jsx("span", { className: "project-purchase-period", children: interval === "month" ? "Monthly" : "Annual" }),
198
- interval === "year" && saving > 0 && /* @__PURE__ */ jsxs("span", { className: "project-purchase-saving", children: [
199
- "Save ",
200
- saving,
201
- "%"
202
- ] })
203
- ] }),
204
- credit && credit.bonus > 0 && recurring != null && /* @__PURE__ */ jsxs(
205
- "span",
444
+ className: `project-purchase-prices ${onChooseFree ? "project-purchase-prices-with-free" : ""}`,
445
+ children: [
446
+ onChooseFree && /* @__PURE__ */ jsxs(
447
+ "button",
448
+ {
449
+ type: "button",
450
+ className: "project-purchase-price project-purchase-price-free",
451
+ "data-testid": "purchase-free",
452
+ "aria-describedby": "purchase-free-summary",
453
+ disabled: disabled || busy,
454
+ onClick: onChooseFree,
455
+ children: [
456
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-price-heading", children: /* @__PURE__ */ jsx("span", { className: "project-purchase-period", children: "No Subscription" }) }),
457
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-details", children: /* @__PURE__ */ jsxs(
458
+ "span",
459
+ {
460
+ id: "purchase-free-summary",
461
+ "data-testid": "purchase-free-summary",
462
+ className: "project-purchase-free-allowances",
463
+ children: [
464
+ /* @__PURE__ */ jsxs("span", { title: "AI credits per month", children: [
465
+ /* @__PURE__ */ jsx(Sparkles, { "aria-hidden": "true" }),
466
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "AI credits: " }),
467
+ product.free_ai_gbp != null ? `${money(product.free_ai_gbp * 100)}/mo` : "\u2014"
468
+ ] }),
469
+ /* @__PURE__ */ jsxs("span", { title: "Storage", children: [
470
+ /* @__PURE__ */ jsx(HardDrive, { "aria-hidden": "true" }),
471
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Storage: " }),
472
+ product.free_storage_gb != null ? `${product.free_storage_gb} GB` : "\u2014"
473
+ ] }),
474
+ /* @__PURE__ */ jsxs("span", { title: "Collaborators", children: [
475
+ /* @__PURE__ */ jsx(Users, { "aria-hidden": "true" }),
476
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Collaborators: " }),
477
+ product.free_collaborators ?? "\u2014"
478
+ ] })
479
+ ]
480
+ }
481
+ ) }),
482
+ /* @__PURE__ */ jsxs("span", { className: "project-purchase-total", children: [
483
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-due", "aria-hidden": "true" }),
484
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-amount", children: "Free" })
485
+ ] })
486
+ ]
487
+ }
488
+ ),
489
+ ["month", "year"].map((interval) => {
490
+ const net = interval === "month" ? monthlyNet : annualNet;
491
+ const quote = quoteFor(interval);
492
+ const quoteState = interval === "month" ? monthlyQuote : annualQuote;
493
+ const discounted = !!activePromo && quote?.promo_code?.toLowerCase() === activePromo.toLowerCase();
494
+ const promoBlocked = !!promoCode.trim() && (!discounted || !!quoteState.isFetching);
495
+ const recurring = quote?.renewal_total_pence ?? quote?.total_pence ?? net;
496
+ const today = quote?.total_pence ?? net;
497
+ const credit = today != null ? applyReferralReward(today, reward, currency) : null;
498
+ const amount = promoBlocked ? null : credit?.youPay ?? today;
499
+ return /* @__PURE__ */ jsxs(
500
+ "button",
206
501
  {
207
- className: "project-purchase-credit",
208
- "data-testid": `purchase-${interval}-credit`,
502
+ type: "button",
503
+ disabled: disabled || busy || amount == null,
504
+ onClick: () => onChoose(interval, cap, quote),
505
+ "data-testid": `purchase-${interval}`,
506
+ className: `project-purchase-price ${interval === "year" ? "project-purchase-price-annual" : ""}`,
209
507
  children: [
210
- /* @__PURE__ */ jsxs("span", { children: [
211
- /* @__PURE__ */ jsxs("span", { children: [
212
- "Plan + add-ons",
213
- quote && quote.tax_pence > 0 ? " incl. tax" : ""
214
- ] }),
215
- /* @__PURE__ */ jsx("span", { children: money(recurring) })
508
+ interval === "year" && saving > 0 && /* @__PURE__ */ jsxs("span", { className: "project-purchase-saving", children: [
509
+ "Save ",
510
+ saving,
511
+ "%"
512
+ ] }),
513
+ /* @__PURE__ */ jsxs("span", { className: "project-purchase-price-heading project-purchase-select", children: [
514
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-period", children: interval === "month" ? "Select monthly" : "Select annual" }),
515
+ /* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": "true", size: 16 })
216
516
  ] }),
217
- /* @__PURE__ */ jsxs("span", { children: [
218
- /* @__PURE__ */ jsx("span", { children: "Account credit" }),
219
- /* @__PURE__ */ jsxs("span", { children: [
220
- "\u2212",
221
- money(credit.bonus)
517
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-details", children: (discounted || credit && credit.bonus > 0) && recurring != null && /* @__PURE__ */ jsxs(
518
+ "span",
519
+ {
520
+ className: "project-purchase-credit",
521
+ "data-testid": `purchase-${interval}-credit`,
522
+ children: [
523
+ /* @__PURE__ */ jsxs("span", { children: [
524
+ /* @__PURE__ */ jsxs("span", { children: [
525
+ "Subscription",
526
+ !discounted && quote && quote.tax_pence > 0 ? " incl. tax" : ""
527
+ ] }),
528
+ /* @__PURE__ */ jsx("span", { children: money(
529
+ discounted ? quote.subtotal_pence + (quote.discount_pence ?? 0) : recurring
530
+ ) })
531
+ ] }),
532
+ discounted && /* @__PURE__ */ jsxs("span", { children: [
533
+ /* @__PURE__ */ jsxs("span", { children: [
534
+ "Promo ",
535
+ quote.promo_code
536
+ ] }),
537
+ /* @__PURE__ */ jsxs("span", { children: [
538
+ "\u2212",
539
+ money(quote.discount_pence ?? 0)
540
+ ] })
541
+ ] }),
542
+ discounted && quote.tax_pence > 0 && /* @__PURE__ */ jsxs("span", { children: [
543
+ /* @__PURE__ */ jsx("span", { children: quote.tax_label ?? "Tax" }),
544
+ /* @__PURE__ */ jsx("span", { children: money(quote.tax_pence) })
545
+ ] }),
546
+ credit && credit.bonus > 0 && /* @__PURE__ */ jsxs("span", { children: [
547
+ /* @__PURE__ */ jsx("span", { children: "Account credit" }),
548
+ /* @__PURE__ */ jsxs("span", { children: [
549
+ "\u2212",
550
+ money(credit.bonus)
551
+ ] })
552
+ ] })
553
+ ]
554
+ }
555
+ ) }),
556
+ /* @__PURE__ */ jsxs("span", { className: "project-purchase-total", children: [
557
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-due text-xs", children: quote && quote.tax_calculated !== false ? quote.tax_pence > 0 ? "Due now (incl. tax)" : "Due now" : "Due now (ex VAT)" }),
558
+ /* @__PURE__ */ jsx("span", { className: "project-purchase-amount", children: amount != null ? money(amount) : "\u2014" }),
559
+ recurring != null && /* @__PURE__ */ jsxs("span", { className: "project-purchase-renewal text-xs", children: [
560
+ "Then ",
561
+ money(recurring),
562
+ "/",
563
+ interval === "year" ? "year" : "month",
564
+ quote?.renewal_note ? ` \xB7 ${quote.renewal_note.toLowerCase()}` : ""
222
565
  ] })
223
566
  ] })
224
567
  ]
225
- }
226
- ),
227
- /* @__PURE__ */ jsxs("span", { className: "project-purchase-total", children: [
228
- /* @__PURE__ */ jsx("span", { className: "text-xs", children: quote ? quote.tax_pence > 0 ? "Due now incl. tax" : "Due now" : "Due now ex VAT" }),
229
- /* @__PURE__ */ jsx("span", { className: "project-purchase-amount", children: amount != null ? money(amount) : "\u2014" })
230
- ] }),
231
- /* @__PURE__ */ jsx("span", { className: "mt-1 text-xs text-muted-foreground", children: credit && credit.bonus > 0 && recurring != null ? `Then ${money(recurring)}/${interval === "year" ? "year" : "month"}` : interval === "year" && recurring != null ? `${money(Math.round(recurring / 12))}/month equivalent` : "Renews monthly" }),
232
- /* @__PURE__ */ jsxs("span", { className: "project-purchase-cta", children: [
233
- "Choose ",
234
- interval === "month" ? "monthly" : "annual",
235
- /* @__PURE__ */ jsx(ArrowRight, { "aria-hidden": "true", size: 14 })
236
- ] })
237
- ]
238
- },
239
- interval
240
- );
241
- }) }),
242
- busy && /* @__PURE__ */ jsx("p", { role: "status", className: "text-sm text-muted-foreground", children: "Opening payment\u2026" })
568
+ },
569
+ interval
570
+ );
571
+ })
572
+ ]
573
+ }
574
+ ),
575
+ busy && /* @__PURE__ */ jsx("p", { role: "status", className: "text-sm text-muted-foreground", children: busyLabel })
243
576
  ] });
244
577
  }
245
578
  export {