@burdenoff/microfe-subscriberbot 2026.1103.2 → 2026.1105.1
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/index.js +3 -3
- package/dist/stories/Accessibility.stories.d.ts +13 -0
- package/dist/stories/Accessibility.stories.d.ts.map +1 -0
- package/dist/stories/pages/AgentNewPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts +1 -0
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts.map +1 -1
- package/dist/stories/pages/InboxPage.stories.d.ts.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.js +168 -168
- package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +1 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js +116 -116
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js +211 -211
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
- package/dist/subscriberbot/components/Modal.d.ts.map +1 -1
- package/dist/subscriberbot/components/Modal.js +43 -33
- package/dist/subscriberbot/components/Modal.js.map +1 -1
- package/dist/subscriberbot/components/PostureOptions.d.ts.map +1 -1
- package/dist/subscriberbot/components/PostureOptions.js +10 -10
- package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
- package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
- package/dist/subscriberbot/components/StateViews.js +45 -37
- package/dist/subscriberbot/components/StateViews.js.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.d.ts.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.js +6 -6
- package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionBanners.js +6 -6
- package/dist/subscriberbot/components/decisions/DecisionCard.d.ts.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionCard.js +149 -147
- package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.js +127 -127
- package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +114 -114
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.js +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +4 -4
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +1 -1
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +11 -11
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +1 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js +29 -29
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +43 -43
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +4 -4
- package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementThread.js +14 -14
- package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
- package/dist/subscriberbot/components/savings/SavingsCards.d.ts.map +1 -1
- package/dist/subscriberbot/components/savings/SavingsCards.js +242 -237
- package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
- package/dist/subscriberbot/components/viz.d.ts +1 -0
- package/dist/subscriberbot/components/viz.d.ts.map +1 -1
- package/dist/subscriberbot/components/viz.js +100 -101
- package/dist/subscriberbot/components/viz.js.map +1 -1
- package/dist/subscriberbot/hooks/index.js +1 -1
- package/dist/subscriberbot/hooks/useFormError.d.ts +7 -0
- package/dist/subscriberbot/hooks/useFormError.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useFormError.js +28 -0
- package/dist/subscriberbot/hooks/useFormError.js.map +1 -0
- package/dist/subscriberbot/hooks/useFormatters.d.ts +11 -0
- package/dist/subscriberbot/hooks/useFormatters.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useFormatters.js +13 -0
- package/dist/subscriberbot/hooks/useFormatters.js.map +1 -0
- package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js +371 -370
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useTr.d.ts.map +1 -1
- package/dist/subscriberbot/hooks/useTr.js +1 -1
- package/dist/subscriberbot/hooks/useTr.js.map +1 -1
- package/dist/subscriberbot/index.js +1 -1
- package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/AssetVaultPage.js +124 -124
- package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.d.ts +0 -10
- package/dist/subscriberbot/pages/DashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.js +107 -98
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.d.ts +0 -10
- package/dist/subscriberbot/pages/InboxPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.js +421 -402
- package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.js +130 -121
- package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
- package/dist/subscriberbot/pages/InvoicesPage.d.ts +0 -12
- package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/InvoicesPage.js +237 -215
- package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.js +303 -295
- package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
- package/dist/subscriberbot/pages/SavingsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/SavingsPage.js +57 -57
- package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts +0 -13
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.js +202 -196
- package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +0 -18
- package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js +283 -275
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +0 -6
- package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.js +85 -77
- package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +0 -9
- package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.js +136 -136
- package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +0 -9
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +267 -260
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts +0 -10
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +96 -96
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts +0 -11
- package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js +46 -46
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts +0 -11
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +181 -171
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +0 -9
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +164 -164
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +0 -9
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +197 -181
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +0 -8
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +79 -79
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +0 -9
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +147 -147
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +0 -10
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +204 -188
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +0 -9
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js +80 -80
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +0 -10
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +484 -458
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +0 -8
- package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js +146 -136
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +0 -10
- package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js +88 -87
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +0 -11
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +520 -490
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +0 -8
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +104 -90
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +0 -8
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +97 -96
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +76 -74
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts +5 -3
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts.map +1 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +26 -25
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
- package/dist/subscriberbot/utils/formatters.d.ts +16 -5
- package/dist/subscriberbot/utils/formatters.d.ts.map +1 -1
- package/dist/subscriberbot/utils/formatters.js +57 -25
- package/dist/subscriberbot/utils/formatters.js.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts +2 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.js +21 -21
- package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcurementDeskPanel.js","names":[],"sources":["../../../src/subscriberbot/admin/ProcurementDeskPanel.tsx"],"sourcesContent":["/**\n * Procurement desk (super admin, admin-app) — BOFF-4158.\n *\n * The queue of expert procurement requests across all workspaces, earliest\n * decision deadline first, with an \"unassigned\" and a \"mine\" view. The desk\n * assigns each request to a procurement expert (or lets Subscriber Bot pick\n * the best available one), the expert works it, talks to the customer or\n * leaves internal notes, and records the outcome — which bills the success\n * fee in global billing. The expert roster (capacity and specialties) is\n * managed below the queue.\n */\n\nimport { useState, type FC, type FormEvent } from 'react';\nimport {\n FEE_STATUS_LABEL,\n ProcurementOutcomeForm,\n ProcurementStatusPill,\n ProcurementThread,\n REQUEST_TYPE_LABEL,\n STATUS_LABEL,\n WORKING_STATUSES,\n} from '../components/procurement';\nimport {\n type ProcurementDeskView,\n useDeskAssignProcurement,\n useDeskProcurementRequests,\n useDeskRecordProcurementOutcome,\n useDeskRetryProcurementFee,\n useDeskSendProcurementMessage,\n useDeskSetProcurementStatus,\n useDeskWaiveProcurementFee,\n useProcurementExperts,\n useUpsertProcurementExpert,\n} from '../hooks/useProcurementApi';\nimport { useTr } from '../hooks/useTr';\nimport { cn } from '../utils/cn';\nimport { formatCurrency, formatDate } from '../utils/formatters';\nimport type {\n SubProcurementExpert,\n SubProcurementRequest,\n SubProcurementStatus,\n} from '../types/procurement';\n\nconst QUEUE_FILTERS: Array<SubProcurementStatus | null> = [\n null,\n 'SUBMITTED',\n 'ASSIGNED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n 'SUCCEEDED',\n 'NO_SAVINGS',\n 'CANCELLED',\n];\n\nconst VIEWS: Array<{ value: ProcurementDeskView; key: string; fallback: string }> = [\n { value: 'ALL', key: 'admin.procurement.view.all', fallback: 'Everything' },\n { value: 'UNASSIGNED', key: 'admin.procurement.view.unassigned', fallback: 'Unassigned' },\n { value: 'MINE', key: 'admin.procurement.view.mine', fallback: 'Assigned to me' },\n];\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst secondaryBtn =\n 'rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\nconst errorText = (err: unknown): string | null =>\n err ? (err instanceof Error ? err.message : String(err)) : null;\n\nconst ASSIGNABLE: SubProcurementStatus[] = ['SUBMITTED', ...WORKING_STATUSES];\n\nconst DeskItem: FC<{ request: SubProcurementRequest; experts: SubProcurementExpert[] }> = ({\n request: p,\n experts,\n}) => {\n const tr = useTr();\n const assign = useDeskAssignProcurement();\n const setStatus = useDeskSetProcurementStatus();\n const send = useDeskSendProcurementMessage();\n const record = useDeskRecordProcurementOutcome();\n const retry = useDeskRetryProcurementFee();\n const waive = useDeskWaiveProcurementFee();\n const [message, setMessage] = useState('');\n const [expertId, setExpertId] = useState('');\n const [expanded, setExpanded] = useState(false);\n const working = WORKING_STATUSES.includes(p.status);\n const open = p.status === 'SUBMITTED' || working;\n const fee = FEE_STATUS_LABEL[p.feeStatus];\n const typeLabel = REQUEST_TYPE_LABEL[p.requestType];\n const actionError =\n errorText(assign.error) ??\n errorText(setStatus.error) ??\n errorText(send.error) ??\n errorText(retry.error) ??\n errorText(waive.error);\n const clear = { onSuccess: () => setMessage('') };\n\n return (\n <li\n className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\"\n data-testid=\"procurement-desk-item\"\n >\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold text-text-primary\">\n {p.vendorName}\n {p.productName ? ` · ${p.productName}` : ''} · {tr(typeLabel.key, typeLabel.fallback)}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {p.baselineAnnualValue != null\n ? tr('admin.procurement.baseline', '{{amount}} / year baseline', {\n amount: formatCurrency(p.baselineAnnualValue, p.currency),\n })\n : '—'}\n {p.targetAnnualValue != null &&\n ` → ${tr('admin.procurement.target', 'target')} ${formatCurrency(p.targetAnnualValue, p.currency)}`}\n {' · '}\n {tr('admin.procurement.deadline', 'decide by {{date}}', {\n date: formatDate(p.deadline),\n })}\n {p.seats != null ? ` · ${p.seats} ${tr('admin.procurement.seats', 'seats')}` : ''}\n {' · '}\n {p.expertName ?? tr('admin.procurement.unassigned', 'unassigned')}\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n {p.feeStatus !== 'NONE' && (\n <span className=\"text-xs text-text-secondary\">\n {formatCurrency(p.feeAmount, p.currency)} · {tr(fee.key, fee.fallback)}\n </span>\n )}\n <ProcurementStatusPill status={p.status} />\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-end gap-2\">\n {ASSIGNABLE.includes(p.status) && (\n <>\n <div className=\"min-w-48\">\n <label htmlFor={`assign-${p.id}`} className=\"sr-only\">\n {tr('admin.procurement.expert', 'Expert')}\n </label>\n <select\n id={`assign-${p.id}`}\n value={expertId}\n onChange={(e) => setExpertId(e.target.value)}\n className={cn(inputCls, 'py-1.5 text-xs')}\n >\n <option value=\"\">\n {tr('admin.procurement.autoPick', 'Best available expert')}\n </option>\n {experts\n .filter((e) => e.active)\n .map((e) => (\n <option key={e.id} value={e.id}>\n {e.displayName} ({e.openRequests}/{e.maxOpenRequests})\n </option>\n ))}\n </select>\n </div>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={assign.isPending}\n onClick={() => assign.mutate({ id: p.id, expertId: expertId || null })}\n >\n {p.expertId\n ? tr('admin.procurement.reassign', 'Reassign')\n : tr('admin.procurement.assign', 'Assign')}\n </button>\n </>\n )}\n {(p.status === 'ASSIGNED' || p.status === 'AWAITING_CUSTOMER') && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={setStatus.isPending}\n onClick={() => setStatus.mutate({ id: p.id, status: 'IN_PROGRESS' })}\n >\n {p.status === 'ASSIGNED'\n ? tr('admin.procurement.start', 'Start negotiating')\n : tr('admin.procurement.resume', 'Resume')}\n </button>\n )}\n {p.feeStatus === 'PENDING_BILLING' && (\n <>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={retry.isPending}\n onClick={() => retry.mutate({ id: p.id })}\n >\n {tr('admin.procurement.retryFee', 'Retry fee billing')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={waive.isPending || !message.trim()}\n onClick={() => waive.mutate({ id: p.id, reason: message.trim() }, clear)}\n >\n {tr('admin.procurement.waiveFee', 'Waive fee (reason below)')}\n </button>\n </>\n )}\n <button type=\"button\" className={secondaryBtn} onClick={() => setExpanded((v) => !v)}>\n {expanded\n ? tr('admin.procurement.hide', 'Hide details')\n : tr('admin.procurement.show', 'Priorities and thread')}\n </button>\n </div>\n\n <div className=\"mt-3 space-y-2\">\n <textarea\n rows={2}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n aria-label={tr('admin.procurement.message', 'Message, internal note or reason')}\n placeholder={tr(\n 'admin.procurement.messagePlaceholder',\n 'Message to the customer, internal note, or reason'\n )}\n className={inputCls}\n />\n <div className=\"flex flex-wrap gap-2\">\n {open && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={send.isPending || !message.trim()}\n onClick={() => send.mutate({ id: p.id, message: message.trim() }, clear)}\n >\n {tr('admin.procurement.sendMessage', 'Message the customer')}\n </button>\n )}\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={send.isPending || !message.trim()}\n onClick={() =>\n send.mutate({ id: p.id, message: message.trim(), internal: true }, clear)\n }\n >\n {tr('admin.procurement.internalNote', 'Add internal note')}\n </button>\n {(p.status === 'ASSIGNED' || p.status === 'IN_PROGRESS') && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={setStatus.isPending || !message.trim()}\n onClick={() =>\n setStatus.mutate(\n { id: p.id, status: 'AWAITING_CUSTOMER', message: message.trim() },\n clear\n )\n }\n >\n {tr('admin.procurement.askCustomer', 'Ask the customer')}\n </button>\n )}\n {open && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={setStatus.isPending}\n onClick={() =>\n setStatus.mutate(\n { id: p.id, status: 'CANCELLED', message: message.trim() || null },\n clear\n )\n }\n >\n {tr('admin.procurement.close', 'Close request')}\n </button>\n )}\n </div>\n </div>\n {actionError && (\n <p role=\"alert\" className=\"mt-2 text-sm text-status-error-text\">\n {actionError}\n </p>\n )}\n\n {working && (\n <div className=\"mt-4 rounded-lg border border-border-subtle p-3\">\n <p className=\"mb-2 text-xs font-medium text-text-secondary\">\n {tr('admin.procurement.recordOutcome', 'Record the outcome')}\n </p>\n <ProcurementOutcomeForm\n request={p}\n pending={record.isPending}\n error={errorText(record.error)}\n onSubmit={(input) => record.mutate({ id: p.id, input })}\n />\n </div>\n )}\n\n {expanded && (\n <div className=\"mt-4 space-y-3\">\n {p.notes && (\n <p className=\"whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm text-text-primary\">\n {p.notes}\n </p>\n )}\n <ProcurementThread\n events={p.events ?? []}\n customerLabel={tr('admin.procurement.customer', 'Customer')}\n />\n </div>\n )}\n </li>\n );\n};\n\nconst ExpertRoster: FC<{ experts: SubProcurementExpert[] }> = ({ experts }) => {\n const tr = useTr();\n const upsert = useUpsertProcurementExpert();\n const [userId, setUserId] = useState('');\n const [displayName, setDisplayName] = useState('');\n const [email, setEmail] = useState('');\n const [specialties, setSpecialties] = useState('');\n const [capacity, setCapacity] = useState('10');\n // Editing a profile keeps the expert's active state; only Activate /\n // Deactivate changes it. A new expert starts active.\n const [editingActive, setEditingActive] = useState(true);\n\n const edit = (e: SubProcurementExpert) => {\n setEditingActive(e.active);\n setUserId(e.userId);\n setDisplayName(e.displayName);\n setEmail(e.email ?? '');\n setSpecialties(e.specialties.join(', '));\n setCapacity(String(e.maxOpenRequests));\n };\n\n const save = (ev: FormEvent) => {\n ev.preventDefault();\n upsert.mutate(\n {\n input: {\n userId: userId.trim(),\n displayName: displayName.trim(),\n ...(email.trim() ? { email: email.trim() } : {}),\n specialties: specialties\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean),\n maxOpenRequests: Number(capacity) || 10,\n active: editingActive,\n },\n },\n {\n onSuccess: () => {\n setEditingActive(true);\n setUserId('');\n setDisplayName('');\n setEmail('');\n setSpecialties('');\n setCapacity('10');\n },\n }\n );\n };\n\n return (\n <div className=\"mt-8 border-t border-border-subtle pt-6\" data-testid=\"procurement-experts\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('admin.procurement.experts.title', 'Procurement experts')}\n </h3>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {tr(\n 'admin.procurement.experts.description',\n 'Automatic assignment picks an active expert with free capacity, preferring a specialty match with the vendor or category.'\n )}\n </p>\n {experts.length === 0 ? (\n <p className=\"mt-3 text-sm text-text-secondary\">\n {tr('admin.procurement.experts.empty', 'No experts yet. Add the first one below.')}\n </p>\n ) : (\n <ul className=\"mt-3 space-y-2\">\n {experts.map((e) => (\n <li\n key={e.id}\n className=\"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-subtle p-3 text-sm\"\n >\n <span className=\"text-text-primary\">\n <span className=\"font-medium\">{e.displayName}</span>\n {e.email ? ` · ${e.email}` : ''}\n {e.specialties.length > 0 ? ` · ${e.specialties.join(', ')}` : ''}\n </span>\n <span className=\"flex items-center gap-2 text-xs text-text-secondary\">\n {tr('admin.procurement.experts.load', '{{open}} of {{max}} open', {\n open: e.openRequests,\n max: e.maxOpenRequests,\n })}\n {!e.active && ` · ${tr('admin.procurement.experts.inactive', 'inactive')}`}\n <button type=\"button\" className={secondaryBtn} onClick={() => edit(e)}>\n {tr('admin.procurement.experts.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={upsert.isPending}\n onClick={() =>\n upsert.mutate({\n input: {\n userId: e.userId,\n displayName: e.displayName,\n ...(e.email ? { email: e.email } : {}),\n specialties: e.specialties,\n maxOpenRequests: e.maxOpenRequests,\n active: !e.active,\n },\n })\n }\n >\n {e.active\n ? tr('admin.procurement.experts.deactivate', 'Deactivate')\n : tr('admin.procurement.experts.activate', 'Activate')}\n </button>\n </span>\n </li>\n ))}\n </ul>\n )}\n <form onSubmit={save} className=\"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-5\">\n <div>\n <label htmlFor=\"expert-user\" className={labelCls}>\n {tr('admin.procurement.experts.userId', 'User id')}\n </label>\n <input\n id=\"expert-user\"\n value={userId}\n onChange={(e) => setUserId(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-name\" className={labelCls}>\n {tr('admin.procurement.experts.name', 'Display name')}\n </label>\n <input\n id=\"expert-name\"\n value={displayName}\n onChange={(e) => setDisplayName(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-email\" className={labelCls}>\n {tr('admin.procurement.experts.email', 'Work email')}\n </label>\n <input\n id=\"expert-email\"\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-specialties\" className={labelCls}>\n {tr('admin.procurement.experts.specialties', 'Specialties (comma separated)')}\n </label>\n <input\n id=\"expert-specialties\"\n value={specialties}\n onChange={(e) => setSpecialties(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-capacity\" className={labelCls}>\n {tr('admin.procurement.experts.capacity', 'Max open requests')}\n </label>\n <input\n id=\"expert-capacity\"\n type=\"number\"\n min=\"1\"\n max=\"500\"\n value={capacity}\n onChange={(e) => setCapacity(e.target.value)}\n className={inputCls}\n />\n </div>\n <div className=\"sm:col-span-5\">\n {upsert.error && (\n <p role=\"alert\" className=\"mb-2 text-sm text-status-error-text\">\n {errorText(upsert.error)}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={upsert.isPending || !userId.trim() || !displayName.trim()}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {tr('admin.procurement.experts.save', 'Save expert')}\n </button>\n </div>\n </form>\n </div>\n );\n};\n\nexport const ProcurementDeskPanel: FC = () => {\n const tr = useTr();\n const [status, setStatus] = useState<SubProcurementStatus | null>(null);\n const [view, setView] = useState<ProcurementDeskView>('ALL');\n const { data, isLoading, isError, error, hasNextPage, fetchNextPage, isFetchingNextPage } =\n useDeskProcurementRequests(status, view);\n const expertsQ = useProcurementExperts();\n const experts = expertsQ.data ?? [];\n const items = data?.pages.flatMap((page) => page.items) ?? [];\n\n const pill = (active: boolean) =>\n cn(\n 'rounded-lg px-3 py-1.5 text-xs font-medium',\n active\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'border border-border-subtle text-text-primary hover:bg-bg-sunken'\n );\n\n return (\n <div data-testid=\"procurement-desk\">\n <div className=\"mb-2 flex flex-wrap gap-1.5\">\n {VIEWS.map((v) => (\n <button\n key={v.value}\n type=\"button\"\n aria-pressed={view === v.value}\n onClick={() => setView(v.value)}\n className={pill(view === v.value)}\n >\n {tr(v.key, v.fallback)}\n </button>\n ))}\n </div>\n <div className=\"mb-4 flex flex-wrap gap-1.5\">\n {QUEUE_FILTERS.map((f) => (\n <button\n key={f ?? 'ALL'}\n type=\"button\"\n aria-pressed={status === f}\n onClick={() => setStatus(f)}\n className={pill(status === f)}\n >\n {f\n ? tr(STATUS_LABEL[f].key, STATUS_LABEL[f].fallback)\n : tr('admin.procurement.allStatuses', 'All statuses')}\n </button>\n ))}\n </div>\n {isLoading ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('admin.procurement.loading', 'Loading queue…')}\n </p>\n ) : isError ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {errorText(error)}\n </p>\n ) : items.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('admin.procurement.empty', 'No procurement requests in this view.')}\n </p>\n ) : (\n <ul className=\"space-y-3\">\n {items.map((p) => (\n <DeskItem key={p.id} request={p} experts={experts} />\n ))}\n </ul>\n )}\n {hasNextPage && (\n <button\n type=\"button\"\n className={cn(secondaryBtn, 'mt-3')}\n disabled={isFetchingNextPage}\n onClick={() => void fetchNextPage()}\n >\n {isFetchingNextPage\n ? tr('admin.procurement.loadingMore', 'Loading…')\n : tr('admin.procurement.loadMore', 'Load more')}\n </button>\n )}\n <ExpertRoster experts={experts} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA2CA,IAAM,IAAoD;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAA8E;CAClF;EAAE,OAAO;EAAO,KAAK;EAA8B,UAAU;CAAa;CAC1E;EAAE,OAAO;EAAc,KAAK;EAAqC,UAAU;CAAa;CACxF;EAAE,OAAO;EAAQ,KAAK;EAA+B,UAAU;CAAiB;AAClF,GAEM,IACJ,wMACI,IACJ,mIACI,IAAW,sDAEX,KAAa,MACjB,IAAO,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,IAAK,MAEvD,IAAqC,CAAC,aAAa,GAAG,CAAgB,GAEtE,KAAqF,EACzF,SAAS,GACT,iBACI;CACJ,IAAM,IAAK,EAAM,GACX,IAAS,EAAyB,GAClC,IAAY,EAA4B,GACxC,IAAO,EAA8B,GACrC,IAAS,EAAgC,GACzC,IAAQ,EAA2B,GACnC,IAAQ,EAA2B,GACnC,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAU,KAAe,EAAS,EAAE,GACrC,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,IAAU,EAAiB,SAAS,EAAE,MAAM,GAC5C,IAAO,EAAE,WAAW,eAAe,GACnC,IAAM,EAAiB,EAAE,YACzB,IAAY,EAAmB,EAAE,cACjC,IACJ,EAAU,EAAO,KAAK,KACtB,EAAU,EAAU,KAAK,KACzB,EAAU,EAAK,KAAK,KACpB,EAAU,EAAM,KAAK,KACrB,EAAU,EAAM,KAAK,GACjB,IAAQ,EAAE,iBA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,EAAM,KAAK,MACV,kBAAC,UAAD;KAEE,MAAK;KACL,gBAAc,MAAS,EAAE;KACzB,eAAe,EAAQ,EAAE,KAAK;KAC9B,WAAW,EAAK,MAAS,EAAE,KAAK;eAE/B,EAAG,EAAE,KAAK,EAAE,QAAQ;IACf,GAPD,EAAE,KAOD,CACT;GACE,CAAA;GACL,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAc,KAAK,MAClB,kBAAC,UAAD;KAEE,MAAK;KACL,gBAAc,MAAW;KACzB,eAAe,EAAU,CAAC;KAC1B,WAAW,EAAK,MAAW,CAAC;eAE3B,IACG,EAAG,EAAa,GAAG,KAAK,EAAa,GAAG,QAAQ,IAChD,EAAG,iCAAiC,cAAc;IAChD,GATD,KAAK,KASJ,CACT;GACE,CAAA;GACJ,IACC,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,6BAA6B,gBAAgB;GAChD,CAAA,IACD,IACF,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB,EAAU,CAAK;GACf,CAAA,IACD,EAAM,WAAW,IACnB,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,2BAA2B,uCAAuC;GACrE,CAAA,IAEH,kBAAC,MAAD;IAAI,WAAU;cACX,EAAM,KAAK,MACV,kBAAC,GAAD;KAAqB,SAAS;KAAY;IAAU,GAArC,EAAE,EAAmC,CACrD;GACC,CAAA;GAEL,KACC,kBAAC,UAAD;IACE,MAAK;IACL,WAAW,EAAG,GAAc,MAAM;IAClC,UAAU;IACV,eAAe,KAAK,EAAc;cAEjC,IACG,EAAG,iCAAiC,UAAU,IAC9C,EAAG,8BAA8B,WAAW;GAC1C,CAAA;GAEV,kBAAC,GAAD,EAAuB,WAAU,CAAA;EAC9B;;AAET"}
|
|
1
|
+
{"version":3,"file":"ProcurementDeskPanel.js","names":[],"sources":["../../../src/subscriberbot/admin/ProcurementDeskPanel.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Procurement desk (super admin, admin-app) — BOFF-4158.\n *\n * The queue of expert procurement requests across all workspaces, earliest\n * decision deadline first, with an \"unassigned\" and a \"mine\" view. The desk\n * assigns each request to a procurement expert (or lets Subscriber Bot pick\n * the best available one), the expert works it, talks to the customer or\n * leaves internal notes, and records the outcome — which bills the success\n * fee in global billing. The expert roster (capacity and specialties) is\n * managed below the queue.\n */\n\nimport { useState, type FC, type FormEvent } from 'react';\nimport {\n FEE_STATUS_LABEL,\n ProcurementOutcomeForm,\n ProcurementStatusPill,\n ProcurementThread,\n REQUEST_TYPE_LABEL,\n STATUS_LABEL,\n WORKING_STATUSES,\n} from '../components/procurement';\nimport {\n type ProcurementDeskView,\n useDeskAssignProcurement,\n useDeskProcurementRequests,\n useDeskRecordProcurementOutcome,\n useDeskRetryProcurementFee,\n useDeskSendProcurementMessage,\n useDeskSetProcurementStatus,\n useDeskWaiveProcurementFee,\n useProcurementExperts,\n useUpsertProcurementExpert,\n} from '../hooks/useProcurementApi';\nimport { useTr } from '../hooks/useTr';\nimport { cn } from '../utils/cn';\n\nimport type {\n SubProcurementExpert,\n SubProcurementRequest,\n SubProcurementStatus,\n} from '../types/procurement';\n\nconst QUEUE_FILTERS: Array<SubProcurementStatus | null> = [\n null,\n 'SUBMITTED',\n 'ASSIGNED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n 'SUCCEEDED',\n 'NO_SAVINGS',\n 'CANCELLED',\n];\n\nconst VIEWS: Array<{ value: ProcurementDeskView; key: string; fallback: string }> = [\n { value: 'ALL', key: 'admin.procurement.view.all', fallback: 'Everything' },\n { value: 'UNASSIGNED', key: 'admin.procurement.view.unassigned', fallback: 'Unassigned' },\n { value: 'MINE', key: 'admin.procurement.view.mine', fallback: 'Assigned to me' },\n];\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\nconst secondaryBtn =\n 'rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\nconst errorText = (err: unknown): string | null =>\n err ? (err instanceof Error ? err.message : String(err)) : null;\n\nconst ASSIGNABLE: SubProcurementStatus[] = ['SUBMITTED', ...WORKING_STATUSES];\n\nconst DeskItem: FC<{ request: SubProcurementRequest; experts: SubProcurementExpert[] }> = ({\n request: p,\n experts,\n}) => {\n const { formatCurrency, formatDate } = useFormatters();\n\n const tr = useTr();\n const assign = useDeskAssignProcurement();\n const setStatus = useDeskSetProcurementStatus();\n const send = useDeskSendProcurementMessage();\n const record = useDeskRecordProcurementOutcome();\n const retry = useDeskRetryProcurementFee();\n const waive = useDeskWaiveProcurementFee();\n const [message, setMessage] = useState('');\n const [expertId, setExpertId] = useState('');\n const [expanded, setExpanded] = useState(false);\n const working = WORKING_STATUSES.includes(p.status);\n const open = p.status === 'SUBMITTED' || working;\n const fee = FEE_STATUS_LABEL[p.feeStatus];\n const typeLabel = REQUEST_TYPE_LABEL[p.requestType];\n const actionError =\n errorText(assign.error) ??\n errorText(setStatus.error) ??\n errorText(send.error) ??\n errorText(retry.error) ??\n errorText(waive.error);\n const clear = { onSuccess: () => setMessage('') };\n\n return (\n <li\n className=\"rounded-xl border border-border-subtle bg-bg-surface p-4\"\n data-testid=\"procurement-desk-item\"\n >\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold text-text-primary\">\n {p.vendorName}\n {p.productName ? ` · ${p.productName}` : ''} · {tr(typeLabel.key, typeLabel.fallback)}\n </p>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {p.baselineAnnualValue != null\n ? tr('admin.procurement.baseline', '{{amount}} / year baseline', {\n amount: formatCurrency(p.baselineAnnualValue, p.currency),\n })\n : '—'}\n {p.targetAnnualValue != null &&\n ` → ${tr('admin.procurement.target', 'target')} ${formatCurrency(p.targetAnnualValue, p.currency)}`}\n {' · '}\n {tr('admin.procurement.deadline', 'decide by {{date}}', {\n date: formatDate(p.deadline),\n })}\n {p.seats != null ? ` · ${p.seats} ${tr('admin.procurement.seats', 'seats')}` : ''}\n {' · '}\n {p.expertName ?? tr('admin.procurement.unassigned', 'unassigned')}\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n {p.feeStatus !== 'NONE' && (\n <span className=\"text-xs text-text-secondary\">\n {formatCurrency(p.feeAmount, p.currency)} · {tr(fee.key, fee.fallback)}\n </span>\n )}\n <ProcurementStatusPill status={p.status} />\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-end gap-2\">\n {ASSIGNABLE.includes(p.status) && (\n <>\n <div className=\"min-w-48\">\n <label htmlFor={`assign-${p.id}`} className=\"sr-only\">\n {tr('admin.procurement.expert', 'Expert')}\n </label>\n <select\n id={`assign-${p.id}`}\n value={expertId}\n onChange={(e) => setExpertId(e.target.value)}\n className={cn(inputCls, 'py-1.5 text-xs')}\n >\n <option value=\"\">\n {tr('admin.procurement.autoPick', 'Best available expert')}\n </option>\n {experts\n .filter((e) => e.active)\n .map((e) => (\n <option key={e.id} value={e.id}>\n {e.displayName} ({e.openRequests}/{e.maxOpenRequests})\n </option>\n ))}\n </select>\n </div>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={assign.isPending}\n onClick={() => assign.mutate({ id: p.id, expertId: expertId || null })}\n >\n {p.expertId\n ? tr('admin.procurement.reassign', 'Reassign')\n : tr('admin.procurement.assign', 'Assign')}\n </button>\n </>\n )}\n {(p.status === 'ASSIGNED' || p.status === 'AWAITING_CUSTOMER') && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={setStatus.isPending}\n onClick={() => setStatus.mutate({ id: p.id, status: 'IN_PROGRESS' })}\n >\n {p.status === 'ASSIGNED'\n ? tr('admin.procurement.start', 'Start negotiating')\n : tr('admin.procurement.resume', 'Resume')}\n </button>\n )}\n {p.feeStatus === 'PENDING_BILLING' && (\n <>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={retry.isPending}\n onClick={() => retry.mutate({ id: p.id })}\n >\n {tr('admin.procurement.retryFee', 'Retry fee billing')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={waive.isPending || !message.trim()}\n onClick={() => waive.mutate({ id: p.id, reason: message.trim() }, clear)}\n >\n {tr('admin.procurement.waiveFee', 'Waive fee (reason below)')}\n </button>\n </>\n )}\n <button type=\"button\" className={secondaryBtn} onClick={() => setExpanded((v) => !v)}>\n {expanded\n ? tr('admin.procurement.hide', 'Hide details')\n : tr('admin.procurement.show', 'Priorities and thread')}\n </button>\n </div>\n\n <div className=\"mt-3 space-y-2\">\n <textarea\n rows={2}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n aria-label={tr('admin.procurement.message', 'Message, internal note or reason')}\n placeholder={tr(\n 'admin.procurement.messagePlaceholder',\n 'Message to the customer, internal note, or reason'\n )}\n className={inputCls}\n />\n <div className=\"flex flex-wrap gap-2\">\n {open && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={send.isPending || !message.trim()}\n onClick={() => send.mutate({ id: p.id, message: message.trim() }, clear)}\n >\n {tr('admin.procurement.sendMessage', 'Message the customer')}\n </button>\n )}\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={send.isPending || !message.trim()}\n onClick={() =>\n send.mutate({ id: p.id, message: message.trim(), internal: true }, clear)\n }\n >\n {tr('admin.procurement.internalNote', 'Add internal note')}\n </button>\n {(p.status === 'ASSIGNED' || p.status === 'IN_PROGRESS') && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={setStatus.isPending || !message.trim()}\n onClick={() =>\n setStatus.mutate(\n { id: p.id, status: 'AWAITING_CUSTOMER', message: message.trim() },\n clear\n )\n }\n >\n {tr('admin.procurement.askCustomer', 'Ask the customer')}\n </button>\n )}\n {open && (\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={setStatus.isPending}\n onClick={() =>\n setStatus.mutate(\n { id: p.id, status: 'CANCELLED', message: message.trim() || null },\n clear\n )\n }\n >\n {tr('admin.procurement.close', 'Close request')}\n </button>\n )}\n </div>\n </div>\n {actionError && (\n <p role=\"alert\" className=\"mt-2 text-sm text-status-error-text\">\n {actionError}\n </p>\n )}\n\n {working && (\n <div className=\"mt-4 rounded-lg border border-border-subtle p-3\">\n <p className=\"mb-2 text-xs font-medium text-text-secondary\">\n {tr('admin.procurement.recordOutcome', 'Record the outcome')}\n </p>\n <ProcurementOutcomeForm\n request={p}\n pending={record.isPending}\n error={errorText(record.error)}\n onSubmit={(input) => record.mutate({ id: p.id, input })}\n />\n </div>\n )}\n\n {expanded && (\n <div className=\"mt-4 space-y-3\">\n {p.notes && (\n <p className=\"whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm text-text-primary\">\n {p.notes}\n </p>\n )}\n <ProcurementThread\n events={p.events ?? []}\n customerLabel={tr('admin.procurement.customer', 'Customer')}\n />\n </div>\n )}\n </li>\n );\n};\n\nconst ExpertRoster: FC<{ experts: SubProcurementExpert[] }> = ({ experts }) => {\n const tr = useTr();\n const upsert = useUpsertProcurementExpert();\n const [userId, setUserId] = useState('');\n const [displayName, setDisplayName] = useState('');\n const [email, setEmail] = useState('');\n const [specialties, setSpecialties] = useState('');\n const [capacity, setCapacity] = useState('10');\n // Editing a profile keeps the expert's active state; only Activate /\n // Deactivate changes it. A new expert starts active.\n const [editingActive, setEditingActive] = useState(true);\n\n const edit = (e: SubProcurementExpert) => {\n setEditingActive(e.active);\n setUserId(e.userId);\n setDisplayName(e.displayName);\n setEmail(e.email ?? '');\n setSpecialties(e.specialties.join(', '));\n setCapacity(String(e.maxOpenRequests));\n };\n\n const save = (ev: FormEvent) => {\n ev.preventDefault();\n upsert.mutate(\n {\n input: {\n userId: userId.trim(),\n displayName: displayName.trim(),\n ...(email.trim() ? { email: email.trim() } : {}),\n specialties: specialties\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean),\n maxOpenRequests: Number(capacity) || 10,\n active: editingActive,\n },\n },\n {\n onSuccess: () => {\n setEditingActive(true);\n setUserId('');\n setDisplayName('');\n setEmail('');\n setSpecialties('');\n setCapacity('10');\n },\n }\n );\n };\n\n return (\n <div className=\"mt-8 border-t border-border-subtle pt-6\" data-testid=\"procurement-experts\">\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tr('admin.procurement.experts.title', 'Procurement experts')}\n </h3>\n <p className=\"mt-0.5 text-xs text-text-secondary\">\n {tr(\n 'admin.procurement.experts.description',\n 'Automatic assignment picks an active expert with free capacity, preferring a specialty match with the vendor or category.'\n )}\n </p>\n {experts.length === 0 ? (\n <p className=\"mt-3 text-sm text-text-secondary\">\n {tr('admin.procurement.experts.empty', 'No experts yet. Add the first one below.')}\n </p>\n ) : (\n <ul className=\"mt-3 space-y-2\">\n {experts.map((e) => (\n <li\n key={e.id}\n className=\"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-subtle p-3 text-sm\"\n >\n <span className=\"text-text-primary\">\n <span className=\"font-medium\">{e.displayName}</span>\n {e.email ? ` · ${e.email}` : ''}\n {e.specialties.length > 0 ? ` · ${e.specialties.join(', ')}` : ''}\n </span>\n <span className=\"flex items-center gap-2 text-xs text-text-secondary\">\n {tr('admin.procurement.experts.load', '{{open}} of {{max}} open', {\n open: e.openRequests,\n max: e.maxOpenRequests,\n })}\n {!e.active && ` · ${tr('admin.procurement.experts.inactive', 'inactive')}`}\n <button type=\"button\" className={secondaryBtn} onClick={() => edit(e)}>\n {tr('admin.procurement.experts.edit', 'Edit')}\n </button>\n <button\n type=\"button\"\n className={secondaryBtn}\n disabled={upsert.isPending}\n onClick={() =>\n upsert.mutate({\n input: {\n userId: e.userId,\n displayName: e.displayName,\n ...(e.email ? { email: e.email } : {}),\n specialties: e.specialties,\n maxOpenRequests: e.maxOpenRequests,\n active: !e.active,\n },\n })\n }\n >\n {e.active\n ? tr('admin.procurement.experts.deactivate', 'Deactivate')\n : tr('admin.procurement.experts.activate', 'Activate')}\n </button>\n </span>\n </li>\n ))}\n </ul>\n )}\n <form onSubmit={save} className=\"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-5\">\n <div>\n <label htmlFor=\"expert-user\" className={labelCls}>\n {tr('admin.procurement.experts.userId', 'User id')}\n </label>\n <input\n id=\"expert-user\"\n value={userId}\n onChange={(e) => setUserId(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-name\" className={labelCls}>\n {tr('admin.procurement.experts.name', 'Display name')}\n </label>\n <input\n id=\"expert-name\"\n value={displayName}\n onChange={(e) => setDisplayName(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-email\" className={labelCls}>\n {tr('admin.procurement.experts.email', 'Work email')}\n </label>\n <input\n id=\"expert-email\"\n type=\"email\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-specialties\" className={labelCls}>\n {tr('admin.procurement.experts.specialties', 'Specialties (comma separated)')}\n </label>\n <input\n id=\"expert-specialties\"\n value={specialties}\n onChange={(e) => setSpecialties(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"expert-capacity\" className={labelCls}>\n {tr('admin.procurement.experts.capacity', 'Max open requests')}\n </label>\n <input\n id=\"expert-capacity\"\n type=\"number\"\n min=\"1\"\n max=\"500\"\n value={capacity}\n onChange={(e) => setCapacity(e.target.value)}\n className={inputCls}\n />\n </div>\n <div className=\"sm:col-span-5\">\n {upsert.error && (\n <p role=\"alert\" className=\"mb-2 text-sm text-status-error-text\">\n {errorText(upsert.error)}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={upsert.isPending || !userId.trim() || !displayName.trim()}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50\"\n >\n {tr('admin.procurement.experts.save', 'Save expert')}\n </button>\n </div>\n </form>\n </div>\n );\n};\n\nexport const ProcurementDeskPanel: FC = () => {\n const tr = useTr();\n const [status, setStatus] = useState<SubProcurementStatus | null>(null);\n const [view, setView] = useState<ProcurementDeskView>('ALL');\n const { data, isLoading, isError, error, hasNextPage, fetchNextPage, isFetchingNextPage } =\n useDeskProcurementRequests(status, view);\n const expertsQ = useProcurementExperts();\n const experts = expertsQ.data ?? [];\n const items = data?.pages.flatMap((page) => page.items) ?? [];\n\n const pill = (active: boolean) =>\n cn(\n 'rounded-lg px-3 py-1.5 text-xs font-medium',\n active\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'border border-border-subtle text-text-primary hover:bg-bg-sunken'\n );\n\n return (\n <div data-testid=\"procurement-desk\">\n <div className=\"mb-2 flex flex-wrap gap-1.5\">\n {VIEWS.map((v) => (\n <button\n key={v.value}\n type=\"button\"\n aria-pressed={view === v.value}\n onClick={() => setView(v.value)}\n className={pill(view === v.value)}\n >\n {tr(v.key, v.fallback)}\n </button>\n ))}\n </div>\n <div className=\"mb-4 flex flex-wrap gap-1.5\">\n {QUEUE_FILTERS.map((f) => (\n <button\n key={f ?? 'ALL'}\n type=\"button\"\n aria-pressed={status === f}\n onClick={() => setStatus(f)}\n className={pill(status === f)}\n >\n {f\n ? tr(STATUS_LABEL[f].key, STATUS_LABEL[f].fallback)\n : tr('admin.procurement.allStatuses', 'All statuses')}\n </button>\n ))}\n </div>\n {isLoading ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('admin.procurement.loading', 'Loading queue…')}\n </p>\n ) : isError ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {errorText(error)}\n </p>\n ) : items.length === 0 ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('admin.procurement.empty', 'No procurement requests in this view.')}\n </p>\n ) : (\n <ul className=\"space-y-3\">\n {items.map((p) => (\n <DeskItem key={p.id} request={p} experts={experts} />\n ))}\n </ul>\n )}\n {hasNextPage && (\n <button\n type=\"button\"\n className={cn(secondaryBtn, 'mt-3')}\n disabled={isFetchingNextPage}\n onClick={() => void fetchNextPage()}\n >\n {isFetchingNextPage\n ? tr('admin.procurement.loadingMore', 'Loading…')\n : tr('admin.procurement.loadMore', 'Load more')}\n </button>\n )}\n <ExpertRoster experts={experts} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA4CA,IAAM,IAAoD;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAA8E;CAClF;EAAE,OAAO;EAAO,KAAK;EAA8B,UAAU;CAAa;CAC1E;EAAE,OAAO;EAAc,KAAK;EAAqC,UAAU;CAAa;CACxF;EAAE,OAAO;EAAQ,KAAK;EAA+B,UAAU;CAAiB;AAClF,GAEM,IACJ,wMACI,IACJ,mIACI,IAAW,sDAEX,KAAa,MACjB,IAAO,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,IAAK,MAEvD,IAAqC,CAAC,aAAa,GAAG,CAAgB,GAEtE,KAAqF,EACzF,SAAS,GACT,iBACI;CACJ,IAAM,EAAE,mBAAgB,kBAAe,EAAc,GAE/C,IAAK,EAAM,GACX,IAAS,EAAyB,GAClC,IAAY,EAA4B,GACxC,IAAO,EAA8B,GACrC,IAAS,EAAgC,GACzC,IAAQ,EAA2B,GACnC,IAAQ,EAA2B,GACnC,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAU,KAAe,EAAS,EAAE,GACrC,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,IAAU,EAAiB,SAAS,EAAE,MAAM,GAC5C,IAAO,EAAE,WAAW,eAAe,GACnC,IAAM,EAAiB,EAAE,YACzB,IAAY,EAAmB,EAAE,cACjC,IACJ,EAAU,EAAO,KAAK,KACtB,EAAU,EAAU,KAAK,KACzB,EAAU,EAAK,KAAK,KACpB,EAAU,EAAM,KAAK,KACrB,EAAU,EAAM,KAAK,GACjB,IAAQ,EAAE,iBAAiB,EAAW,EAAE,EAAE;CAEhD,OACE,kBAAC,MAAD;EACE,WAAU;EACV,eAAY;YAFd;GAIE,kBAAC,OAAD;IAAK,WAAU;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AAW,EAAK,MAAS,EAAE,KAAK;eAE/B,EAAG,EAAE,KAAK,EAAE,QAAQ;IACf,GAPD,EAAE,KAOD,CACT;GACE,CAAA;GACL,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAc,KAAK,MAClB,kBAAC,UAAD;KAEE,MAAK;KACL,gBAAc,MAAW;KACzB,eAAe,EAAU,CAAC;KAC1B,WAAW,EAAK,MAAW,CAAC;eAE3B,IACG,EAAG,EAAa,GAAG,KAAK,EAAa,GAAG,QAAQ,IAChD,EAAG,iCAAiC,cAAc;IAChD,GATD,KAAK,KASJ,CACT;GACE,CAAA;GACJ,IACC,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,6BAA6B,gBAAgB;GAChD,CAAA,IACD,IACF,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB,EAAU,CAAK;GACf,CAAA,IACD,EAAM,WAAW,IACnB,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,2BAA2B,uCAAuC;GACrE,CAAA,IAEH,kBAAC,MAAD;IAAI,WAAU;cACX,EAAM,KAAK,MACV,kBAAC,GAAD;KAAqB,SAAS;KAAY;IAAU,GAArC,EAAE,EAAmC,CACrD;GACC,CAAA;GAEL,KACC,kBAAC,UAAD;IACE,MAAK;IACL,WAAW,EAAG,GAAc,MAAM;IAClC,UAAU;IACV,eAAe,KAAK,EAAc;cAEjC,IACG,EAAG,iCAAiC,UAAU,IAC9C,EAAG,8BAA8B,WAAW;GAC1C,CAAA;GAEV,kBAAC,GAAD,EAAuB,WAAU,CAAA;EAC9B;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/Modal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAA4B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/Modal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAA4B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI1E,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAoHhC,CAAC"}
|
|
@@ -1,54 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { useEffect as t, useId as n, useRef as r } from "react";
|
|
3
|
+
import { X as i } from "lucide-react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
5
|
//#region src/subscriberbot/components/Modal.tsx
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
}, [
|
|
10
|
-
let e = (e) => {
|
|
11
|
-
e.key === "Escape" &&
|
|
6
|
+
var s = ({ title: s, description: c, onClose: l, children: u, maxWidthClassName: d = "max-w-lg" }) => {
|
|
7
|
+
let f = n(), p = n(), m = e(), h = r(null), g = r(l);
|
|
8
|
+
return t(() => {
|
|
9
|
+
g.current = l;
|
|
10
|
+
}, [l]), t(() => {
|
|
11
|
+
let e = document.activeElement instanceof HTMLElement ? document.activeElement : null, t = (e) => {
|
|
12
|
+
if (e.key === "Escape" && (e.preventDefault(), g.current()), e.key !== "Tab") return;
|
|
13
|
+
let t = h.current;
|
|
14
|
+
if (!t) return;
|
|
15
|
+
let n = Array.from(t.querySelectorAll("button:not(:disabled), input:not(:disabled):not([type=\"hidden\"]), select:not(:disabled), textarea:not(:disabled), a[href], [tabindex]:not([tabindex=\"-1\"])")).filter((e) => e.tabIndex >= 0 && e.getClientRects().length > 0), r = n[0], i = n.at(-1);
|
|
16
|
+
!r || !i ? (e.preventDefault(), t.focus()) : e.shiftKey && (document.activeElement === r || !t.contains(document.activeElement)) ? (e.preventDefault(), i.focus()) : !e.shiftKey && (document.activeElement === i || !t.contains(document.activeElement)) && (e.preventDefault(), r.focus());
|
|
12
17
|
};
|
|
13
|
-
return document.addEventListener("keydown",
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
return document.addEventListener("keydown", t), () => {
|
|
19
|
+
document.removeEventListener("keydown", t), e?.isConnected && e.focus();
|
|
20
|
+
};
|
|
21
|
+
}, []), t(() => {
|
|
22
|
+
let e = h.current;
|
|
16
23
|
(e?.querySelector("input:not([type=\"hidden\"]), select, textarea") ?? e?.querySelector("button, [href], [tabindex]:not([tabindex=\"-1\"])"))?.focus();
|
|
17
|
-
}, []), /* @__PURE__ */
|
|
24
|
+
}, []), /* @__PURE__ */ a("div", {
|
|
18
25
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4 backdrop-blur-sm",
|
|
19
26
|
onMouseDown: (e) => {
|
|
20
|
-
e.target === e.currentTarget &&
|
|
27
|
+
e.target === e.currentTarget && l();
|
|
21
28
|
},
|
|
22
|
-
children: /* @__PURE__ */
|
|
23
|
-
ref:
|
|
29
|
+
children: /* @__PURE__ */ o("div", {
|
|
30
|
+
ref: h,
|
|
24
31
|
role: "dialog",
|
|
25
32
|
"aria-modal": "true",
|
|
26
|
-
"aria-labelledby":
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
"aria-labelledby": f,
|
|
34
|
+
"aria-describedby": c ? p : void 0,
|
|
35
|
+
tabIndex: -1,
|
|
36
|
+
className: `max-h-[90vh] w-full ${d} overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface p-5 shadow-lg`,
|
|
37
|
+
children: [/* @__PURE__ */ o("div", {
|
|
29
38
|
className: "mb-4 flex items-start justify-between gap-3",
|
|
30
|
-
children: [/* @__PURE__ */
|
|
39
|
+
children: [/* @__PURE__ */ o("div", {
|
|
31
40
|
className: "min-w-0",
|
|
32
|
-
children: [/* @__PURE__ */
|
|
33
|
-
id:
|
|
41
|
+
children: [/* @__PURE__ */ a("h3", {
|
|
42
|
+
id: f,
|
|
34
43
|
className: "text-lg font-semibold text-text-primary",
|
|
35
|
-
children: o
|
|
36
|
-
}), s && /* @__PURE__ */ i("p", {
|
|
37
|
-
className: "mt-0.5 text-xs text-text-secondary",
|
|
38
44
|
children: s
|
|
45
|
+
}), c && /* @__PURE__ */ a("p", {
|
|
46
|
+
id: p,
|
|
47
|
+
className: "mt-0.5 text-xs text-text-secondary",
|
|
48
|
+
children: c
|
|
39
49
|
})]
|
|
40
|
-
}), /* @__PURE__ */
|
|
50
|
+
}), /* @__PURE__ */ a("button", {
|
|
41
51
|
type: "button",
|
|
42
|
-
onClick:
|
|
43
|
-
"aria-label": "Close dialog",
|
|
44
|
-
className: "shrink-0 rounded-md p-1 text-text-secondary hover:text-text-primary",
|
|
45
|
-
children: /* @__PURE__ */ i
|
|
52
|
+
onClick: l,
|
|
53
|
+
"aria-label": m("common.closeDialog", "Close dialog"),
|
|
54
|
+
className: "flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded-md p-1 text-text-secondary hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-focus-ring)]",
|
|
55
|
+
children: /* @__PURE__ */ a(i, { className: "h-5 w-5" })
|
|
46
56
|
})]
|
|
47
|
-
}),
|
|
57
|
+
}), u]
|
|
48
58
|
})
|
|
49
59
|
});
|
|
50
60
|
};
|
|
51
61
|
//#endregion
|
|
52
|
-
export {
|
|
62
|
+
export { s as Modal };
|
|
53
63
|
|
|
54
64
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":[],"sources":["../../../src/subscriberbot/components/Modal.tsx"],"sourcesContent":["/**\n * Accessible modal dialog\n * @module subscriberbot/components\n *\n * A small, dependency-light dialog used for the MFE's create/edit forms.\n * Handles the a11y contract every modal here must meet:\n * - `role=\"dialog\"` + `aria-modal=\"true\"` + `aria-labelledby` (wired to the\n * heading id),\n * - Escape-to-close,\n * - initial focus moved to the first form field,\n * - a semantic overlay scrim (`bg-bg-overlay`, never raw black),\n * - responsive layout (full-width on mobile, scrolls when the form is long).\n */\n\nimport { useEffect, useId, useRef, type FC, type ReactNode } from 'react';\nimport { X } from 'lucide-react';\n\ninterface ModalProps {\n title: string;\n description?: string;\n onClose: () => void;\n children: ReactNode;\n /** Constrain width. Defaults to a comfortable single-column form width. */\n maxWidthClassName?: string;\n}\n\nexport const Modal: FC<ModalProps> = ({\n title,\n description,\n onClose,\n children,\n maxWidthClassName = 'max-w-lg',\n}) => {\n const titleId = useId();\n const panelRef = useRef<HTMLDivElement>(null);\n\n // Callers usually pass an inline `onClose`, which is a new function on every\n // parent render. Keep the latest one in a ref so neither effect below re-runs\n // because of it: re-running the focus effect would yank focus back to the\n // first field on every keystroke whenever the form state lives in the parent.\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n }, [onClose]);\n\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onCloseRef.current();\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, []);\n\n useEffect(() => {\n // Move initial focus to the first interactive form field (falling back to\n // any focusable control) so keyboard users land inside the dialog. This\n // runs once, when the dialog opens.\n const panel = panelRef.current;\n const firstField = panel?.querySelector<HTMLElement>(\n 'input:not([type=\"hidden\"]), select, textarea'\n );\n (\n firstField ??\n panel?.querySelector<HTMLElement>('button, [href], [tabindex]:not([tabindex=\"-1\"])')\n )?.focus();\n }, []);\n\n return (\n <div\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4 backdrop-blur-sm\"\n onMouseDown={(e) => {\n if (e.target === e.currentTarget) onClose();\n }}\n >\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n className={`max-h-[90vh] w-full ${maxWidthClassName} overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface p-5 shadow-lg`}\n >\n <div className=\"mb-4 flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <h3 id={titleId} className=\"text-lg font-semibold text-text-primary\">\n {title}\n </h3>\n {description && <p className=\"mt-0.5 text-xs text-text-secondary\"
|
|
1
|
+
{"version":3,"file":"Modal.js","names":[],"sources":["../../../src/subscriberbot/components/Modal.tsx"],"sourcesContent":["/**\n * Accessible modal dialog\n * @module subscriberbot/components\n *\n * A small, dependency-light dialog used for the MFE's create/edit forms.\n * Handles the a11y contract every modal here must meet:\n * - `role=\"dialog\"` + `aria-modal=\"true\"` + `aria-labelledby` (wired to the\n * heading id),\n * - Escape-to-close,\n * - initial focus moved to the first form field,\n * - a semantic overlay scrim (`bg-bg-overlay`, never raw black),\n * - responsive layout (full-width on mobile, scrolls when the form is long).\n */\n\nimport { useEffect, useId, useRef, type FC, type ReactNode } from 'react';\nimport { X } from 'lucide-react';\nimport { useTr } from '../hooks/useTr';\n\ninterface ModalProps {\n title: string;\n description?: string;\n onClose: () => void;\n children: ReactNode;\n /** Constrain width. Defaults to a comfortable single-column form width. */\n maxWidthClassName?: string;\n}\n\nexport const Modal: FC<ModalProps> = ({\n title,\n description,\n onClose,\n children,\n maxWidthClassName = 'max-w-lg',\n}) => {\n const titleId = useId();\n const descriptionId = useId();\n const tr = useTr();\n const panelRef = useRef<HTMLDivElement>(null);\n\n // Callers usually pass an inline `onClose`, which is a new function on every\n // parent render. Keep the latest one in a ref so neither effect below re-runs\n // because of it: re-running the focus effect would yank focus back to the\n // first field on every keystroke whenever the form state lives in the parent.\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n }, [onClose]);\n\n useEffect(() => {\n const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onCloseRef.current();\n }\n if (e.key !== 'Tab') return;\n const panel = panelRef.current;\n if (!panel) return;\n const controls = Array.from(\n panel.querySelectorAll<HTMLElement>(\n 'button:not(:disabled), input:not(:disabled):not([type=\"hidden\"]), select:not(:disabled), textarea:not(:disabled), a[href], [tabindex]:not([tabindex=\"-1\"])'\n )\n ).filter((element) => element.tabIndex >= 0 && element.getClientRects().length > 0);\n const first = controls[0];\n const last = controls.at(-1);\n if (!first || !last) {\n e.preventDefault();\n panel.focus();\n } else if (\n e.shiftKey &&\n (document.activeElement === first || !panel.contains(document.activeElement))\n ) {\n e.preventDefault();\n last.focus();\n } else if (\n !e.shiftKey &&\n (document.activeElement === last || !panel.contains(document.activeElement))\n ) {\n e.preventDefault();\n first.focus();\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n if (opener?.isConnected) opener.focus();\n };\n }, []);\n\n useEffect(() => {\n // Move initial focus to the first interactive form field (falling back to\n // any focusable control) so keyboard users land inside the dialog. This\n // runs once, when the dialog opens.\n const panel = panelRef.current;\n const firstField = panel?.querySelector<HTMLElement>(\n 'input:not([type=\"hidden\"]), select, textarea'\n );\n (\n firstField ??\n panel?.querySelector<HTMLElement>('button, [href], [tabindex]:not([tabindex=\"-1\"])')\n )?.focus();\n }, []);\n\n return (\n <div\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4 backdrop-blur-sm\"\n onMouseDown={(e) => {\n if (e.target === e.currentTarget) onClose();\n }}\n >\n <div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n className={`max-h-[90vh] w-full ${maxWidthClassName} overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface p-5 shadow-lg`}\n >\n <div className=\"mb-4 flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <h3 id={titleId} className=\"text-lg font-semibold text-text-primary\">\n {title}\n </h3>\n {description && (\n <p id={descriptionId} className=\"mt-0.5 text-xs text-text-secondary\">\n {description}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={tr('common.closeDialog', 'Close dialog')}\n className=\"flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded-md p-1 text-text-secondary hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-focus-ring)]\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n {children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AA2BA,IAAa,KAAyB,EACpC,UACA,gBACA,YACA,aACA,uBAAoB,iBAChB;CACJ,IAAM,IAAU,EAAM,GAChB,IAAgB,EAAM,GACtB,IAAK,EAAM,GACX,IAAW,EAAuB,IAAI,GAMtC,IAAa,EAAO,CAAO;CA4DjC,OA3DA,QAAgB;EACd,EAAW,UAAU;CACvB,GAAG,CAAC,CAAO,CAAC,GAEZ,QAAgB;EACd,IAAM,IAAS,SAAS,yBAAyB,cAAc,SAAS,gBAAgB,MAClF,KAAa,MAAqB;GAKtC,IAJI,EAAE,QAAQ,aACZ,EAAE,eAAe,GACjB,EAAW,QAAQ,IAEjB,EAAE,QAAQ,OAAO;GACrB,IAAM,IAAQ,EAAS;GACvB,IAAI,CAAC,GAAO;GACZ,IAAM,IAAW,MAAM,KACrB,EAAM,iBACJ,gKACF,CACF,EAAE,QAAQ,MAAY,EAAQ,YAAY,KAAK,EAAQ,eAAe,EAAE,SAAS,CAAC,GAC5E,IAAQ,EAAS,IACjB,IAAO,EAAS,GAAG,EAAE;GAC3B,AAAI,CAAC,KAAS,CAAC,KACb,EAAE,eAAe,GACjB,EAAM,MAAM,KAEZ,EAAE,aACD,SAAS,kBAAkB,KAAS,CAAC,EAAM,SAAS,SAAS,aAAa,MAE3E,EAAE,eAAe,GACjB,EAAK,MAAM,KAEX,CAAC,EAAE,aACF,SAAS,kBAAkB,KAAQ,CAAC,EAAM,SAAS,SAAS,aAAa,OAE1E,EAAE,eAAe,GACjB,EAAM,MAAM;EAEhB;EAEA,OADA,SAAS,iBAAiB,WAAW,CAAS,SACjC;GAEX,AADA,SAAS,oBAAoB,WAAW,CAAS,GAC7C,GAAQ,eAAa,EAAO,MAAM;EACxC;CACF,GAAG,CAAC,CAAC,GAEL,QAAgB;EAId,IAAM,IAAQ,EAAS;EAIvB,CAHmB,GAAO,cACxB,gDACF,KAGE,GAAO,cAA2B,mDAAiD,IAClF,MAAM;CACX,GAAG,CAAC,CAAC,GAGH,kBAAC,OAAD;EACE,WAAU;EACV,cAAc,MAAM;GAClB,AAAI,EAAE,WAAW,EAAE,iBAAe,EAAQ;EAC5C;YAEA,kBAAC,OAAD;GACE,KAAK;GACL,MAAK;GACL,cAAW;GACX,mBAAiB;GACjB,oBAAkB,IAAc,IAAgB,KAAA;GAChD,UAAU;GACV,WAAW,uBAAuB,EAAkB;aAPtD,CASE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,IAAI;MAAS,WAAU;gBACxB;KACC,CAAA,GACH,KACC,kBAAC,KAAD;MAAG,IAAI;MAAe,WAAU;gBAC7B;KACA,CAAA,CAEF;QACL,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,cAAY,EAAG,sBAAsB,cAAc;KACnD,WAAU;eAEV,kBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;IAClB,CAAA,CACL;OACJ,CACE;;CACF,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostureOptions.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/PostureOptions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PostureOptions.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/PostureOptions.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,iFAAiF;IACjF,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAED,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,mBAAmB,+BAqB7E"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { useFormatters as t } from "../hooks/useFormatters.js";
|
|
3
|
+
import { isPostureSelectable as n, useAutonomousAgentMode as r } from "../hooks/useAutonomousAgentMode.js";
|
|
4
4
|
import { Fragment as i, jsx as a } from "react/jsx-runtime";
|
|
5
5
|
//#region src/subscriberbot/components/PostureOptions.tsx
|
|
6
6
|
function o({ options: o, currentStatus: s }) {
|
|
7
|
-
let c =
|
|
8
|
-
return /* @__PURE__ */ a(i, { children: o.map((
|
|
9
|
-
let
|
|
7
|
+
let { formatEnumLabel: c } = t(), l = e(), u = r();
|
|
8
|
+
return /* @__PURE__ */ a(i, { children: o.map((e) => {
|
|
9
|
+
let t = l(`agents.postures.${e.toLowerCase()}`, c(e)), r = n(e, u, s);
|
|
10
10
|
return /* @__PURE__ */ a("option", {
|
|
11
|
-
value:
|
|
12
|
-
disabled: !
|
|
13
|
-
children:
|
|
14
|
-
},
|
|
11
|
+
value: e,
|
|
12
|
+
disabled: !r,
|
|
13
|
+
children: r ? t : l("agents.postures.unavailable", "{{label}} (not yet available)", { label: t })
|
|
14
|
+
}, e);
|
|
15
15
|
}) });
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostureOptions.js","names":[],"sources":["../../../src/subscriberbot/components/PostureOptions.tsx"],"sourcesContent":["/**\n * PostureOptions — `<option>` list for editable agent-posture selects.\n * @module subscriberbot/components\n *\n * Renders every posture, but disables AUTONOMOUS (and labels it as not yet\n * available) while the fail-closed `subscriberbot.agents.autonomous` gate is\n * shut. Filter controls that only narrow a list should keep rendering plain\n * options; this component is for controls that write a posture.\n */\n\nimport { isPostureSelectable, useAutonomousAgentMode } from '../hooks/useAutonomousAgentMode';\nimport { useTr } from '../hooks/useTr';\nimport
|
|
1
|
+
{"version":3,"file":"PostureOptions.js","names":[],"sources":["../../../src/subscriberbot/components/PostureOptions.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * PostureOptions — `<option>` list for editable agent-posture selects.\n * @module subscriberbot/components\n *\n * Renders every posture, but disables AUTONOMOUS (and labels it as not yet\n * available) while the fail-closed `subscriberbot.agents.autonomous` gate is\n * shut. Filter controls that only narrow a list should keep rendering plain\n * options; this component is for controls that write a posture.\n */\n\nimport { isPostureSelectable, useAutonomousAgentMode } from '../hooks/useAutonomousAgentMode';\nimport { useTr } from '../hooks/useTr';\n\nimport type { SubAgentStatus } from '../types';\n\nexport interface PostureOptionsProps {\n /** Postures to render, in display order. */\n options: readonly SubAgentStatus[];\n /** The record's current posture, if any (keeps an existing value selectable). */\n currentStatus?: SubAgentStatus;\n}\n\nexport function PostureOptions({ options, currentStatus }: PostureOptionsProps) {\n const { formatEnumLabel } = useFormatters();\n\n const tr = useTr();\n const autonomousAvailable = useAutonomousAgentMode();\n\n return (\n <>\n {options.map((s) => {\n const label = tr(`agents.postures.${s.toLowerCase()}`, formatEnumLabel(s));\n const selectable = isPostureSelectable(s, autonomousAvailable, currentStatus);\n return (\n <option key={s} value={s} disabled={!selectable}>\n {selectable\n ? label\n : tr('agents.postures.unavailable', '{{label}} (not yet available)', { label })}\n </option>\n );\n })}\n </>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAgB,EAAe,EAAE,YAAS,oBAAsC;CAC9E,IAAM,EAAE,uBAAoB,EAAc,GAEpC,IAAK,EAAM,GACX,IAAsB,EAAuB;CAEnD,OACE,kBAAA,GAAA,EAAA,UACG,EAAQ,KAAK,MAAM;EAClB,IAAM,IAAQ,EAAG,mBAAmB,EAAE,YAAY,KAAK,EAAgB,CAAC,CAAC,GACnE,IAAa,EAAoB,GAAG,GAAqB,CAAa;EAC5E,OACE,kBAAC,UAAD;GAAgB,OAAO;GAAG,UAAU,CAAC;aAClC,IACG,IACA,EAAG,+BAA+B,iCAAiC,EAAE,SAAM,CAAC;EAC1E,GAJK,CAIL;CAEZ,CAAC,EACD,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateViews.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StateViews.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StateViews.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StateViews.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM3C,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAQ5C,CAAC;AAEF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA4BxC,CAAC;AAEF,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAWpC,CAAC"}
|
|
@@ -1,49 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { cn as t } from "../utils/cn.js";
|
|
3
|
+
import { AlertCircle as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { Spinner as a } from "@burdenoff/fe-libs/ui";
|
|
5
6
|
//#region src/subscriberbot/components/StateViews.tsx
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
className: "
|
|
10
|
-
children:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
7
|
+
var o = ({ label: n, className: o }) => {
|
|
8
|
+
let s = e();
|
|
9
|
+
return /* @__PURE__ */ i("div", {
|
|
10
|
+
className: t("flex min-h-[40vh] flex-col items-center justify-center gap-3", o),
|
|
11
|
+
children: [/* @__PURE__ */ r(a, { size: "lg" }), /* @__PURE__ */ r("p", {
|
|
12
|
+
className: "text-sm text-text-secondary",
|
|
13
|
+
children: n ?? s("common.loading", "Loading…")
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}, s = ({ title: a, message: o, onRetry: s, className: c }) => {
|
|
17
|
+
let l = e();
|
|
18
|
+
return /* @__PURE__ */ i("div", {
|
|
19
|
+
role: "alert",
|
|
20
|
+
className: t("flex min-h-[40vh] flex-col items-center justify-center gap-4 text-center", c),
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ r(n, { className: "h-10 w-10 text-status-error-text" }),
|
|
23
|
+
/* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("h2", {
|
|
24
|
+
className: "text-lg font-semibold text-text-primary",
|
|
25
|
+
children: a ?? l("common.somethingWentWrong", "Something went wrong")
|
|
26
|
+
}), o && /* @__PURE__ */ r("p", {
|
|
27
|
+
className: "mt-1 max-w-md text-sm text-text-secondary",
|
|
28
|
+
children: o
|
|
29
|
+
})] }),
|
|
30
|
+
s && /* @__PURE__ */ r("button", {
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: s,
|
|
33
|
+
className: "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90",
|
|
34
|
+
children: l("common.retry", "Retry")
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}, c = ({ title: e, description: n, action: a, children: o, className: s }) => /* @__PURE__ */ i("section", {
|
|
39
|
+
className: t("mt-8 first:mt-0", s),
|
|
40
|
+
children: [/* @__PURE__ */ i("div", {
|
|
33
41
|
className: "mb-3 flex items-end justify-between gap-3",
|
|
34
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r("h2", {
|
|
35
43
|
className: "text-base font-semibold text-text-primary",
|
|
36
|
-
children:
|
|
37
|
-
}),
|
|
44
|
+
children: e
|
|
45
|
+
}), n && /* @__PURE__ */ r("p", {
|
|
38
46
|
className: "mt-0.5 text-sm text-text-secondary",
|
|
39
|
-
children:
|
|
40
|
-
})] }), a && /* @__PURE__ */
|
|
47
|
+
children: n
|
|
48
|
+
})] }), a && /* @__PURE__ */ r("div", {
|
|
41
49
|
className: "shrink-0",
|
|
42
50
|
children: a
|
|
43
51
|
})]
|
|
44
52
|
}), o]
|
|
45
53
|
});
|
|
46
54
|
//#endregion
|
|
47
|
-
export {
|
|
55
|
+
export { s as ErrorView, o as LoadingView, c as Section };
|
|
48
56
|
|
|
49
57
|
//# sourceMappingURL=StateViews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateViews.js","names":[],"sources":["../../../src/subscriberbot/components/StateViews.tsx"],"sourcesContent":["/**\n * Shared loading / error state views\n * @module subscriberbot/components\n *\n * Small reusable building blocks so every page renders consistent\n * loading / error / empty states without re-implementing them.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface LoadingViewProps {\n label?: string;\n className?: string;\n}\n\nexport const LoadingView: FC<LoadingViewProps> = ({ label
|
|
1
|
+
{"version":3,"file":"StateViews.js","names":[],"sources":["../../../src/subscriberbot/components/StateViews.tsx"],"sourcesContent":["/**\n * Shared loading / error state views\n * @module subscriberbot/components\n *\n * Small reusable building blocks so every page renders consistent\n * loading / error / empty states without re-implementing them.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../hooks/useTr';\nimport { cn } from '../utils/cn';\n\ninterface LoadingViewProps {\n label?: string;\n className?: string;\n}\n\nexport const LoadingView: FC<LoadingViewProps> = ({ label, className }) => {\n const tr = useTr();\n return (\n <div className={cn('flex min-h-[40vh] flex-col items-center justify-center gap-3', className)}>\n <Spinner size=\"lg\" />\n <p className=\"text-sm text-text-secondary\">{label ?? tr('common.loading', 'Loading…')}</p>\n </div>\n );\n};\n\ninterface ErrorViewProps {\n title?: string;\n message?: string;\n onRetry?: () => void;\n className?: string;\n}\n\nexport const ErrorView: FC<ErrorViewProps> = ({ title, message, onRetry, className }) => {\n const tr = useTr();\n return (\n <div\n role=\"alert\"\n className={cn(\n 'flex min-h-[40vh] flex-col items-center justify-center gap-4 text-center',\n className\n )}\n >\n <AlertCircle className=\"h-10 w-10 text-status-error-text\" />\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {title ?? tr('common.somethingWentWrong', 'Something went wrong')}\n </h2>\n {message && <p className=\"mt-1 max-w-md text-sm text-text-secondary\">{message}</p>}\n </div>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90\"\n >\n {tr('common.retry', 'Retry')}\n </button>\n )}\n </div>\n );\n};\n\ninterface SectionProps {\n title: string;\n description?: string;\n action?: ReactNode;\n children: ReactNode;\n className?: string;\n}\n\nexport const Section: FC<SectionProps> = ({ title, description, action, children, className }) => (\n <section className={cn('mt-8 first:mt-0', className)}>\n <div className=\"mb-3 flex items-end justify-between gap-3\">\n <div>\n <h2 className=\"text-base font-semibold text-text-primary\">{title}</h2>\n {description && <p className=\"mt-0.5 text-sm text-text-secondary\">{description}</p>}\n </div>\n {action && <div className=\"shrink-0\">{action}</div>}\n </div>\n {children}\n </section>\n);\n"],"mappings":";;;;;;AAmBA,IAAa,KAAqC,EAAE,UAAO,mBAAgB;CACzE,IAAM,IAAK,EAAM;CACjB,OACE,kBAAC,OAAD;EAAK,WAAW,EAAG,gEAAgE,CAAS;YAA5F,CACE,kBAAC,GAAD,EAAS,MAAK,KAAM,CAAA,GACpB,kBAAC,KAAD;GAAG,WAAU;aAA+B,KAAS,EAAG,kBAAkB,UAAU;EAAK,CAAA,CACtF;;AAET,GASa,KAAiC,EAAE,UAAO,YAAS,YAAS,mBAAgB;CACvF,IAAM,IAAK,EAAM;CACjB,OACE,kBAAC,OAAD;EACE,MAAK;EACL,WAAW,EACT,4EACA,CACF;YALF;GAOE,kBAAC,GAAD,EAAa,WAAU,mCAAoC,CAAA;GAC3D,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;cACX,KAAS,EAAG,6BAA6B,sBAAsB;GAC9D,CAAA,GACH,KAAW,kBAAC,KAAD;IAAG,WAAU;cAA6C;GAAW,CAAA,CAC9E,EAAA,CAAA;GACJ,KACC,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,WAAU;cAET,EAAG,gBAAgB,OAAO;GACrB,CAAA;EAEP;;AAET,GAUa,KAA6B,EAAE,UAAO,gBAAa,WAAQ,aAAU,mBAChF,kBAAC,WAAD;CAAS,WAAW,EAAG,mBAAmB,CAAS;WAAnD,CACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;aAA6C;EAAU,CAAA,GACpE,KAAe,kBAAC,KAAD;GAAG,WAAU;aAAsC;EAAe,CAAA,CAC/E,EAAA,CAAA,GACJ,KAAU,kBAAC,OAAD;GAAK,WAAU;aAAY;EAAY,CAAA,CAC/C;KACJ,CACM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAyED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAwB5C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useFormatters as e } from "../hooks/useFormatters.js";
|
|
2
|
+
import { cn as t } from "../utils/cn.js";
|
|
3
3
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/subscriberbot/components/StatusBadge.tsx
|
|
5
5
|
var i = {
|
|
@@ -52,13 +52,13 @@ var i = {
|
|
|
52
52
|
STALE: "secondary",
|
|
53
53
|
FLAGGED: "warning"
|
|
54
54
|
}, s = ({ status: s, className: c }) => {
|
|
55
|
-
let l = s.toUpperCase(),
|
|
55
|
+
let { formatEnumLabel: l } = e(), u = s.toUpperCase(), d = o[u] ?? "secondary", f = a.has(u);
|
|
56
56
|
return /* @__PURE__ */ r("span", {
|
|
57
|
-
className:
|
|
58
|
-
children: [
|
|
57
|
+
className: t("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium", i[d], c),
|
|
58
|
+
children: [f && /* @__PURE__ */ n("span", {
|
|
59
59
|
"aria-hidden": "true",
|
|
60
60
|
className: "size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse"
|
|
61
|
-
}),
|
|
61
|
+
}), l(s)]
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
64
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module subscriberbot/components\n *\n * A colored badge for Subscriber Bot domain statuses (relationship lifecycle,\n * invoice status, agent posture, channel verification, provider status,\n * workflow state) with semantic color mapping. Accepts the raw server enum\n * value (e.g. \"ACTIVE\", \"PAST_DUE\", \"SUGGEST_ONLY\").\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/subscriberbot/components/StatusBadge.tsx"],"sourcesContent":["import { useFormatters } from '../hooks/useFormatters';\n/**\n * Status Badge Component\n * @module subscriberbot/components\n *\n * A colored badge for Subscriber Bot domain statuses (relationship lifecycle,\n * invoice status, agent posture, channel verification, provider status,\n * workflow state) with semantic color mapping. Accepts the raw server enum\n * value (e.g. \"ACTIVE\", \"PAST_DUE\", \"SUGGEST_ONLY\").\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['ACTIVE', 'AUTONOMOUS', 'TRIAL', 'EXPIRING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Relationship lifecycle\n ACTIVE: 'success',\n TRIAL: 'info',\n PAUSED: 'warning',\n PAST_DUE: 'destructive',\n LAPSED: 'warning',\n EXPIRED: 'secondary',\n CANCELLED: 'destructive',\n\n // Invoice status\n DRAFT: 'secondary',\n ISSUED: 'info',\n PAID: 'success',\n OVERDUE: 'destructive',\n FAILED: 'destructive',\n REFUNDED: 'outline',\n\n // Bank connections (BOFF-4161)\n NEEDS_REAUTH: 'warning',\n ERROR: 'destructive',\n DISCONNECTED: 'secondary',\n\n // Agent posture\n AUTONOMOUS: 'success',\n SUGGEST_ONLY: 'info',\n DISABLED: 'secondary',\n\n // Channel verification / payment instrument\n VERIFIED: 'success',\n PENDING: 'warning',\n EXPIRING: 'warning',\n REMOVED: 'outline',\n\n // Provider status\n CLAIMED: 'success',\n UNVERIFIED: 'secondary',\n DEPRECATED: 'outline',\n\n // Workflow status\n ARCHIVED: 'outline',\n\n // Adapter submission / marketplace report moderation status\n APPROVED: 'success',\n REJECTED: 'destructive',\n DISMISSED: 'outline',\n RESOLVED: 'success',\n\n // AI decision status (DISMISSED shared with moderation above)\n PROPOSED: 'info',\n APPLYING: 'warning',\n APPLIED: 'success',\n STALE: 'secondary',\n FLAGGED: 'warning',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const { formatEnumLabel } = useFormatters();\n\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;AACX,GAIM,IAAe,IAAI,IAAI;CAAC;CAAU;CAAc;CAAS;AAAU,CAAC,GAEpE,IAAiD;CAErD,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,SAAS;CACT,WAAW;CAGX,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CAGV,cAAc;CACd,OAAO;CACP,cAAc;CAGd,YAAY;CACZ,cAAc;CACd,UAAU;CAGV,UAAU;CACV,SAAS;CACT,UAAU;CACV,SAAS;CAGT,SAAS;CACT,YAAY;CACZ,YAAY;CAGZ,UAAU;CAGV,UAAU;CACV,UAAU;CACV,WAAW;CACX,UAAU;CAGV,UAAU;CACV,UAAU;CACV,SAAS;CACT,OAAO;CACP,SAAS;AACX,GAEa,KAAqC,EAAE,WAAQ,mBAAgB;CAC1E,IAAM,EAAE,uBAAoB,EAAc,GAEpC,IAAM,EAAO,YAAY,GACzB,IAAU,EAAiB,MAAQ,aACnC,IAAS,EAAa,IAAI,CAAG;CAEnC,OACE,kBAAC,QAAD;EACE,WAAW,EACT,mFACA,EAAc,IACd,CACF;YALF,CAOG,KACC,kBAAC,QAAD;GACE,eAAY;GACZ,WAAU;EACX,CAAA,GAEF,EAAgB,CAAM,CACnB;;AAEV"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useSubscriberBot as e } from "../../context/SubscriberBotContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
|
+
import { cn as n } from "../../utils/cn.js";
|
|
4
4
|
import { AlertTriangle as r, Info as i } from "lucide-react";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
6
|
//#region src/subscriberbot/components/decisions/DecisionBanners.tsx
|
|
7
7
|
var s = ({ className: e }) => {
|
|
8
|
-
let r =
|
|
8
|
+
let r = t();
|
|
9
9
|
return /* @__PURE__ */ o("div", {
|
|
10
10
|
role: "note",
|
|
11
11
|
"data-testid": "ai-disclaimer",
|
|
12
|
-
className:
|
|
12
|
+
className: n("flex items-start gap-2.5 rounded-lg border border-border-subtle bg-bg-sunken px-4 py-2.5 text-xs text-text-secondary", e),
|
|
13
13
|
children: [/* @__PURE__ */ a(i, {
|
|
14
14
|
className: "mt-0.5 h-4 w-4 shrink-0 text-text-secondary",
|
|
15
15
|
"aria-hidden": !0
|
|
@@ -23,11 +23,11 @@ var s = ({ className: e }) => {
|
|
|
23
23
|
] })]
|
|
24
24
|
});
|
|
25
25
|
}, c = ({ message: i, onRetry: s, className: c }) => {
|
|
26
|
-
let l =
|
|
26
|
+
let l = t(), { navigateTo: u } = e();
|
|
27
27
|
return /* @__PURE__ */ o("div", {
|
|
28
28
|
role: "status",
|
|
29
29
|
"data-testid": "decisions-unavailable",
|
|
30
|
-
className:
|
|
30
|
+
className: n("flex flex-col gap-3 rounded-lg border border-status-warning-text/30 bg-status-warning-bg-subtle px-4 py-3 text-sm text-status-warning-text sm:flex-row sm:items-center sm:justify-between", c),
|
|
31
31
|
children: [/* @__PURE__ */ o("div", {
|
|
32
32
|
className: "flex items-start gap-2.5",
|
|
33
33
|
children: [/* @__PURE__ */ a(r, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionCard.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/decisions/DecisionCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DecisionCard.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/components/decisions/DecisionCard.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAU1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA+B/C,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC;IACnC,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC;CAC7C,CA6GA,CAAC;AAMF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA+EpF,CAAC;AAMF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA6CzE,CAAC;AAMF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAC5B,QAAQ,EAAE,WAAW,CAAC;IACtB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAsHA,CAAC"}
|