@arbidocs/blocks 0.5.36 → 0.5.38
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/README.md +22 -0
- package/dist/{WorkspaceTableView-ATZHON74.cjs → WorkspaceTableView-KG546U7M.cjs} +5 -5
- package/dist/{WorkspaceTableView-ATZHON74.cjs.map → WorkspaceTableView-KG546U7M.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-7APDRIPL.js → WorkspaceTableView-OSFIWJ5C.js} +3 -3
- package/dist/{WorkspaceTableView-7APDRIPL.js.map → WorkspaceTableView-OSFIWJ5C.js.map} +1 -1
- package/dist/{chunk-RBHVIVWP.js → chunk-K6W2GWCN.js} +80 -80
- package/dist/chunk-K6W2GWCN.js.map +1 -0
- package/dist/{chunk-Q7BS7EOU.cjs → chunk-KFQ6E6LE.cjs} +32 -28
- package/dist/chunk-KFQ6E6LE.cjs.map +1 -0
- package/dist/{chunk-XHW35TC7.js → chunk-PPHUOWCJ.js} +33 -29
- package/dist/chunk-PPHUOWCJ.js.map +1 -0
- package/dist/chunk-PTYERKEU.js +2132 -0
- package/dist/chunk-PTYERKEU.js.map +1 -0
- package/dist/chunk-TQSU3I4C.cjs +2180 -0
- package/dist/chunk-TQSU3I4C.cjs.map +1 -0
- package/dist/{chunk-G4VUVOHZ.cjs → chunk-YDY4GIC2.cjs} +79 -79
- package/dist/chunk-YDY4GIC2.cjs.map +1 -0
- package/dist/connect/index.cjs +2509 -1744
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +2 -0
- package/dist/connect/index.js +2221 -1459
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/databases/ConnectedDatabasesPage.d.ts +1 -0
- package/dist/connection/databases/DatabaseViewsMenu.d.ts +10 -0
- package/dist/connection/databases/index.d.ts +1 -0
- package/dist/connection/databases/useDatabaseCellSources.d.ts +6 -0
- package/dist/connection/workspace-form/ConnectedProjectSelector.d.ts +15 -0
- package/dist/connection/workspace-form/ConnectedWorkspaceFormModal.d.ts +11 -0
- package/dist/connection/workspace-form/WorkspaceCreateForm.d.ts +15 -0
- package/dist/connection/workspace-form/index.d.ts +3 -0
- package/dist/connection/workspace-form/types.d.ts +28 -0
- package/dist/connection/workspace-list/ConnectedWorkspaceList.d.ts +4 -1
- package/dist/connection/workspace-list/useConnectedWorkspaceList.d.ts +12 -36
- package/dist/databases/index.cjs +193 -2173
- package/dist/databases/index.cjs.map +1 -1
- package/dist/databases/index.js +4 -2129
- package/dist/databases/index.js.map +1 -1
- package/dist/workspaces/WorkspaceFormParts.d.ts +3 -2
- package/dist/workspaces/index.cjs +27 -27
- package/dist/workspaces/index.js +2 -2
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/chunk-G4VUVOHZ.cjs.map +0 -1
- package/dist/chunk-Q7BS7EOU.cjs.map +0 -1
- package/dist/chunk-RBHVIVWP.js.map +0 -1
- package/dist/chunk-XHW35TC7.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkKFQ6E6LE_cjs = require('../chunk-KFQ6E6LE.cjs');
|
|
5
5
|
var chunkKWJW5TMH_cjs = require('../chunk-KWJW5TMH.cjs');
|
|
6
6
|
require('../chunk-UAEYU2NN.cjs');
|
|
7
7
|
require('../chunk-C2ECYOPP.cjs');
|
|
@@ -63,7 +63,7 @@ function WorkspaceGallery({
|
|
|
63
63
|
const opening = workspace.id === activeOpeningId;
|
|
64
64
|
const state = { current, opening };
|
|
65
65
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
-
|
|
66
|
+
chunkKFQ6E6LE_cjs.WorkspaceCard,
|
|
67
67
|
{
|
|
68
68
|
workspace,
|
|
69
69
|
current,
|
|
@@ -86,103 +86,103 @@ function WorkspaceGallery({
|
|
|
86
86
|
|
|
87
87
|
Object.defineProperty(exports, "CommonWorkspaceToggle", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkKFQ6E6LE_cjs.CommonWorkspaceToggle; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "DEFAULT_WORKSPACE_CARD_LABELS", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkKFQ6E6LE_cjs.DEFAULT_WORKSPACE_CARD_LABELS; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "ExpandableSection", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkKFQ6E6LE_cjs.ExpandableSection; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "FormActions", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkKFQ6E6LE_cjs.FormActions; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "FormErrorBanner", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkKFQ6E6LE_cjs.FormErrorBanner; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "ItalicNone", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkKFQ6E6LE_cjs.ItalicNone; }
|
|
110
110
|
});
|
|
111
111
|
Object.defineProperty(exports, "LeaveFooter", {
|
|
112
112
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunkKFQ6E6LE_cjs.LeaveFooter; }
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "ModalActionRow", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkKFQ6E6LE_cjs.ModalActionRow; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "PageLoading", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkKFQ6E6LE_cjs.PageLoading; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "ProjectActionButton", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkKFQ6E6LE_cjs.ProjectActionButton; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "ProjectOptionRow", {
|
|
128
128
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkKFQ6E6LE_cjs.ProjectOptionRow; }
|
|
130
130
|
});
|
|
131
131
|
Object.defineProperty(exports, "ProjectPicker", {
|
|
132
132
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkKFQ6E6LE_cjs.ProjectPicker; }
|
|
134
134
|
});
|
|
135
135
|
Object.defineProperty(exports, "WorkspaceAudienceLine", {
|
|
136
136
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceAudienceLine; }
|
|
138
138
|
});
|
|
139
139
|
Object.defineProperty(exports, "WorkspaceCard", {
|
|
140
140
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceCard; }
|
|
142
142
|
});
|
|
143
143
|
Object.defineProperty(exports, "WorkspaceFieldsView", {
|
|
144
144
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceFieldsView; }
|
|
146
146
|
});
|
|
147
147
|
Object.defineProperty(exports, "WorkspaceFormModal", {
|
|
148
148
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceFormModal; }
|
|
150
150
|
});
|
|
151
151
|
Object.defineProperty(exports, "WorkspaceGroup", {
|
|
152
152
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceGroup; }
|
|
154
154
|
});
|
|
155
155
|
Object.defineProperty(exports, "WorkspaceIdentityPanel", {
|
|
156
156
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceIdentityPanel; }
|
|
158
158
|
});
|
|
159
159
|
Object.defineProperty(exports, "WorkspaceList", {
|
|
160
160
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceList; }
|
|
162
162
|
});
|
|
163
163
|
Object.defineProperty(exports, "WorkspacePageFrame", {
|
|
164
164
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspacePageFrame; }
|
|
166
166
|
});
|
|
167
167
|
Object.defineProperty(exports, "WorkspaceProjectSlot", {
|
|
168
168
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceProjectSlot; }
|
|
170
170
|
});
|
|
171
171
|
Object.defineProperty(exports, "WorkspaceTypeBadge", {
|
|
172
172
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkKFQ6E6LE_cjs.WorkspaceTypeBadge; }
|
|
174
174
|
});
|
|
175
175
|
Object.defineProperty(exports, "formatRole", {
|
|
176
176
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunkKFQ6E6LE_cjs.formatRole; }
|
|
178
178
|
});
|
|
179
179
|
Object.defineProperty(exports, "getRoleBadgeClass", {
|
|
180
180
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
181
|
+
get: function () { return chunkKFQ6E6LE_cjs.getRoleBadgeClass; }
|
|
182
182
|
});
|
|
183
183
|
Object.defineProperty(exports, "getRoleDescription", {
|
|
184
184
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
185
|
+
get: function () { return chunkKFQ6E6LE_cjs.getRoleDescription; }
|
|
186
186
|
});
|
|
187
187
|
Object.defineProperty(exports, "NO_PROJECT_GROUP_KEY", {
|
|
188
188
|
enumerable: true,
|
package/dist/workspaces/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { WorkspaceCard } from '../chunk-
|
|
3
|
-
export { CommonWorkspaceToggle, DEFAULT_WORKSPACE_CARD_LABELS, ExpandableSection, FormActions, FormErrorBanner, ItalicNone, LeaveFooter, ModalActionRow, PageLoading, ProjectActionButton, ProjectOptionRow, ProjectPicker, WorkspaceAudienceLine, WorkspaceCard, WorkspaceFieldsView, WorkspaceFormModal, WorkspaceGroup, WorkspaceIdentityPanel, WorkspaceList, WorkspacePageFrame, WorkspaceProjectSlot, WorkspaceTypeBadge, formatRole, getRoleBadgeClass, getRoleDescription } from '../chunk-
|
|
2
|
+
import { WorkspaceCard } from '../chunk-PPHUOWCJ.js';
|
|
3
|
+
export { CommonWorkspaceToggle, DEFAULT_WORKSPACE_CARD_LABELS, ExpandableSection, FormActions, FormErrorBanner, ItalicNone, LeaveFooter, ModalActionRow, PageLoading, ProjectActionButton, ProjectOptionRow, ProjectPicker, WorkspaceAudienceLine, WorkspaceCard, WorkspaceFieldsView, WorkspaceFormModal, WorkspaceGroup, WorkspaceIdentityPanel, WorkspaceList, WorkspacePageFrame, WorkspaceProjectSlot, WorkspaceTypeBadge, formatRole, getRoleBadgeClass, getRoleDescription } from '../chunk-PPHUOWCJ.js';
|
|
4
4
|
export { NO_PROJECT_GROUP_KEY, WORKSPACE_CATEGORY_FILTERS, byRecentUpdate, getHumanUserCount, getVariantBgClass, getVariantBorderClass, getWorkspaceTypeInfo, groupWorkspacesByProject, isAgentAccount, isListedWorkspace, projectFilterId, workspaceConversationCount, workspaceDocumentCount, workspaceFilterAttributes, workspaceGroupStats } from '../chunk-57CG33XJ.js';
|
|
5
5
|
import '../chunk-WZ63HE2C.js';
|
|
6
6
|
import '../chunk-FUPAGAZB.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/coedit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.38",
|
|
4
4
|
"description": "Real-time collaboration for the ARBI native DOCX editor: a Yjs mirror of the canonical OOXML package, session, and server runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/blocks",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.38",
|
|
4
4
|
"description": "Composable, domain-neutral UI blocks for ARBI apps, organised by capability (retrieval, facts, agents, workspaces, citations, collaboration) plus shell, theme and site primitives, on top of @arbidocs/react.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -296,9 +296,9 @@
|
|
|
296
296
|
"example:test:e2e": "playwright test -c examples/custom-ui/playwright.config.ts"
|
|
297
297
|
},
|
|
298
298
|
"dependencies": {
|
|
299
|
-
"@arbidocs/client": "0.5.
|
|
300
|
-
"@arbidocs/coedit": "0.5.
|
|
301
|
-
"@arbidocs/sdk": "0.5.
|
|
299
|
+
"@arbidocs/client": "0.5.38",
|
|
300
|
+
"@arbidocs/coedit": "0.5.38",
|
|
301
|
+
"@arbidocs/sdk": "0.5.38",
|
|
302
302
|
"@auth0/auth0-react": "^2.19.0",
|
|
303
303
|
"@dnd-kit/core": "^6.3.1",
|
|
304
304
|
"@dnd-kit/sortable": "^10.0.0",
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
"y-protocols": "^1.0.6"
|
|
346
346
|
},
|
|
347
347
|
"peerDependencies": {
|
|
348
|
-
"@arbidocs/react": "0.5.
|
|
348
|
+
"@arbidocs/react": "0.5.38",
|
|
349
349
|
"@lexical/html": "0.35.0",
|
|
350
350
|
"@lexical/link": "0.35.0",
|
|
351
351
|
"@lexical/list": "0.35.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection/billing/support.ts","../src/connection/billing/plan-constants.ts","../src/connection/billing/quota-items.ts","../src/connection/billing/reward-balance.ts","../src/connection/billing/addon-pricing.ts","../src/connection/billing/api-error.ts","../src/connection/billing/tax-quote.ts","../src/connection/billing/plan-pricing.ts","../src/connection/billing/plan-badge.ts","../src/connection/workspace-list/projectBilling.tsx"],"names":["useHost","useArbi","PoundSterling","formatGbp","HardDrive","Users","useUserSettings","gbp","jsx","PlanBadge","ProjectReadout","QuotaMeter","ProjectBreakdown","UsageMeter"],"mappings":";;;;;;;;;;AA4BA,IAAM,YAAA,GAA+B,EAAE,aAAA,EAAe,KAAA,EAAM;AAErD,SAAS,iBAAA,GAAoC;AAClD,EAAA,OAAOA,yBAAA,GAAU,OAAA,IAAW,YAAA;AAC9B;AAGO,SAAS,YAAA,GAAmC;AACjD,EAAA,MAAM,OAAOC,aAAA,EAAQ;AACrB,EAAA,OAAO,KAAK,UAAA,GAAc,IAAA,CAAK,KAAK,QAAA,EAAS,EAAG,cAAc,MAAA,GAAa,MAAA;AAC7E;;;ACnCO,IAAM,UAAA,GAAa;AACnB,IAAM,cAAA,GAAiB;AAMvB,IAAM,kBAAA,GAAqB;AAC3B,IAAM,gBAAA,GAAmB;AAIzB,IAAM,uBAAA,GAA0B;AAGhC,IAAM,4BAAA,GAA+B;AAIrC,IAAM,WAAA,GAAc;AACpB,IAAM,eAAA,GAAkB;AACxB,IAAM,kBAAA,GAAqB;AAG3B,IAAM,uBAAA,GAA0B,GAAA;AAOhC,IAAM,4BAAA,GAA+B;;;ACjB5C,IAAM,GAAA,GAAM,CAAC,CAAA,KAAc,IAAA,CAAK,MAAM,CAAC,CAAA,CAAE,eAAe,OAAO,CAAA;AAGxD,SAAS,gBAAgB,aAAA,EAAyD;AACvF,EAAA,IAAI,CAAC,eAA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AAA,CAAW,GAAA,CAAI,CAAC,EAAE,GAAA,EAAK,IAAA,EAAM,KAAA,EAAO,WAAA,EAAa,GAAA,EAAI,qBACnDJ,cAAA;AAAA,QAACK,4BAAA;AAAA,QAAA;AAAA,UAEC,IAAA;AAAA,UACA,KAAA;AAAA,UACA,KAAA,EAAO,WAAA;AAAA,UACP;AAAA,SAAA;AAAA,QAJK;AAAA,OAMR,CAAA,GACD,MAAA;AAAA,MAEN,QAAA,EAAU;AAAA,QACR,KAAA,EAAO,WAAA;AAAA,QACP,KAAA,EACE,QAAQ,kBAAA,IAAsB,IAAA,GAC1B,aACA,OAAA,CAAQ,kBAAA,CAAmB,eAAe,OAAO;AAAA;AACzD;AAAA,GACF;AAEF,EAAA,OAAO,EAAE,SAAA,EAAW,OAAA,EAAS,SAAA,EAAU;AACzC","file":"chunk-G4VUVOHZ.cjs","sourcesContent":["/**\n * What a host adds to the billing kit. Selling plans needs Stripe, which stays the host's: whether\n * this deployment sells plans (a publishable key is configured), and its embedded checkout. It is the\n * host configuration's `billing`; without it nothing is for sale: projects show their limits and\n * usage only.\n */\nimport type { ReactNode } from 'react'\nimport { useArbi } from '@arbidocs/react'\nimport { useHost } from '../../provider/host'\n\nexport interface BillingCheckoutSupport {\n /** Load the host's Stripe (lazily, when a checkout opens); `null` when it cannot. */\n load(): Promise<unknown> | null\n /** Stripe's embedded checkout for a session, on the loaded Stripe. */\n render(stripe: unknown, session: { clientSecret: string; onComplete: () => void }): ReactNode\n}\n\nexport interface BillingSupport {\n /** This deployment sells plans (Stripe is configured). */\n stripeEnabled: boolean\n checkout?: BillingCheckoutSupport\n /**\n * Add-on blocks the user just bought here, so the host does not announce them later as having\n * arrived on their own.\n */\n onAddonBlocksBought?: (projectExtId: string, blocks: { ai: number; storage: number }) => void\n}\n\nconst NOT_FOR_SALE: BillingSupport = { stripeEnabled: false }\n\nexport function useBillingSupport(): BillingSupport {\n return useHost().billing ?? NOT_FOR_SALE\n}\n\n/** The signed-in user's id (`usr-…`), to tell the projects they own from the others. */\nexport function useSelfExtId(): string | undefined {\n const arbi = useArbi()\n return arbi.isLoggedIn ? (arbi.user.identity()?.externalId ?? undefined) : undefined\n}\n","/** Pro's allowance per month (one licence) — must match the backend. Legacy multi-pack plans get it per pack.\n * The live numbers for an existing project come from `project.addons`; these are only for\n * describing the plan before a project exists (new-project dialog, upgrade picker). */\nexport const PRO_AI_GBP = 10\nexport const PRO_STORAGE_GB = 5\n\n/**\n * Add-on block sizes (£25 of AI usage or 25 GB), the same on every plan. Their prices come from the\n * products API (`addon_prices`) before a project exists, and from `project.addons` after.\n */\nexport const ADDON_BLOCK_AI_GBP = 25\nexport const STORAGE_BLOCK_GB = 25\n\n/** Default monthly usage cap for a new Pro project (pence); it limits automatic top-ups only. 0 = no automatic\n * top-ups, null = no limit. */\nexport const DEFAULT_SPEND_CAP_PENCE = 10000\n\n/** The automatic add-on triggers when less than this much AI usage (£) remains; the backend minimum. */\nexport const MIN_AUTO_TOPUP_THRESHOLD_GBP = 1\n\n/** Free-tier quotas — must match backend FREE_* constants in src/constants.py\n * (FREE_AI_GBP=1, FREE_STORAGE_GB=0.05 → 50 MB, FREE_COLLABORATORS=0). */\nexport const FREE_AI_GBP = 1\nexport const FREE_STORAGE_MB = 50\nexport const FREE_COLLABORATORS = 0\n\n/** Collaborator limits at or above this are \"unlimited\" (the backend reports 999 for Pro/dev). */\nexport const UNLIMITED_COLLABORATORS = 999\n\n/**\n * Suggested initial daily per-user AI usage cap (£), pre-filled when creating\n * a new project. The user can clear it to create a project with no cap.\n * Backend treats null as \"no enforcement\" — there is no server-side default.\n */\nexport const SUGGESTED_DAILY_CAP_PER_USER = 10\n","/**\n * Quota display — single source of truth.\n *\n * Builds the icon / label / formatted used-of-limit strings for a project's\n * quotas (AI usage in £, storage, collaborators). Shared by QuotaBadges and the\n * project tooltip so the numbers and units can never disagree (storage in GB on\n * plans of 1 GB or more, MB below).\n */\n\nimport { HardDrive, PoundSterling, Users } from 'lucide-react'\nimport { formatGbp } from '@arbidocs/react'\nimport type { QuotaMeterItem } from '../../settings'\nimport type { components } from '@arbidocs/client'\nimport { UNLIMITED_COLLABORATORS } from './plan-constants'\n\ntype Quotas = components['schemas']['ProjectResponse']['quotas']\n\nconst fmt = (v: number) => Math.round(v).toLocaleString('en-US')\n\n/** \"May 31, 2025\" — the one format every AI-usage-reset mention uses. */\nexport function formatResetDate(unixTimestamp: number | null | undefined): string | null {\n if (!unixTimestamp) return null\n const date = new Date(unixTimestamp * 1000)\n return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })\n}\n\n/**\n * When the project's AI usage allowance next resets, as a unix timestamp.\n * Pro projects report it directly (`addons.ai_usage_reset_at` — monthly, even on an\n * annual plan); monthly subscriptions otherwise reset with the billing period\n * (`current_period_end`); free projects reset on the backend-stamped signup\n * anniversary (`quotas.budget_reset_at`). Only a FUTURE date is returned — a stale\n * past stamp would read as a bug, not a promise.\n */\nexport function aiUsageResetTimestamp(project: {\n quotas?: { budget_reset_at?: number | null } | null\n current_period_end?: number | null\n plan_interval?: string | null\n addons?: { ai_usage_reset_at?: number | null } | null\n}): number | null {\n // An annual period end is a year away — never a monthly AI usage reset.\n const periodEnd = project.plan_interval === 'year' ? null : project.current_period_end\n const ts =\n project.addons?.ai_usage_reset_at ?? periodEnd ?? project.quotas?.budget_reset_at ?? null\n return ts && ts * 1000 > Date.now() ? ts : null\n}\n\n// Defensive: a quota field may be missing on partial/empty payloads — treat it\n// as 0 / 0 rather than crashing the whole row.\nconst quota = (q?: { used?: number; limit?: number }) => ({\n used: q?.used ?? 0,\n limit: q?.limit ?? 0,\n})\n/** GB from 1 GB plans up (\"2.4 GB\", \"5 GB\"), MB below (\"50 MB\"); `unit: false` drops the unit. */\nfunction storageText(gbValue: number, limitGb: number, unit = true): string {\n if (limitGb >= 1) {\n const n = Math.round(gbValue * 10) / 10\n return `${n.toLocaleString('en-US')}${unit ? ' GB' : ''}`\n }\n return `${fmt(gbValue * 1000)}${unit ? ' MB' : ''}`\n}\nconst pctOf = (used: number, limit: number) => (limit > 0 ? (used / limit) * 100 : 0)\n\nexport function getQuotaItems(quotas: Quotas): QuotaMeterItem[] {\n const aiUsage = quota(quotas?.ai_usage)\n const storage = quota(quotas?.storage_gb)\n const collaborators = quota(quotas?.collaborators)\n const unlimitedCollaborators = collaborators.limit >= UNLIMITED_COLLABORATORS\n return [\n {\n key: 'ai-usage',\n icon: PoundSterling,\n label: 'AI usage',\n used: formatGbp(aiUsage.used),\n usedOfLimit: `${formatGbp(aiUsage.used)} / ${formatGbp(aiUsage.limit)}`,\n pct: pctOf(aiUsage.used, aiUsage.limit),\n },\n {\n key: 'storage',\n icon: HardDrive,\n label: 'Storage',\n used: storageText(storage.used, storage.limit),\n usedOfLimit: `${storageText(storage.used, storage.limit, false)} / ${storageText(\n storage.limit,\n storage.limit\n )}`,\n pct: pctOf(storage.used, storage.limit),\n },\n {\n key: 'collaborators',\n icon: Users,\n label: 'Collaborators',\n used: fmt(collaborators.used),\n usedOfLimit: unlimitedCollaborators\n ? `${fmt(collaborators.used)} / Unlimited`\n : `${fmt(collaborators.used)} / ${fmt(collaborators.limit)}`,\n // Zero seats (Free) IS the cap: 0 / 0 shows a full destructive bar,\n // because you can't add anyone — the truth the upgrade door answers.\n // (Only when the quota is actually present; a missing field on a\n // partial payload stays an empty bar, not a false alarm.)\n pct: unlimitedCollaborators\n ? 0\n : quotas?.collaborators && collaborators.limit === 0\n ? 100\n : pctOf(collaborators.used, collaborators.limit),\n },\n ]\n}\n","/**\n * Reward-balance logic (hook + money formatter).\n *\n * A user's reward balance is their available account balance — a single GLOBAL per-user\n * number, the Stripe customer account balance mirrored read-only into\n * `settings.extra_discount`. It auto-applies to the user's NEXT invoice.\n *\n * \"Rewards\" is the broad concept: the balance can be fed by several sources (referral\n * reward is just one). The referral pricing surfaces of the billing kit\n * speak to the referral source specifically; this module owns the balance itself.\n */\n\nimport { useUserSettings } from '@arbidocs/react'\n\nexport interface RewardBalance {\n amount: number // minor units (e.g. pennies) of available account balance\n currency: string\n}\n\n/** The user's available reward balance (all sources), or null if none. */\nexport function useRewardBalance(): RewardBalance | null {\n const { data } = useUserSettings()\n // Backend mirrors this read-only as { amount, currency }; schema types it as a loose object.\n const ed = data?.extra_discount as { amount?: number; currency?: string } | null | undefined\n if (!ed || !ed.amount || ed.amount <= 0) return null\n return { amount: ed.amount, currency: ed.currency || 'gbp' }\n}\n\n/** Format minor units as a localized money string, e.g. `£20` (whole) or `£29.99`. */\nexport function formatMoney(cents: number, currency = 'gbp'): string {\n const value = cents / 100\n const isWhole = Number.isInteger(value)\n const c = currency.toLowerCase()\n const symbol =\n c === 'usd' ? '$' : c === 'gbp' ? '£' : c === 'eur' ? '€' : currency.toUpperCase() + ' '\n return `${symbol}${value.toLocaleString('en-US', {\n minimumFractionDigits: isWhole ? 0 : 2,\n maximumFractionDigits: isWhole ? 0 : 2,\n })}`\n}\n","/** Add-on block price helpers (VAT-inclusive pence from `project.addons`). */\n\nimport { formatGbp } from '@arbidocs/react'\nimport type { components } from '@arbidocs/client'\nimport type { AddonKind } from './useAddonPurchase'\nimport { formatMoney } from './reward-balance'\n\ntype ProjectAddons = components['schemas']['ProjectAddons']\n\nconst gbp = (pence: number) => formatMoney(pence, 'gbp')\n\n/** \"3 Nov 2026\". */\nexport function formatPeriodEnd(unix: number | null | undefined): string | null {\n if (!unix) return null\n return new Date(unix * 1000).toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n })\n}\n\n/** What one more block of this kind costs right now, incl. UK VAT. */\nexport function addonPricePence(kind: AddonKind, addons: ProjectAddons): number {\n return kind === 'ai_usage' ? addons.ai_block_price_pence : addons.storage_block_price_pence\n}\n\n/** The same price ex VAT. */\nfunction addonPriceExVatPence(kind: AddonKind, addons: ProjectAddons): number {\n return kind === 'ai_usage'\n ? addons.ai_block_price_ex_vat_pence\n : addons.storage_block_price_ex_vat_pence\n}\n\n/**\n * The PUT /addons/settings body (the monthly usage cap and the automatic add-on trigger) from the current add-on\n * state with the given changes applied.\n */\nexport function addonSettingsBody(\n addons: ProjectAddons,\n change: Partial<{\n spend_cap_pence: number | null\n auto_topup_threshold_gbp: number\n }> = {}\n) {\n return {\n spend_cap_pence: addons.spend_cap_pence ?? null,\n auto_topup_threshold_gbp: addons.auto_topup_threshold_gbp,\n ...change,\n }\n}\n\n/**\n * Of `count` blocks of a kind, how many are on an earlier catalogue's price (legacy, at their old size: £10 of AI\n * usage or 10 GB) and how many on today's. A reduction removes today's blocks first, so the legacy ones are the\n * last kept.\n */\nexport function splitBlocks(\n kind: AddonKind,\n count: number,\n addons: ProjectAddons\n): { legacy: number; current: number } {\n const granted =\n (kind === 'ai_usage' ? addons.legacy_ai_blocks : addons.legacy_storage_blocks) ?? 0\n const legacy = Math.max(0, Math.min(granted, count))\n return { legacy, current: count - legacy }\n}\n\n/** One block's size: \"£25 of AI usage\" / \"25 GB\" (legacy: \"£10\" / \"10 GB\"). */\nfunction blockSize(kind: AddonKind, addons: ProjectAddons, legacy: boolean): string {\n if (kind === 'ai_usage') {\n return formatGbp(legacy ? (addons.legacy_block_ai_gbp ?? 10) : addons.block_ai_gbp)\n }\n return `${legacy ? (addons.legacy_block_storage_gb ?? 10) : addons.block_storage_gb} GB`\n}\n\n/**\n * \"2 × £25 of AI usage\", \"1 × £10 + 1 × £25 of AI usage\", \"1 × 10 GB + 2 × 25 GB\": `count` blocks of a kind, the\n * legacy ones (kept last on a reduction) at their old size.\n */\nexport function blocksLabel(kind: AddonKind, count: number, addons: ProjectAddons): string {\n const { legacy, current } = splitBlocks(kind, count, addons)\n const parts = [\n ...(legacy > 0 ? [`${legacy} × ${blockSize(kind, addons, true)}`] : []),\n ...(current > 0 || legacy === 0 ? [`${current} × ${blockSize(kind, addons, false)}`] : []),\n ]\n return `${parts.join(' + ')}${kind === 'ai_usage' ? ' of AI usage' : ''}`\n}\n\n/**\n * Bounds for \"Reduce from next period\": keep `min`..`current` blocks. `next` is what renews\n * now (a pending reduction, or the current count). Storage can't go below what usage needs.\n */\nexport function reduceBounds(\n kind: AddonKind,\n addons: ProjectAddons\n): { min: number; current: number; next: number } {\n const current = kind === 'ai_usage' ? addons.ai_blocks : addons.storage_blocks\n const pending = kind === 'ai_usage' ? addons.ai_blocks_next : addons.storage_blocks_next\n const min = kind === 'ai_usage' ? 0 : Math.min(addons.storage_blocks_min, current)\n return { min, current, next: pending ?? current }\n}\n\n/** One block's monthly-equivalent price ex VAT: AI usage and storage are priced separately. */\nfunction blockMonthlyExVatPence(kind: AddonKind, addons: ProjectAddons): number {\n return kind === 'ai_usage'\n ? addons.ai_block_monthly_ex_vat_pence\n : addons.storage_block_monthly_ex_vat_pence\n}\n\n/** What one block renews at per billing period, ex VAT (annual: 12 × the monthly price). */\nfunction blockPeriodExVatPence(kind: AddonKind, addons: ProjectAddons): number {\n return kind === 'ai_usage'\n ? addons.ai_block_period_ex_vat_pence\n : addons.storage_block_period_ex_vat_pence\n}\n\n/** What one add-on renews at: \"£25/month + VAT\" or \"£225/year + VAT\". */\nfunction blockRenewalShort(kind: AddonKind, addons: ProjectAddons, isAnnual: boolean): string {\n return `${gbp(blockPeriodExVatPence(kind, addons))}/${isAnnual ? 'year' : 'month'} + VAT`\n}\n\n/** The extra line annual plans show beside an AI usage add-on or upgrade price. */\nexport const ANNUAL_PREMIUM_AI_NOTE = 'No markup on Premium AI on annual plans'\n\n/** The confirm dialog's figures: charged now (incl. / ex VAT), what it covers until, then what renews. */\nexport function addonCharge(\n kind: AddonKind,\n addons: ProjectAddons,\n isAnnual: boolean,\n periodEnd: number | null | undefined\n): { now: string; nowExVat: string; nowVat: string; until: string | null; then: string } {\n return {\n now: gbp(addonPricePence(kind, addons)),\n nowExVat: gbp(addonPriceExVatPence(kind, addons)),\n nowVat: gbp(addonPricePence(kind, addons) - addonPriceExVatPence(kind, addons)),\n until: isAnnual ? formatPeriodEnd(periodEnd) : null,\n then: blockRenewalShort(kind, addons, isAnnual),\n }\n}\n\n/** Why automatic top-ups stopped (one line; the price of a step is on the Add button). */\nexport const CAP_REACHED_MESSAGE = 'Usage cap reached: no more automatic top-ups this month.'\n\n/** The £0 usage cap: no automatic top-ups (adding by hand still works). */\nexport const ZERO_BUDGET_MESSAGE = 'Automatic top-ups are off (£0 usage cap).'\n\n/** The usage cap's heading wherever it is edited or shown. */\nexport const USAGE_CAP_LABEL = 'Usage cap'\n\n/** What the usage cap means (in \"More info\"): £0 and \"No limit\" explained. */\nexport const USAGE_CAP_HELP =\n 'The most automatic top-ups (AI usage added when it runs low, storage added when an upload needs it) may ' +\n 'cost in a month. Adding or removing by hand is never limited by it; the plan and renewals are not counted. ' +\n '£0 = no automatic top-ups: AI usage and uploads stop at your allowance unless you add more. ' +\n 'No limit = no cap.'\n\n/** A £0 cap turns automatic top-ups off (manual adds still work). */\nexport function isAddonBudgetZero(addons: Pick<ProjectAddons, 'spend_cap_pence'>): boolean {\n return addons.spend_cap_pence === 0\n}\n\n/**\n * How much more of a resource automatic top-ups may add this month before the usage cap stops them, in the\n * resource's unit (£ of AI usage / GB): the whole blocks the cap left pays for at today's ex-VAT price. `null` =\n * no limit; 0 with a £0 cap or when not even one block fits.\n */\nexport function autoRoom(kind: AddonKind, addons: ProjectAddons): number | null {\n const left = addons.cap_left_pence\n if (left == null) return addons.spend_cap_pence === 0 ? 0 : null\n const price = addonPriceExVatPence(kind, addons)\n if (price <= 0) return 0\n const blocks = Math.floor(left / price)\n return blocks * (kind === 'ai_usage' ? addons.block_ai_gbp : addons.block_storage_gb)\n}\n\n/** The size of the block a one-step reduction removes from what renews (today's blocks go first). */\nexport function nextRemovedBlockSize(kind: AddonKind, addons: ProjectAddons): number {\n const { next } = reduceBounds(kind, addons)\n const { current } = splitBlocks(kind, next, addons)\n if (kind === 'ai_usage') {\n return current > 0 ? addons.block_ai_gbp : (addons.legacy_block_ai_gbp ?? 10)\n }\n return current > 0 ? addons.block_storage_gb : (addons.legacy_block_storage_gb ?? 10)\n}\n\n/**\n * Pounds typed into a usage cap field → pence. '' → the default (null); invalid → undefined.\n * Equal to the default is also sent as null (\"keep the default\").\n */\nexport function parseBudgetPounds(value: string): number | null | undefined {\n if (value.trim() === '') return null\n const n = Number(value)\n if (!Number.isFinite(n) || n < 0) return undefined\n return Math.round(n * 100)\n}\n\n/** Toast after saving the usage cap. */\nexport function budgetSavedMessage(capPence: number | null): string {\n if (capPence == null) return 'Usage cap: no limit'\n if (capPence === 0) return 'Usage cap: £0 (no automatic top-ups)'\n return `Usage cap: ${gbp(capPence)} a month`\n}\n\nconst gbText = (n: number) => `${Math.round(n * 10) / 10} GB`\n\n/** \"£25 of AI usage\" / \"25 GB\". */\nexport function stepLabel(kind: AddonKind, size: number): string {\n return kind === 'ai_usage' ? `${formatGbp(size)} of AI usage` : gbText(size)\n}\n\n/** The PUT /addons/next-period body that renews `keep` blocks of `kind` (the other kind unchanged). */\nexport function nextPeriodBody(kind: AddonKind, keep: number) {\n return kind === 'ai_usage'\n ? { ai_blocks: keep, storage_blocks: null }\n : { ai_blocks: null, storage_blocks: keep }\n}\n\n/**\n * The \"+\" step's price line, ex VAT: \"£25/month · today £25\" (annual: \"£18.75/month · today £150\");\n * storage, charged for the rest of the period: \"£25/month · prorated today £8.33\".\n */\nexport function addStepCaption(kind: AddonKind, addons: ProjectAddons): string {\n const now = gbp(addonPriceExVatPence(kind, addons))\n const today = kind === 'storage' ? `prorated today ${now}` : `today ${now}`\n return `${gbp(blockMonthlyExVatPence(kind, addons))}/month · ${today}`\n}\n","/**\n * The `detail` of a refused billing call: the response body's `detail` (a string, or the\n * `{code, message}` of a payment refusal), whether the error is an SDK `ArbiApiError` (body in\n * `apiError`) or the body itself.\n */\nexport function apiErrorDetail(error: unknown): unknown {\n const body = (error as { apiError?: unknown } | null)?.apiError ?? error\n return (body as { detail?: unknown } | null)?.detail\n}\n","/**\n * Tax-inclusive totals from the backend's Stripe Tax quotes (`TaxQuoteResponse`, plan-change\n * previews, add-on quotes): \"£48.00 incl. VAT (£40.00 + £8.00 VAT 20%)\", \"£40.00 · no VAT\n * (reverse charge)\", \"£40.00 · no tax\".\n */\n\nimport type { components } from '@arbidocs/client'\nimport { apiErrorDetail } from './api-error'\n\nexport type TaxQuote = components['schemas']['TaxQuoteResponse']\n\n/** Countries whose tax depends on the postcode: the field is shown up front. */\nexport const POSTCODE_COUNTRIES: readonly string[] = ['US', 'CA']\n\n/** The quote error that asks for a ZIP / postal code. */\nexport const TAX_LOCATION_INVALID = 'TAX_LOCATION_INVALID'\n\n/** \"£42.00\" — always pence, so the parts of a total add up on screen. */\nexport function money2(pence: number, currency = 'gbp'): string {\n const symbol = { gbp: '£', usd: '$', eur: '€' }[currency.toLowerCase()] ?? `${currency} `\n return `${symbol}${(pence / 100).toLocaleString('en-GB', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })}`\n}\n\nexport interface TaxParts {\n subtotal: number\n tax: number\n total: number\n /** \"VAT 20%\"; null when no tax is due. */\n label?: string | null\n reverseCharge?: boolean\n}\n\n/** \"VAT\" for a VAT label, else \"tax\". */\nfunction taxKind(label: string | null | undefined): string {\n return /^vat\\b/i.test(label ?? '') ? 'VAT' : 'tax'\n}\n\n/** What follows the total: \"incl. VAT (£40.00 + £8.00 VAT 20%)\", \"· no VAT (reverse charge)\", \"· no tax\". */\nexport function taxDetail({ subtotal, tax, label, reverseCharge }: TaxParts): string {\n if (reverseCharge) return '· no VAT (reverse charge)'\n if (tax <= 0) return '· no tax'\n return `incl. ${taxKind(label)} (${money2(subtotal)} + ${money2(tax)} ${label ?? 'tax'})`\n}\n\n/** \"£48.00 incl. VAT (£40.00 + £8.00 VAT 20%)\", \"£40.00 · no VAT (reverse charge)\", \"£40.00 · no tax\". */\nexport function taxSummary(parts: TaxParts): string {\n return `${money2(parts.total)} ${taxDetail(parts)}`\n}\n\n/** \"£21.00 incl. VAT\" / \"£17.50\" — a total with only the word for its tax. */\nexport function totalWithTaxWord({ total, tax, label }: TaxParts): string {\n return tax > 0 ? `${money2(total)} incl. ${taxKind(label)}` : money2(total)\n}\n\n/** The parts of a quote response. */\nexport function quoteParts(quote: TaxQuote): TaxParts {\n return {\n subtotal: quote.subtotal_pence,\n tax: quote.tax_pence,\n total: quote.total_pence,\n label: quote.tax_label,\n reverseCharge: quote.reverse_charge,\n }\n}\n\n/** \"Total today £48.00 incl. VAT (£40.00 + £8.00 VAT 20%)\". */\nexport function quoteTotalLine(quote: TaxQuote): string {\n return `Total today ${taxSummary(quoteParts(quote))}`\n}\n\n/** The API error code (`detail.code`) and message, if any. */\nexport function quoteError(error: unknown): { code?: string; message?: string } {\n const detail = apiErrorDetail(error)\n if (detail && typeof detail === 'object') {\n const { code, message } = detail as { code?: unknown; message?: unknown }\n return {\n code: typeof code === 'string' ? code : undefined,\n message: typeof message === 'string' ? message : undefined,\n }\n }\n return { message: typeof detail === 'string' ? detail : undefined }\n}\n","/**\n * Pro plan price helpers. Prices come from Stripe via GET /v1/user/products (source of truth).\n * One plan is sold: Pro, one licence (£10 of AI usage + 5 GB a month). Each price lists\n * `pack_prices` for that one licence — `amount` incl. UK VAT and `amount_ex_vat` — and\n * `addon_prices` (one add-on block on that interval). Display them as-is.\n * Legacy subscriptions with several packs keep working; their name and price come from the project.\n */\n\nimport type { components } from '@arbidocs/client'\nimport { formatGbp } from '@arbidocs/react'\nimport { formatMoney } from './reward-balance'\nimport { formatPeriodEnd } from './addon-pricing'\nimport { taxSummary } from './tax-quote'\nimport { ADDON_BLOCK_AI_GBP, STORAGE_BLOCK_GB } from './plan-constants'\n\ntype PlanChangePreview = components['schemas']['PlanChangePreview']\ntype ProductPrice = components['schemas']['ProductPrice']\ntype ProductResponse = components['schemas']['ProductResponse']\ntype PackPrice = components['schemas']['PackPrice']\ntype AddonPrice = components['schemas']['AddonPrice']\n\nexport type PlanInterval = 'month' | 'year'\n\nconst gbp = (pence: number) => formatMoney(pence, 'gbp')\n\n/** The headline price: \"£40 + VAT\". */\nexport function plusVat(exVatPence: number, currency = 'gbp'): string {\n return `${formatMoney(exVatPence, currency)} + VAT`\n}\n\n/** The one licence Pro sells. Other pack counts exist only on legacy subscriptions (displayed, not sold). */\nexport const PRO_PACKS = 1\n\n/** A plan the pickers offer. */\nexport type PlanChoice = 'free' | 'pro'\n\n/** Packs per plan choice (0 = Free). */\nexport const PLAN_CHOICE_PACKS: Record<PlanChoice, number> = {\n free: 0,\n pro: PRO_PACKS,\n}\n\n/** \"Free\" (0), \"Pro\" (1), otherwise \"Pro ×N\" (a legacy multi-pack plan; the API's own name wins). */\nexport function planNameForPacks(packs: number | null | undefined): string {\n const n = packs ?? 0\n if (n <= 0) return 'Free'\n if (n === PRO_PACKS) return 'Pro'\n return `Pro ×${n}`\n}\n\n/** The plan-change panel's fixed lines, each with a test id. */\nexport interface PlanChangeLine {\n id: 'pay-today' | 'from' | 'current-until' | 'no-change' | 'awaiting-bank'\n text: string\n}\n\n/**\n * What a plan change costs, from the backend's Stripe invoice preview (taxed for the customer's\n * address), as fixed lines:\n * - \"Pay today £42.00 incl. VAT (£35.00 + £7.00 VAT 20%)\" (\"Pay today £0\" for a change that waits)\n * - \"From 16 Nov 2026: £210.00 incl. VAT (£175.00 + £35.00 VAT 20%) a month\"\n * - \"Current plan until 16 Nov 2026\" for a change that waits for the period end.\n * \"No change\" when the selection is what the project already has; \"Waiting for your bank\" while\n * an earlier upgrade payment awaits 3-D Secure.\n */\nexport function planPreviewLines(preview: PlanChangePreview): PlanChangeLine[] {\n if (preview.unchanged) return [{ id: 'no-change', text: 'No change' }]\n const date = formatPeriodEnd(preview.next_renewal_at)\n const cadence = preview.interval === 'year' ? 'year' : 'month'\n const lines: PlanChangeLine[] = [\n preview.awaiting_confirmation\n ? { id: 'awaiting-bank', text: 'Waiting for your bank' }\n : {\n id: 'pay-today',\n text: preview.effective_now\n ? `Pay today ${taxSummary({\n subtotal: preview.due_now_ex_vat_pence,\n tax: preview.due_now_tax_pence,\n total: preview.due_now_pence,\n label: preview.tax_label,\n })}`\n : `Pay today ${gbp(0)}`,\n },\n {\n id: 'from',\n text: `${date ? `From ${date}` : 'From renewal'}: ${taxSummary({\n subtotal: preview.next_renewal_ex_vat_pence,\n tax: preview.next_renewal_tax_pence,\n total: preview.next_renewal_pence,\n label: preview.tax_label,\n })} a ${cadence}`,\n },\n ]\n if (!preview.effective_now) {\n lines.push({ id: 'current-until', text: `Current plan until ${date ?? 'renewal'}` })\n }\n return lines\n}\n\n/** Stand-in for \"Pay today\" when the preview failed for an upgrade. */\nexport const PAY_TODAY_UNPRICED = 'Pay today: the difference for the rest of this period'\n\n/** One add-on block's price on this interval's plan price (`addon_prices`), if listed. */\nexport function addonPrice(\n price: ProductPrice | undefined,\n kind: 'ai_usage' | 'storage' = 'ai_usage'\n): AddonPrice | undefined {\n return price?.addon_prices?.find((p) => p.kind === kind)\n}\n\n/** Per add-on block of `kind` per month, ex VAT (annual plans: the monthly equivalent). */\nexport function addonMonthlyExVat(\n price: ProductPrice | undefined,\n kind: 'ai_usage' | 'storage' = 'ai_usage'\n): number | undefined {\n return addonPrice(price, kind)?.monthly_ex_vat\n}\n\n/** What a checkout buys: \"Pro\", \"Pro + 2 × £25 of AI usage + 1 × 25 GB\". */\nexport function checkoutItemsLabel(aiBlocks: number, storageBlocks: number): string {\n return [\n 'Pro',\n aiBlocks > 0 && `${aiBlocks} × ${formatGbp(ADDON_BLOCK_AI_GBP)} of AI usage`,\n storageBlocks > 0 && `${storageBlocks} × ${STORAGE_BLOCK_GB} GB`,\n ]\n .filter(Boolean)\n .join(' + ')\n}\n\n/** The price of `packs` packs on this interval's price, if Stripe lists it (only one licence is listed). */\nexport function packPrice(\n price: ProductPrice | undefined,\n packs: number = PRO_PACKS\n): PackPrice | undefined {\n return price?.pack_prices?.find((p) => p.packs === packs)\n}\n\nexport interface ProPrices {\n monthly?: ProductPrice\n annual?: ProductPrice\n}\n\n/** The Pro product's monthly and annual prices (default price per interval wins). */\nexport function findProPrices(products: ProductResponse[] | undefined): ProPrices {\n const prices = products?.[0]?.prices ?? []\n const pick = (interval: PlanInterval) =>\n prices.find((p) => p.interval === interval && p.default_price) ??\n prices.find((p) => p.interval === interval)\n return { monthly: pick('month'), annual: pick('year') }\n}\n\n/** Annual savings vs 12 × monthly, as a whole percent (e.g. £360 vs £480 → 25). */\nexport function calcSavingsPercent(\n monthlyPrice: ProductPrice | undefined,\n annualPrice: ProductPrice | undefined\n): number | null {\n const monthly = packPrice(monthlyPrice)?.amount ?? monthlyPrice?.amount\n const annual = packPrice(annualPrice)?.amount ?? annualPrice?.amount\n if (monthly == null || annual == null || monthly === 0) return null\n const savings = Math.round(((monthly * 12 - annual) / (monthly * 12)) * 100)\n return savings > 0 ? savings : null\n}\n\n/** Most add-on blocks of each kind a checkout may include (the backend's limit). */\nexport const MAX_CHECKOUT_BLOCKS = 100\n\n/** \"£25/month + VAT each\", annual: \"£225/year + VAT each\": one block on the chosen interval. */\nexport function checkoutBlockPriceText(\n price: ProductPrice | undefined,\n kind: 'ai_usage' | 'storage'\n): string | null {\n const block = addonPrice(price, kind)\n if (!block) return null\n const currency = price?.currency ?? 'gbp'\n return price?.interval === 'year'\n ? `${formatMoney(block.amount_ex_vat, currency)}/year + VAT each`\n : `${formatMoney(block.amount_ex_vat, currency)}/month + VAT each`\n}\n","import type { PlanBadgeProps } from '../../settings'\nimport type { components } from '@arbidocs/client'\nimport { planNameForPacks } from './plan-pricing'\n\ntype ProjectBillingFields = Pick<\n components['schemas']['ProjectResponse'],\n 'subscription' | 'plan_interval'\n> &\n Partial<Pick<components['schemas']['ProjectResponse'], 'packs' | 'addons'>>\n\n/** A project is on Pro when it has a billing interval (null = Free or checkout pending). */\nexport function isProProject(project: Pick<ProjectBillingFields, 'plan_interval'>): boolean {\n return project.plan_interval != null\n}\n\n/** \"Pro\", or a legacy multi-pack plan's name (\"Pro ×N\") — the API's name when it sends one (owner view). */\nexport function proTierName(project: ProjectBillingFields): string {\n return project.addons?.plan_name || planNameForPacks(Math.max(project.packs ?? 1, 1))\n}\n\n/** \"Free\", \"Pro monthly\", \"Pro annual\", \"Pro ×3 monthly\" (legacy) or \"Dev\" — the full plan name. */\nexport function planName(project: ProjectBillingFields): string {\n if (project.subscription === 'dev') return 'Dev'\n if (!isProProject(project)) return 'Free'\n return `${proTierName(project)} ${project.plan_interval === 'year' ? 'annual' : 'monthly'}`\n}\n\n/**\n * Maps a project's billing state to the `PlanBadge` block's label + tone.\n * Pro reads as accent, Free/dev as neutral, payment trouble or cancelling as pending.\n */\nexport function planBadgeView(\n project: ProjectBillingFields\n): Pick<PlanBadgeProps, 'label' | 'tone'> {\n const { subscription } = project\n const label =\n subscription === 'canceled'\n ? 'Cancelling'\n : subscription === 'dev'\n ? 'Dev'\n : isProProject(project)\n ? proTierName(project)\n : 'Free'\n\n const tone =\n subscription === 'dev'\n ? 'dev'\n : subscription === 'canceled' || subscription === 'past_due'\n ? 'pending'\n : isProProject(project)\n ? 'paid'\n : 'free'\n\n return { label, tone }\n}\n","/**\n * What a project's group in the workspace list says about the project itself: its plan badge (own\n * projects, where plans are sold), the usage readout beside its name, and the plan and limits\n * breakdown behind the name. One source for the cards' bands and the table's headings.\n */\nimport type { ReactNode } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport type { components } from '@arbidocs/client'\nimport { UsageMeter } from '../../components/UsageMeter'\nimport { PlanBadge, QuotaMeter } from '../../settings'\nimport { ProjectBreakdown, ProjectReadout } from '../../home/ProjectBandParts'\nimport { planBadgeView } from '../billing/plan-badge'\nimport { getQuotaItems } from '../billing/quota-items'\n\ntype Project = components['schemas']['ProjectResponse']\n\nexport interface ProjectGroupBilling {\n /** The plan badge: own projects only, where plans are sold. */\n planBadge?: ReactNode\n /** Plan and usage, right after the name (projects with quotas). */\n readout?: ReactNode\n /** The plan and limits panel behind the name; meters for own projects only. */\n breakdown?: ReactNode\n}\n\nexport function projectGroupBilling(\n project: Project | undefined,\n { isOwned, stripeEnabled }: { isOwned: boolean; stripeEnabled: boolean }\n): ProjectGroupBilling {\n if (!project) return {}\n const planBadge = isOwned && stripeEnabled ? <PlanBadge {...planBadgeView(project)} /> : undefined\n const quotaItems = project.quotas ? getQuotaItems(project.quotas) : []\n const readout = project.quotas ? (\n <ProjectReadout\n plan={\n planBadge ? { badge: planBadge, testId: `project-tier-${project.external_id}` } : undefined\n }\n usage={{\n testId: `project-usage-${project.external_id}`,\n // Bare numbers without plans for sale: a glance beside the name, not the Plan & Usage detail.\n node: (\n <QuotaMeter\n items={quotaItems}\n size=\"sm\"\n showTooltips={false}\n showBars={stripeEnabled}\n showPercent={false}\n />\n ),\n }}\n />\n ) : (\n planBadge\n )\n const breakdown = (\n <ProjectBreakdown\n name={project.name}\n badge={planBadge}\n meters={\n isOwned\n ? quotaItems.map(({ key, icon, label, usedOfLimit, pct }) => (\n <UsageMeter\n key={key}\n icon={icon as LucideIcon}\n label={label}\n value={usedOfLimit}\n pct={pct}\n />\n ))\n : undefined\n }\n dailyCap={{\n label: 'Daily cap',\n value:\n project.daily_cap_per_user == null\n ? 'No limit'\n : project.daily_cap_per_user.toLocaleString('en-US'),\n }}\n />\n )\n return { planBadge, readout, breakdown }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/workspaces/WorkspaceSettingsParts.tsx","../src/workspaces/CommonWorkspaceToggle.tsx","../src/workspaces/workspace-roles.ts","../src/workspaces/WorkspaceFormParts.tsx","../src/workspaces/WorkspaceCard.tsx","../src/workspaces/WorkspaceGroup.tsx","../src/workspaces/WorkspaceTypeBadge.tsx"],"names":["jsx","jsxs","Popover","PopoverTrigger","PopoverContent","Button","UserPlus","cn","LogOut","IconToggle","Globe","AlertCircle","Dialog","DialogContent","ModalHeader","Fragment","DialogTitle","DialogDescription","entityNoun","Select","SelectTrigger","SelectValue","SelectContent","SelectItem","SelectSeparator","Plus","ArrowUpRight","getEntityLabel","useId","useState","KeyValueRow","FileText","Input","AlignLeft","CreditCard","createContext","useMemo","ActionLink","useContext","Check","ChevronRight","MessagesSquare","Users","MemberAvatarStack","fmtDate","format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SAAA;AAAA,EACA,WAAA,GAAc,KAAA;AAAA,EACd,IAAA,GAAO,IAAA;AAAA,EACP,UAAA,GAAa,KAAA;AAAA,EACb;AACF,CAAA,EAA4B;AAC1B,EAAA,MAAM,SAAA,GAAYwC,mCAAA,CAAkB,SAAA,CAAU,KAAK,CAAA;AACnD,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,KAAYC,sCAAA,CAAqB,SAAA,CAAU,WAAW,SAAS,CAAA;AAC7E,EAAA,MAAM,OAAO,SAAA,CAAU,SAAA,GAAYtC,iBAAAA,GAAQ,SAAA,GAAY,IAAIgC,iBAAAA,GAAQO,gBAAA;AAEnE,EAAA,uBACEjD,cAAAA;AAAA,IAACkD,wCAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,OAAA,EAASC,oCAAkB,OAAO,CAAA;AAAA,MAClC,SAAA,EAAW,IAAA;AAAA,MACX,WAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ","file":"chunk-Q7BS7EOU.cjs","sourcesContent":["import type { ReactNode } from 'react'\nimport { LogOut, UserPlus } from 'lucide-react'\nimport { Button, cn, Popover, PopoverContent, PopoverTrigger } from '@arbidocs/react/ui'\n\n/**\n * Page frame of a workspace's home: a bounded column whose ONE scroll region spans the full\n * width (scrollbar on the outer edge), the inset living on the content inside it. A container,\n * so children can use `@2xl:` queries.\n */\nexport function WorkspacePageFrame({ testId, children }: { testId?: string; children: ReactNode }) {\n return (\n <div\n className=\"flex h-full flex-col @container\"\n data-slot=\"workspace-page\"\n data-testid={testId}\n >\n {/* scrollbar-gutter:stable keeps the content from jumping when a scrollbar appears. */}\n <div className=\"scrollbar-subtle min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]\">\n <div className=\"space-y-6 px-4 pb-6 sm:px-6 pt-4\">{children}</div>\n </div>\n </div>\n )\n}\n\n/** Tinted card holding the identity bar and the expandable member list. */\nexport function WorkspaceIdentityPanel({ children }: { children: ReactNode }) {\n return (\n <div\n data-slot=\"workspace-identity-panel\"\n className=\"group rounded-lg border border-border bg-card px-4 py-3 shadow-xs\"\n >\n {children}\n </div>\n )\n}\n\nexport interface WorkspaceProjectSlotProps {\n testId: string\n /** Screen-reader caption (\"Project:\"): the chip says what it is without a word in front. */\n caption: string\n children: ReactNode\n}\n\n/** The project control / chip pinned to the end of the name row. */\nexport function WorkspaceProjectSlot({ testId, caption, children }: WorkspaceProjectSlotProps) {\n return (\n <div className=\"flex min-w-0 items-center gap-3\">\n <div className=\"flex min-w-0 flex-1 items-center gap-2\" data-testid={testId}>\n <span className=\"sr-only\">{caption}</span>\n {children}\n </div>\n </div>\n )\n}\n\n/** Stated absence (\"None\") rather than a blank gap. */\nexport function ItalicNone({ children }: { children: ReactNode }) {\n return <span className=\"text-sm italic text-muted-foreground\">{children}</span>\n}\n\nexport interface WorkspaceAudienceLineProps {\n visibility: {\n testId: string\n caption: string\n /** The owner's visibility switch (developers only). */\n toggle?: ReactNode\n /** The state named in words, so the switch is never a puzzle. */\n stateText: string\n /** What the state means for who can see the workspace; opened by tapping the state words. */\n stateHelp: string\n }\n /** Member avatar stack. */\n members: ReactNode\n /** \"Share\" button (owners). */\n share?: { label: string; onClick: () => void; testId: string }\n}\n\n/** Visibility and members end the description line together: who can see and use the workspace. */\nexport function WorkspaceAudienceLine({ visibility, members, share }: WorkspaceAudienceLineProps) {\n return (\n <span className=\"flex flex-wrap items-center gap-x-4 gap-y-2\" data-slot=\"workspace-audience\">\n <span className=\"flex items-center gap-2\" data-testid={visibility.testId}>\n <span className=\"sr-only\">{visibility.caption}</span>\n {visibility.toggle}\n {/* Tap-to-explain, not hover-only: the words must answer a click on touch screens too. */}\n <Popover>\n <PopoverTrigger className=\"touch-hit cursor-pointer rounded-sm text-sm text-muted-foreground underline decoration-dotted underline-offset-4 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\">\n {visibility.stateText}\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-64 text-sm\">\n {visibility.stateHelp}\n </PopoverContent>\n </Popover>\n </span>\n {/* Faces first, then Share: \"these people ... add more\". */}\n <span className=\"flex items-center gap-1\">\n {members}\n {share && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n className=\"h-8 gap-1.5 px-3 text-sm pointer-coarse:h-11\"\n onClick={share.onClick}\n data-testid={share.testId}\n >\n <UserPlus className=\"size-4\" />\n {share.label}\n </Button>\n )}\n </span>\n </span>\n )\n}\n\n/**\n * Collapsible block under the identity bar. Stays mounted and animates its height (grid-rows\n * 0fr to 1fr), so opening and closing glides instead of snapping.\n */\nexport function ExpandableSection({\n expanded,\n testId,\n children,\n}: {\n expanded: boolean\n testId?: string\n children: ReactNode\n}) {\n return (\n <div\n className={cn(\n 'grid transition-[grid-template-rows] duration-300 ease-in-out',\n expanded ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'\n )}\n data-slot=\"expandable-section\"\n data-expanded={expanded}\n data-testid={testId}\n >\n <div className=\"overflow-hidden\">\n <div className=\"mt-4 border-t border-border pt-4\">{children}</div>\n </div>\n </div>\n )\n}\n\n/** Centered loading placeholder of a page body. */\nexport function PageLoading({ children }: { children: ReactNode }) {\n return <div className=\"flex h-64 items-center justify-center\">{children}</div>\n}\n\nexport interface LeaveFooterProps {\n testId?: string\n leave: { label: string; disabled?: boolean; onClick: () => void; testId?: string }\n}\n\n/** Leaving ENDS your part in the workspace, so it sits last and alone at the foot of the page. */\nexport function LeaveFooter({ testId, leave }: LeaveFooterProps) {\n return (\n <div className=\"flex justify-end\" data-slot=\"leave-footer\" data-testid={testId}>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={leave.onClick}\n disabled={leave.disabled}\n className=\"h-7 px-2 text-sm text-destructive hover:bg-destructive/10 hover:text-destructive pointer-coarse:h-11\"\n data-testid={leave.testId}\n >\n <LogOut className=\"mr-1 size-3.5\" />\n {leave.label}\n </Button>\n </div>\n )\n}\n","/**\n * CommonWorkspaceToggle Component\n *\n * Toggle for workspace common/members-only visibility.\n * Takes isCommon and onToggle as props for form integration.\n */\n\nimport { Globe } from 'lucide-react'\nimport { IconToggle } from '@arbidocs/react/ui'\n\nexport interface CommonWorkspaceToggleProps {\n isCommon: boolean\n onToggle: (isCommon: boolean) => void\n disabled?: boolean\n /** Tooltip to show when disabled */\n disabledTooltip?: string\n 'data-testid'?: string\n}\n\nconst COLORS = {\n text: 'text-muted-foreground',\n bg: 'bg-gray-600',\n}\n\nexport function CommonWorkspaceToggle({\n isCommon,\n onToggle,\n disabled = false,\n disabledTooltip,\n 'data-testid': dataTestId,\n}: CommonWorkspaceToggleProps) {\n return (\n <IconToggle\n icon={Globe}\n isActive={isCommon}\n onToggle={onToggle}\n colors={COLORS}\n disabled={disabled}\n disabledTooltip={disabledTooltip}\n tooltipActive=\"On: everyone on this deployment can see it. Turn off to limit it to members.\"\n tooltipInactive=\"Off: only members of this workspace can see it. Turn on to let everyone on this deployment see it.\"\n data-testid={dataTestId}\n />\n )\n}\n","/**\n * A workspace role ('owner' | 'collaborator' | 'guest') as people see it: its name, its badge\n * colours and what it lets a member do.\n */\n\nexport type WorkspaceRoleName = 'owner' | 'collaborator' | 'guest'\n\n/** \"Owner\", \"Collaborator\", \"Guest\". */\nexport function formatRole(role: string): string {\n return role.charAt(0).toUpperCase() + role.slice(1)\n}\n\nconst ROLE_BADGE_CLASSES: Record<WorkspaceRoleName, string> = {\n owner: 'bg-primary text-white hover:bg-primary border border-primary',\n collaborator: 'bg-secondary text-white hover:bg-secondary border border-secondary',\n guest: 'bg-gray-600 text-white hover:bg-gray-600 border border-gray-600',\n}\n\n/** The badge classes of a role. */\nexport function getRoleBadgeClass(role: WorkspaceRoleName): string {\n return ROLE_BADGE_CLASSES[role]\n}\n\nconst ROLE_DESCRIPTIONS: Record<WorkspaceRoleName, string> = {\n owner:\n 'Owners have full control of the workspace, including adding and removing members, but cannot see private content created by other members.',\n collaborator:\n 'Collaborators can create and edit shared content, but cannot delete shared content created by others and cannot manage workspace settings or membership.',\n guest:\n 'Guests can create private content and view shared content, but cannot create or edit shared content.',\n}\n\n/** What a role lets a member do (a tooltip). */\nexport function getRoleDescription(role: WorkspaceRoleName): string {\n return ROLE_DESCRIPTIONS[role]\n}\n","import { useState, type ReactNode, useId } from 'react'\nimport {\n AlertCircle,\n AlignLeft,\n ArrowUpRight,\n CreditCard,\n FileText,\n Globe,\n Plus,\n} from 'lucide-react'\nimport {\n Button,\n cn,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogTitle,\n Input,\n Select,\n SelectContent,\n SelectItem,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n entityNoun,\n getEntityLabel,\n} from '@arbidocs/react/ui'\nimport { KeyValueRow } from '../home/KeyValueRow'\nimport { ModalHeader } from '../settings/ModalScaffold'\n\n/** Inline error strip of a form. */\nexport function FormErrorBanner({\n message,\n testId,\n className,\n id,\n}: {\n message: string\n testId?: string\n className?: string\n /** Lets a field point at this message with `aria-describedby`. */\n id?: string\n}) {\n return (\n <div\n id={id}\n role=\"alert\"\n data-slot=\"form-error\"\n data-testid={testId}\n className={cn(\n 'flex items-center gap-2 rounded-md border border-red-border bg-red-bg p-3 text-sm text-red-text',\n className\n )}\n >\n <AlertCircle className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n {message}\n </div>\n )\n}\n\n/** Right-aligned footer row of a form (Cancel + submit). */\nexport function FormActions({ className, children }: { className?: string; children: ReactNode }) {\n return (\n <div\n data-slot=\"form-actions\"\n className={cn('sticky bottom-0 flex justify-end gap-2 bg-background pt-2', className)}\n >\n {children}\n </div>\n )\n}\n\n/** Footer row of a modal body, separated by a rule. */\nexport function ModalActionRow({ children }: { children: ReactNode }) {\n return (\n <div\n data-slot=\"modal-action-row\"\n className=\"sticky bottom-0 -mx-6 -mb-6 flex flex-col-reverse gap-2 border-t border-border bg-background px-6 pb-6 pt-3 sm:flex-row sm:items-center sm:justify-end\"\n >\n {children}\n </div>\n )\n}\n\nexport interface WorkspaceFormModalProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n title: ReactNode\n /** Icon before the title. */\n icon?: ReactNode\n /** Optional intro paragraph above the form (first-run welcome). */\n intro?: ReactNode\n testId?: string\n /** Visually hidden description. */\n description?: string\n children: ReactNode\n}\n\n/** Dialog frame of the create-workspace form: header, optional intro, scrolling body. */\nexport function WorkspaceFormModal({\n open,\n onOpenChange,\n title,\n icon,\n intro,\n testId,\n description = 'Create a new workspace',\n children,\n}: WorkspaceFormModalProps) {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n presentation=\"sheet\"\n className=\"flex max-h-panel w-modal max-w-modal-vw flex-col overflow-hidden p-0\"\n data-testid={testId}\n >\n <ModalHeader>\n <ModalTitleRow icon={icon} title={title} description={description} />\n </ModalHeader>\n <div className=\"min-h-0 flex-1 overflow-auto px-6 pb-6\">\n {intro && <p className=\"pb-4 text-sm text-muted-foreground\">{intro}</p>}\n {children}\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction ModalTitleRow({\n icon,\n title,\n description,\n}: {\n icon?: ReactNode\n title: ReactNode\n description: string\n}) {\n return (\n <>\n <DialogTitle>\n <div className=\"flex items-center gap-2\">\n {icon}\n <span>{title}</span>\n </div>\n </DialogTitle>\n <DialogDescription className=\"sr-only\">{description}</DialogDescription>\n </>\n )\n}\n\n/** One entry of the project picker: identity on the left, optional quota summary on the right. */\nexport function ProjectOptionRow({ identity, meta }: { identity: ReactNode; meta?: string }) {\n return (\n <div className=\"flex w-full min-w-0 items-center gap-2\">\n {identity}\n {meta && <span className=\"ml-auto truncate text-sm text-muted-foreground\">{meta}</span>}\n </div>\n )\n}\n\nexport interface ProjectPickerOption {\n id: string\n content: ReactNode\n}\n\nexport interface ProjectPickerProps {\n value?: string\n options: ProjectPickerOption[]\n onChange: (id: string) => void\n /**\n * `form` (default): the full-width field of the workspace form. `welcome`: the compact switcher\n * in the welcome dialog's quota header (muted pill, menu aligned to its end).\n */\n variant?: 'form' | 'welcome'\n /** Adds a \"Create new project...\" entry. */\n onCreate?: () => void\n disabled?: boolean\n readOnly?: boolean\n className?: string\n labels?: { placeholder: string; create: string }\n /** Trigger test id (default `workspace-project-select`, or `welcome-modal-project-select`). */\n testId?: string\n}\n\nconst CREATE_VALUE = '__create__'\n\n/** The one project picker: a workspace's owning project (optionally with a create entry), or the\n * welcome dialog's project switcher (`variant=\"welcome\"`). */\nexport function ProjectPicker({\n value,\n options,\n onChange,\n variant = 'form',\n onCreate,\n disabled,\n readOnly,\n className,\n labels = {\n placeholder: `Select ${entityNoun('PROJECT')}`,\n create: `Create new ${entityNoun('PROJECT')}...`,\n },\n testId,\n}: ProjectPickerProps) {\n const welcome = variant === 'welcome'\n return (\n <Select\n value={value ?? options[0]?.id}\n onValueChange={(v) => (v === CREATE_VALUE ? onCreate?.() : onChange(v))}\n disabled={disabled || readOnly}\n >\n <SelectTrigger\n className={cn(\n welcome &&\n 'h-7 w-auto max-w-[9.5rem] shrink-0 gap-1 border-none bg-muted px-2 text-xs font-medium pointer-coarse:h-11',\n className,\n readOnly && 'cursor-not-allowed'\n )}\n data-testid={\n testId ?? (welcome ? 'welcome-modal-project-select' : 'workspace-project-select')\n }\n >\n {welcome ? <SelectValue /> : <SelectValue placeholder={labels.placeholder} />}\n </SelectTrigger>\n <SelectContent align={welcome ? 'end' : undefined}>\n {options.map((o) => (\n <SelectItem key={o.id} value={o.id}>\n {o.content}\n </SelectItem>\n ))}\n {onCreate && (\n <>\n <SelectSeparator />\n <SelectItem value={CREATE_VALUE}>\n <div className=\"flex items-center gap-1.5 text-primary\">\n <Plus className=\"size-3.5\" />\n <span>{labels.create}</span>\n </div>\n </SelectItem>\n </>\n )}\n </SelectContent>\n </Select>\n )\n}\n\n/** Compact CTA on a project row (e.g. Upgrade / Change plan). */\nexport function ProjectActionButton({\n label,\n onClick,\n className,\n testId,\n}: {\n label: string\n onClick: () => void\n className?: string\n testId?: string\n}) {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onClick}\n className={cn(\n 'h-7 gap-1.5 whitespace-nowrap px-2 py-0 text-sm font-medium pointer-coarse:h-11',\n className\n )}\n data-testid={testId}\n >\n <ArrowUpRight className=\"size-3.5\" />\n {label}\n </Button>\n )\n}\n\nexport interface WorkspaceFieldsViewProps {\n /** `modal` (create flow) or `settings` (editing an existing workspace). */\n variant?: 'modal' | 'settings'\n name: string\n description: string\n onNameChange: (value: string) => void\n onDescriptionChange: (value: string) => void\n onNameBlur?: () => void\n onNameFocus?: () => void\n onDescriptionBlur?: () => void\n disabled?: boolean\n readOnly?: boolean\n maxNameLength?: number\n /** Id of the form's error message (a `FormErrorBanner id`): the name input is then `aria-invalid`\n * and described by it. */\n errorId?: string\n /** Content of the Visibility row (settings only); omit to hide the row. */\n visibility?: ReactNode\n /** Content of the Project row; omit to hide the row. */\n project?: ReactNode\n labels?: Partial<WorkspaceFieldsLabels>\n}\n\nexport interface WorkspaceFieldsLabels {\n readOnlyNotice: string\n name: string\n description: string\n visibility: string\n project: string\n over: (n: number) => string\n charsLeft: (n: number) => string\n}\n\nconst DEFAULT_LABELS: WorkspaceFieldsLabels = {\n readOnlyNotice: 'Read-only workspace',\n name: 'Name *',\n description: 'Description',\n visibility: 'Visibility',\n get project() {\n return getEntityLabel('PROJECT')\n },\n over: (n) => `${n} over`,\n charsLeft: (n) => `${n} chars left`,\n}\n\n/** Name / description / visibility / project rows shared by the create and settings forms. */\nexport function WorkspaceFieldsView({\n variant = 'modal',\n name,\n description,\n onNameChange,\n onDescriptionChange,\n onNameBlur,\n onNameFocus,\n onDescriptionBlur,\n disabled = false,\n readOnly = false,\n errorId,\n maxNameLength = 50,\n visibility,\n project,\n labels,\n}: WorkspaceFieldsViewProps) {\n const workspaceDescriptionId = useId()\n const workspaceNameId = useId()\n const l = { ...DEFAULT_LABELS, ...labels }\n const [nameFocused, setNameFocused] = useState(false)\n const isModal = variant === 'modal'\n const charsLeft = maxNameLength - name.length\n // The modal only surfaces the counter near the limit; settings shows it while focused.\n const counterVisible = !readOnly && nameFocused && (!isModal || charsLeft <= 10)\n const isDisabled = isModal ? disabled : disabled || readOnly\n\n return (\n <div className=\"space-y-1\" data-slot=\"workspace-fields\">\n {readOnly && (\n <div data-testid=\"workspace-form-readonly-notice\" className=\"sr-only\">\n {l.readOnlyNotice}\n </div>\n )}\n <KeyValueRow label={l.name} icon={<FileText size={14} />} htmlFor={workspaceNameId}>\n <div className=\"relative\">\n <Input\n id={workspaceNameId}\n type=\"text\"\n value={name}\n onChange={(e) => onNameChange(e.target.value)}\n onBlur={() => {\n setNameFocused(false)\n onNameBlur?.()\n }}\n onFocus={() => {\n setNameFocused(true)\n onNameFocus?.()\n }}\n maxLength={maxNameLength}\n readOnly={readOnly}\n disabled={isDisabled}\n className={cn(\n isModal ? 'bg-background' : 'capitalize',\n readOnly && 'cursor-not-allowed',\n 'pr-20'\n )}\n required\n aria-invalid={errorId ? true : undefined}\n aria-describedby={errorId}\n data-testid=\"workspace-form-name-input\"\n />\n {counterVisible && (\n <div\n className={cn(\n 'pointer-events-none absolute right-3 top-1/2 hidden -translate-y-1/2 text-sm lg:block',\n charsLeft < 0 ? 'text-red-text' : 'text-muted-foreground'\n )}\n >\n {charsLeft < 0 ? l.over(-charsLeft) : l.charsLeft(charsLeft)}\n </div>\n )}\n </div>\n </KeyValueRow>\n\n <KeyValueRow\n label={l.description}\n icon={<AlignLeft size={14} />}\n htmlFor={workspaceDescriptionId}\n >\n <Input\n id={workspaceDescriptionId}\n type=\"text\"\n dictate\n value={description}\n onChange={(e) => onDescriptionChange(e.target.value)}\n onBlur={onDescriptionBlur}\n readOnly={readOnly}\n disabled={isDisabled}\n className={cn(isModal && 'bg-background', readOnly && 'cursor-not-allowed')}\n data-testid=\"workspace-form-description-input\"\n />\n </KeyValueRow>\n\n {visibility && (\n <KeyValueRow label={l.visibility} icon={<Globe size={14} />}>\n {visibility}\n </KeyValueRow>\n )}\n {project && (\n <KeyValueRow label={l.project} icon={<CreditCard size={14} />}>\n {project}\n </KeyValueRow>\n )}\n </div>\n )\n}\n","import {\n createContext,\n useContext,\n type HTMLAttributes,\n useMemo,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { Check, ChevronRight, FileText, MessagesSquare, Users } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { formatRelativeTime } from '@arbidocs/react/ui'\nimport { fmtDate } from '../lib/format'\nimport { ActionLink } from '../components/ActionLink'\nimport { MemberAvatarStack, type StackedMember } from '../components/MemberAvatarStack'\n\n/** Everything a workspace tile shows, source-agnostic (not the raw SDK shape). */\nexport interface WorkspaceSummary {\n id: string\n name: string\n description?: string | null\n /** Host-supplied line under the name (a reference, a client, a status...). Not interpreted. */\n subtitle?: ReactNode\n docCount: number\n /** Hidden when undefined, so a host without chats shows no empty counter. */\n chatCount?: number\n /** Number of visible members (agents excluded by the caller). */\n memberCount: number\n members: StackedMember[]\n /** The viewer may not see who is here (RLS): renders an em dash, not a `0`. */\n membersHidden?: boolean\n /** ISO timestamp: rendered as \"Updated {relative}\". */\n updatedAt?: string | null\n}\n\n/** Every fixed string of the workspace tile. Pass a partial `labels` to translate or reword. */\nexport interface WorkspaceCardLabels {\n /** The tile's accessible name. */\n openWorkspace: (name: string) => string\n currentWorkspace: string\n documents: string\n chats: string\n members: string\n /** `relative` is the formatted \"3 days ago\". */\n updated: (relative: string) => string\n}\n\nexport const DEFAULT_WORKSPACE_CARD_LABELS: WorkspaceCardLabels = {\n openWorkspace: (name) => `Open workspace ${name}`,\n currentWorkspace: 'Current workspace',\n documents: 'Documents',\n chats: 'Tasks',\n members: 'Members',\n updated: (relative) => `Updated ${relative}`,\n}\n\ninterface CardContextValue {\n current: boolean\n testId?: string\n labels: WorkspaceCardLabels\n}\n\nconst CardContext = createContext<CardContextValue>({\n current: false,\n labels: DEFAULT_WORKSPACE_CARD_LABELS,\n})\n\ntype DivProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'>\n\n/* ------------------------------------------------------------------ */\n/* Parts */\n/* ------------------------------------------------------------------ */\n\nexport interface WorkspaceCardRootProps extends DivProps {\n /** This is the workspace you are in: accented surface, \"Current workspace\" cue. */\n current?: boolean\n onSelect: () => void\n /**\n * Real link target. The tile then renders as an anchor (ctrl-click / new tab, in-SPA through\n * the host environment's `linkComponent`); `onSelect` still fires on a plain click.\n */\n href?: string\n /** Accessible name; defaults to `labels.openWorkspace(name)` when composed via `WorkspaceCard`. */\n label: string\n testId?: string\n labels?: Partial<WorkspaceCardLabels>\n children: ReactNode\n}\n\n/**\n * The tile surface: one button that opens the workspace. A raised white card\n * (hairline border, soft shadow, hover lift); the current workspace takes the selection tint.\n */\nfunction WorkspaceCardRoot({\n current = false,\n onSelect,\n href,\n label,\n testId,\n labels,\n className,\n children,\n ...rest\n}: WorkspaceCardRootProps) {\n const mergedLabels = useMemo(() => ({ ...DEFAULT_WORKSPACE_CARD_LABELS, ...labels }), [labels])\n const surfaceClass = cn(\n '@container/ws-card flex min-h-40 w-full cursor-pointer flex-col gap-3 rounded-lg p-4 text-left transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n current\n ? 'bg-accent text-accent-foreground'\n : 'border border-border bg-card shadow-xs transition-colors hover:border-ring/50 hover:bg-accent/40',\n className\n )\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onSelect()\n }\n }\n return (\n <CardContext.Provider value={{ current, testId, labels: mergedLabels }}>\n {href ? (\n <ActionLink\n {...(rest as object)}\n href={href}\n onSelect={onSelect}\n aria-label={label}\n aria-current={current ? 'page' : undefined}\n data-slot=\"workspace-card\"\n data-testid={testId}\n data-active={current || undefined}\n className={surfaceClass}\n >\n {children}\n </ActionLink>\n ) : (\n <div\n {...rest}\n role=\"button\"\n tabIndex={0}\n aria-label={label}\n aria-current={current ? 'page' : undefined}\n data-slot=\"workspace-card\"\n data-testid={testId}\n data-active={current || undefined}\n onClick={onSelect}\n onKeyDown={handleKeyDown}\n className={surfaceClass}\n >\n {children}\n </div>\n )}\n </CardContext.Provider>\n )\n}\n\n/** Mark + name + open cue, on one row. Put the entity mark first. */\nfunction WorkspaceCardHeader({ className, children, ...rest }: DivProps & { children: ReactNode }) {\n return (\n <div\n {...rest}\n className={cn('flex flex-wrap items-center gap-x-3 gap-y-2', className)}\n data-slot=\"workspace-card-header\"\n >\n {children}\n </div>\n )\n}\n\nfunction WorkspaceCardTitle({ children, className }: { children: ReactNode; className?: string }) {\n const { testId } = useContext(CardContext)\n return (\n <h3\n className={cn(\n 'line-clamp-2 min-w-24 flex-1 break-words text-base font-semibold leading-tight text-foreground',\n className\n )}\n data-slot=\"workspace-card-title\"\n data-testid={testId && `${testId}-title`}\n >\n {children}\n </h3>\n )\n}\n\n/**\n * The open cue is always on screen (never hover-only): a chevron, or the words\n * \"Current workspace\" on the one you are in.\n */\nfunction WorkspaceCardOpenCue({\n testId,\n currentLabel,\n}: {\n /** Deliberately separate from the card id: suites count cards by prefix. */\n testId?: string\n /** Overrides `labels.currentWorkspace`. */\n currentLabel?: string\n}) {\n const { current, labels } = useContext(CardContext)\n return (\n <span\n className=\"inline-flex max-w-full min-w-0 shrink-0 items-center text-sm text-muted-foreground\"\n data-slot=\"workspace-card-open-cue\"\n data-testid={testId}\n >\n {current ? (\n // Never wider than the card: the words truncate, and in a card narrower than 20rem\n // the pill shrinks to a check (the words stay as the accessible name).\n <span className=\"inline-flex max-w-full min-w-0 items-center gap-1 rounded-full bg-background px-2 py-0.5 text-xs font-medium text-foreground\">\n <Check className=\"hidden size-3 shrink-0 @max-xs/ws-card:block\" aria-hidden=\"true\" />\n <span className=\"min-w-0 truncate @max-xs/ws-card:sr-only\">\n {currentLabel ?? labels.currentWorkspace}\n </span>\n </span>\n ) : (\n <ChevronRight className=\"size-4\" aria-hidden=\"true\" />\n )}\n </span>\n )\n}\n\nfunction WorkspaceCardDescription({\n children,\n className,\n}: {\n children: ReactNode\n className?: string\n}) {\n return (\n <p\n className={cn('line-clamp-2 text-sm text-muted-foreground', className)}\n title={typeof children === 'string' ? children : undefined}\n data-slot=\"workspace-card-description\"\n >\n {children}\n </p>\n )\n}\n\n/** Host-supplied line under the title. */\nfunction WorkspaceCardSubtitle({\n className,\n children,\n ...rest\n}: DivProps & { children: ReactNode }) {\n return (\n <div\n {...rest}\n className={cn('truncate text-xs text-muted-foreground', className)}\n data-slot=\"workspace-card-subtitle\"\n >\n {children}\n </div>\n )\n}\n\n/** Footer block: stats row and meta line, pinned to the bottom of the tile. */\nfunction WorkspaceCardFooter({ className, children, ...rest }: DivProps & { children: ReactNode }) {\n return (\n <div {...rest} className={cn('mt-auto flex flex-col gap-2', className)}>\n {children}\n </div>\n )\n}\n\nexport interface WorkspaceCardStatsProps {\n docCount: number\n /** Omit to hide the chats counter. */\n chatCount?: number\n memberCount: number\n members?: StackedMember[]\n membersHidden?: boolean\n /** Faces before the rest collapse into `+N`. */\n maxAvatars?: number\n className?: string\n}\n\n/** Documents / chats / members counts, with the member faces at the trailing edge. */\nfunction WorkspaceCardStats({\n docCount,\n chatCount,\n memberCount,\n members = [],\n membersHidden = false,\n maxAvatars = 3,\n className,\n}: WorkspaceCardStatsProps) {\n const { current, testId, labels } = useContext(CardContext)\n return (\n <div\n className={cn('flex w-full items-center gap-x-4 text-sm text-muted-foreground', className)}\n data-slot=\"workspace-card-stats\"\n >\n <span className=\"inline-flex items-center gap-1.5\" title={labels.documents}>\n <FileText className=\"size-4\" aria-hidden=\"true\" />\n <span className=\"tabular-nums\">{docCount.toLocaleString()}</span>\n </span>\n {chatCount !== undefined && (\n <span className=\"inline-flex items-center gap-1.5\" title={labels.chats}>\n <MessagesSquare className=\"size-4\" aria-hidden=\"true\" />\n <span className=\"tabular-nums\">{chatCount.toLocaleString()}</span>\n </span>\n )}\n <span className=\"inline-flex items-center gap-1.5\" title={labels.members}>\n <Users className=\"size-4\" aria-hidden=\"true\" />\n <span className=\"tabular-nums\" data-testid={testId && `${testId}-member-count`}>\n {membersHidden ? '—' : memberCount}\n </span>\n </span>\n <MemberAvatarStack\n members={members}\n total={memberCount}\n max={maxAvatars}\n hidden={membersHidden}\n ringClassName={current ? 'ring-accent' : 'ring-muted'}\n label={labels.members}\n className=\"ml-auto\"\n testId={testId && `${testId}-member-avatars`}\n />\n </div>\n )\n}\n\n/** \"Updated 3 days ago\", with the exact date on the title. */\nfunction WorkspaceCardMeta({ updatedAt }: { updatedAt: string }) {\n const { labels } = useContext(CardContext)\n return (\n <span\n className=\"min-w-0 max-w-full self-start truncate text-xs text-muted-foreground\"\n title={fmtDate(updatedAt)}\n data-slot=\"workspace-card-meta\"\n >\n {labels.updated(formatRelativeTime(updatedAt))}\n </span>\n )\n}\n\n/* ------------------------------------------------------------------ */\n/* Default composition */\n/* ------------------------------------------------------------------ */\n\nexport interface WorkspaceCardProps {\n workspace: WorkspaceSummary\n current?: boolean\n onSelect: () => void\n /** Real link target; see `WorkspaceCard.Root`. */\n href?: string\n /** The entity mark shown before the name (the host's own workspace glyph). */\n mark?: ReactNode\n /** Card id; derived ids: `-title`, `-member-count`, `-member-avatars`. */\n testId?: string\n /** Id for the open cue (kept apart from `testId`, see `WorkspaceCard.OpenCue`). */\n openCueTestId?: string\n maxAvatars?: number\n /**\n * The stats row: omit for the default counts + member faces, `false` to hide it, or any node to\n * replace it.\n */\n stats?: ReactNode | false\n /** Reword the tile's fixed strings. */\n labels?: Partial<WorkspaceCardLabels>\n className?: string\n}\n\n/**\n * The workspace tile: mark + name + open cue, description, stats and meta.\n * The whole tile opens the workspace; nothing on it is hover-only.\n *\n * Need a different layout? Compose the parts: `WorkspaceCard.Root`, `.Header`,\n * `.Title`, `.OpenCue`, `.Subtitle`, `.Description`, `.Footer`, `.Stats`, `.Meta`.\n */\nfunction WorkspaceCardBase({\n workspace,\n current = false,\n onSelect,\n href,\n mark,\n testId,\n openCueTestId,\n maxAvatars,\n stats,\n labels,\n className,\n}: WorkspaceCardProps) {\n const mergedLabels = { ...DEFAULT_WORKSPACE_CARD_LABELS, ...labels }\n return (\n <WorkspaceCardRoot\n current={current}\n onSelect={onSelect}\n href={href}\n label={mergedLabels.openWorkspace(workspace.name)}\n labels={labels}\n testId={testId}\n className={className}\n >\n <WorkspaceCardHeader>\n {mark}\n <WorkspaceCardTitle>{workspace.name}</WorkspaceCardTitle>\n <WorkspaceCardOpenCue testId={openCueTestId} />\n </WorkspaceCardHeader>\n {workspace.subtitle && <WorkspaceCardSubtitle>{workspace.subtitle}</WorkspaceCardSubtitle>}\n {workspace.description && (\n <WorkspaceCardDescription>{workspace.description}</WorkspaceCardDescription>\n )}\n <WorkspaceCardFooter>\n {stats === undefined ? (\n <WorkspaceCardStats\n docCount={workspace.docCount}\n chatCount={workspace.chatCount}\n memberCount={workspace.memberCount}\n members={workspace.members}\n membersHidden={workspace.membersHidden}\n maxAvatars={maxAvatars}\n />\n ) : (\n stats\n )}\n {workspace.updatedAt && <WorkspaceCardMeta updatedAt={workspace.updatedAt} />}\n </WorkspaceCardFooter>\n </WorkspaceCardRoot>\n )\n}\n\nexport const WorkspaceCard = Object.assign(WorkspaceCardBase, {\n Root: WorkspaceCardRoot,\n Header: WorkspaceCardHeader,\n Title: WorkspaceCardTitle,\n OpenCue: WorkspaceCardOpenCue,\n Subtitle: WorkspaceCardSubtitle,\n Description: WorkspaceCardDescription,\n Footer: WorkspaceCardFooter,\n Stats: WorkspaceCardStats,\n Meta: WorkspaceCardMeta,\n})\n","import type { ReactNode } from 'react'\nimport { ChevronRight } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { CollapsibleSection } from '../home/CollapsibleSection'\n\nexport interface WorkspaceListProps {\n children: ReactNode\n className?: string\n testId?: string\n}\n\n/** The column that stacks workspace groups (padding follows the page gutter). */\nexport function WorkspaceList({ children, className, testId }: WorkspaceListProps) {\n return (\n <div\n className={cn('flex w-full flex-col gap-2 px-4 py-4 sm:px-8', className)}\n data-slot=\"workspace-list\"\n data-testid={testId}\n >\n {children}\n </div>\n )\n}\n\nexport interface WorkspaceGroupProps {\n /** Group heading: name, count, badges. Plain text on the canvas, no band. */\n title: ReactNode\n isExpanded: boolean\n onToggle: () => void\n /**\n * Makes the whole header one target (e.g. open the project panel); the\n * chevron stays a separate toggle. Adds a trailing `openLabel` affordance.\n */\n onOpen?: () => void\n /** Words beside the trailing chevron when `onOpen` is set, e.g. \"Plans & Usage\". */\n openLabel?: string\n /** Muted words on the right of a collapsed group without `onOpen`, e.g. \"Show 11 shared workspaces\". */\n collapsedHint?: string\n /** The cards, laid out in a responsive grid (1 / 2 / 3 columns). */\n children: ReactNode\n className?: string\n}\n\n/**\n * One collapsible band of workspace tiles under a slim header. The open\n * affordance is always visible, so nothing is reachable by hover alone.\n */\nexport function WorkspaceGroup({\n title,\n isExpanded,\n onToggle,\n onOpen,\n openLabel,\n collapsedHint,\n children,\n className,\n}: WorkspaceGroupProps) {\n return (\n <CollapsibleSection\n title={title}\n isExpanded={isExpanded}\n onToggle={onToggle}\n onHeaderClick={onOpen}\n rightContent={\n onOpen && openLabel ? (\n <span className=\"flex shrink-0 items-center gap-1 text-sm font-medium text-muted-foreground\">\n {openLabel}\n <ChevronRight className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n </span>\n ) : collapsedHint && !isExpanded ? (\n <span className=\"shrink-0 text-sm text-muted-foreground\">{collapsedHint}</span>\n ) : undefined\n }\n className={cn('group', className)}\n headerClassName=\"mb-3 flex-wrap gap-y-2 rounded-md px-1 py-1 pointer-coarse:min-h-11\"\n childrenClassName=\"mb-8 grid gap-3 @xl:grid-cols-2 @5xl:grid-cols-3\"\n >\n {children}\n </CollapsibleSection>\n )\n}\n","/**\n * WorkspaceTypeBadge: a workspace's type badge (private, shared or public: icon, colour, label).\n */\n\nimport { User, Users, Globe } from 'lucide-react'\nimport type { components } from '@arbidocs/client'\nimport { WorkspaceTypeBadgeView } from './WorkspaceBadges'\nimport { getHumanUserCount, getVariantBgClass, getWorkspaceTypeInfo } from './workspace-type'\n\ntype Workspace = Pick<components['schemas']['WorkspaceResponse'], 'is_public' | 'users'>\n\nexport interface WorkspaceTypeBadgeProps {\n workspace: Workspace\n showTooltip?: boolean\n size?: 'sm' | 'md'\n isSelected?: boolean\n className?: string\n}\n\nexport function WorkspaceTypeBadge({\n workspace,\n showTooltip = false,\n size = 'md',\n isSelected = false,\n className,\n}: WorkspaceTypeBadgeProps) {\n const userCount = getHumanUserCount(workspace.users)\n const { type, variant } = getWorkspaceTypeInfo(workspace.is_public, userCount)\n const icon = workspace.is_public ? Globe : userCount > 1 ? Users : User\n\n return (\n <WorkspaceTypeBadgeView\n icon={icon}\n bgClass={getVariantBgClass(variant)}\n typeLabel={type}\n showTooltip={showTooltip}\n size={size}\n isSelected={isSelected}\n className={className}\n />\n )\n}\n"]}
|