@arbidocs/blocks 0.5.130 → 0.5.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DocumentReviewCard-M53XFLI2.cjs → DocumentReviewCard-2VI5OOLE.cjs} +3 -3
- package/dist/{DocumentReviewCard-M53XFLI2.cjs.map → DocumentReviewCard-2VI5OOLE.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-EFRMXIM5.cjs → FilesViewerDialog-77YTFIX3.cjs} +4 -4
- package/dist/{FilesViewerDialog-EFRMXIM5.cjs.map → FilesViewerDialog-77YTFIX3.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-QPROJRCF.cjs → WorkspaceTableView-7BMZ2O3Y.cjs} +6 -6
- package/dist/{WorkspaceTableView-QPROJRCF.cjs.map → WorkspaceTableView-7BMZ2O3Y.cjs.map} +1 -1
- package/dist/{chunk-KWHGYHRC.cjs → chunk-KSDTK66A.cjs} +2 -2
- package/dist/{chunk-KWHGYHRC.cjs.map → chunk-KSDTK66A.cjs.map} +1 -1
- package/dist/{chunk-MI3N3ZOT.cjs → chunk-PDDYAY4Z.cjs} +20 -20
- package/dist/{chunk-MI3N3ZOT.cjs.map → chunk-PDDYAY4Z.cjs.map} +1 -1
- package/dist/{chunk-T73BHNQX.cjs → chunk-TBPCG2PV.cjs} +240 -89
- package/dist/chunk-TBPCG2PV.cjs.map +1 -0
- package/dist/{chunk-GOQV6NOK.cjs → chunk-U7KB42OQ.cjs} +4 -4
- package/dist/{chunk-GOQV6NOK.cjs.map → chunk-U7KB42OQ.cjs.map} +1 -1
- package/dist/{chunk-GEZB3OEC.cjs → chunk-XJE7W42L.cjs} +18 -17
- package/dist/chunk-XJE7W42L.cjs.map +1 -0
- package/dist/connect/index.cjs +1413 -653
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +1 -1
- package/dist/connection/billing/ChangePlanDialog.d.ts +2 -1
- package/dist/connection/billing/ChangePlanDialog.js +8 -3
- package/dist/connection/billing/ChangePlanDialog.js.map +2 -2
- package/dist/connection/billing/ChangeProPlan.js +4 -4
- package/dist/connection/billing/ChangeProPlan.js.map +2 -2
- package/dist/connection/billing/CollaboratorPlan.js +5 -3
- package/dist/connection/billing/CollaboratorPlan.js.map +2 -2
- package/dist/connection/billing/ConnectedWelcomeDialog.d.ts +5 -13
- package/dist/connection/billing/ConnectedWelcomeDialog.js +38 -19
- package/dist/connection/billing/ConnectedWelcomeDialog.js.map +2 -2
- package/dist/connection/billing/MonthlySpendCap.d.ts +10 -3
- package/dist/connection/billing/MonthlySpendCap.js +103 -11
- package/dist/connection/billing/MonthlySpendCap.js.map +2 -2
- package/dist/connection/billing/NewProjectFlow.js +20 -7
- package/dist/connection/billing/NewProjectFlow.js.map +2 -2
- package/dist/connection/billing/ProjectDetail.js +1 -1
- package/dist/connection/billing/ProjectDetail.js.map +2 -2
- package/dist/connection/billing/ProjectPurchaseOptions.d.ts +14 -3
- package/dist/connection/billing/ProjectPurchaseOptions.js +472 -139
- package/dist/connection/billing/ProjectPurchaseOptions.js.map +2 -2
- package/dist/connection/billing/ProjectUsageCard.js +4 -4
- package/dist/connection/billing/ProjectUsageCard.js.map +2 -2
- package/dist/connection/billing/ReduceAddonDialog.js +2 -2
- package/dist/connection/billing/ReduceAddonDialog.js.map +2 -2
- package/dist/connection/billing/StripeCheckoutModal.js +3 -2
- package/dist/connection/billing/StripeCheckoutModal.js.map +2 -2
- package/dist/connection/billing/SubscriptionPlans.d.ts +5 -1
- package/dist/connection/billing/SubscriptionPlans.js +89 -6
- package/dist/connection/billing/SubscriptionPlans.js.map +2 -2
- package/dist/connection/billing/index.d.ts +1 -1
- package/dist/connection/billing/index.js +2 -2
- package/dist/connection/billing/index.js.map +2 -2
- package/dist/connection/billing/referral-reward.d.ts +2 -3
- package/dist/connection/billing/referral-reward.js +8 -3
- package/dist/connection/billing/referral-reward.js.map +2 -2
- package/dist/connection/billing/tax-quote.d.ts +2 -2
- package/dist/connection/billing/tax-quote.js +1 -0
- package/dist/connection/billing/tax-quote.js.map +2 -2
- package/dist/connection/command/ConnectedCommandPalette.js +2 -0
- package/dist/connection/command/ConnectedCommandPalette.js.map +2 -2
- package/dist/connection/command/actions.js +1 -1
- package/dist/connection/command/actions.js.map +2 -2
- package/dist/connection/contacts/ConnectedAddContacts.d.ts +7 -1
- package/dist/connection/contacts/ConnectedAddContacts.js +33 -17
- package/dist/connection/contacts/ConnectedAddContacts.js.map +2 -2
- package/dist/connection/contacts/ConnectedInviteContactsDialog.js +3 -2
- package/dist/connection/contacts/ConnectedInviteContactsDialog.js.map +2 -2
- package/dist/connection/contacts/ConnectedWelcomeInvitations.d.ts +6 -0
- package/dist/connection/contacts/ConnectedWelcomeInvitations.js +198 -0
- package/dist/connection/contacts/ConnectedWelcomeInvitations.js.map +7 -0
- package/dist/connection/projects/ConnectedProjectsPanel.js +17 -5
- package/dist/connection/projects/ConnectedProjectsPanel.js.map +2 -2
- package/dist/connection/shell/ConnectedWorkspaceSwitcher.js +3 -3
- package/dist/connection/shell/ConnectedWorkspaceSwitcher.js.map +2 -2
- package/dist/connection/workspace-form/ConnectedWorkspaceFormModal.js +2 -2
- package/dist/connection/workspace-form/ConnectedWorkspaceFormModal.js.map +2 -2
- package/dist/connection/workspace-list/ConnectedWorkspaceList.js +1 -1
- package/dist/connection/workspace-list/ConnectedWorkspaceList.js.map +2 -2
- package/dist/connection/workspace-list/useConnectedWorkspaceList.d.ts +1 -1
- package/dist/connection/workspace-list/useConnectedWorkspaceList.js +4 -4
- package/dist/connection/workspace-list/useConnectedWorkspaceList.js.map +2 -2
- package/dist/embed/index.cjs +8 -8
- package/dist/index.cjs +48 -48
- package/dist/index.cjs.map +1 -1
- package/dist/nav/actions.d.ts +2 -0
- package/dist/nav/actions.js.map +2 -2
- package/dist/settings/Billing.d.ts +2 -2
- package/dist/settings/Billing.js +4 -3
- package/dist/settings/Billing.js.map +2 -2
- package/dist/settings/PanelFrame.d.ts +3 -1
- package/dist/settings/PanelFrame.js +3 -2
- package/dist/settings/PanelFrame.js.map +2 -2
- package/dist/settings/SubscriptionParts.d.ts +4 -2
- package/dist/settings/SubscriptionParts.js +22 -3
- package/dist/settings/SubscriptionParts.js.map +2 -2
- package/dist/settings/WelcomeDialog.d.ts +31 -4
- package/dist/settings/WelcomeDialog.js +221 -82
- package/dist/settings/WelcomeDialog.js.map +2 -2
- package/dist/settings/index.cjs +144 -144
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +7 -7
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/src/connection/billing/project-purchase.css +518 -39
- package/dist/chunk-GEZB3OEC.cjs.map +0 -1
- package/dist/chunk-T73BHNQX.cjs.map +0 -1
|
@@ -1,34 +1,125 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import { Label } from "@arbidocs/react/ui";
|
|
4
|
+
import { Button, Checkbox, Label } from "@arbidocs/react/ui";
|
|
5
5
|
import { formatMoney } from "./reward-balance.js";
|
|
6
|
+
import { Minus, Plus } from "lucide-react";
|
|
6
7
|
function MonthlySpendCap({
|
|
7
8
|
value,
|
|
8
9
|
minimum,
|
|
9
10
|
maximum,
|
|
10
|
-
stepPence
|
|
11
|
+
stepPence,
|
|
11
12
|
onChange,
|
|
12
13
|
inputRef,
|
|
13
14
|
testId = "spend-cap-input",
|
|
14
|
-
compact = false
|
|
15
|
+
compact = false,
|
|
16
|
+
control = "slider",
|
|
17
|
+
basePence = 0,
|
|
18
|
+
annualMaximumPence,
|
|
19
|
+
onEnabledChange,
|
|
20
|
+
disabled = false
|
|
15
21
|
}) {
|
|
16
22
|
const id = useId();
|
|
17
23
|
const step = stepPence / 100;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
24
|
+
const minimumExtra = Math.ceil(minimum / stepPence) * stepPence;
|
|
25
|
+
const maximumExtra = Math.max(Math.floor(maximum / stepPence) * stepPence, minimumExtra);
|
|
26
|
+
const extra = Math.max(
|
|
27
|
+
minimumExtra,
|
|
28
|
+
Math.min(maximumExtra, Math.floor(value / stepPence) * stepPence)
|
|
29
|
+
);
|
|
30
|
+
const min = (basePence + minimumExtra) / 100;
|
|
31
|
+
const max = (basePence + maximumExtra) / 100;
|
|
32
|
+
const pounds = (basePence + extra) / 100;
|
|
21
33
|
const money = (n) => formatMoney(n, "gbp");
|
|
34
|
+
if (control === "purchase")
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", { className: "project-purchase-auto-summary", children: [
|
|
36
|
+
/* @__PURE__ */ jsx("span", { className: "project-purchase-ceiling-intro text-muted-foreground", children: "Project spend cap if I exceed my quota:" }),
|
|
37
|
+
/* @__PURE__ */ jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: "project-purchase-ceiling-columns",
|
|
41
|
+
role: "group",
|
|
42
|
+
"aria-label": "Auto-upgrade maximum",
|
|
43
|
+
"data-testid": "auto-upgrade-maximum",
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsxs(
|
|
46
|
+
"output",
|
|
47
|
+
{
|
|
48
|
+
className: "project-purchase-ceiling-monthly",
|
|
49
|
+
id,
|
|
50
|
+
"data-testid": testId,
|
|
51
|
+
"aria-live": "polite",
|
|
52
|
+
"aria-label": `${money(pounds * 100)} maximum per month`,
|
|
53
|
+
children: [
|
|
54
|
+
money(pounds * 100),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { className: "project-purchase-ceiling-unit", children: "/monthly" })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsxs("div", { className: "project-purchase-max-stepper", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
Button,
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
variant: "outline",
|
|
65
|
+
size: "icon",
|
|
66
|
+
"aria-label": "Decrease auto-upgrade maximum",
|
|
67
|
+
disabled: disabled || extra <= minimumExtra,
|
|
68
|
+
onClick: () => onChange(Math.max(minimumExtra, extra - stepPence)),
|
|
69
|
+
children: /* @__PURE__ */ jsx(Minus, { size: 14, "aria-hidden": "true" })
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Button,
|
|
74
|
+
{
|
|
75
|
+
type: "button",
|
|
76
|
+
variant: "outline",
|
|
77
|
+
size: "icon",
|
|
78
|
+
"aria-label": "Increase auto-upgrade maximum",
|
|
79
|
+
disabled: disabled || extra >= maximumExtra,
|
|
80
|
+
onClick: () => onChange(Math.min(maximumExtra, extra + stepPence)),
|
|
81
|
+
children: /* @__PURE__ */ jsx(Plus, { size: 14, "aria-hidden": "true" })
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] }),
|
|
85
|
+
annualMaximumPence != null && /* @__PURE__ */ jsx("div", { className: "project-purchase-annual-maximum", "data-testid": "annual-spend-ceiling", children: /* @__PURE__ */ jsxs(
|
|
86
|
+
"output",
|
|
87
|
+
{
|
|
88
|
+
"aria-live": "polite",
|
|
89
|
+
"aria-label": `${money(annualMaximumPence)} maximum with annual billing`,
|
|
90
|
+
children: [
|
|
91
|
+
money(annualMaximumPence),
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "project-purchase-ceiling-unit", children: "/annual" })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
22
100
|
return /* @__PURE__ */ jsxs("div", { className: "w-full space-y-2", children: [
|
|
23
101
|
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-4", children: [
|
|
24
|
-
/* @__PURE__ */
|
|
102
|
+
onEnabledChange ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
Checkbox,
|
|
105
|
+
{
|
|
106
|
+
id: `${id}-enabled`,
|
|
107
|
+
checked: extra > 0,
|
|
108
|
+
disabled: disabled || maximumExtra === 0,
|
|
109
|
+
onCheckedChange: (checked) => onEnabledChange(checked === true),
|
|
110
|
+
className: "project-purchase-auto-checkbox"
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${id}-enabled`, children: "Auto-upgrade" }),
|
|
114
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: id, className: "sr-only", children: "Auto-upgrade limit" })
|
|
115
|
+
] }) : /* @__PURE__ */ jsx(Label, { htmlFor: id, children: "Auto-upgrade limit" }),
|
|
25
116
|
/* @__PURE__ */ jsxs("output", { htmlFor: id, className: "font-semibold tabular-nums", children: [
|
|
26
|
-
"+",
|
|
117
|
+
basePence > 0 ? "" : "+",
|
|
27
118
|
money(pounds * 100),
|
|
28
119
|
"/month ex VAT"
|
|
29
120
|
] })
|
|
30
121
|
] }),
|
|
31
|
-
/* @__PURE__ */ jsx("p", { id: `${id}-description`, className: "text-xs text-muted-foreground", children:
|
|
122
|
+
/* @__PURE__ */ jsx("p", { id: `${id}-description`, className: "text-xs text-muted-foreground", children: extra === 0 ? "Automatic upgrades are off." : basePence > 0 ? `Monthly plan and add-ons ${money(basePence)} + up to ${money(extra)} in automatic upgrades. We notify you before an upgrade.` : "Just-in-time upgrades avoid work interruption when you hit your limits. We notify you before any upgrade." }),
|
|
32
123
|
/* @__PURE__ */ jsx(
|
|
33
124
|
"input",
|
|
34
125
|
{
|
|
@@ -39,9 +130,10 @@ function MonthlySpendCap({
|
|
|
39
130
|
max,
|
|
40
131
|
step,
|
|
41
132
|
value: pounds,
|
|
42
|
-
onChange: (event) => onChange(Number(event.target.value) * 100),
|
|
133
|
+
onChange: (event) => onChange(Math.round(Number(event.target.value) * 100) - basePence),
|
|
134
|
+
disabled,
|
|
43
135
|
"aria-describedby": `${id}-description`,
|
|
44
|
-
"aria-valuetext": `${money(pounds * 100)} extra per month for automatic upgrades, beyond your selected plan and add-ons, plus VAT`,
|
|
136
|
+
"aria-valuetext": basePence > 0 ? `${money(pounds * 100)} total per month, including ${money(basePence)} for the selected monthly plan and add-ons and up to ${money(extra)} for automatic upgrades, plus VAT` : `${money(pounds * 100)} extra per month for automatic upgrades, beyond your selected plan and add-ons, plus VAT`,
|
|
45
137
|
style: {
|
|
46
138
|
"--cap-progress": `${max > min ? (pounds - min) / (max - min) * 100 : 100}%`
|
|
47
139
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/billing/MonthlySpendCap.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useId, type CSSProperties, type Ref } from 'react'\nimport { Label } from '@arbidocs/react/ui'\nimport { formatMoney } from './reward-balance'\n\n/** Monthly budget for automatic upgrades. Defaults are owned by the caller. */\nexport function MonthlySpendCap({\n value,\n minimum,\n maximum,\n stepPence
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["import { useId, type CSSProperties, type Ref } from 'react'\nimport { Button, Checkbox, Label } from '@arbidocs/react/ui'\nimport { formatMoney } from './reward-balance'\nimport { Minus, Plus } from 'lucide-react'\n\n/** Monthly budget for automatic upgrades. Defaults are owned by the caller. */\nexport function MonthlySpendCap({\n value,\n minimum,\n maximum,\n stepPence,\n onChange,\n inputRef,\n testId = 'spend-cap-input',\n compact = false,\n control = 'slider',\n basePence = 0,\n annualMaximumPence,\n onEnabledChange,\n disabled = false,\n}: {\n value: number\n minimum: number\n maximum: number\n stepPence: number\n onChange: (pence: number) => void\n inputRef?: Ref<HTMLInputElement>\n compact?: boolean\n control?: 'slider' | 'purchase'\n /** Include the selected subscription and add-ons in the displayed monthly total. */\n basePence?: number\n /** Estimated full-year ceiling using the annual catalogue's prices, before credits and tax. */\n annualMaximumPence?: number\n onEnabledChange?: (enabled: boolean) => void\n disabled?: boolean\n testId?: string\n}) {\n const id = useId()\n const step = stepPence / 100\n const minimumExtra = Math.ceil(minimum / stepPence) * stepPence\n const maximumExtra = Math.max(Math.floor(maximum / stepPence) * stepPence, minimumExtra)\n const extra = Math.max(\n minimumExtra,\n Math.min(maximumExtra, Math.floor(value / stepPence) * stepPence)\n )\n const min = (basePence + minimumExtra) / 100\n const max = (basePence + maximumExtra) / 100\n const pounds = (basePence + extra) / 100\n const money = (n: number) => formatMoney(n, 'gbp')\n if (control === 'purchase')\n return (\n <div className=\"project-purchase-auto-summary\">\n <span className=\"project-purchase-ceiling-intro text-muted-foreground\">\n Project spend cap if I exceed my quota:\n </span>\n <div\n className=\"project-purchase-ceiling-columns\"\n role=\"group\"\n aria-label=\"Auto-upgrade maximum\"\n data-testid=\"auto-upgrade-maximum\"\n >\n <output\n className=\"project-purchase-ceiling-monthly\"\n id={id}\n data-testid={testId}\n aria-live=\"polite\"\n aria-label={`${money(pounds * 100)} maximum per month`}\n >\n {money(pounds * 100)}\n <span className=\"project-purchase-ceiling-unit\">/monthly</span>\n </output>\n <div className=\"project-purchase-max-stepper\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n aria-label=\"Decrease auto-upgrade maximum\"\n disabled={disabled || extra <= minimumExtra}\n onClick={() => onChange(Math.max(minimumExtra, extra - stepPence))}\n >\n <Minus size={14} aria-hidden=\"true\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n aria-label=\"Increase auto-upgrade maximum\"\n disabled={disabled || extra >= maximumExtra}\n onClick={() => onChange(Math.min(maximumExtra, extra + stepPence))}\n >\n <Plus size={14} aria-hidden=\"true\" />\n </Button>\n </div>\n {annualMaximumPence != null && (\n <div className=\"project-purchase-annual-maximum\" data-testid=\"annual-spend-ceiling\">\n <output\n aria-live=\"polite\"\n aria-label={`${money(annualMaximumPence)} maximum with annual billing`}\n >\n {money(annualMaximumPence)}\n <span className=\"project-purchase-ceiling-unit\">/annual</span>\n </output>\n </div>\n )}\n </div>\n </div>\n )\n return (\n <div className=\"w-full space-y-2\">\n <div className=\"flex items-baseline justify-between gap-4\">\n {onEnabledChange ? (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={`${id}-enabled`}\n checked={extra > 0}\n disabled={disabled || maximumExtra === 0}\n onCheckedChange={(checked) => onEnabledChange(checked === true)}\n className=\"project-purchase-auto-checkbox\"\n />\n <Label htmlFor={`${id}-enabled`}>Auto-upgrade</Label>\n <Label htmlFor={id} className=\"sr-only\">\n Auto-upgrade limit\n </Label>\n </div>\n ) : (\n <Label htmlFor={id}>Auto-upgrade limit</Label>\n )}\n <output htmlFor={id} className=\"font-semibold tabular-nums\">\n {basePence > 0 ? '' : '+'}\n {money(pounds * 100)}/month ex VAT\n </output>\n </div>\n <p id={`${id}-description`} className=\"text-xs text-muted-foreground\">\n {extra === 0\n ? 'Automatic upgrades are off.'\n : basePence > 0\n ? `Monthly plan and add-ons ${money(basePence)} + up to ${money(extra)} in automatic upgrades. We notify you before an upgrade.`\n : 'Just-in-time upgrades avoid work interruption when you hit your limits. We notify you before any upgrade.'}\n </p>\n <input\n ref={inputRef}\n id={id}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={pounds}\n onChange={(event) => onChange(Math.round(Number(event.target.value) * 100) - basePence)}\n disabled={disabled}\n aria-describedby={`${id}-description`}\n aria-valuetext={\n basePence > 0\n ? `${money(pounds * 100)} total per month, including ${money(basePence)} for the selected monthly plan and add-ons and up to ${money(extra)} for automatic upgrades, plus VAT`\n : `${money(pounds * 100)} extra per month for automatic upgrades, beyond your selected plan and add-ons, plus VAT`\n }\n style={\n {\n '--cap-progress': `${max > min ? ((pounds - min) / (max - min)) * 100 : 100}%`,\n } as CSSProperties\n }\n className=\"w-full accent-secondary\"\n data-testid={testId}\n />\n <div className=\"flex justify-between text-xs text-muted-foreground\">\n <span>{money(min * 100)}</span>\n <span>{money(max * 100)}</span>\n </div>\n {!compact && (\n <p className=\"text-xs text-muted-foreground\">\n You can also adj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E7C;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,7 +10,6 @@ import { notify } from "@arbidocs/react/shell";
|
|
|
10
10
|
import { useBillingSupport } from "./support.js";
|
|
11
11
|
import { apiErrorDetail } from "./api-error.js";
|
|
12
12
|
import { refusal } from "./refusal-copy.js";
|
|
13
|
-
import { SUGGESTED_DAILY_CAP_PER_USER } from "./plan-constants.js";
|
|
14
13
|
import { findProPrices } from "./plan-pricing.js";
|
|
15
14
|
function createProjectErrorMessage(error, fallback = `Failed to create ${entityNoun("PROJECT")}`) {
|
|
16
15
|
const detail = apiErrorDetail(error);
|
|
@@ -20,9 +19,14 @@ function createProjectErrorMessage(error, fallback = `Failed to create ${entityN
|
|
|
20
19
|
}
|
|
21
20
|
function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
22
21
|
const [projectName, setProjectName] = useState(defaultName);
|
|
22
|
+
const [promoCode, setPromoCode] = useState("");
|
|
23
|
+
const [checkoutPromoCode, setCheckoutPromoCode] = useState();
|
|
23
24
|
const [aiBlocks, setAiBlocks] = useState(0);
|
|
24
25
|
const [storageBlocks, setStorageBlocks] = useState(0);
|
|
25
26
|
const [collaboratorBlocks, setCollaboratorBlocks] = useState(0);
|
|
27
|
+
const [dailyCapValue, setDailyCapValue] = useState("");
|
|
28
|
+
const parsedDailyCap = dailyCapValue.trim() === "" ? null : Number(dailyCapValue);
|
|
29
|
+
const validDailyCap = parsedDailyCap === null || Number.isFinite(parsedDailyCap) && parsedDailyCap >= 0;
|
|
26
30
|
const [isCreating, setIsCreating] = useState(false);
|
|
27
31
|
const isSlow = useIsSlow(isCreating);
|
|
28
32
|
const [checkoutOpen, setCheckoutOpen] = useState(false);
|
|
@@ -39,9 +43,11 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
39
43
|
useEffect(() => {
|
|
40
44
|
if (!open) return;
|
|
41
45
|
setProjectName(defaultName);
|
|
46
|
+
setPromoCode("");
|
|
42
47
|
setAiBlocks(0);
|
|
43
48
|
setStorageBlocks(0);
|
|
44
49
|
setCollaboratorBlocks(0);
|
|
50
|
+
setDailyCapValue("");
|
|
45
51
|
setIsCreating(false);
|
|
46
52
|
}, [open, defaultName]);
|
|
47
53
|
const close = () => {
|
|
@@ -63,16 +69,16 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
63
69
|
setCheckoutProject(null);
|
|
64
70
|
paymentCompleted.current = false;
|
|
65
71
|
};
|
|
66
|
-
const canSubmit = !!projectName.trim() && !isCreating && !createProject.isPending;
|
|
67
|
-
const create = (interval, capPence, quote) => {
|
|
72
|
+
const canSubmit = !!projectName.trim() && validDailyCap && !isCreating && !createProject.isPending;
|
|
73
|
+
const create = (interval, capPence, quote, plan = stripeEnabled ? "pro" : "free") => {
|
|
68
74
|
if (!canSubmit) return;
|
|
69
75
|
const currentAttempt = ++attempt.current;
|
|
70
76
|
setIsCreating(true);
|
|
71
77
|
createProject.mutate(
|
|
72
78
|
{
|
|
73
79
|
name: projectName.trim(),
|
|
74
|
-
plan
|
|
75
|
-
daily_cap_per_user:
|
|
80
|
+
plan,
|
|
81
|
+
daily_cap_per_user: parsedDailyCap === null ? null : Math.round(parsedDailyCap * 100) / 100
|
|
76
82
|
},
|
|
77
83
|
{
|
|
78
84
|
onSuccess: (project) => {
|
|
@@ -81,7 +87,7 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
setIsCreating(false);
|
|
84
|
-
if (
|
|
90
|
+
if (plan === "free") {
|
|
85
91
|
notify.success(`${getEntityLabel("PROJECT")} created`);
|
|
86
92
|
onOpenChange(false);
|
|
87
93
|
return;
|
|
@@ -91,6 +97,7 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
91
97
|
setCheckoutInterval(interval ?? "month");
|
|
92
98
|
setCheckoutBudget(capPence ?? null);
|
|
93
99
|
setCheckoutQuote(quote);
|
|
100
|
+
setCheckoutPromoCode(promoCode.trim() || void 0);
|
|
94
101
|
setCheckoutOpen(true);
|
|
95
102
|
onOpenChange(false);
|
|
96
103
|
},
|
|
@@ -116,7 +123,7 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
116
123
|
title: `New ${entityNoun("PROJECT")}`,
|
|
117
124
|
description: stripeEnabled ? "Name your project and choose monthly or annual billing." : "Name your project.",
|
|
118
125
|
size: "md",
|
|
119
|
-
className: stripeEnabled ? "project-purchase-modal sm:max-w-[
|
|
126
|
+
className: stripeEnabled ? "project-purchase-modal sm:max-w-[640px]" : void 0,
|
|
120
127
|
children: /* @__PURE__ */ jsxs(PlanStack, { gap: 4, children: [
|
|
121
128
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
122
129
|
/* @__PURE__ */ jsx(Label, { htmlFor: "new-project-name", children: "Name" }),
|
|
@@ -138,12 +145,17 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
138
145
|
ProjectPurchaseOptions,
|
|
139
146
|
{
|
|
140
147
|
products,
|
|
148
|
+
promoCode,
|
|
149
|
+
onPromoCodeChange: setPromoCode,
|
|
141
150
|
aiBlocks,
|
|
142
151
|
storageBlocks,
|
|
143
152
|
collaboratorBlocks,
|
|
144
153
|
onAiBlocksChange: setAiBlocks,
|
|
145
154
|
onStorageBlocksChange: setStorageBlocks,
|
|
146
155
|
onCollaboratorBlocksChange: setCollaboratorBlocks,
|
|
156
|
+
dailyCapValue,
|
|
157
|
+
onDailyCapChange: setDailyCapValue,
|
|
158
|
+
dailyCapError: !validDailyCap ? "Enter a positive amount, zero, or leave blank for no limit." : null,
|
|
147
159
|
disabled: !canSubmit,
|
|
148
160
|
busy: isCreating,
|
|
149
161
|
enabled: open,
|
|
@@ -161,6 +173,7 @@ function NewProjectFlow({ open, onOpenChange, defaultName }) {
|
|
|
161
173
|
checkoutProject && /* @__PURE__ */ jsx(
|
|
162
174
|
StripeCheckoutModal,
|
|
163
175
|
{
|
|
176
|
+
promoCode: checkoutPromoCode,
|
|
164
177
|
price: findProPrices(products)[checkoutInterval === "year" ? "annual" : "monthly"],
|
|
165
178
|
projectExtId: checkoutProject.id,
|
|
166
179
|
interval: checkoutInterval,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/billing/NewProjectFlow.tsx"],
|
|
4
|
-
"sourcesContent": ["/** Name the project, then choose monthly or annual payment. Stripe confirms payment. */\nimport { useEffect, useRef, useState } from 'react'\nimport { Button, Input, Label, entityNoun, getEntityLabel } from '@arbidocs/react/ui'\nimport { ModalScaffold, PlanActionButton, PlanNotice, PlanStack } from '../../settings'\nimport { useProducts, useCreateProject, useDeleteProject, useIsSlow } from '@arbidocs/react'\nimport { StripeCheckoutModal } from './StripeCheckoutModal'\nimport { ProjectPurchaseOptions } from './ProjectPurchaseOptions'\nimport { notify } from '@arbidocs/react/shell'\nimport { useBillingSupport } from './support'\nimport { apiErrorDetail } from './api-error'\nimport { refusal } from './refusal-copy'\nimport {
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/** Name the project, then choose monthly or annual payment. Stripe confirms payment. */\nimport { useEffect, useRef, useState } from 'react'\nimport { Button, Input, Label, entityNoun, getEntityLabel } from '@arbidocs/react/ui'\nimport { ModalScaffold, PlanActionButton, PlanNotice, PlanStack } from '../../settings'\nimport { useProducts, useCreateProject, useDeleteProject, useIsSlow } from '@arbidocs/react'\nimport { StripeCheckoutModal } from './StripeCheckoutModal'\nimport { ProjectPurchaseOptions } from './ProjectPurchaseOptions'\nimport { notify } from '@arbidocs/react/shell'\nimport { useBillingSupport } from './support'\nimport { apiErrorDetail } from './api-error'\nimport { refusal } from './refusal-copy'\nimport { findProPrices, type PlanInterval } from './plan-pricing'\nimport type { TaxQuote } from './tax-quote'\n\nfunction createProjectErrorMessage(\n error: unknown,\n fallback = `Failed to create ${entityNoun('PROJECT')}`\n): string {\n const detail = apiErrorDetail(error)\n if (typeof detail === 'string' && detail) return detail\n const message = (detail as { message?: unknown } | null)?.message\n return typeof message === 'string' && message ? message : fallback\n}\n\ninterface NewProjectFlowProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n defaultName: string\n}\n\nexport function NewProjectFlow({ open, onOpenChange, defaultName }: NewProjectFlowProps) {\n const [projectName, setProjectName] = useState(defaultName)\n const [promoCode, setPromoCode] = useState('')\n const [checkoutPromoCode, setCheckoutPromoCode] = useState<string>()\n const [aiBlocks, setAiBlocks] = useState(0)\n const [storageBlocks, setStorageBlocks] = useState(0)\n const [collaboratorBlocks, setCollaboratorBlocks] = useState(0)\n const [dailyCapValue, setDailyCapValue] = useState('')\n const parsedDailyCap = dailyCapValue.trim() === '' ? null : Number(dailyCapValue)\n const validDailyCap =\n parsedDailyCap === null || (Number.isFinite(parsedDailyCap) && parsedDailyCap >= 0)\n const [isCreating, setIsCreating] = useState(false)\n const isSlow = useIsSlow(isCreating)\n const [checkoutOpen, setCheckoutOpen] = useState(false)\n const [checkoutProject, setCheckoutProject] = useState<{ id: string; name: string } | null>(null)\n const [checkoutInterval, setCheckoutInterval] = useState<PlanInterval>('month')\n const [checkoutBudget, setCheckoutBudget] = useState<number | null>(null)\n const [checkoutQuote, setCheckoutQuote] = useState<TaxQuote>()\n const paymentCompleted = useRef(false)\n const attempt = useRef(0)\n const { stripeEnabled } = useBillingSupport()\n const { data: products, isLoading: productsLoading } = useProducts({ enabled: stripeEnabled })\n const createProject = useCreateProject()\n const deleteProject = useDeleteProject()\n\n useEffect(() => {\n if (!open) return\n setProjectName(defaultName)\n setPromoCode('')\n setAiBlocks(0)\n setStorageBlocks(0)\n setCollaboratorBlocks(0)\n setDailyCapValue('')\n setIsCreating(false)\n }, [open, defaultName])\n\n const close = () => {\n attempt.current += 1\n setIsCreating(false)\n onOpenChange(false)\n }\n const handleCheckoutOpenChange = (nextOpen: boolean) => {\n setCheckoutOpen(nextOpen)\n if (nextOpen) return\n if (checkoutProject && !paymentCompleted.current) {\n deleteProject.mutate(checkoutProject.id, {\n onSuccess: () =>\n notify.info(\n `Payment not completed. Nothing was charged and \"${checkoutProject.name}\" wasn't created.`\n ),\n onError: (error) => console.error('Failed to discard cancelled project', error),\n })\n }\n setCheckoutProject(null)\n paymentCompleted.current = false\n }\n const canSubmit = !!projectName.trim() && validDailyCap && !isCreating && !createProject.isPending\n const create = (\n interval?: PlanInterval,\n capPence?: number,\n quote?: TaxQuote,\n plan: 'free' | 'pro' = stripeEnabled ? 'pro' : 'free'\n ) => {\n if (!canSubmit) return\n const currentAttempt = ++attempt.current\n setIsCreating(true)\n createProject.mutate(\n {\n name: projectName.trim(),\n plan,\n daily_cap_per_user: parsedDailyCap === null ? null : Math.round(parsedDailyCap * 100) / 100,\n },\n {\n onSuccess: (project) => {\n if (currentAttempt !== attempt.current) {\n // The user cancelled while creation was in flight; no checkout or charge was started.\n deleteProject.mutate(project.external_id)\n return\n }\n setIsCreating(false)\n if (plan === 'free') {\n notify.success(`${getEntityLabel('PROJECT')} created`)\n onOpenChange(false)\n return\n }\n paymentCompleted.current = false\n setCheckoutProject({ id: project.external_id, name: project.name })\n setCheckoutInterval(interval ?? 'month')\n setCheckoutBudget(capPence ?? null)\n setCheckoutQuote(quote)\n setCheckoutPromoCode(promoCode.trim() || undefined)\n setCheckoutOpen(true)\n onOpenChange(false)\n },\n onError: (error) => {\n setIsCreating(false)\n if (currentAttempt !== attempt.current) return\n notify.error(\n stripeEnabled\n ? refusal(\n `\"${projectName.trim()}\" wasn't created`,\n createProjectErrorMessage(error, 'Try again')\n )\n : createProjectErrorMessage(error)\n )\n },\n }\n )\n }\n\n return (\n <>\n <ModalScaffold\n open={open}\n onOpenChange={(next) => (next ? onOpenChange(true) : close())}\n title={`New ${entityNoun('PROJECT')}`}\n description={\n stripeEnabled\n ? 'Name your project and choose monthly or annual billing.'\n : 'Name your project.'\n }\n size=\"md\"\n className={stripeEnabled ? 'project-purchase-modal sm:max-w-[640px]' : undefined}\n >\n <PlanStack gap={4}>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-project-name\">Name</Label>\n <Input\n id=\"new-project-name\"\n value={projectName}\n onChange={(event) => setProjectName(event.target.value)}\n placeholder={`My ${getEntityLabel('PROJECT')}`}\n autoFocus\n onKeyDown={(event) => {\n if (event.key === 'Enter' && !stripeEnabled) create()\n }}\n />\n </div>\n {stripeEnabled &&\n (productsLoading ? (\n <PlanNotice>Loading prices\u2026</PlanNotice>\n ) : (\n <ProjectPurchaseOptions\n products={products}\n promoCode={promoCode}\n onPromoCodeChange={setPromoCode}\n aiBlocks={aiBlocks}\n storageBlocks={storageBlocks}\n collaboratorBlocks={collaboratorBlocks}\n onAiBlocksChange={setAiBlocks}\n onStorageBlocksChange={setStorageBlocks}\n onCollaboratorBlocksChange={setCollaboratorBlocks}\n dailyCapValue={dailyCapValue}\n onDailyCapChange={setDailyCapValue}\n dailyCapError={\n !validDailyCap\n ? 'Enter a positive amount, zero, or leave blank for no limit.'\n : null\n }\n disabled={!canSubmit}\n busy={isCreating}\n enabled={open}\n onChoose={create}\n />\n ))}\n <div className=\"flex items-center justify-end gap-2\">\n <Button variant=\"ghost\" onClick={close}>\n Cancel\n </Button>\n {!stripeEnabled && (\n <PlanActionButton onClick={() => create()} disabled={!canSubmit}>\n {isCreating ? 'Creating\u2026' : `Create ${entityNoun('PROJECT')}`}\n </PlanActionButton>\n )}\n </div>\n {isSlow && (\n <PlanNotice className=\"text-xs\" testId=\"new-project-still-working\">\n Still working. We'll update here.\n </PlanNotice>\n )}\n </PlanStack>\n </ModalScaffold>\n {checkoutProject && (\n <StripeCheckoutModal\n promoCode={checkoutPromoCode}\n price={findProPrices(products)[checkoutInterval === 'year' ? 'annual' : 'monthly']}\n projectExtId={checkoutProject.id}\n interval={checkoutInterval}\n addonBudgetPence={checkoutBudget}\n aiBlocks={aiBlocks}\n storageBlocks={storageBlocks}\n collaboratorBlocks={collaboratorBlocks}\n quote={checkoutQuote}\n open={checkout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IACC,mBACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,OAAO,cAAc,QAAQ,EAAE,qBAAqB,SAAS,WAAW,SAAS;AAAA,QACjF,cAAc,gBAAgB;AAAA,QAC9B,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,MAAM;AAAA,QACN,cAAc;AAAA,QACd,aAAa,MAAM;AACjB,2BAAiB,UAAU;AAAA,QAC7B;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -82,7 +82,7 @@ function ProjectDetail({ projectExtId, storage }) {
|
|
|
82
82
|
children: [
|
|
83
83
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
84
84
|
/* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-foreground", children: "Daily limit per collaborator" }),
|
|
85
|
-
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-sm text-muted-foreground", children: "
|
|
85
|
+
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-sm text-muted-foreground", children: "Collaborators will use your project's quota. Set a daily limit on how much AI a collaborator can use." })
|
|
86
86
|
] }),
|
|
87
87
|
/* @__PURE__ */ jsx(DailyCapEditor, { project })
|
|
88
88
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/billing/ProjectDetail.tsx"],
|
|
4
|
-
"sourcesContent": ["import { SuspendedProjectRecovery } from './SuspendedProjectRecovery'\n/**\n * ProjectDetail\n *\n * Content of an opened per-project tab. Only your OWN projects are openable\n * (the table gates this), so this is purely the deep detail: the daily-cap\n * setter for others on the project, plus the usage breakdown. The high-level\n * summary (plan, AI credits, storage, collaborators) lives in the projects list;\n * renaming the project is done here, from the pencil beside its name.\n */\n\nimport { useCallback, useState, type ReactNode } from 'react'\nimport { useProjects, useUpdateProjectFields } from '@arbidocs/react'\nimport { CollaboratorPlan } from './CollaboratorPlan'\nimport { DailyCapEditor } from './DailyCapEditor'\nimport { SubscriptionStatus } from './SubscriptionStatus'\nimport { ProjectBilling } from './ProjectBilling'\nimport { ChangePlanDialog } from './ChangePlanDialog'\nimport { ProjectUsageContent } from './ProjectUsageContent'\nimport { PlanBadge, ProjectDetailHeader, ProjectDetailSection, RenameDialog } from '../../settings'\nimport { planBadgeView } from './plan-badge'\nimport { notify } from '@arbidocs/react/shell'\nimport { EntityIcon, entityNoun, getEntityLabel } from '@arbidocs/react/ui'\nimport { useBillingSupport, useSelfExtId } from './support'\n\nexport interface ProjectDetailProps {\n projectExtId: string\n /** The project's storage (by workspace and kind, largest items, recently deleted), from the host. */\n storage?: ReactNode\n}\n\nexport function ProjectDetail({ projectExtId, storage }: ProjectDetailProps) {\n const { stripeEnabled } = useBillingSupport()\n const [planOpen, setPlanOpen] = useState(false)\n const [renameOpen, setRenameOpen] = useState(false)\n const [renameValue, setRenameValue] = useState('')\n const updateProject = useUpdateProjectFields()\n const { data: projects, isLoading } = useProjects()\n const currentUserExtId = useSelfExtId()\n\n const project = projects?.find((p) => p.external_id === projectExtId)\n\n const handleSaveRename = useCallback(() => {\n const trimmed = renameValue.trim()\n if (!project || !trimmed || trimmed === project.name) {\n setRenameOpen(false)\n return\n }\n updateProject.mutate(\n {\n projectExtId: project.external_id,\n patch: { name: trimmed },\n },\n {\n onSuccess: () => {\n setRenameOpen(false)\n notify.success(`${getEntityLabel('PROJECT')} renamed`)\n },\n onError: () => notify.error(`Failed to rename ${entityNoun('PROJECT')}`),\n }\n )\n }, [project, renameValue, updateProject])\n\n const hasBilling = stripeEnabled && project?.subscription !== 'dev'\n\n if (isLoading) {\n return (\n <div className=\"text-sm text-muted-foreground p-6\">Loading {entityNoun('PROJECT')}...</div>\n )\n }\n\n if (!project) {\n return (\n <div className=\"text-sm text-muted-foreground p-6\" data-testid=\"project-detail-missing\">\n This project is no longer available.\n </div>\n )\n }\n\n // Defensive: the list never opens a tab for a project you don't own.\n if (project.created_by !== currentUserExtId) {\n return (\n <div className=\"text-sm text-muted-foreground p-6\" data-testid=\"project-detail-not-owner\">\n Only the project owner can see usage detail.\n </div>\n )\n }\n\n return (\n <div className=\"p-6 space-y-6 max-w-4xl\" data-testid={`project-detail-${project.external_id}`}>\n {/* Page header \u2014 name + plan badge. Plan changes live on the Plan card below. */}\n <ProjectDetailHeader\n icon={<EntityIcon entityType=\"PROJECT\" />}\n name={project.name}\n onRename={() => {\n setRenameValue(project.name)\n setRenameOpen(true)\n }}\n badge={stripeEnabled ? <PlanBadge {...planBadgeView(project)} size=\"md\" /> : undefined}\n />\n\n {hasBilling && project.subscription === 'suspended' ? (\n <SuspendedProjectRecovery project={project} onResubscribe={() => setPlanOpen(true)} />\n ) : (\n <>\n {/* Billing deployments: Plan card (allowance, plan + change), and on Pro the\n Add-ons and monthly spend cap cards. Otherwise just the quota meters. */}\n {hasBilling && (\n <ProjectBilling project={project} onChangePlan={() => setPlanOpen(true)} />\n )}\n\n {/* Limits \u2014 quota meters (non-billing) + the per-collaborator daily cap. */}\n <ProjectDetailSection title={hasBilling ? 'Collaborator limits' : 'Plan limits'}>\n {!hasBilling && <SubscriptionStatus project={project} />}\n {hasBilling && project.addons && <CollaboratorPlan project={project} />}\n\n <div\n className={\n hasBilling\n ? 'flex flex-wrap items-center justify-between gap-x-6 gap-y-3'\n : 'mt-5 flex flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t border-border pt-5'\n }\n >\n <div className=\"min-w-0\">\n <h4 className=\"text-sm font-semibold text-foreground\">\n Daily limit per collaborator\n </h4>\n <p className=\"mt-0.5 text-sm text-muted-foreground\"
|
|
5
|
-
"mappings": ";AAmEM,SAqCE,UA/BF,KANA;AAnEN,SAAS,gCAAgC;AAWzC,SAAS,aAAa,gBAAgC;AACtD,SAAS,aAAa,8BAA8B;AACpD,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,0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S,WAAW,SAAS;AAAA,MAAE;AAAA,OAAG;AAAA,EAEzF;AAEA,MAAI,CAAC,SAAS;AACZ,WACE,oBAAC,SAAI,WAAU,qCAAoC,eAAY,0BAAyB,kDAExF;AAAA,EAEJ;AAGA,MAAI,QAAQ,eAAe,kBAAkB;AAC3C,WACE,oBAAC,SAAI,WAAU,qCAAoC,eAAY,4BAA2B,0DAE1F;AAAA,EAEJ;AAEA,SACE,qBAAC,SAAI,WAAU,2BAA0B,eAAa,kBAAkB,QAAQ,WAAW,IAEzF;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,oBAAC,cAAW,YAAW,WAAU;AAAA,QACvC,MAAM,QAAQ;AAAA,QACd,UAAU,MAAM;AACd,yBAAe,QAAQ,IAAI;AAC3B,wBAAc,IAAI;AAAA,QACpB;AAAA,QACA,OAAO,gBAAgB,oBAAC,aAAW,GAAG,cAAc,OAAO,GAAG,MAAK,MAAK,IAAK;AAAA;AAAA,IAC/E;AAAA,IAEC,cAAc,QAAQ,iBAAiB,cACtC,oBAAC,4BAAyB,SAAkB,eAAe,MAAM,YAAY,IAAI,GAAG,IAEpF,iCAGG;AAAA,oBACC,oBAAC,kBAAe,SAAkB,cAAc,MAAM,YAAY,IAAI,GAAG;AAAA,MAI3E,qBAAC,wBAAqB,OAAO,aAAa,wBAAwB,eAC/D;AAAA,SAAC,cAAc,oBAAC,sBAAmB,SAAkB;AAAA,QACrD,cAAc,QAAQ,UAAU,oBAAC,oBAAiB,SAAkB;AAAA,QAErE;AAAA,UAAC;AAAA;AAAA,YACC,WACE,aACI,gEACA;AAAA,YAGN;AAAA,mCAAC,SAAI,WAAU,WACb;AAAA,oCAAC,QAAG,WAAU,yCAAwC,0CAEtD;AAAA,gBACA,oBAAC,OAAE,WAAU,wCAAuC
|
|
4
|
+
"sourcesContent": ["import { SuspendedProjectRecovery } from './SuspendedProjectRecovery'\n/**\n * ProjectDetail\n *\n * Content of an opened per-project tab. Only your OWN projects are openable\n * (the table gates this), so this is purely the deep detail: the daily-cap\n * setter for others on the project, plus the usage breakdown. The high-level\n * summary (plan, AI credits, storage, collaborators) lives in the projects list;\n * renaming the project is done here, from the pencil beside its name.\n */\n\nimport { useCallback, useState, type ReactNode } from 'react'\nimport { useProjects, useUpdateProjectFields } from '@arbidocs/react'\nimport { CollaboratorPlan } from './CollaboratorPlan'\nimport { DailyCapEditor } from './DailyCapEditor'\nimport { SubscriptionStatus } from './SubscriptionStatus'\nimport { ProjectBilling } from './ProjectBilling'\nimport { ChangePlanDialog } from './ChangePlanDialog'\nimport { ProjectUsageContent } from './ProjectUsageContent'\nimport { PlanBadge, ProjectDetailHeader, ProjectDetailSection, RenameDialog } from '../../settings'\nimport { planBadgeView } from './plan-badge'\nimport { notify } from '@arbidocs/react/shell'\nimport { EntityIcon, entityNoun, getEntityLabel } from '@arbidocs/react/ui'\nimport { useBillingSupport, useSelfExtId } from './support'\n\nexport interface ProjectDetailProps {\n projectExtId: string\n /** The project's storage (by workspace and kind, largest items, recently deleted), from the host. */\n storage?: ReactNode\n}\n\nexport function ProjectDetail({ projectExtId, storage }: ProjectDetailProps) {\n const { stripeEnabled } = useBillingSupport()\n const [planOpen, setPlanOpen] = useState(false)\n const [renameOpen, setRenameOpen] = useState(false)\n const [renameValue, setRenameValue] = useState('')\n const updateProject = useUpdateProjectFields()\n const { data: projects, isLoading } = useProjects()\n const currentUserExtId = useSelfExtId()\n\n const project = projects?.find((p) => p.external_id === projectExtId)\n\n const handleSaveRename = useCallback(() => {\n const trimmed = renameValue.trim()\n if (!project || !trimmed || trimmed === project.name) {\n setRenameOpen(false)\n return\n }\n updateProject.mutate(\n {\n projectExtId: project.external_id,\n patch: { name: trimmed },\n },\n {\n onSuccess: () => {\n setRenameOpen(false)\n notify.success(`${getEntityLabel('PROJECT')} renamed`)\n },\n onError: () => notify.error(`Failed to rename ${entityNoun('PROJECT')}`),\n }\n )\n }, [project, renameValue, updateProject])\n\n const hasBilling = stripeEnabled && project?.subscription !== 'dev'\n\n if (isLoading) {\n return (\n <div className=\"text-sm text-muted-foreground p-6\">Loading {entityNoun('PROJECT')}...</div>\n )\n }\n\n if (!project) {\n return (\n <div className=\"text-sm text-muted-foreground p-6\" data-testid=\"project-detail-missing\">\n This project is no longer available.\n </div>\n )\n }\n\n // Defensive: the list never opens a tab for a project you don't own.\n if (project.created_by !== currentUserExtId) {\n return (\n <div className=\"text-sm text-muted-foreground p-6\" data-testid=\"project-detail-not-owner\">\n Only the project owner can see usage detail.\n </div>\n )\n }\n\n return (\n <div className=\"p-6 space-y-6 max-w-4xl\" data-testid={`project-detail-${project.external_id}`}>\n {/* Page header \u2014 name + plan badge. Plan changes live on the Plan card below. */}\n <ProjectDetailHeader\n icon={<EntityIcon entityType=\"PROJECT\" />}\n name={project.name}\n onRename={() => {\n setRenameValue(project.name)\n setRenameOpen(true)\n }}\n badge={stripeEnabled ? <PlanBadge {...planBadgeView(project)} size=\"md\" /> : undefined}\n />\n\n {hasBilling && project.subscription === 'suspended' ? (\n <SuspendedProjectRecovery project={project} onResubscribe={() => setPlanOpen(true)} />\n ) : (\n <>\n {/* Billing deployments: Plan card (allowance, plan + change), and on Pro the\n Add-ons and monthly spend cap cards. Otherwise just the quota meters. */}\n {hasBilling && (\n <ProjectBilling project={project} onChangePlan={() => setPlanOpen(true)} />\n )}\n\n {/* Limits \u2014 quota meters (non-billing) + the per-collaborator daily cap. */}\n <ProjectDetailSection title={hasBilling ? 'Collaborator limits' : 'Plan limits'}>\n {!hasBilling && <SubscriptionStatus project={project} />}\n {hasBilling && project.addons && <CollaboratorPlan project={project} />}\n\n <div\n className={\n hasBilling\n ? 'flex flex-wrap items-center justify-between gap-x-6 gap-y-3'\n : 'mt-5 flex flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t border-border pt-5'\n }\n >\n <div className=\"min-w-0\">\n <h4 className=\"text-sm font-semibold text-foreground\">\n Daily limit per collaborator\n </h4>\n <p className=\"mt-0.5 text-sm text-muted-foreground\">\n Collaborators will use your project's quota. Set a daily limit on how much AI\n a collaborator can use.\n </p>\n </div>\n <DailyCapEditor project={project} />\n </div>\n </ProjectDetailSection>\n\n {/* Usage */}\n <ProjectDetailSection title=\"Usage\">\n <ProjectUsageContent\n projectExtId={project.external_id}\n projectName={project.name}\n aiUsageLimit={project.quotas?.ai_usage?.limit}\n />\n </ProjectDetailSection>\n\n {/* Storage \u2014 by workspace and kind, largest items, Recently deleted. */}\n {storage}\n </>\n )}\n\n <RenameDialog\n open={renameOpen}\n onClose={() => setRenameOpen(false)}\n value={renameValue}\n onChange={setRenameValue}\n onSave={handleSaveRename}\n isSaving={updateProject.isPending}\n testId=\"project-detail-rename-input\"\n />\n\n {/* Plan picker \u2014 shared (Pro \u2192 switch interval / move to Free, Free \u2192 subscribe). */}\n <ChangePlanDialog project={project} open={planOpen} onOpenChange={setPlanOpen} />\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAmEM,SAqCE,UA/BF,KANA;AAnEN,SAAS,gCAAgC;AAWzC,SAAS,aAAa,gBAAgC;AACtD,SAAS,aAAa,8BAA8B;AACpD,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,WAAW,qBAAqB,sBAAsB,oBAAoB;AACnF,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,YAAY,YAAY,sBAAsB;AACvD,SAAS,mBAAmB,oBAAoB;AAQzC,SAAS,cAAc,EAAE,cAAc,QAAQ,GAAuB;AAC3E,QAAM,EAAE,cAAc,IAAI,kBAAkB;AAC5C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,EAAE;AACjD,QAAM,gBAAgB,uBAAuB;AAC7C,QAAM,EAAE,MAAM,UAAU,UAAU,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idocs/client';
|
|
2
2
|
import { type PlanInterval } from './plan-pricing';
|
|
3
|
-
import type
|
|
3
|
+
import { type TaxQuote } from './tax-quote';
|
|
4
4
|
type Product = components['schemas']['ProductResponse'];
|
|
5
5
|
type Price = components['schemas']['ProductPrice'];
|
|
6
6
|
export declare function purchaseNet(price: Price | undefined, ai: number, storage: number, collaborators: number): number | null;
|
|
7
|
-
/**
|
|
8
|
-
export declare function ProjectPurchaseOptions({ products, projectExtId, aiBlocks, storageBlocks, collaboratorBlocks, onAiBlocksChange, onStorageBlocksChange, onCollaboratorBlocksChange, disabled, busy, enabled, onChoose, }: {
|
|
7
|
+
/** Free, monthly and annual choices; paid choices show the actual starting charge. */
|
|
8
|
+
export declare function ProjectPurchaseOptions({ products, projectExtId, aiBlocks, storageBlocks, collaboratorBlocks, onAiBlocksChange, onStorageBlocksChange, onCollaboratorBlocksChange, disabled, busy, busyLabel, enabled, onChoose, onChooseFree, promoCode, onPromoCodeChange, dailyCapValue, onDailyCapChange, onSaveDailyCap, canSaveDailyCap, dailyCapError, currentQuotas, }: {
|
|
9
9
|
products: Product[] | undefined;
|
|
10
10
|
projectExtId?: string;
|
|
11
11
|
aiBlocks: number;
|
|
@@ -16,7 +16,18 @@ export declare function ProjectPurchaseOptions({ products, projectExtId, aiBlock
|
|
|
16
16
|
onCollaboratorBlocksChange: (count: number) => void;
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
busy?: boolean;
|
|
19
|
+
busyLabel?: string;
|
|
19
20
|
enabled?: boolean;
|
|
21
|
+
/** Keep an existing project Free, or create a new project without a subscription. */
|
|
22
|
+
onChooseFree?: () => void;
|
|
23
|
+
promoCode?: string;
|
|
24
|
+
onPromoCodeChange?: (code: string) => void;
|
|
25
|
+
dailyCapValue?: string;
|
|
26
|
+
onDailyCapChange?: (value: string) => void;
|
|
27
|
+
onSaveDailyCap?: () => void;
|
|
28
|
+
canSaveDailyCap?: boolean;
|
|
29
|
+
dailyCapError?: string | null;
|
|
30
|
+
currentQuotas?: components['schemas']['ProjectQuotas'];
|
|
20
31
|
onChoose: (interval: PlanInterval, capPence: number, quote?: TaxQuote) => void;
|
|
21
32
|
}): import("react").JSX.Element;
|
|
22
33
|
export {};
|