@arbidocs/blocks 0.5.22 → 0.5.24
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/{WorkspaceTableView-6JVHGDUB.cjs → WorkspaceTableView-GIDGNGBW.cjs} +6 -6
- package/dist/{WorkspaceTableView-6JVHGDUB.cjs.map → WorkspaceTableView-GIDGNGBW.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-ECPHGWHF.js → WorkspaceTableView-S2PTTVHL.js} +4 -4
- package/dist/{WorkspaceTableView-ECPHGWHF.js.map → WorkspaceTableView-S2PTTVHL.js.map} +1 -1
- package/dist/auth/index.cjs +47 -47
- package/dist/auth/index.js +2 -2
- package/dist/{chunk-7DDMF3DZ.cjs → chunk-53T2FY4Z.cjs} +5 -31
- package/dist/chunk-53T2FY4Z.cjs.map +1 -0
- package/dist/chunk-5ZBXFHZW.js +434 -0
- package/dist/chunk-5ZBXFHZW.js.map +1 -0
- package/dist/{chunk-K237IYOD.cjs → chunk-BYJUI4AT.cjs} +54 -2
- package/dist/chunk-BYJUI4AT.cjs.map +1 -0
- package/dist/{chunk-O4EQYPLO.cjs → chunk-C2SZQKX2.cjs} +169 -27
- package/dist/chunk-C2SZQKX2.cjs.map +1 -0
- package/dist/{chunk-MSPNYW6Z.cjs → chunk-DTLVC6MN.cjs} +2 -53
- package/dist/chunk-DTLVC6MN.cjs.map +1 -0
- package/dist/{chunk-RVKVGS72.js → chunk-FDUQQNDT.js} +2 -2
- package/dist/{chunk-RVKVGS72.js.map → chunk-FDUQQNDT.js.map} +1 -1
- package/dist/{chunk-TTJGCJWX.cjs → chunk-H3XAHVDT.cjs} +42 -2
- package/dist/chunk-H3XAHVDT.cjs.map +1 -0
- package/dist/{chunk-XL55UDLO.js → chunk-IJJKUTKM.js} +5 -30
- package/dist/chunk-IJJKUTKM.js.map +1 -0
- package/dist/{chunk-ZX663X3X.cjs → chunk-KNRAKOCO.cjs} +6 -428
- package/dist/chunk-KNRAKOCO.cjs.map +1 -0
- package/dist/chunk-KUQOHPKP.cjs +443 -0
- package/dist/chunk-KUQOHPKP.cjs.map +1 -0
- package/dist/{chunk-F2BYURQZ.cjs → chunk-LYF47OXX.cjs} +5 -5
- package/dist/{chunk-F2BYURQZ.cjs.map → chunk-LYF47OXX.cjs.map} +1 -1
- package/dist/{chunk-PZRTRYPD.js → chunk-MKTEVOC3.js} +44 -5
- package/dist/chunk-MKTEVOC3.js.map +1 -0
- package/dist/{chunk-6XW3CMU4.js → chunk-N3KNAQ55.js} +144 -4
- package/dist/chunk-N3KNAQ55.js.map +1 -0
- package/dist/{chunk-KL6XOSEN.js → chunk-PLAGIVFF.js} +4 -52
- package/dist/chunk-PLAGIVFF.js.map +1 -0
- package/dist/{chunk-FZVAJFRH.cjs → chunk-RHKFCSFC.cjs} +2 -2
- package/dist/{chunk-FZVAJFRH.cjs.map → chunk-RHKFCSFC.cjs.map} +1 -1
- package/dist/{chunk-NVRJ6WTR.js → chunk-RTAYJUQM.js} +3 -3
- package/dist/{chunk-NVRJ6WTR.js.map → chunk-RTAYJUQM.js.map} +1 -1
- package/dist/{chunk-IXBJEQH5.js → chunk-VN4FSGBR.js} +53 -4
- package/dist/chunk-VN4FSGBR.js.map +1 -0
- package/dist/{chunk-SLRVI2YU.js → chunk-X6U6L6BG.js} +29 -4
- package/dist/chunk-X6U6L6BG.js.map +1 -0
- package/dist/{chunk-SQ5F5BFW.cjs → chunk-XDU3HHUU.cjs} +32 -6
- package/dist/chunk-XDU3HHUU.cjs.map +1 -0
- package/dist/{chunk-SKVVOEMX.js → chunk-XXUPUXBF.js} +8 -423
- package/dist/chunk-XXUPUXBF.js.map +1 -0
- package/dist/connect/index.cjs +1203 -624
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +770 -197
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/auth/CompactLogin.d.ts +26 -0
- package/dist/connection/auth/ConnectedLoginPage.d.ts +9 -1
- package/dist/connection/auth/index.d.ts +3 -1
- package/dist/connection/auth/sso-popup.d.ts +13 -0
- package/dist/connection/auth/sso-sign-in.d.ts +38 -0
- package/dist/connection/auth/support.d.ts +17 -0
- package/dist/connection/auth/useLoginActions.d.ts +9 -2
- package/dist/connection/billing/ConnectedQuotaDialog.d.ts +5 -13
- package/dist/connection/billing/index.d.ts +1 -1
- package/dist/connection/connectors/ConnectedSharePointAdminConsentPage.d.ts +26 -0
- package/dist/connection/connectors/index.d.ts +1 -0
- package/dist/connection/projects/ConnectedProjectsPanel.d.ts +9 -1
- package/dist/connection/projects/ProjectsListPage.d.ts +40 -0
- package/dist/connection/projects/index.d.ts +1 -0
- package/dist/connection/settings-page/ConnectedAccountSettings.d.ts +2 -1
- package/dist/connection/settings-page/ConnectedBoxPortalSection.d.ts +6 -0
- package/dist/connection/settings-page/appearanceSection.d.ts +30 -0
- package/dist/connection/settings-page/index.d.ts +1 -0
- package/dist/index.cjs +209 -237
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -50
- package/dist/index.js.map +1 -1
- package/dist/settings/AppearanceSettings.d.ts +1 -2
- package/dist/settings/index.cjs +153 -153
- package/dist/settings/index.d.ts +2 -1
- package/dist/settings/index.js +1 -1
- package/dist/site/index.cjs +82 -74
- package/dist/site/index.d.ts +2 -0
- package/dist/site/index.js +3 -3
- package/dist/studio/index.cjs +73 -73
- package/dist/studio/index.js +5 -5
- package/dist/theme/appearance.d.ts +47 -0
- package/dist/theme/fromCss.d.ts +33 -0
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/chunk-6XW3CMU4.js.map +0 -1
- package/dist/chunk-7DDMF3DZ.cjs.map +0 -1
- package/dist/chunk-AMTWY22T.js +0 -11
- package/dist/chunk-AMTWY22T.js.map +0 -1
- package/dist/chunk-IXBJEQH5.js.map +0 -1
- package/dist/chunk-K237IYOD.cjs.map +0 -1
- package/dist/chunk-KL6XOSEN.js.map +0 -1
- package/dist/chunk-MSPNYW6Z.cjs.map +0 -1
- package/dist/chunk-O4EQYPLO.cjs.map +0 -1
- package/dist/chunk-PZRTRYPD.js.map +0 -1
- package/dist/chunk-SKVVOEMX.js.map +0 -1
- package/dist/chunk-SLRVI2YU.js.map +0 -1
- package/dist/chunk-SQ5F5BFW.cjs.map +0 -1
- package/dist/chunk-TTJGCJWX.cjs.map +0 -1
- package/dist/chunk-XL55UDLO.js.map +0 -1
- package/dist/chunk-ZU2B2RZK.cjs +0 -13
- package/dist/chunk-ZU2B2RZK.cjs.map +0 -1
- package/dist/chunk-ZX663X3X.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ProjectReadout, ProjectBreakdown } from './chunk-RQKWYKZY.js';
|
|
3
|
-
import { PlanBadge, QuotaMeter } from './chunk-
|
|
3
|
+
import { PlanBadge, QuotaMeter } from './chunk-FDUQQNDT.js';
|
|
4
4
|
import { UsageMeter } from './chunk-66TA5IBN.js';
|
|
5
5
|
import { useHost } from './chunk-T4P237N6.js';
|
|
6
6
|
import { useArbi, formatGbp, useUserSettings } from '@arbidocs/react';
|
|
@@ -421,5 +421,5 @@ function projectGroupBilling(project, { isOwned, stripeEnabled }) {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
export { ADDON_BLOCK_AI_GBP, ANNUAL_PREMIUM_AI_NOTE, CAP_REACHED_MESSAGE, DEFAULT_SPEND_CAP_PENCE, FREE_AI_GBP, FREE_COLLABORATORS, FREE_STORAGE_MB, MAX_CHECKOUT_BLOCKS, MIN_AUTO_TOPUP_THRESHOLD_GBP, PAY_TODAY_UNPRICED, PLAN_CHOICE_PACKS, POSTCODE_COUNTRIES, PRO_AI_GBP, PRO_PACKS, PRO_STORAGE_GB, STORAGE_BLOCK_GB, SUGGESTED_DAILY_CAP_PER_USER, TAX_LOCATION_INVALID, USAGE_CAP_HELP, USAGE_CAP_LABEL, ZERO_BUDGET_MESSAGE, addStepCaption, addonCharge, addonPrice, addonSettingsBody, aiUsageResetTimestamp, apiErrorDetail, autoRoom, blocksLabel, budgetSavedMessage, calcSavingsPercent, checkoutBlockPriceText, checkoutItemsLabel, findProPrices, formatMoney, formatPeriodEnd, formatResetDate, getQuotaItems, isAddonBudgetZero, isProProject, money2, nextPeriodBody, nextRemovedBlockSize, packPrice, parseBudgetPounds, planBadgeView, planName, planNameForPacks, planPreviewLines, plusVat, proTierName, projectGroupBilling, quoteError, quoteParts, quoteTotalLine, reduceBounds, splitBlocks, stepLabel, taxDetail, totalWithTaxWord, useBillingSupport, useRewardBalance, useSelfExtId };
|
|
424
|
-
//# sourceMappingURL=chunk-
|
|
425
|
-
//# sourceMappingURL=chunk-
|
|
424
|
+
//# sourceMappingURL=chunk-RTAYJUQM.js.map
|
|
425
|
+
//# sourceMappingURL=chunk-RTAYJUQM.js.map
|
|
@@ -1 +1 @@
|
|
|
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":["formatGbp","gbp"],"mappings":";;;;;;;;AA4BA,IAAM,YAAA,GAA+B,EAAE,aAAA,EAAe,KAAA,EAAM;AAErD,SAAS,iBAAA,GAAoC;AAClD,EAAA,OAAO,OAAA,GAAU,OAAA,IAAW,YAAA;AAC9B;AAGO,SAAS,YAAA,GAAmC;AACjD,EAAA,MAAM,OAAO,OAAA,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,GAA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A,EAAO,UAAA;AAAA,YACP,IAAA,EAAK,IAAA;AAAA,YACL,YAAA,EAAc,KAAA;AAAA,YACd,QAAA,EAAU,aAAA;AAAA,YACV,WAAA,EAAa;AAAA;AAAA;AACf;AAEJ;AAAA,GACF,GAEA,SAAA;AAEF,EAAA,MAAM,SAAA,mBACJ,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,MAAM,OAAA,CAAQ,IAAA;AAAA,MACd,KAAA,EAAO,SAAA;AAAA,MACP,MAAA,EACE,OAAA,GACI,UAAA,CAAW,GAAA,CAAI,CAAC,EAAE,GAAA,EAAK,IAAA,EAAM,KAAA,EAAO,WAAA,EAAa,GAAA,EAAI,qBACnD,GAAA;AAAA,QAAC,UAAA;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-NVRJ6WTR.js","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
|
+
{"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/work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AAAA,GACF;AAEF,EAAA,OAAO,EAAE,SAAA,EAAW,OAAA,EAAS,SAAA,EAAU;AACzC","file":"chunk-RTAYJUQM.js","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"]}
|
|
@@ -3,7 +3,7 @@ import { testIdOr } from './chunk-7F6CBP3Z.js';
|
|
|
3
3
|
import { ArrowRight, EyeOff, Eye, AlertCircle, Loader2, WifiOff, MoreVertical, Key, Shield, Upload } from 'lucide-react';
|
|
4
4
|
import { cn, Input, Button, Checkbox, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@arbidocs/react/ui';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import { createContext, useId, useMemo, useContext, useState, useRef } from 'react';
|
|
6
|
+
import { createContext, useId, useMemo, useContext, useState, useRef, useEffect } from 'react';
|
|
7
7
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
8
8
|
|
|
9
9
|
function AuthLayout({
|
|
@@ -915,6 +915,55 @@ function withTrailingFragment(next, trailingFragment) {
|
|
|
915
915
|
return `${next}${trailingFragment}`;
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
918
|
+
// src/connection/auth/fragment-credentials.ts
|
|
919
|
+
var KEYS = ["email", "password", "next"];
|
|
920
|
+
function safeNext(next) {
|
|
921
|
+
if (!next || !next.startsWith("/") || next.startsWith("//") || next.startsWith("/\\")) return null;
|
|
922
|
+
return next;
|
|
923
|
+
}
|
|
924
|
+
function parseFragmentCredentials(hash) {
|
|
925
|
+
const { params, trailingFragment } = splitAuthHash(hash);
|
|
926
|
+
const email = params.get("email")?.trim();
|
|
927
|
+
const password = params.get("password");
|
|
928
|
+
if (!email || !password) return null;
|
|
929
|
+
const next = safeNext(params.get("next"));
|
|
930
|
+
return { email, password, next: next && withTrailingFragment(next, trailingFragment) };
|
|
931
|
+
}
|
|
932
|
+
function consumeFragmentCredentials() {
|
|
933
|
+
if (typeof window === "undefined") return null;
|
|
934
|
+
const { hash, pathname, search } = window.location;
|
|
935
|
+
const { params, trailingFragment } = splitAuthHash(hash);
|
|
936
|
+
if (!KEYS.some((k) => k !== "next" && params.has(k))) return null;
|
|
937
|
+
const credentials = parseFragmentCredentials(hash);
|
|
938
|
+
for (const k of KEYS) params.delete(k);
|
|
939
|
+
const rest = params.toString();
|
|
940
|
+
const kept = rest ? `#${rest}${trailingFragment}` : trailingFragment;
|
|
941
|
+
window.history.replaceState(window.history.state, "", `${pathname}${search}${kept}`);
|
|
942
|
+
return credentials;
|
|
943
|
+
}
|
|
944
|
+
var taken = null;
|
|
945
|
+
function take() {
|
|
946
|
+
const fresh = consumeFragmentCredentials();
|
|
947
|
+
if (fresh) taken = fresh;
|
|
948
|
+
return taken;
|
|
949
|
+
}
|
|
950
|
+
function useFragmentCredentials({
|
|
951
|
+
enabled = false,
|
|
952
|
+
onCredentials
|
|
953
|
+
}) {
|
|
954
|
+
const [credentials] = useState(() => enabled ? take() : null);
|
|
955
|
+
const handedOver = useRef(false);
|
|
956
|
+
const callback = useRef(onCredentials);
|
|
957
|
+
callback.current = onCredentials;
|
|
958
|
+
useEffect(() => {
|
|
959
|
+
if (!credentials || handedOver.current) return;
|
|
960
|
+
handedOver.current = true;
|
|
961
|
+
taken = null;
|
|
962
|
+
callback.current(credentials);
|
|
963
|
+
}, [credentials]);
|
|
964
|
+
return credentials && { email: credentials.email, next: credentials.next };
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export { AccountRecoveryDialog, AuthAlert, AuthConsent, AuthDivider, AuthField, AuthFieldBadge, AuthFooterLinks, AuthHeading, AuthHero, AuthInput, AuthLayout, AuthLink, AuthNote, AuthOfflineBadge, AuthSubmitButton, AuthTabs, DEFAULT_ACCOUNT_RECOVERY_DIALOG_LABELS, DEFAULT_AUTH_CONSENT_LABELS, DEFAULT_AUTH_FOOTER_LINKS_LABELS, DEFAULT_AUTH_OFFLINE_BADGE_LABELS, DEFAULT_PASSWORD_RULES, DEFAULT_RECOVERY_KEY_DIALOG_LABELS, DEFAULT_REVEALABLE_PASSWORD_INPUT_LABELS, RecoveryKeyDialog, RevealablePasswordInput, consumeFragmentCredentials, createPasswordRules, parseAuthError, parseFragmentCredentials, promptSaveCredential, splitAuthHash, useFragmentCredentials, withTrailingFragment };
|
|
968
|
+
//# sourceMappingURL=chunk-VN4FSGBR.js.map
|
|
969
|
+
//# sourceMappingURL=chunk-VN4FSGBR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/auth/AuthLayout.tsx","../src/auth/AuthForm.tsx","../src/auth/AuthFooter.tsx","../src/auth/auth-error.ts","../src/auth/password-rules.ts","../src/auth/credential-storage.ts","../src/auth/RecoveryDialogs.tsx","../src/connection/auth/auth-hash.ts","../src/connection/auth/fragment-credentials.ts"],"names":["jsxs","jsx","cn","useMemo","AlertCircle","useId","Button","Input","Fragment","Loader2","useState","useRef"],"mappings":";;;;;;;AAwBO,SAAS,UAAA,CAAW;AAAA,EACzB,QAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA,GAAS;AACX,CAAA,EAAoB;AAClB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,4CAAA;AAAA;AAAA,QAEA,KAAA,IAAS,mDAAA;AAAA,QACT;AAAA,OACF;AAAA,MACA,aAAA,EAAa,MAAA;AAAA,MAEZ,QAAA,EAAA;AAAA,QAAA,MAAA;AAAA,wBACD,IAAA,CAAC,SAAA,EAAA,E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AAU,KAAA;AAAA,EACV;AACF,CAAA,EAAgF;AAE9E,EAAA,MAAM,CAAC,WAAW,CAAA,GAAIC,QAAAA,CAAS,MAAO,OAAA,GAAU,IAAA,KAAS,IAAK,CAAA;AAC9D,EAAA,MAAM,UAAA,GAAaC,OAAO,KAAK,CAAA;AAC/B,EAAA,MAAM,QAAA,GAAWA,OAAO,aAAa,CAAA;AACrC,EAAA,QAAA,CAAS,OAAA,GAAU,aAAA;AAEnB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,WAAA,IAAe,UAAA,CAAW,OAAA,EAAS;AACxC,IAAA,UAAA,CAAW,OAAA,GAAU,IAAA;AACrB,IAAA,KAAA,GAAQ,IAAA;AACR,IAAA,QAAA,CAAS,QAAQ,WAAW,CAAA;AAAA,EAC9B,CAAA,EAAG,CAAC,WAAW,CAAC,CAAA;AAEhB,EAAA,OAAO,eAAe,EAAE,KAAA,EAAO,YAAY,KAAA,EAAO,IAAA,EAAM,YAAY,IAAA,EAAK;AAC3E","file":"chunk-VN4FSGBR.js","sourcesContent":["import type { LucideIcon } from 'lucide-react'\nimport { ArrowRight } from 'lucide-react'\nimport type { ReactNode } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\nexport interface AuthLayoutProps {\n /** The form column content. */\n children: ReactNode\n /** Sits above the form: the Login / Register tabs, or an offline badge. */\n headerRight?: ReactNode\n /** Hero panel: the right half on desktop, hidden on mobile. Omit for a single centred column. */\n aside?: ReactNode\n /** Brand mark shown top-left of the form column (logo + name). */\n brand?: ReactNode\n /** Pinned bottom-right over the hero on desktop (e.g. a deployment indicator). */\n corner?: ReactNode\n className?: string\n testId?: string\n}\n\n/**\n * Full-bleed split: a calm form column on the left, the hero (`aside`) on the right. On mobile the\n * hero is hidden and the form fills the screen. With no `aside` it is a single centred column.\n */\nexport function AuthLayout({\n children,\n headerRight,\n aside,\n brand,\n corner,\n className,\n testId = 'auth-layout',\n}: AuthLayoutProps) {\n return (\n <div\n data-slot=\"auth-layout\"\n className={cn(\n 'min-h-screen bg-background text-foreground',\n // The hero needs height: a phone held sideways (under 32rem tall) gets the form alone.\n aside && 'md:grid [@media(min-height:32rem)]:md:grid-cols-2',\n className\n )}\n data-testid={testId}\n >\n {corner}\n <section className=\"flex min-h-screen flex-col px-4 py-5 sm:px-8 md:px-12 md:py-6\">\n {brand && (\n <div className=\"flex items-center gap-3 font-semibold text-foreground\">{brand}</div>\n )}\n {/* Top-aligned at a fixed offset (not vertically centred) so switching tabs never moves the tabs. */}\n <div className=\"mx-auto mt-10 flex w-full max-w-sm flex-col gap-5 py-8 md:mt-[14vh]\">\n {headerRight && <div className=\"flex items-center\">{headerRight}</div>}\n {children}\n </div>\n </section>\n {/* Exactly one screen tall and pinned, so the hero is centred in the window rather than in\n the row: a form that overflows the screen (Login, with its SSO buttons, on a laptop)\n would otherwise stretch the row and move the hero text when switching tabs. */}\n {aside && (\n <div className=\"hidden [@media(min-height:32rem)]:md:sticky [@media(min-height:32rem)]:md:top-0 [@media(min-height:32rem)]:md:flex [@media(min-height:32rem)]:md:h-screen\">\n {aside}\n </div>\n )}\n </div>\n )\n}\n\nexport interface AuthHeroPillar {\n icon: LucideIcon\n title: string\n body: string\n}\n\nexport interface AuthHeroProps {\n /** First line of the headline. */\n headline?: ReactNode\n /** Second headline line, set in italic accent. */\n emphasis?: string\n lead?: ReactNode\n pillars?: AuthHeroPillar[]\n link?: { href: string; label: string }\n /** Cover image behind the content (any CSS `url(...)` source). A tint keeps text legible. */\n backgroundImage?: string\n /** Extra content under the pillars (a quote, a logo row, a screenshot). */\n children?: ReactNode\n className?: string\n testId?: string\n}\n\n/** The value-proposition panel for {@link AuthLayout}'s `aside`: headline, lead, pillars, link. */\nexport function AuthHero({\n headline,\n emphasis,\n lead,\n pillars = [],\n link,\n backgroundImage,\n children,\n className,\n testId = 'product-pillars',\n}: AuthHeroProps) {\n return (\n <div\n data-slot=\"auth-hero\"\n className={cn(\n 'relative flex w-full flex-col justify-center gap-6 overflow-hidden bg-hero px-12 py-16 text-white',\n className\n )}\n data-testid={testId}\n >\n {backgroundImage && (\n <>\n <div\n aria-hidden=\"true\"\n data-slot=\"auth-hero-image\"\n className=\"absolute inset-0 bg-cover bg-center\"\n style={{ backgroundImage: `url(${backgroundImage})` }}\n />\n <div aria-hidden=\"true\" className=\"absolute inset-0 bg-hero/70\" />\n </>\n )}\n {headline && (\n <h2 className=\"relative max-w-[18ch] text-3xl font-semibold leading-tight text-white\">\n {headline}\n {emphasis && (\n <>\n <br />\n <span className=\"italic text-theme-cyan-bright\">{emphasis}</span>\n </>\n )}\n </h2>\n )}\n {lead && <p className=\"relative max-w-[44ch] text-base text-white/70\">{lead}</p>}\n\n <ul className=\"relative flex max-w-[46ch] flex-col gap-5\">\n {pillars.map(({ icon: Icon, title, body }) => (\n <li key={title} className=\"flex gap-3\">\n <Icon className=\"mt-0.5 h-5 w-5 shrink-0 text-theme-cyan-bright\" aria-hidden=\"true\" />\n <div>\n <h3 className=\"text-base font-semibold leading-snug text-white\">{title}</h3>\n <p className=\"text-sm leading-relaxed text-white/70\">{body}</p>\n </div>\n </li>\n ))}\n </ul>\n\n {children && <div className=\"relative\">{children}</div>}\n\n {link && (\n <a\n href={link.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"relative inline-flex items-center gap-1 text-sm font-medium text-theme-cyan-bright transition-colors hover:text-white\"\n >\n {link.label}\n <ArrowRight className=\"h-4 w-4\" />\n </a>\n )}\n </div>\n )\n}\n","import { AlertCircle, Eye, EyeOff, Loader2, WifiOff } from 'lucide-react'\nimport {\n createContext,\n useContext,\n useId,\n useMemo,\n useState,\n type ComponentProps,\n type ReactNode,\n} from 'react'\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { Button, cn, Input } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\n/** Title + one-line description above an auth form. */\nexport function AuthHeading({ title, description }: { title: ReactNode; description?: ReactNode }) {\n return (\n <div data-slot=\"auth-heading\">\n <h1 className=\"text-2xl font-semibold tracking-tight text-foreground\">{title}</h1>\n {description && <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>}\n </div>\n )\n}\n\n/** A text-style action under or beside a field (\"Forgot your password?\", \"Clear form\"). */\nexport function AuthLink({ className, type = 'button', ...props }: ComponentProps<'button'>) {\n return (\n <button\n type={type}\n data-slot=\"auth-link\"\n className={cn(\n 'text-sm text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n className\n )}\n {...props}\n />\n )\n}\n\ninterface AuthFieldContextValue {\n id: string\n errorId?: string\n}\n\n/** What an `AuthField` hands to the control inside: its id and the id of its error message. */\nconst AuthFieldContext = createContext<AuthFieldContextValue | null>(null)\n\n/** Merge space-separated id lists for `aria-describedby`. */\nfunction joinIds(...ids: Array<string | undefined>): string | undefined {\n const joined = ids.filter(Boolean).join(' ')\n return joined || undefined\n}\n\nexport interface AuthFieldProps {\n /** Id of the control inside, for the label. Omit it to use a generated (`useId`) id that the\n * `AuthInput` / `RevealablePasswordInput` inside picks up automatically. */\n htmlFor?: string\n /** Field-level error: shown under the control, linked with `aria-describedby`, and marks the\n * control `aria-invalid`. */\n error?: ReactNode\n errorTestId?: string\n label: ReactNode\n required?: boolean\n /** Right-aligned action in the label row (e.g. \"Clear form\"). */\n labelAction?: ReactNode\n /** Overlaid at the right edge of the control (e.g. a \"Verified\" badge). */\n trailing?: ReactNode\n className?: string\n children: ReactNode\n}\n\n/** Label (with required marker) above a control. */\nexport function AuthField({\n htmlFor,\n error,\n errorTestId,\n label,\n required,\n labelAction,\n trailing,\n className,\n children,\n}: AuthFieldProps) {\n const generatedId = useId()\n const id = htmlFor ?? generatedId\n const errorId = error ? `${id}-error` : undefined\n const context = useMemo(() => ({ id, errorId }), [id, errorId])\n return (\n <AuthFieldContext.Provider value={context}>\n <div data-slot=\"auth-field\" className={className}>\n <div className=\"mb-1 flex items-center justify-between\">\n <label htmlFor={id} className=\"block text-sm font-medium text-foreground\">\n {label} {required && <span className=\"text-red-text\">*</span>}\n </label>\n {labelAction}\n </div>\n {trailing ? (\n <div className=\"relative\">\n {children}\n {trailing}\n </div>\n ) : (\n children\n )}\n {error && (\n <p\n id={errorId}\n role=\"alert\"\n className=\"mt-1 text-sm text-red-text\"\n data-testid={errorTestId}\n >\n {error}\n </p>\n )}\n </div>\n </AuthFieldContext.Provider>\n )\n}\n\n/** Input styled for auth forms (faint placeholder). */\nexport function AuthInput({\n className,\n id,\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n ...props\n}: ComponentProps<typeof Input>) {\n const field = useContext(AuthFieldContext)\n return (\n <Input\n id={id ?? field?.id}\n aria-describedby={joinIds(describedBy, field?.errorId)}\n aria-invalid={invalid ?? (field?.errorId ? true : undefined)}\n className={cn('placeholder:text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\n/** Every fixed string of the revealable password input. */\nexport interface RevealablePasswordInputLabels {\n hidePassword: string\n showPassword: string\n}\n\nexport const DEFAULT_REVEALABLE_PASSWORD_INPUT_LABELS: RevealablePasswordInputLabels = {\n hidePassword: 'Hide password',\n showPassword: 'Show password',\n}\n\n/** Every fixed string of the offline badge. */\nexport interface AuthOfflineBadgeLabels {\n offline: string\n}\n\nexport const DEFAULT_AUTH_OFFLINE_BADGE_LABELS: AuthOfflineBadgeLabels = {\n offline: 'Offline',\n}\n\nexport interface RevealablePasswordInputProps extends Omit<ComponentProps<typeof Input>, 'type'> {\n /** Controlled reveal state. Omit it and the input manages its own (see `defaultRevealed`). */\n isRevealed?: boolean\n /** Initial state when uncontrolled. */\n defaultRevealed?: boolean\n /** Called on every toggle press, controlled or not. */\n onToggleReveal?: () => void\n labels?: Partial<RevealablePasswordInputLabels>\n /** Show/hide button id (default `toggle-password-visibility`); `data-testid` goes to the input. */\n toggleTestId?: string\n}\n\n/** Password input with a show/hide button inside the field. */\nexport function RevealablePasswordInput({\n isRevealed: controlledRevealed,\n defaultRevealed = false,\n onToggleReveal,\n className,\n labels,\n toggleTestId,\n ...props\n}: RevealablePasswordInputProps) {\n const [innerRevealed, setInnerRevealed] = useState(defaultRevealed)\n const isControlled = controlledRevealed !== undefined\n const isRevealed = isControlled ? controlledRevealed : innerRevealed\n const l = useMemo(() => ({ ...DEFAULT_REVEALABLE_PASSWORD_INPUT_LABELS, ...labels }), [labels])\n return (\n <div className=\"relative\">\n <AuthInput\n type={isRevealed ? 'text' : 'password'}\n className={cn('pr-10', className)}\n {...props}\n />\n <button\n type=\"button\"\n onClick={() => {\n if (!isControlled) setInnerRevealed((prev) => !prev)\n onToggleReveal?.()\n }}\n aria-label={isRevealed ? l.hidePassword : l.showPassword}\n aria-pressed={isRevealed}\n className=\"absolute inset-y-0 right-0 flex w-10 items-center justify-center rounded-r-md text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring pointer-coarse:w-11\"\n data-testid={testIdOr(toggleTestId, { testId: 'toggle-password-visibility' })}\n >\n {isRevealed ? (\n <EyeOff className=\"h-4 w-4\" aria-hidden=\"true\" />\n ) : (\n <Eye className=\"h-4 w-4\" aria-hidden=\"true\" />\n )}\n </button>\n </div>\n )\n}\n\n/** Small pill on a locked field, e.g. \"Verified\". */\nexport function AuthFieldBadge({\n icon,\n children,\n testId,\n}: {\n icon?: ReactNode\n children: ReactNode\n testId?: string\n}) {\n return (\n <span\n className=\"pointer-events-none absolute inset-y-0 right-3 flex items-center gap-1 text-xs font-medium text-green-text\"\n data-testid={testId}\n >\n {icon}\n {children}\n </span>\n )\n}\n\n/** Centred muted sentence under a step's primary action. */\nexport function AuthNote({ className, ...props }: ComponentProps<'p'>) {\n return <p className={cn('text-center text-sm text-muted-foreground', className)} {...props} />\n}\n\n/** Error / status message box for a form. */\nexport function AuthAlert({\n children,\n withIcon = false,\n testId,\n id,\n}: {\n children: ReactNode\n withIcon?: boolean\n testId?: 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-testid={testId}\n className=\"flex gap-2 rounded-md bg-red-bg p-3 text-sm text-red-text\"\n >\n {withIcon && <AlertCircle className=\"h-5 w-5 flex-shrink-0\" aria-hidden=\"true\" />}\n <div>{children}</div>\n </div>\n )\n}\n\nexport interface AuthSubmitButtonProps extends ComponentProps<typeof Button> {\n /** Shows a spinner and sets `aria-busy`. */\n isBusy?: boolean\n /** Shorthand for `data-testid`. */\n testId?: string\n}\n\n/** Full-width primary submit with a spinner while busy. */\nexport function AuthSubmitButton({\n isBusy,\n testId,\n children,\n className,\n ...props\n}: AuthSubmitButtonProps) {\n return (\n <Button\n type=\"submit\"\n className={cn('w-full', className)}\n aria-busy={isBusy || undefined}\n data-testid={testId}\n {...props}\n >\n {isBusy && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />}\n {children}\n </Button>\n )\n}\n\n/** \"or continue with\" separator between the form and the SSO button. */\nexport function AuthDivider({ label, testId }: { label: string; testId?: string }) {\n return (\n <div\n data-slot=\"auth-divider\"\n data-testid={testIdOr(testId, { testId: 'login-divider' })}\n className=\"relative\"\n >\n <div className=\"absolute inset-0 flex items-center\">\n <div className=\"w-full border-t border-border\" />\n </div>\n <div className=\"relative flex justify-center text-xs\">\n <span className=\"bg-background px-2 text-muted-foreground\">{label}</span>\n </div>\n </div>\n )\n}\n\nexport interface AuthTabOption<T extends string> {\n value: T\n label: string\n testId?: string\n}\n\n/**\n * Underline tab pair (Login / Register) above the form. Radix Tabs: one tab stop, arrow keys,\n * Home and End move between tabs and select them (the form below swaps with the selection).\n */\nexport function AuthTabs<T extends string>({\n value,\n onChange,\n tabs,\n ariaLabel,\n}: {\n value: T\n onChange: (value: T) => void\n tabs: AuthTabOption<T>[]\n ariaLabel: string\n}) {\n return (\n <TabsPrimitive.Root value={value} onValueChange={(next) => onChange(next as T)}>\n <TabsPrimitive.List aria-label={ariaLabel} className=\"inline-flex items-center gap-6\">\n {tabs.map((tab) => (\n <TabsPrimitive.Trigger\n key={tab.value}\n value={tab.value}\n data-testid={tab.testId}\n className={cn(\n '-mb-px border-b-2 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-w-11 pointer-coarse:py-3',\n tab.value === value\n ? 'border-primary text-foreground'\n : 'border-transparent text-muted-foreground hover:text-foreground'\n )}\n >\n {tab.label}\n </TabsPrimitive.Trigger>\n ))}\n </TabsPrimitive.List>\n {/* The form the tabs switch lives outside this component; these empty, hidden panels only\n give each tab's `aria-controls` a valid target. */}\n {tabs.map((tab) => (\n <TabsPrimitive.Content\n key={tab.value}\n value={tab.value}\n tabIndex={-1}\n aria-hidden=\"true\"\n className=\"hidden\"\n />\n ))}\n </TabsPrimitive.Root>\n )\n}\n\n/** Pill shown instead of the tabs when the device is offline. */\nexport function AuthOfflineBadge({\n label,\n title,\n testId,\n labels,\n}: {\n label?: string\n title?: string\n testId?: string\n labels?: Partial<AuthOfflineBadgeLabels>\n}) {\n const text = label ?? labels?.offline ?? DEFAULT_AUTH_OFFLINE_BADGE_LABELS.offline\n return (\n <span\n data-testid={testIdOr(testId, { testId: 'login-offline-indicator' })}\n className=\"inline-flex items-center gap-1.5 rounded-md bg-yellow-bg px-2.5 py-1.5 text-sm font-medium text-yellow-text\"\n title={title}\n >\n <WifiOff className=\"h-4 w-4 shrink-0\" />\n {text}\n </span>\n )\n}\n","import { useMemo, type ReactNode } from 'react'\nimport { MoreVertical } from 'lucide-react'\nimport {\n Checkbox,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\nexport interface AuthLegalLink {\n href: string\n label: string\n}\n\nexport interface AuthConsentProps {\n termsAccepted: boolean\n onTermsAcceptedChange: (accepted: boolean) => void\n /** Whether to download a recovery key on signup (opt-out; unchecking shows the warning). */\n saveRecoveryKey: boolean\n onSaveRecoveryKeyChange: (save: boolean) => void\n termsLink: AuthLegalLink\n privacyLink: AuthLegalLink\n /** Shown (role=\"alert\") only when the recovery-key box is unchecked. */\n noRecoveryKeyWarning: string\n labels?: Partial<AuthConsentLabels>\n /** Part ids; defaults are the current ids. */\n testIds?: Partial<\n Record<'termsCheckbox' | 'recoveryKeyCheckbox' | 'noRecoveryKeyWarning', string>\n >\n}\n\n/** Every fixed string of the sign-up consent block. */\nexport interface AuthConsentLabels {\n /** Text before the terms link. */\n acknowledge: string\n /** Text between the terms and privacy links. */\n and: string\n downloadRecoveryKey: string\n}\n\nexport const DEFAULT_AUTH_CONSENT_LABELS: AuthConsentLabels = {\n acknowledge: 'I acknowledge the',\n and: 'and',\n downloadRecoveryKey: 'Download my recovery key',\n}\n\n/** Every fixed string of the sign-in footer. */\nexport interface AuthFooterLinksLabels {\n installOptions: string\n install: string\n}\n\nexport const DEFAULT_AUTH_FOOTER_LINKS_LABELS: AuthFooterLinksLabels = {\n installOptions: 'Install options',\n install: 'Install',\n}\n\nconst LEGAL_LINK_CLASS = 'underline transition-colors hover:text-primary'\n\n/** Sign-up consent: required terms checkbox and the opt-out \"download recovery key\" checkbox. */\nexport function AuthConsent({\n termsAccepted,\n onTermsAcceptedChange,\n saveRecoveryKey,\n onSaveRecoveryKeyChange,\n termsLink,\n privacyLink,\n noRecoveryKeyWarning,\n labels,\n testIds,\n}: AuthConsentProps) {\n const l = useMemo(() => ({ ...DEFAULT_AUTH_CONSENT_LABELS, ...labels }), [labels])\n return (\n <div data-slot=\"auth-consent\" className=\"space-y-2\">\n <div className=\"flex items-start gap-2\">\n <Checkbox\n id=\"accept-terms\"\n checked={termsAccepted}\n onCheckedChange={(checked) => onTermsAcceptedChange(checked === true)}\n data-testid={testIdOr(testIds?.termsCheckbox, { testId: 'accept-terms-checkbox' })}\n />\n <label\n htmlFor=\"accept-terms\"\n className=\"cursor-pointer text-sm leading-relaxed text-muted-foreground\"\n >\n {l.acknowledge}{' '}\n <a\n href={termsLink.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={LEGAL_LINK_CLASS}\n >\n {termsLink.label}\n </a>{' '}\n {l.and}{' '}\n <a\n href={privacyLink.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={LEGAL_LINK_CLASS}\n >\n {privacyLink.label}\n </a>\n </label>\n </div>\n <div className=\"flex items-start gap-2\">\n <Checkbox\n id=\"save-recovery-key\"\n checked={saveRecoveryKey}\n onCheckedChange={(checked) => onSaveRecoveryKeyChange(checked === true)}\n data-testid={testIdOr(testIds?.recoveryKeyCheckbox, {\n testId: 'save-recovery-key-checkbox',\n })}\n />\n <label\n htmlFor=\"save-recovery-key\"\n className=\"cursor-pointer text-sm leading-relaxed text-muted-foreground\"\n >\n {l.downloadRecoveryKey}\n </label>\n </div>\n {/* Only shown on opt-out: the default path stays free of warnings. */}\n {!saveRecoveryKey && (\n <p\n className=\"text-sm text-red-text\"\n role=\"alert\"\n data-testid={testIdOr(testIds?.noRecoveryKeyWarning, {\n testId: 'no-recovery-key-warning',\n })}\n >\n {noRecoveryKeyWarning}\n </p>\n )}\n </div>\n )\n}\n\nexport interface AuthInstallOption {\n id: string\n label: ReactNode\n icon?: ReactNode\n onSelect: () => void\n disabled?: boolean\n testId?: string\n}\n\nexport interface AuthFooterLinksProps {\n privacyLink: AuthLegalLink\n /** Entries of the \"Install\" kebab menu. Omit/empty to hide the menu. */\n installOptions?: AuthInstallOption[]\n /** Dialog or other overlay owned by the host, rendered inside the footer. */\n children?: ReactNode\n labels?: Partial<AuthFooterLinksLabels>\n /** Install menu trigger id (default `install-options-trigger`). */\n installTriggerTestId?: string\n}\n\n/** Sign-in footer: privacy link on the left, an \"Install\" kebab menu on the right. */\nexport function AuthFooterLinks({\n privacyLink,\n installOptions = [],\n children,\n labels,\n installTriggerTestId,\n}: AuthFooterLinksProps) {\n const l = useMemo(() => ({ ...DEFAULT_AUTH_FOOTER_LINKS_LABELS, ...labels }), [labels])\n return (\n <div\n data-slot=\"auth-footer-links\"\n className=\"flex items-center justify-between pt-2 text-sm text-muted-foreground\"\n >\n <a\n href={privacyLink.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center transition-colors hover:text-primary pointer-coarse:min-h-11\"\n >\n {privacyLink.label}\n </a>\n\n {installOptions.length > 0 && (\n <DropdownMenu>\n <DropdownMenuTrigger\n className=\"flex items-center gap-1 rounded-md px-1.5 py-1 transition-colors hover:text-primary focus:outline-none focus-visible:ring-1 focus-visible:ring-ring pointer-coarse:min-h-11\"\n aria-label={l.installOptions}\n data-testid={testIdOr(installTriggerTestId, { testId: 'install-options-trigger' })}\n >\n {l.install}\n <MoreVertical size={14} />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {installOptions.map((option) => (\n <DropdownMenuItem\n key={option.id}\n onClick={option.onSelect}\n disabled={option.disabled}\n className=\"gap-2\"\n data-testid={option.testId}\n >\n {option.icon}\n {option.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n {children}\n </div>\n )\n}\n","/**\n * Auth Error Parsing Utility\n *\n * Parses API error responses into user-friendly messages.\n * Handles FastAPI/Pydantic error formats (detail field) and standard Error objects.\n */\n\nexport interface ParseAuthErrorOptions {\n /** Default message if error cannot be parsed */\n defaultMessage?: string\n /** Check for 429 rate limit errors */\n checkRateLimit?: boolean\n /** Map specific error messages to custom messages */\n messageMap?: Record<string, string>\n}\n\n/**\n * Parse an API error into a user-friendly message\n */\nexport function parseAuthError(error: unknown, options: ParseAuthErrorOptions = {}): string {\n const {\n defaultMessage = 'Unable to communicate with the server',\n checkRateLimit = false,\n messageMap = {},\n } = options\n\n if (!error) return defaultMessage\n\n // An Error carrying the server's answer (`detail`, `status`: what the SDK's auth calls throw) is\n // read like the answer itself.\n if (error instanceof Error && !('detail' in error) && !('status' in error)) {\n return isNetworkError(error.message)\n ? defaultMessage\n : applyMessageMap(error.message, messageMap)\n }\n\n if (typeof error !== 'object') return defaultMessage\n\n const errorObj = error as {\n detail?: string | Array<{ msg: string }>\n message?: string\n status?: number\n }\n // The server's answer wins over a wrapping message (\"Login failed: …\").\n const message = errorObj.detail === undefined ? errorObj.message : undefined\n\n // Check for rate limiting (429)\n if (checkRateLimit) {\n if (\n errorObj.status === 429 ||\n errorObj.message?.includes('429') ||\n (typeof errorObj.detail === 'string' && errorObj.detail.includes('429'))\n ) {\n return 'Error: duplicate request'\n }\n }\n\n // Handle detail field (FastAPI/Pydantic style)\n if (errorObj.detail) {\n if (Array.isArray(errorObj.detail)) {\n return errorObj.detail[0]?.msg || 'Validation error occurred'\n }\n if (typeof errorObj.detail === 'string') {\n return applyMessageMap(errorObj.detail, messageMap)\n }\n }\n\n // Handle message field\n if (message) {\n return isNetworkError(message) ? defaultMessage : applyMessageMap(message, messageMap)\n }\n\n return defaultMessage\n}\n\nfunction isNetworkError(message: string): boolean {\n const lower = message.toLowerCase()\n return lower.includes('fetch') || lower.includes('network')\n}\n\nfunction applyMessageMap(message: string, messageMap: Record<string, string>): string {\n return messageMap[message] ?? message\n}\n","/**\n * Password rules: the requirements a new password must meet (registration, a new SSO account's\n * master password, a password change), as one value a site configures once (`createPasswordRules`)\n * and every form reads: the one-line hint of `PasswordStrengthInput`, the submit gate, the error.\n */\n\nexport interface PasswordRequirements {\n minLength: boolean\n hasUpperOrSpecial: boolean\n hasNumber: boolean\n}\n\nexport interface PasswordRules {\n minLength: number\n /** Which requirements the password meets. */\n check(password: string): PasswordRequirements\n /** The first unmet requirement as a short hint, or `null` when the password is acceptable. */\n unmet(password: string): string | null\n isValid(password: string): boolean\n /** The first unmet requirement as a sentence (an error to show), or `null`. */\n error(password: string): string | null\n}\n\n/** The rules with a minimum length (default 8): one uppercase or special character, one number. */\nexport function createPasswordRules(minLength = 8): PasswordRules {\n const check = (password: string): PasswordRequirements => ({\n minLength: password.length >= minLength,\n hasUpperOrSpecial: /[A-Z!@#$%^&*()_+\\-=[\\]{};':\"\\\\|,.<>/?]/.test(password),\n hasNumber: /[0-9]/.test(password),\n })\n return {\n minLength,\n check,\n unmet(password) {\n const met = check(password)\n if (!met.minLength) return `Minimum ${minLength} characters`\n if (!met.hasUpperOrSpecial) return 'At least one uppercase letter or special character'\n if (!met.hasNumber) return 'At least one number'\n return null\n },\n isValid(password) {\n const met = check(password)\n return met.minLength && met.hasUpperOrSpecial && met.hasNumber\n },\n error(password) {\n const met = check(password)\n if (!met.minLength) return `Password must be at least ${minLength} characters long.`\n if (!met.hasUpperOrSpecial) {\n return 'Password must contain at least one uppercase letter or special character.'\n }\n if (!met.hasNumber) return 'Password must contain at least one number.'\n return null\n },\n }\n}\n\n/** The default rules (8 characters). */\nexport const DEFAULT_PASSWORD_RULES = createPasswordRules()\n","/**\n * Credential Storage Utilities\n *\n * Uses the Credential Management API to prompt browsers to save passwords.\n * This helps users store passwords in their browser's built-in password manager.\n */\n\n/**\n * Prompt the browser to save credentials to its password manager.\n *\n * This uses the Credential Management API which is supported by:\n * - Chrome/Edge (full support, syncs to Google/Microsoft account)\n * - Firefox (limited support)\n * - Safari (uses Keychain instead)\n *\n * @param email - User's email address\n * @param password - User's password\n * @returns true if credential was stored, false otherwise\n */\nexport async function promptSaveCredential(email: string, password: string): Promise<boolean> {\n // Check if Credential Management API is supported\n if (!('credentials' in navigator) || !('PasswordCredential' in window)) {\n console.info('[CREDENTIAL] Credential Management API not supported')\n return false\n }\n\n try {\n // Create a PasswordCredential object\n const credential = new (\n window as unknown as {\n PasswordCredential: new (data: {\n id: string\n password: string\n name?: string\n }) => Credential\n }\n ).PasswordCredential({\n id: email,\n password: password,\n name: 'ARBI Account',\n })\n\n // Prompt the browser to store the credential\n await navigator.credentials.store(credential)\n console.info('[CREDENTIAL] Credential stored successfully')\n return true\n } catch (error) {\n // User may have declined or browser doesn't support\n console.info('[CREDENTIAL] Failed to store credential:', error)\n return false\n }\n}\n","import {\n useMemo,\n useRef,\n useState,\n type DragEvent,\n type FormEvent,\n type ReactNode,\n useId,\n} from 'react'\nimport { AlertCircle, Key, Loader2, Shield, Upload } from 'lucide-react'\nimport {\n Button,\n cn,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n} from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\n\nfunction ErrorBox({ message, id }: { message: string; id?: string }) {\n return (\n <div id={id} role=\"alert\" className=\"rounded-md bg-red-bg p-3\">\n <div className=\"flex gap-2\">\n <AlertCircle className=\"h-5 w-5 flex-shrink-0 text-red-text\" aria-hidden=\"true\" />\n <p className=\"text-sm text-red-text\">{message}</p>\n </div>\n </div>\n )\n}\n\n/** Every fixed string of the recovery-key dialog. `title` / description props win. */\nexport interface RecoveryKeyDialogLabels {\n title: string\n verifiedDescription: string\n unverifiedDescription: string\n done: string\n currentPassword: string\n passwordPlaceholder: string\n cancel: string\n verifying: string\n verify: string\n}\n\nexport const DEFAULT_RECOVERY_KEY_DIALOG_LABELS: RecoveryKeyDialogLabels = {\n title: 'Save your recovery key',\n verifiedDescription:\n \"If you forget your password, this is the only way to get back into your account. Save it to your password manager so it's there when you need it.\",\n unverifiedDescription: 'Confirm your password to continue.',\n done: 'Done',\n currentPassword: 'Current Password',\n passwordPlaceholder: 'Enter your password',\n cancel: 'Cancel',\n verifying: 'Verifying...',\n verify: 'Verify',\n}\n\n/** Every fixed string of the account-recovery dialog. */\nexport interface AccountRecoveryDialogLabels {\n title: string\n description: string\n emailAddress: string\n emailPlaceholder: string\n keyLoadedFromLink: string\n ssoProtectedKeyNotice: string\n recoveryKey: string\n ssoProtectedKey: string\n dropKeyHere: string\n uploadKeyPrompt: string\n ssoSignInNotice: string\n ssoSignIn: string\n afterRecoveryNotice: string\n cancel: string\n recovering: string\n recoverAccount: string\n}\n\nexport const DEFAULT_ACCOUNT_RECOVERY_DIALOG_LABELS: AccountRecoveryDialogLabels = {\n title: 'Recover Your Account',\n description: 'Upload your recovery key to regain access to your account',\n emailAddress: 'Email Address',\n emailPlaceholder: 'Enter your email',\n keyLoadedFromLink: 'Recovery key loaded from link',\n ssoProtectedKeyNotice: 'SSO-protected key — you must be signed into the matching SSO account.',\n recoveryKey: 'Recovery Key',\n ssoProtectedKey: 'SSO Protected Key',\n dropKeyHere: 'Drop your recovery key here',\n uploadKeyPrompt: 'Click or drag to upload your recovery key (.key file)',\n ssoSignInNotice:\n 'This account signs in with single sign-on. Sign in with your identity provider to continue — you won\\u2019t need your forgotten master password for that step.',\n ssoSignIn: 'Sign in with Auth0 to continue',\n afterRecoveryNotice:\n 'After successful recovery, you will be prompted to set a new password to secure your account.',\n cancel: 'Cancel',\n recovering: 'Recovering...',\n recoverAccount: 'Recover Account',\n}\n\nexport interface RecoveryKeyDialogProps {\n labels?: Partial<RecoveryKeyDialogLabels>\n open: boolean\n onClose: () => void\n /** Content shown once the password is verified (the key download). `null` while verifying. */\n verified: ReactNode | null\n password: string\n onPasswordChange: (password: string) => void\n onVerify: () => void\n isVerifying: boolean\n error: string | null\n title?: string\n verifiedDescription?: string\n unverifiedDescription?: string\n /** Dialog test id (default `download-recovery-key-dialog`). */\n testId?: string\n /** Part ids; defaults are the current ids. */\n testIds?: Partial<Record<'passwordInput', string>>\n}\n\n/**\n * \"Save your recovery key\": confirm the account password first, then reveal the key download\n * (`verified`) with a Done button.\n */\nexport function RecoveryKeyDialog({\n open,\n onClose,\n verified,\n password,\n onPasswordChange,\n onVerify,\n isVerifying,\n error,\n title,\n verifiedDescription,\n unverifiedDescription,\n labels,\n testId,\n testIds,\n}: RecoveryKeyDialogProps) {\n const verifyPasswordId = useId()\n const l = useMemo(() => ({ ...DEFAULT_RECOVERY_KEY_DIALOG_LABELS, ...labels }), [labels])\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault()\n onVerify()\n }\n\n return (\n <Dialog open={open} onOpenChange={onClose}>\n <DialogContent\n presentation=\"sheet\"\n className=\"sm:max-w-md\"\n data-testid={testIdOr(testId, { testId: 'download-recovery-key-dialog' })}\n >\n <DialogHeader>\n <DialogTitle className=\"font-heading\">{title ?? l.title}</DialogTitle>\n <DialogDescription>\n {verified\n ? (verifiedDescription ?? l.verifiedDescription)\n : (unverifiedDescription ?? l.unverifiedDescription)}\n </DialogDescription>\n </DialogHeader>\n\n {verified ? (\n <div className=\"space-y-4\">\n {verified}\n <div className=\"flex justify-end\">\n <Button onClick={onClose}>{l.done}</Button>\n </div>\n </div>\n ) : (\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <div className=\"space-y-2\">\n <label htmlFor={verifyPasswordId} className=\"text-sm font-medium\">\n {l.currentPassword}\n </label>\n <Input\n id={verifyPasswordId}\n type=\"password\"\n value={password}\n onChange={(e) => onPasswordChange(e.target.value)}\n placeholder={l.passwordPlaceholder}\n disabled={isVerifying}\n autoComplete=\"current-password\"\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? `${verifyPasswordId}-error` : undefined}\n data-testid={testIdOr(testIds?.passwordInput, { testId: 'verify-password-input' })}\n />\n </div>\n\n {error && <ErrorBox message={error} id={`${verifyPasswordId}-error`} />}\n\n <div className=\"flex flex-col-reverse sm:flex-row sm:justify-end gap-3\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose} disabled={isVerifying}>\n {l.cancel}\n </Button>\n <Button type=\"submit\" disabled={isVerifying || !password}>\n {isVerifying ? (\n <>\n <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n {l.verifying}\n </>\n ) : (\n l.verify\n )}\n </Button>\n </div>\n </form>\n )}\n </DialogContent>\n </Dialog>\n )\n}\n\nexport interface AccountRecoveryDialogProps {\n labels?: Partial<AccountRecoveryDialogLabels>\n open: boolean\n onClose: () => void\n email: string\n onEmailChange: (email: string) => void\n /** The key arrived in the page URL (the /recover link): show a \"loaded\" notice, no file picker. */\n isKeyFromLink: boolean\n /** Name of the chosen key file, once one is loaded. */\n keyFileName: string | null\n /** The loaded key is wrapped with the user's SSO identity. */\n isKeyEncrypted: boolean\n /** A file was picked or dropped. */\n onKeyFile: (file: File) => void\n error: string | null\n /** SSO sign-in is the next required step (SSO-wrapped key or SSO-linked account). */\n needsSsoSignIn: boolean\n onSsoSignIn: () => void\n isProcessing: boolean\n /** Enables the submit button (email and key present). */\n canSubmit: boolean\n onSubmit: () => void\n /** Dialog test id (default `forgot-password-modal`). */\n testId?: string\n /** Part ids; defaults are the current ids. */\n testIds?: Partial<\n Record<'emailInput' | 'keyDropzone' | 'keyInput' | 'ssoSignIn' | 'cancel' | 'submit', string>\n >\n}\n\n/**\n * Account recovery: email + recovery key (file or link) -> sign in with the key. When the account\n * is SSO-linked, the SSO prompt replaces the submit button.\n */\nexport function AccountRecoveryDialog({\n open,\n onClose,\n email,\n onEmailChange,\n isKeyFromLink,\n keyFileName,\n isKeyEncrypted,\n onKeyFile,\n error,\n needsSsoSignIn,\n onSsoSignIn,\n isProcessing,\n canSubmit,\n onSubmit,\n labels,\n testId,\n testIds,\n}: AccountRecoveryDialogProps) {\n const recoveryEmailId = useId()\n const l = useMemo(() => ({ ...DEFAULT_ACCOUNT_RECOVERY_DIALOG_LABELS, ...labels }), [labels])\n const fileInputRef = useRef<HTMLInputElement>(null)\n const [isDragActive, setIsDragActive] = useState(false)\n\n const handleDragOver = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragActive(true)\n }\n const handleDragLeave = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragActive(false)\n }\n const handleDrop = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragActive(false)\n const file = e.dataTransfer.files?.[0]\n if (file) onKeyFile(file)\n }\n\n return (\n <Dialog open={open} onOpenChange={onClose}>\n <DialogContent\n presentation=\"sheet\"\n className=\"sm:max-w-md\"\n data-testid={testIdOr(testId, { testId: 'forgot-password-modal' })}\n >\n <DialogHeader>\n <DialogTitle className=\"flex items-center gap-2\">\n <Key className=\"h-5 w-5 text-primary\" />\n {l.title}\n </DialogTitle>\n <DialogDescription>{l.description}</DialogDescription>\n </DialogHeader>\n\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <label htmlFor={recoveryEmailId} className=\"text-sm font-medium\">\n {l.emailAddress}\n </label>\n <Input\n id={recoveryEmailId}\n type=\"email\"\n value={email}\n onChange={(e) => onEmailChange(e.target.value)}\n placeholder={l.emailPlaceholder}\n disabled={isProcessing}\n data-testid={testIdOr(testIds?.emailInput, { testId: 'recovery-email-input' })}\n />\n </div>\n\n {isKeyFromLink ? (\n <div className=\"rounded-md bg-green-bg p-3\">\n <div className=\"flex items-center gap-2 text-sm\">\n <Key className=\"h-4 w-4 text-green-text\" />\n <span className=\"font-medium text-green-text\">{l.keyLoadedFromLink}</span>\n </div>\n {isKeyEncrypted && (\n <p className=\"mt-1 inline-flex items-center gap-1 text-sm text-primary\">\n <Shield className=\"h-3 w-3\" />\n {l.ssoProtectedKeyNotice}\n </p>\n )}\n </div>\n ) : (\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{l.recoveryKey}</label>\n <div\n role=\"button\"\n tabIndex={0}\n className={cn(\n 'cursor-pointer rounded-lg p-4 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n isDragActive ? 'bg-accent' : 'bg-muted hover:bg-muted/70'\n )}\n onClick={() => fileInputRef.current?.click()}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n fileInputRef.current?.click()\n }\n }}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n data-testid={testIdOr(testIds?.keyDropzone, { testId: 'recovery-key-dropzone' })}\n >\n <input\n ref={fileInputRef}\n type=\"file\"\n accept=\".key\"\n onClick={(e) => e.stopPropagation()}\n onChange={(e) => {\n const file = e.target.files?.[0]\n if (file) onKeyFile(file)\n }}\n className=\"hidden\"\n data-testid={testIdOr(testIds?.keyInput, { testId: 'recovery-key-input' })}\n />\n {keyFileName ? (\n <div className=\"flex flex-col items-center gap-1\">\n <div className=\"flex items-center justify-center gap-2 text-sm\">\n <Key className=\"h-4 w-4 text-green-text\" />\n <span className=\"font-medium text-green-text\">{keyFileName}</span>\n </div>\n {isKeyEncrypted && (\n <span className=\"inline-flex items-center gap-1 text-sm text-primary\">\n <Shield className=\"h-3 w-3\" />\n {l.ssoProtectedKey}\n </span>\n )}\n </div>\n ) : (\n <div className=\"space-y-2\">\n <Upload className=\"mx-auto h-8 w-8 text-muted-foreground\" />\n <p className=\"text-sm text-muted-foreground\">\n {isDragActive ? l.dropKeyHere : l.uploadKeyPrompt}\n </p>\n </div>\n )}\n </div>\n </div>\n )}\n\n {error && <ErrorBox message={error} />}\n\n {needsSsoSignIn ? (\n <div className=\"space-y-2 rounded-lg bg-muted p-3\">\n <div className=\"flex gap-2\">\n <Shield className=\"h-5 w-5 flex-shrink-0 text-primary\" />\n <p className=\"text-sm\">{l.ssoSignInNotice}</p>\n </div>\n <Button\n onClick={onSsoSignIn}\n className=\"w-full\"\n data-testid={testIdOr(testIds?.ssoSignIn, { testId: 'recovery-sso-signin-button' })}\n >\n {l.ssoSignIn}\n </Button>\n </div>\n ) : (\n <div className=\"rounded-md bg-muted p-3\">\n <p className=\"text-sm text-muted-foreground\">{l.afterRecoveryNotice}</p>\n </div>\n )}\n </div>\n\n <DialogFooter className=\"gap-2\">\n <Button\n variant=\"outline\"\n onClick={onClose}\n disabled={isProcessing}\n data-testid={testIdOr(testIds?.cancel, { testId: 'forgot-password-cancel' })}\n >\n {l.cancel}\n </Button>\n {/* Hidden when SSO sign-in is the next step, to avoid two competing options. */}\n {!needsSsoSignIn && (\n <Button\n onClick={onSubmit}\n disabled={isProcessing || !canSubmit}\n data-testid={testIdOr(testIds?.submit, { testId: 'forgot-password-submit' })}\n >\n {isProcessing ? (\n <>\n <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n {l.recovering}\n </>\n ) : (\n l.recoverAccount\n )}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n","/** The auth pages' URL fragment: `#verify=…&code=…&next=…`, and a fragment carried after it. */\n\n/**\n * Split an auth page's hash (`#verify=…&code=…&next=…`) from a second fragment appended after it.\n * A call invitation's registration link ends with the call key fragment (`…#k=…&v=…`) — a URL has\n * one fragment, so it arrives inside ours, after a second `#`.\n */\nexport function splitAuthHash(hash: string): {\n params: URLSearchParams\n /** `#k=…&v=…` (with its `#`), or '' when there is none. */\n trailingFragment: string\n} {\n const raw = hash.replace(/^#/, '')\n const cut = raw.indexOf('#')\n return {\n params: new URLSearchParams(cut >= 0 ? raw.slice(0, cut) : raw),\n trailingFragment: cut >= 0 ? raw.slice(cut) : '',\n }\n}\n\n/** `next` with the trailing fragment appended, unless `next` already carries a fragment. */\nexport function withTrailingFragment(next: string, trailingFragment: string): string {\n if (!trailingFragment || trailingFragment === '#' || next.includes('#')) return next\n return `${next}${trailingFragment}`\n}\n","/**\n * Sign-in from the URL fragment, for mock and demo deployments only:\n *\n * <login page>#email=<urlencoded>&password=<urlencoded>[&next=/path]\n *\n * OFF by default: nothing is read unless the page opts in (`enabled`). A password in a link is\n * visible to whoever holds the link, so a real deployment never turns this on. When on, the\n * fragment is read once and scrubbed from the address bar (`history.replaceState`) before the\n * first render commits, so it does not linger in history or get copied along with the URL. The\n * fragment never reaches the server; the credentials are never logged nor stored.\n *\n * Values are form-urlencoded (`URLSearchParams`): encode a `+` in a password as `%2B`. Other\n * auth-page parameters (`#verify=…`) and a trailing fragment after a second `#` (a call key) are\n * left in place.\n */\n\nimport { useEffect, useRef, useState } from 'react'\nimport { splitAuthHash, withTrailingFragment } from './auth-hash'\n\nexport interface FragmentCredentials {\n email: string\n password: string\n /** Where to go once signed in: a same-origin path, or `null`. */\n next: string | null\n}\n\nconst KEYS = ['email', 'password', 'next'] as const\n\n/** A same-origin absolute path (`/app/…`), never a scheme or a protocol-relative URL. */\nfunction safeNext(next: string | null): string | null {\n if (!next || !next.startsWith('/') || next.startsWith('//') || next.startsWith('/\\\\')) return null\n return next\n}\n\n/** The credentials in an auth page's hash, or `null` without both an email and a password. */\nexport function parseFragmentCredentials(hash: string): FragmentCredentials | null {\n const { params, trailingFragment } = splitAuthHash(hash)\n const email = params.get('email')?.trim()\n const password = params.get('password')\n if (!email || !password) return null\n const next = safeNext(params.get('next'))\n return { email, password, next: next && withTrailingFragment(next, trailingFragment) }\n}\n\n/**\n * Read the credentials from the current URL's fragment and scrub them (with `next`) from the\n * address bar, keeping any other fragment parameters. `null` when there are none; a fragment with\n * only one of email/password is scrubbed all the same.\n */\nexport function consumeFragmentCredentials(): FragmentCredentials | null {\n if (typeof window === 'undefined') return null\n const { hash, pathname, search } = window.location\n const { params, trailingFragment } = splitAuthHash(hash)\n if (!KEYS.some((k) => k !== 'next' && params.has(k))) return null\n const credentials = parseFragmentCredentials(hash)\n for (const k of KEYS) params.delete(k)\n const rest = params.toString()\n const kept = rest ? `#${rest}${trailingFragment}` : trailingFragment\n window.history.replaceState(window.history.state, '', `${pathname}${search}${kept}`)\n return credentials\n}\n\n// Read once per page load and held only until the sign-in is handed over (a strict-mode double\n// render reads the already-scrubbed URL, so it takes these instead).\nlet taken: FragmentCredentials | null = null\n\nfunction take(): FragmentCredentials | null {\n const fresh = consumeFragmentCredentials()\n if (fresh) taken = fresh\n return taken\n}\n\nexport interface UseFragmentCredentialsOptions {\n /** Opt in. Off by default: only a mock/demo deployment turns this on. */\n enabled?: boolean\n /** Sign in with them (the same path as the form). Called once. */\n onCredentials: (credentials: FragmentCredentials) => void\n}\n\n/**\n * Opt-in sign-in from `#email=…&password=…[&next=…]` (see the top of this file). Returns the\n * email and `next` from the link (to prefill the form should the sign-in fail), or `null`.\n */\nexport function useFragmentCredentials({\n enabled = false,\n onCredentials,\n}: UseFragmentCredentialsOptions): Omit<FragmentCredentials, 'password'> | null {\n // Read (and scrub) during the first render, before any effect or await.\n const [credentials] = useState(() => (enabled ? take() : null))\n const handedOver = useRef(false)\n const callback = useRef(onCredentials)\n callback.current = onCredentials\n\n useEffect(() => {\n if (!credentials || handedOver.current) return\n handedOver.current = true\n taken = null\n callback.current(credentials)\n }, [credentials])\n\n return credentials && { email: credentials.email, next: credentials.next }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { tid } from './chunk-
|
|
2
|
+
import { tid } from './chunk-5ZBXFHZW.js';
|
|
3
3
|
import { EmptyState } from './chunk-P6GHJSLR.js';
|
|
4
4
|
import { ArrowUp, ArrowDown, ChevronsUpDown } from 'lucide-react';
|
|
5
5
|
import { Table, TableHeader, TableRow, TableHead, cn, TableBody, TableCell } from '@arbidocs/react/ui';
|
|
@@ -115,7 +115,32 @@ function DataTable({
|
|
|
115
115
|
}) })
|
|
116
116
|
] }) });
|
|
117
117
|
}
|
|
118
|
+
function PageHeader({
|
|
119
|
+
title,
|
|
120
|
+
eyebrow,
|
|
121
|
+
description,
|
|
122
|
+
leading,
|
|
123
|
+
actions,
|
|
124
|
+
tabs,
|
|
125
|
+
className,
|
|
126
|
+
testId
|
|
127
|
+
}) {
|
|
128
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), "data-testid": testId, children: [
|
|
129
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
|
|
130
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
131
|
+
leading && /* @__PURE__ */ jsx("div", { className: "shrink-0", "data-slot": "page-header-leading", children: leading }),
|
|
132
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
133
|
+
eyebrow && /* @__PURE__ */ jsx("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: eyebrow }),
|
|
134
|
+
/* @__PURE__ */ jsx("h1", { className: "font-display text-2xl font-semibold tracking-tight text-foreground", children: title }),
|
|
135
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-2xl text-sm text-muted-foreground", children: description })
|
|
136
|
+
] })
|
|
137
|
+
] }),
|
|
138
|
+
actions && /* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
139
|
+
] }),
|
|
140
|
+
tabs && /* @__PURE__ */ jsx("div", { "data-slot": "page-header-tabs", children: tabs })
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
118
143
|
|
|
119
|
-
export { DataTable };
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
export { DataTable, PageHeader };
|
|
145
|
+
//# sourceMappingURL=chunk-X6U6L6BG.js.map
|
|
146
|
+
//# sourceMappingURL=chunk-X6U6L6BG.js.map
|