@burdenoff/microfe-subscriberbot 2026.1107.8 → 2026.1110.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/node_modules/clsx/dist/clsx.js +8 -7
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +134 -151
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoot.js +10 -7
- package/dist/subscriberbot/SubscriberBotRoot.js.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.js +1 -2
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.js +9 -10
- package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
- package/dist/subscriberbot/admin/AdminRoot.js +2 -3
- package/dist/subscriberbot/admin/AdminRoot.js.map +1 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js +56 -57
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js +107 -108
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
- package/dist/subscriberbot/admin/index.js +1 -1
- package/dist/subscriberbot/components/EmptyState.js +1 -2
- package/dist/subscriberbot/components/EmptyState.js.map +1 -1
- package/dist/subscriberbot/components/MetricsCard.js +1 -2
- package/dist/subscriberbot/components/MetricsCard.js.map +1 -1
- package/dist/subscriberbot/components/Modal.js +2 -3
- package/dist/subscriberbot/components/Modal.js.map +1 -1
- package/dist/subscriberbot/components/PageLayout.js +1 -2
- package/dist/subscriberbot/components/PageLayout.js.map +1 -1
- package/dist/subscriberbot/components/PostureOptions.js +7 -8
- package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
- package/dist/subscriberbot/components/StateViews.js +1 -2
- package/dist/subscriberbot/components/StateViews.js.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.js +2 -3
- package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionBanners.js +7 -8
- package/dist/subscriberbot/components/decisions/DecisionBanners.js.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionCard.js +65 -66
- package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
- package/dist/subscriberbot/components/decisions/decisionModel.js +2 -3
- package/dist/subscriberbot/components/decisions/decisionModel.js.map +1 -1
- package/dist/subscriberbot/components/decisions/index.js +4 -3
- package/dist/subscriberbot/components/index.js +8 -7
- package/dist/subscriberbot/components/mobile/MobileDashboard.js +23 -24
- package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +40 -49
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.js +1 -2
- package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.js +1 -2
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.js.map +1 -1
- package/dist/subscriberbot/components/mobile/index.js +4 -3
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +1 -2
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +4 -5
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js +4 -5
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/index.js +5 -4
- package/dist/subscriberbot/components/negotiations/labels.js +1 -2
- package/dist/subscriberbot/components/negotiations/labels.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +4 -5
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +1 -2
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementThread.js +4 -5
- package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
- package/dist/subscriberbot/components/procurement/index.js +5 -4
- package/dist/subscriberbot/components/procurement/labels.js +1 -2
- package/dist/subscriberbot/components/procurement/labels.js.map +1 -1
- package/dist/subscriberbot/components/savings/SavingsCards.js +90 -91
- package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
- package/dist/subscriberbot/components/savings/index.js +3 -2
- package/dist/subscriberbot/components/savings/savingsModel.js +2 -3
- package/dist/subscriberbot/components/savings/savingsModel.js.map +1 -1
- package/dist/subscriberbot/components/viz.js +2 -3
- package/dist/subscriberbot/components/viz.js.map +1 -1
- package/dist/subscriberbot/context/SubscriberBotContext.js +3 -3
- package/dist/subscriberbot/context/SubscriberBotContext.js.map +1 -1
- package/dist/subscriberbot/context/index.js +1 -1
- package/dist/subscriberbot/hooks/index.js +2 -2
- package/dist/subscriberbot/hooks/useAutonomousAgentMode.js +2 -3
- package/dist/subscriberbot/hooks/useAutonomousAgentMode.js.map +1 -1
- package/dist/subscriberbot/hooks/useBankingApi.js +2 -3
- package/dist/subscriberbot/hooks/useBankingApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useCompactViewport.js +1 -2
- package/dist/subscriberbot/hooks/useCompactViewport.js.map +1 -1
- package/dist/subscriberbot/hooks/useFormError.js +1 -2
- package/dist/subscriberbot/hooks/useFormError.js.map +1 -1
- package/dist/subscriberbot/hooks/useFormatters.js +1 -2
- package/dist/subscriberbot/hooks/useFormatters.js.map +1 -1
- package/dist/subscriberbot/hooks/useNegotiationApi.js +2 -3
- package/dist/subscriberbot/hooks/useNegotiationApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useProcurementApi.js +2 -3
- package/dist/subscriberbot/hooks/useProcurementApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useRouteSelection.js +3 -3
- package/dist/subscriberbot/hooks/useRouteSelection.js.map +1 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js +1 -2
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useTr.js +1 -2
- package/dist/subscriberbot/hooks/useTr.js.map +1 -1
- package/dist/subscriberbot/index.js +9 -8
- package/dist/subscriberbot/pages/AssetVaultPage.js +34 -35
- package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.js +86 -87
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.js +194 -199
- package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.js +28 -29
- package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
- package/dist/subscriberbot/pages/InvoicesPage.js +179 -188
- package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.js +293 -298
- package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
- package/dist/subscriberbot/pages/SavingsPage.js +25 -26
- package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.js +67 -68
- package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js +126 -127
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.js +10 -11
- package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.js +23 -24
- package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +337 -359
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/ConnectBankModal.js +22 -27
- package/dist/subscriberbot/pages/banking/ConnectBankModal.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +25 -26
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js +34 -35
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +125 -130
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +94 -95
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +15 -16
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +20 -21
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +86 -87
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +164 -165
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js +20 -21
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +350 -351
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderInsights.js +95 -96
- package/dist/subscriberbot/pages/providers/ProviderInsights.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js +11 -12
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js +62 -63
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +166 -172
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +12 -13
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +21 -22
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +242 -255
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +2 -3
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
- package/dist/subscriberbot/services/createSandboxAssistantTransport.js +1 -2
- package/dist/subscriberbot/services/createSandboxAssistantTransport.js.map +1 -1
- package/dist/subscriberbot/store/index.js +1 -1
- package/dist/subscriberbot/store/subscriberbotStore.js +1 -2
- package/dist/subscriberbot/store/subscriberbotStore.js.map +1 -1
- package/dist/subscriberbot/utils/bankRedirectLink.js +18 -19
- package/dist/subscriberbot/utils/bankRedirectLink.js.map +1 -1
- package/dist/subscriberbot/utils/chartScale.js +1 -2
- package/dist/subscriberbot/utils/chartScale.js.map +1 -1
- package/dist/subscriberbot/utils/cn.js +2 -3
- package/dist/subscriberbot/utils/cn.js.map +1 -1
- package/dist/subscriberbot/utils/formatters.js +4 -5
- package/dist/subscriberbot/utils/formatters.js.map +1 -1
- package/dist/subscriberbot/utils/navigation.js +1 -2
- package/dist/subscriberbot/utils/navigation.js.map +1 -1
- package/dist/subscriberbot/utils/pageContext.js +3 -4
- package/dist/subscriberbot/utils/pageContext.js.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.js +21 -22
- package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
- package/dist/subscriberbot/utils/portfolio.js +5 -6
- package/dist/subscriberbot/utils/portfolio.js.map +1 -1
- package/dist/subscriberbot/utils/renewals.js +1 -2
- package/dist/subscriberbot/utils/renewals.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipGlyph.js","names":[],"sources":["../../../../src/subscriberbot/components/mobile/RelationshipGlyph.tsx"],"sourcesContent":["/**\n * Relationship glyph — the square icon tile on mobile renewal and list cards.\n * @module subscriberbot/components/mobile\n */\n\nimport type { FC } from 'react';\nimport {\n BadgeCheck,\n CreditCard,\n FileSignature,\n GraduationCap,\n Hourglass,\n KeyRound,\n Newspaper,\n Repeat2,\n type LucideIcon,\n} from 'lucide-react';\nimport type { SubRelationshipKind } from '../../types';\nimport { cn } from '../../utils/cn';\n\nconst KIND_ICON: Record<SubRelationshipKind, LucideIcon> = {\n SUBSCRIPTION: Repeat2,\n MEMBERSHIP: BadgeCheck,\n LICENSE: KeyRound,\n CONTRACT: FileSignature,\n NEWSLETTER: Newspaper,\n RECURRING_PAYMENT: CreditCard,\n ENROLLMENT: GraduationCap,\n TRIAL: Hourglass,\n};\n\ninterface RelationshipGlyphProps {\n kind: SubRelationshipKind | null;\n className?: string;\n}\n\nexport const RelationshipGlyph: FC<RelationshipGlyphProps> = ({ kind, className }) => {\n const Icon = (kind && KIND_ICON[kind]) || Repeat2;\n return (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'flex size-12 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary',\n className\n )}\n >\n <Icon className=\"h-6 w-6\" />\n </span>\n );\n};\n"],"mappings":";;;;AAoBA,
|
|
1
|
+
{"version":3,"file":"RelationshipGlyph.js","names":["KIND_ICON","Repeat2","BadgeCheck","KeyRound","FileSignature","Newspaper","CreditCard","GraduationCap","Hourglass","RelationshipGlyph","Icon","kind","cn","className"],"sources":["../../../../src/subscriberbot/components/mobile/RelationshipGlyph.tsx"],"sourcesContent":["/**\n * Relationship glyph — the square icon tile on mobile renewal and list cards.\n * @module subscriberbot/components/mobile\n */\n\nimport type { FC } from 'react';\nimport {\n BadgeCheck,\n CreditCard,\n FileSignature,\n GraduationCap,\n Hourglass,\n KeyRound,\n Newspaper,\n Repeat2,\n type LucideIcon,\n} from 'lucide-react';\nimport type { SubRelationshipKind } from '../../types';\nimport { cn } from '../../utils/cn';\n\nconst KIND_ICON: Record<SubRelationshipKind, LucideIcon> = {\n SUBSCRIPTION: Repeat2,\n MEMBERSHIP: BadgeCheck,\n LICENSE: KeyRound,\n CONTRACT: FileSignature,\n NEWSLETTER: Newspaper,\n RECURRING_PAYMENT: CreditCard,\n ENROLLMENT: GraduationCap,\n TRIAL: Hourglass,\n};\n\ninterface RelationshipGlyphProps {\n kind: SubRelationshipKind | null;\n className?: string;\n}\n\nexport const RelationshipGlyph: FC<RelationshipGlyphProps> = ({ kind, className }) => {\n const Icon = (kind && KIND_ICON[kind]) || Repeat2;\n return (\n <span\n aria-hidden=\"true\"\n className={cn(\n 'flex size-12 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary',\n className\n )}\n >\n <Icon className=\"h-6 w-6\" />\n </span>\n );\n};\n"],"mappings":";;;;AAoBA,IAAMA,IAAqD;CACzD,cAAcC;CACd,YAAYC;CACZ,SAASC;CACT,UAAUC;CACV,YAAYC;CACZ,mBAAmBC;CACnB,YAAYC;CACZ,OAAOC;AACT,GAOaC,KAAiD,EAAE,SAAM,mBAAgB;CACpF,IAAMC,IAAQC,KAAQX,EAAUW,MAAUV;CAC1C,OACE,kBAAC,QAAD;EACE,eAAY;EACZ,WAAWW,EACT,iGACAC,CACF;EAEA,UAAA,kBAACH,GAAD,EAAM,WAAU,UAAW,CAAA;CACvB,CAAA;AAEV"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./MobileScreen.js";
|
|
1
|
+
import { MobileScreen as e } from "./MobileScreen.js";
|
|
2
|
+
import { MobileDashboard as t } from "./MobileDashboard.js";
|
|
3
|
+
import { MobileRelationshipList as n } from "./MobileRelationshipList.js";
|
|
2
4
|
import "./RelationshipGlyph.js";
|
|
3
|
-
|
|
4
|
-
import "./MobileRelationshipList.js";
|
|
5
|
+
export { t as MobileDashboard, n as MobileRelationshipList, e as MobileScreen };
|
|
@@ -2,7 +2,7 @@ import { useTr as e } from "../../hooks/useTr.js";
|
|
|
2
2
|
import { cn as t } from "../../utils/cn.js";
|
|
3
3
|
import { STATUS_LABEL as n, statusTone as r } from "./labels.js";
|
|
4
4
|
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/subscriberbot/components/negotiations/NegotiationStatusPill.tsx
|
|
6
6
|
var a = ({ status: a, className: o }) => {
|
|
7
7
|
let s = e(), c = n[a];
|
|
8
8
|
return /* @__PURE__ */ i("span", {
|
|
@@ -12,7 +12,6 @@ var a = ({ status: a, className: o }) => {
|
|
|
12
12
|
children: s(c.key, c.fallback)
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { a as NegotiationStatusPill };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=NegotiationStatusPill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NegotiationStatusPill.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/NegotiationStatusPill.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport type { SubNegotiationStatus } from '../../types/negotiation';\nimport { STATUS_LABEL, statusTone } from './labels';\n\nexport const NegotiationStatusPill: FC<{ status: SubNegotiationStatus; className?: string }> = ({\n status,\n className,\n}) => {\n const tr = useTr();\n const label = STATUS_LABEL[status];\n return (\n <span\n data-testid=\"negotiation-status\"\n data-status={status}\n className={cn(\n 'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium',\n statusTone(status),\n className\n )}\n >\n {tr(label.key, label.fallback)}\n </span>\n );\n};\n"],"mappings":";;;;;AAMA,
|
|
1
|
+
{"version":3,"file":"NegotiationStatusPill.js","names":["NegotiationStatusPill","tr","useTr","label","STATUS_LABEL","status","cn","statusTone","className"],"sources":["../../../../src/subscriberbot/components/negotiations/NegotiationStatusPill.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport type { SubNegotiationStatus } from '../../types/negotiation';\nimport { STATUS_LABEL, statusTone } from './labels';\n\nexport const NegotiationStatusPill: FC<{ status: SubNegotiationStatus; className?: string }> = ({\n status,\n className,\n}) => {\n const tr = useTr();\n const label = STATUS_LABEL[status];\n return (\n <span\n data-testid=\"negotiation-status\"\n data-status={status}\n className={cn(\n 'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium',\n statusTone(status),\n className\n )}\n >\n {tr(label.key, label.fallback)}\n </span>\n );\n};\n"],"mappings":";;;;;AAMA,IAAaA,KAAmF,EAC9F,WACA,mBACI;CACJ,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAaC;CAC3B,OACE,kBAAC,QAAD;EACE,eAAY;EACZ,eAAaA;EACb,WAAWC,EACT,2EACAC,EAAWF,CAAM,GACjBG,CACF;EAEC,UAAAP,EAAGE,EAAM,KAAKA,EAAM,QAAQ;CACzB,CAAA;AAEV"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useFormatters as e } from "../../hooks/useFormatters.js";
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
3
|
import { EVENT_LABEL as n, STATUS_LABEL as r } from "./labels.js";
|
|
4
4
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/subscriberbot/components/negotiations/NegotiationTimeline.tsx
|
|
6
6
|
var o = {
|
|
7
7
|
customer: {
|
|
8
8
|
key: "negotiations.role.customer",
|
|
@@ -17,7 +17,7 @@ var o = {
|
|
|
17
17
|
fallback: "Subscriber Bot"
|
|
18
18
|
}
|
|
19
19
|
}, s = ({ events: s, customerLabel: c }) => {
|
|
20
|
-
let { formatDateTime: l } =
|
|
20
|
+
let { formatDateTime: l } = e(), u = t();
|
|
21
21
|
return s.length === 0 ? null : /* @__PURE__ */ i("ol", {
|
|
22
22
|
className: "space-y-3",
|
|
23
23
|
"data-testid": "negotiation-timeline",
|
|
@@ -43,7 +43,6 @@ var o = {
|
|
|
43
43
|
})
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { s as NegotiationTimeline };
|
|
48
47
|
|
|
49
48
|
//# sourceMappingURL=NegotiationTimeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NegotiationTimeline.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/NegotiationTimeline.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type { SubNegotiationEvent } from '../../types/negotiation';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'negotiations.role.customer', fallback: 'You' },\n negotiator: { key: 'negotiations.role.negotiator', fallback: 'Negotiation desk' },\n system: { key: 'negotiations.role.system', fallback: 'Subscriber Bot' },\n};\n\nexport const NegotiationTimeline: FC<{ events: SubNegotiationEvent[]; customerLabel?: string }> = ({\n events,\n customerLabel,\n}) => {\n const { formatDateTime } = useFormatters();\n\n const tr = useTr();\n if (events.length === 0) return null;\n return (\n <ol className=\"space-y-3\" data-testid=\"negotiation-timeline\">\n {events.map((event) => {\n const role = ROLE_LABEL[event.actorRole] ?? ROLE_LABEL.system!;\n const who =\n event.actorRole === 'customer' && customerLabel\n ? customerLabel\n : tr(role.key, role.fallback);\n const label = EVENT_LABEL[event.kind];\n const to = event.toStatus ? STATUS_LABEL[event.toStatus] : null;\n return (\n <li key={event.id} className=\"rounded-lg border border-border-subtle bg-bg-surface p-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {tr(label.key, label.fallback)}\n {to && event.kind !== 'CREATED' ? ` → ${tr(to.key, to.fallback)}` : ''}\n </span>\n <span>\n {who} · {formatDateTime(event.createdAt)}\n </span>\n </div>\n {event.message && (\n <p className=\"mt-1.5 whitespace-pre-wrap text-sm text-text-primary\">\n {event.message}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n"],"mappings":";;;;;AAOA,
|
|
1
|
+
{"version":3,"file":"NegotiationTimeline.js","names":["ROLE_LABEL","NegotiationTimeline","useFormatters","tr","useTr","events","role","event","who","customerLabel","label","EVENT_LABEL","to","STATUS_LABEL","formatDateTime"],"sources":["../../../../src/subscriberbot/components/negotiations/NegotiationTimeline.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type { SubNegotiationEvent } from '../../types/negotiation';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'negotiations.role.customer', fallback: 'You' },\n negotiator: { key: 'negotiations.role.negotiator', fallback: 'Negotiation desk' },\n system: { key: 'negotiations.role.system', fallback: 'Subscriber Bot' },\n};\n\nexport const NegotiationTimeline: FC<{ events: SubNegotiationEvent[]; customerLabel?: string }> = ({\n events,\n customerLabel,\n}) => {\n const { formatDateTime } = useFormatters();\n\n const tr = useTr();\n if (events.length === 0) return null;\n return (\n <ol className=\"space-y-3\" data-testid=\"negotiation-timeline\">\n {events.map((event) => {\n const role = ROLE_LABEL[event.actorRole] ?? ROLE_LABEL.system!;\n const who =\n event.actorRole === 'customer' && customerLabel\n ? customerLabel\n : tr(role.key, role.fallback);\n const label = EVENT_LABEL[event.kind];\n const to = event.toStatus ? STATUS_LABEL[event.toStatus] : null;\n return (\n <li key={event.id} className=\"rounded-lg border border-border-subtle bg-bg-surface p-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {tr(label.key, label.fallback)}\n {to && event.kind !== 'CREATED' ? ` → ${tr(to.key, to.fallback)}` : ''}\n </span>\n <span>\n {who} · {formatDateTime(event.createdAt)}\n </span>\n </div>\n {event.message && (\n <p className=\"mt-1.5 whitespace-pre-wrap text-sm text-text-primary\">\n {event.message}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n"],"mappings":";;;;;AAOA,IAAMA,IAAgE;CACpE,UAAU;EAAE,KAAK;EAA8B,UAAU;CAAM;CAC/D,YAAY;EAAE,KAAK;EAAgC,UAAU;CAAmB;CAChF,QAAQ;EAAE,KAAK;EAA4B,UAAU;CAAiB;AACxE,GAEaC,KAAsF,EACjG,WACA,uBACI;CACJ,IAAM,EAAE,sBAAmBC,EAAc,GAEnCC,IAAKC,EAAM;CAEjB,OADIC,EAAO,WAAW,IAAU,OAE9B,kBAAC,MAAD;EAAI,WAAU;EAAY,eAAY;EACnC,UAAAA,EAAO,KAAK,MAAU;GACrB,IAAMC,IAAON,EAAWO,EAAM,cAAcP,EAAW,QACjDQ,IACJD,EAAM,cAAc,cAAcE,IAC9BA,IACAN,EAAGG,EAAK,KAAKA,EAAK,QAAQ,GAC1BI,IAAQC,EAAYJ,EAAM,OAC1BK,IAAKL,EAAM,WAAWM,EAAaN,EAAM,YAAY;GAC3D,OACE,kBAAC,MAAD;IAAmB,WAAU;IAA7B,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACGJ,EAAGO,EAAM,KAAKA,EAAM,QAAQ,GAC5BE,KAAML,EAAM,SAAS,YAAY,MAAMJ,EAAGS,EAAG,KAAKA,EAAG,QAAQ,MAAM,EAChE;KACN,CAAA,GAAA,kBAAC,QAAD,EAAA,UAAA;MACGJ;MAAI;MAAIM,EAAeP,EAAM,SAAS;KACnC,EAAA,CAAA,CACH;IACJ,CAAA,GAAAA,EAAM,WACL,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAA,EAAM;IACN,CAAA,CAEH;GAfK,GAAAA,EAAM,EAeX;EAER,CAAC;CACC,CAAA;AAER"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useFormatters as e } from "../../hooks/useFormatters.js";
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/subscriberbot/components/negotiations/OutcomeForm.tsx
|
|
6
6
|
var a = "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)]", o = "mb-1 block text-xs font-medium text-text-secondary", s = ({ negotiation: s, pending: c, error: l, submitLabel: u, onSubmit: d }) => {
|
|
7
|
-
let { formatCurrency: f } =
|
|
7
|
+
let { formatCurrency: f } = e(), p = t(), [m, h] = n("SUCCEEDED"), [g, _] = n(""), [v, y] = n(""), [b, x] = n(""), [S, C] = n(!!s.relationshipId);
|
|
8
8
|
return /* @__PURE__ */ i("form", {
|
|
9
9
|
onSubmit: (e) => {
|
|
10
10
|
e.preventDefault(), d({
|
|
@@ -106,7 +106,6 @@ var a = "w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 t
|
|
|
106
106
|
]
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
|
-
//#endregion
|
|
110
109
|
export { s as OutcomeForm };
|
|
111
110
|
|
|
112
111
|
//# sourceMappingURL=OutcomeForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutcomeForm.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/OutcomeForm.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Outcome form shared by the customer (self-serve) and the negotiation desk.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubNegotiation,\n SubNegotiationOutcome,\n SubRecordNegotiationOutcomeInput,\n} from '../../types/negotiation';\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 labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface OutcomeFormProps {\n negotiation: SubNegotiation;\n pending: boolean;\n error?: string | null;\n submitLabel: string;\n onSubmit: (input: SubRecordNegotiationOutcomeInput) => void;\n}\n\nexport const OutcomeForm: FC<OutcomeFormProps> = ({\n negotiation,\n pending,\n error,\n submitLabel,\n onSubmit,\n}) => {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubNegotiationOutcome>('SUCCEEDED');\n const [newAmount, setNewAmount] = useState('');\n const [credit, setCredit] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(negotiation.relationshipId));\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(outcome === 'SUCCEEDED' && newAmount ? { newAmount: Number(newAmount) } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: Number(credit) } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && negotiation.relationshipId\n ? { applyToRelationship: apply }\n : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"negotiation-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('negotiations.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('negotiations.outcome.succeeded', 'The bill was lowered or credited')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('negotiations.outcome.noSavings', 'No savings offered')}\n </label>\n </fieldset>\n {outcome === 'SUCCEEDED' && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"outcome-new-amount\" className={labelCls}>\n {tr('negotiations.outcome.newAmount', 'New price ({{current}} today)', {\n current: formatCurrency(negotiation.currentAmount, negotiation.currency),\n })}\n </label>\n <input\n id=\"outcome-new-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={newAmount}\n onChange={(e) => setNewAmount(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"outcome-credit\" className={labelCls}>\n {tr('negotiations.outcome.credit', 'One-off credit or refund')}\n </label>\n <input\n id=\"outcome-credit\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n )}\n <div>\n <label htmlFor=\"outcome-summary\" className={labelCls}>\n {tr('negotiations.outcome.summary', 'What was agreed')}\n </label>\n <textarea\n id=\"outcome-summary\"\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && negotiation.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('negotiations.outcome.apply', 'Update the tracked subscription with the new price')}\n </label>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending}\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 {submitLabel}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAaA,
|
|
1
|
+
{"version":3,"file":"OutcomeForm.js","names":["inputCls","labelCls","OutcomeForm","useFormatters","tr","useTr","outcome","setOutcome","useState","newAmount","setNewAmount","credit","setCredit","summary","setSummary","apply","setApply","negotiation","onSubmit","formatCurrency","error","pending","submitLabel"],"sources":["../../../../src/subscriberbot/components/negotiations/OutcomeForm.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Outcome form shared by the customer (self-serve) and the negotiation desk.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubNegotiation,\n SubNegotiationOutcome,\n SubRecordNegotiationOutcomeInput,\n} from '../../types/negotiation';\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 labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface OutcomeFormProps {\n negotiation: SubNegotiation;\n pending: boolean;\n error?: string | null;\n submitLabel: string;\n onSubmit: (input: SubRecordNegotiationOutcomeInput) => void;\n}\n\nexport const OutcomeForm: FC<OutcomeFormProps> = ({\n negotiation,\n pending,\n error,\n submitLabel,\n onSubmit,\n}) => {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubNegotiationOutcome>('SUCCEEDED');\n const [newAmount, setNewAmount] = useState('');\n const [credit, setCredit] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(negotiation.relationshipId));\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(outcome === 'SUCCEEDED' && newAmount ? { newAmount: Number(newAmount) } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: Number(credit) } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && negotiation.relationshipId\n ? { applyToRelationship: apply }\n : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"negotiation-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('negotiations.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('negotiations.outcome.succeeded', 'The bill was lowered or credited')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name=\"outcome\"\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('negotiations.outcome.noSavings', 'No savings offered')}\n </label>\n </fieldset>\n {outcome === 'SUCCEEDED' && (\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"outcome-new-amount\" className={labelCls}>\n {tr('negotiations.outcome.newAmount', 'New price ({{current}} today)', {\n current: formatCurrency(negotiation.currentAmount, negotiation.currency),\n })}\n </label>\n <input\n id=\"outcome-new-amount\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={newAmount}\n onChange={(e) => setNewAmount(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor=\"outcome-credit\" className={labelCls}>\n {tr('negotiations.outcome.credit', 'One-off credit or refund')}\n </label>\n <input\n id=\"outcome-credit\"\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n </div>\n )}\n <div>\n <label htmlFor=\"outcome-summary\" className={labelCls}>\n {tr('negotiations.outcome.summary', 'What was agreed')}\n </label>\n <textarea\n id=\"outcome-summary\"\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && negotiation.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('negotiations.outcome.apply', 'Update the tracked subscription with the new price')}\n </label>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending}\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 {submitLabel}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAaA,IAAMA,IACJ,wMACIC,IAAW,sDAUJC,KAAqC,EAChD,gBACA,YACA,UACA,gBACA,kBACI;CACJ,IAAM,EAAE,sBAAmBC,EAAc,GAEnCC,IAAKC,EAAM,GACX,CAACC,GAASC,KAAcC,EAAgC,WAAW,GACnE,CAACC,GAAWC,KAAgBF,EAAS,EAAE,GACvC,CAACG,GAAQC,KAAaJ,EAAS,EAAE,GACjC,CAACK,GAASC,KAAcN,EAAS,EAAE,GACnC,CAACO,GAAOC,KAAYR,EAAS,EAAQS,EAAY,cAAe;CAetE,OACE,kBAAC,QAAD;EAAM,WAdc,MAAiB;GAErC,AADA,EAAE,eAAe,GACjBC,EAAS;IACP;IACA,GAAIZ,MAAY,eAAeG,IAAY,EAAE,WAAW,OAAOA,CAAS,EAAE,IAAI,CAAC;IAC/E,GAAIH,MAAY,eAAeK,IAAS,EAAE,eAAe,OAAOA,CAAM,EAAE,IAAI,CAAC;IAC7E,GAAIE,EAAQ,KAAK,IAAI,EAAE,SAASA,EAAQ,KAAK,EAAE,IAAI,CAAC;IACpD,GAAIP,MAAY,eAAeW,EAAY,iBACvC,EAAE,qBAAqBF,EAAM,IAC7B,CAAC;GACP,CAAC;EACH;EAGgC,WAAU;EAAY,eAAY;EAAhE,UAAA;GACE,kBAAC,Y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zC,UAAAG,EAAG,gCAAgC,iBAAiB;GAChD,CAAA,GACP,kBAAC,YAAD;IACE,IAAG;IACH,MAAM;IACN,OAAOS;IACP,WAAW,MAAMC,EAAW,EAAE,OAAO,KAAK;IAC1C,WAAWd;GACZ,CAAA,CACE,EAAA,CAAA;GACJM,MAAY,eAAeW,EAAY,kBACtC,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CACE,kBAAC,SAAD;KAAO,MAAK;KAAW,SAASF;KAAO,WAAW,MAAMC,EAAS,EAAE,OAAO,OAAO;IAAI,CAAA,GACpFZ,EAAG,8BAA8B,oDAAoD,CACjF;;GAERgB,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;IACvB,UAAAA;GACA,CAAA;GAEL,kBAAC,UAAD;IACE,MAAK;IACL,UAAUC;IACV,WAAU;IAET,UAAAC;GACK,CAAA;EACJ;;AAEV"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./labels.js";
|
|
2
|
-
import "./NegotiationStatusPill.js";
|
|
3
|
-
import "./NegotiationTimeline.js";
|
|
4
|
-
import "./OutcomeForm.js";
|
|
1
|
+
import { BILL_TYPES as e, BILL_TYPE_LABEL as t, EVENT_LABEL as n, FEE_STATUS_LABEL as r, OPEN_STATUSES as i, STATUS_LABEL as a, TARGETS as o, TARGET_LABEL as s, statusTone as c } from "./labels.js";
|
|
2
|
+
import { NegotiationStatusPill as l } from "./NegotiationStatusPill.js";
|
|
3
|
+
import { NegotiationTimeline as u } from "./NegotiationTimeline.js";
|
|
4
|
+
import { OutcomeForm as d } from "./OutcomeForm.js";
|
|
5
|
+
export { e as BILL_TYPES, t as BILL_TYPE_LABEL, n as EVENT_LABEL, r as FEE_STATUS_LABEL, l as NegotiationStatusPill, u as NegotiationTimeline, i as OPEN_STATUSES, d as OutcomeForm, a as STATUS_LABEL, o as TARGETS, s as TARGET_LABEL, c as statusTone };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/subscriberbot/components/negotiations/labels.ts
|
|
2
2
|
var e = [
|
|
3
3
|
"INTERNET",
|
|
4
4
|
"CABLE_TV",
|
|
@@ -173,7 +173,6 @@ var l = [
|
|
|
173
173
|
"IN_PROGRESS",
|
|
174
174
|
"AWAITING_CUSTOMER"
|
|
175
175
|
];
|
|
176
|
-
//#endregion
|
|
177
176
|
export { e as BILL_TYPES, t as BILL_TYPE_LABEL, o as EVENT_LABEL, a as FEE_STATUS_LABEL, l as OPEN_STATUSES, i as STATUS_LABEL, n as TARGETS, r as TARGET_LABEL, c as statusTone };
|
|
178
177
|
|
|
179
178
|
//# sourceMappingURL=labels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","names":[],"sources":["../../../../src/subscriberbot/components/negotiations/labels.ts"],"sourcesContent":["/**\n * Bill negotiation labels (BOFF-4154): i18n keys with English fallbacks.\n */\nimport type {\n SubNegotiationBillType,\n SubNegotiationEventKind,\n SubNegotiationFeeStatus,\n SubNegotiationStatus,\n SubNegotiationTarget,\n} from '../../types/negotiation';\n\nexport type Label = { key: string; fallback: string };\n\nexport const BILL_TYPES: SubNegotiationBillType[] = [\n 'INTERNET',\n 'CABLE_TV',\n 'MOBILE_PHONE',\n 'HOME_PHONE',\n 'INSURANCE',\n 'UTILITY',\n 'SUBSCRIPTION',\n 'OTHER',\n];\n\nexport const BILL_TYPE_LABEL: Record<SubNegotiationBillType, Label> = {\n CABLE_TV: { key: 'negotiations.billType.cableTv', fallback: 'Cable TV' },\n INTERNET: { key: 'negotiations.billType.internet', fallback: 'Internet' },\n MOBILE_PHONE: { key: 'negotiations.billType.mobilePhone', fallback: 'Mobile phone' },\n HOME_PHONE: { key: 'negotiations.billType.homePhone', fallback: 'Home phone' },\n INSURANCE: { key: 'negotiations.billType.insurance', fallback: 'Insurance' },\n UTILITY: { key: 'negotiations.billType.utility', fallback: 'Utility' },\n SUBSCRIPTION: { key: 'negotiations.billType.subscription', fallback: 'Subscription' },\n OTHER: { key: 'negotiations.billType.other', fallback: 'Other' },\n};\n\nexport const TARGETS: SubNegotiationTarget[] = [\n 'LOWER_PRICE',\n 'REMOVE_FEES',\n 'BETTER_PLAN_SAME_PRICE',\n 'RETENTION_OFFER',\n 'CANCEL_IF_NO_DEAL',\n];\n\nexport const TARGET_LABEL: Record<SubNegotiationTarget, Label> = {\n LOWER_PRICE: { key: 'negotiations.target.lowerPrice', fallback: 'Lower the price' },\n REMOVE_FEES: { key: 'negotiations.target.removeFees', fallback: 'Remove fees' },\n BETTER_PLAN_SAME_PRICE: {\n key: 'negotiations.target.betterPlan',\n fallback: 'Better plan for the same price',\n },\n RETENTION_OFFER: { key: 'negotiations.target.retention', fallback: 'Best retention offer' },\n CANCEL_IF_NO_DEAL: {\n key: 'negotiations.target.cancelIfNoDeal',\n fallback: 'Lower the price or cancel',\n },\n};\n\nexport const STATUS_LABEL: Record<SubNegotiationStatus, Label> = {\n DRAFT: { key: 'negotiations.status.draft', fallback: 'Draft' },\n SUBMITTED: { key: 'negotiations.status.submitted', fallback: 'Submitted' },\n IN_PROGRESS: { key: 'negotiations.status.inProgress', fallback: 'Negotiating' },\n AWAITING_CUSTOMER: { key: 'negotiations.status.awaitingCustomer', fallback: 'Needs your reply' },\n SUCCEEDED: { key: 'negotiations.status.succeeded', fallback: 'Bill lowered' },\n NO_SAVINGS: { key: 'negotiations.status.noSavings', fallback: 'No savings' },\n CANCELLED: { key: 'negotiations.status.cancelled', fallback: 'Cancelled' },\n};\n\nexport const FEE_STATUS_LABEL: Record<SubNegotiationFeeStatus, Label> = {\n NONE: { key: 'negotiations.fee.none', fallback: 'No fee' },\n PENDING_BILLING: { key: 'negotiations.fee.pending', fallback: 'Fee pending' },\n BILLED: { key: 'negotiations.fee.billed', fallback: 'Fee billed' },\n WAIVED: { key: 'negotiations.fee.waived', fallback: 'Fee waived' },\n};\n\nexport const EVENT_LABEL: Record<SubNegotiationEventKind, Label> = {\n CREATED: { key: 'negotiations.event.created', fallback: 'Request created' },\n UPDATED: { key: 'negotiations.event.updated', fallback: 'Details updated' },\n SUBMITTED: { key: 'negotiations.event.submitted', fallback: 'Submitted' },\n STATUS_CHANGED: { key: 'negotiations.event.statusChanged', fallback: 'Status changed' },\n NOTE: { key: 'negotiations.event.note', fallback: 'Message' },\n OUTCOME_RECORDED: { key: 'negotiations.event.outcome', fallback: 'Outcome recorded' },\n FEE_BILLED: { key: 'negotiations.event.feeBilled', fallback: 'Success fee billed' },\n FEE_BILLING_FAILED: {\n key: 'negotiations.event.feeBillingFailed',\n fallback: 'Fee billing failed (will be retried)',\n },\n FEE_WAIVED: { key: 'negotiations.event.feeWaived', fallback: 'Success fee waived' },\n CANCELLED: { key: 'negotiations.event.cancelled', fallback: 'Cancelled' },\n};\n\nconst STATUS_TONE: Record<SubNegotiationStatus, string> = {\n DRAFT: 'bg-bg-sunken text-text-secondary',\n SUBMITTED: 'bg-[var(--color-accent-soft)] text-text-primary',\n IN_PROGRESS: 'bg-[var(--color-accent-soft)] text-text-primary',\n AWAITING_CUSTOMER: 'bg-status-warning-bg-subtle text-status-warning-text',\n SUCCEEDED: 'bg-status-success-bg-subtle text-status-success-text',\n NO_SAVINGS: 'bg-bg-sunken text-text-secondary',\n CANCELLED: 'bg-bg-sunken text-text-secondary',\n};\n\nexport function statusTone(status: SubNegotiationStatus): string {\n return STATUS_TONE[status];\n}\n\nexport const OPEN_STATUSES: SubNegotiationStatus[] = [\n 'DRAFT',\n 'SUBMITTED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n];\n"],"mappings":";AAaA,
|
|
1
|
+
{"version":3,"file":"labels.js","names":["BILL_TYPES","BILL_TYPE_LABEL","TARGETS","TARGET_LABEL","STATUS_LABEL","FEE_STATUS_LABEL","EVENT_LABEL","STATUS_TONE","statusTone","status","OPEN_STATUSES"],"sources":["../../../../src/subscriberbot/components/negotiations/labels.ts"],"sourcesContent":["/**\n * Bill negotiation labels (BOFF-4154): i18n keys with English fallbacks.\n */\nimport type {\n SubNegotiationBillType,\n SubNegotiationEventKind,\n SubNegotiationFeeStatus,\n SubNegotiationStatus,\n SubNegotiationTarget,\n} from '../../types/negotiation';\n\nexport type Label = { key: string; fallback: string };\n\nexport const BILL_TYPES: SubNegotiationBillType[] = [\n 'INTERNET',\n 'CABLE_TV',\n 'MOBILE_PHONE',\n 'HOME_PHONE',\n 'INSURANCE',\n 'UTILITY',\n 'SUBSCRIPTION',\n 'OTHER',\n];\n\nexport const BILL_TYPE_LABEL: Record<SubNegotiationBillType, Label> = {\n CABLE_TV: { key: 'negotiations.billType.cableTv', fallback: 'Cable TV' },\n INTERNET: { key: 'negotiations.billType.internet', fallback: 'Internet' },\n MOBILE_PHONE: { key: 'negotiations.billType.mobilePhone', fallback: 'Mobile phone' },\n HOME_PHONE: { key: 'negotiations.billType.homePhone', fallback: 'Home phone' },\n INSURANCE: { key: 'negotiations.billType.insurance', fallback: 'Insurance' },\n UTILITY: { key: 'negotiations.billType.utility', fallback: 'Utility' },\n SUBSCRIPTION: { key: 'negotiations.billType.subscription', fallback: 'Subscription' },\n OTHER: { key: 'negotiations.billType.other', fallback: 'Other' },\n};\n\nexport const TARGETS: SubNegotiationTarget[] = [\n 'LOWER_PRICE',\n 'REMOVE_FEES',\n 'BETTER_PLAN_SAME_PRICE',\n 'RETENTION_OFFER',\n 'CANCEL_IF_NO_DEAL',\n];\n\nexport const TARGET_LABEL: Record<SubNegotiationTarget, Label> = {\n LOWER_PRICE: { key: 'negotiations.target.lowerPrice', fallback: 'Lower the price' },\n REMOVE_FEES: { key: 'negotiations.target.removeFees', fallback: 'Remove fees' },\n BETTER_PLAN_SAME_PRICE: {\n key: 'negotiations.target.betterPlan',\n fallback: 'Better plan for the same price',\n },\n RETENTION_OFFER: { key: 'negotiations.target.retention', fallback: 'Best retention offer' },\n CANCEL_IF_NO_DEAL: {\n key: 'negotiations.target.cancelIfNoDeal',\n fallback: 'Lower the price or cancel',\n },\n};\n\nexport const STATUS_LABEL: Record<SubNegotiationStatus, Label> = {\n DRAFT: { key: 'negotiations.status.draft', fallback: 'Draft' },\n SUBMITTED: { key: 'negotiations.status.submitted', fallback: 'Submitted' },\n IN_PROGRESS: { key: 'negotiations.status.inProgress', fallback: 'Negotiating' },\n AWAITING_CUSTOMER: { key: 'negotiations.status.awaitingCustomer', fallback: 'Needs your reply' },\n SUCCEEDED: { key: 'negotiations.status.succeeded', fallback: 'Bill lowered' },\n NO_SAVINGS: { key: 'negotiations.status.noSavings', fallback: 'No savings' },\n CANCELLED: { key: 'negotiations.status.cancelled', fallback: 'Cancelled' },\n};\n\nexport const FEE_STATUS_LABEL: Record<SubNegotiationFeeStatus, Label> = {\n NONE: { key: 'negotiations.fee.none', fallback: 'No fee' },\n PENDING_BILLING: { key: 'negotiations.fee.pending', fallback: 'Fee pending' },\n BILLED: { key: 'negotiations.fee.billed', fallback: 'Fee billed' },\n WAIVED: { key: 'negotiations.fee.waived', fallback: 'Fee waived' },\n};\n\nexport const EVENT_LABEL: Record<SubNegotiationEventKind, Label> = {\n CREATED: { key: 'negotiations.event.created', fallback: 'Request created' },\n UPDATED: { key: 'negotiations.event.updated', fallback: 'Details updated' },\n SUBMITTED: { key: 'negotiations.event.submitted', fallback: 'Submitted' },\n STATUS_CHANGED: { key: 'negotiations.event.statusChanged', fallback: 'Status changed' },\n NOTE: { key: 'negotiations.event.note', fallback: 'Message' },\n OUTCOME_RECORDED: { key: 'negotiations.event.outcome', fallback: 'Outcome recorded' },\n FEE_BILLED: { key: 'negotiations.event.feeBilled', fallback: 'Success fee billed' },\n FEE_BILLING_FAILED: {\n key: 'negotiations.event.feeBillingFailed',\n fallback: 'Fee billing failed (will be retried)',\n },\n FEE_WAIVED: { key: 'negotiations.event.feeWaived', fallback: 'Success fee waived' },\n CANCELLED: { key: 'negotiations.event.cancelled', fallback: 'Cancelled' },\n};\n\nconst STATUS_TONE: Record<SubNegotiationStatus, string> = {\n DRAFT: 'bg-bg-sunken text-text-secondary',\n SUBMITTED: 'bg-[var(--color-accent-soft)] text-text-primary',\n IN_PROGRESS: 'bg-[var(--color-accent-soft)] text-text-primary',\n AWAITING_CUSTOMER: 'bg-status-warning-bg-subtle text-status-warning-text',\n SUCCEEDED: 'bg-status-success-bg-subtle text-status-success-text',\n NO_SAVINGS: 'bg-bg-sunken text-text-secondary',\n CANCELLED: 'bg-bg-sunken text-text-secondary',\n};\n\nexport function statusTone(status: SubNegotiationStatus): string {\n return STATUS_TONE[status];\n}\n\nexport const OPEN_STATUSES: SubNegotiationStatus[] = [\n 'DRAFT',\n 'SUBMITTED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n];\n"],"mappings":";AAaA,IAAaA,IAAuC;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEaC,IAAyD;CACpE,UAAU;EAAE,KAAK;EAAiC,UAAU;CAAW;CACvE,UAAU;EAAE,KAAK;EAAkC,UAAU;CAAW;CACxE,cAAc;EAAE,KAAK;EAAqC,UAAU;CAAe;CACnF,YAAY;EAAE,KAAK;EAAmC,UAAU;CAAa;CAC7E,WAAW;EAAE,KAAK;EAAmC,UAAU;CAAY;CAC3E,SAAS;EAAE,KAAK;EAAiC,UAAU;CAAU;CACrE,cAAc;EAAE,KAAK;EAAsC,UAAU;CAAe;CACpF,OAAO;EAAE,KAAK;EAA+B,UAAU;CAAQ;AACjE,GAEaC,IAAkC;CAC7C;CACA;CACA;CACA;CACA;AACF,GAEaC,IAAoD;CAC/D,aAAa;EAAE,KAAK;EAAkC,UAAU;CAAkB;CAClF,aAAa;EAAE,KAAK;EAAkC,UAAU;CAAc;CAC9E,wBAAwB;EACtB,KAAK;EACL,UAAU;CACZ;CACA,iBAAiB;EAAE,KAAK;EAAiC,UAAU;CAAuB;CAC1F,mBAAmB;EACjB,KAAK;EACL,UAAU;CACZ;AACF,GAEaC,IAAoD;CAC/D,OAAO;EAAE,KAAK;EAA6B,UAAU;CAAQ;CAC7D,WAAW;EAAE,KAAK;EAAiC,UAAU;CAAY;CACzE,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/useTr.js";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx
|
|
6
6
|
var a = "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)]", o = "mb-1 block text-xs font-medium text-text-secondary";
|
|
7
7
|
function s(e, t, n, r) {
|
|
8
8
|
if (e == null || !Number.isFinite(t)) return 0;
|
|
@@ -10,7 +10,7 @@ function s(e, t, n, r) {
|
|
|
10
10
|
return Math.round((i * Math.min(12, Math.max(0, n)) / 12 + r) * 100) / 100;
|
|
11
11
|
}
|
|
12
12
|
var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
|
|
13
|
-
let { formatCurrency: f } =
|
|
13
|
+
let { formatCurrency: f } = e(), p = t(), [m, h] = n("SUCCEEDED"), [g, _] = n(""), [v, y] = n(String(c.termMonths)), [b, x] = n(""), [S, C] = n(""), [w, T] = n(""), [E, D] = n(!!c.relationshipId), O = Number(g), k = Number(v) || c.termMonths, A = Number(b) || 0, j = g ? s(c.baselineAnnualValue, O, k, A) : 0, M = Math.round(j * c.feeRate * 100) / 100;
|
|
14
14
|
return /* @__PURE__ */ i("form", {
|
|
15
15
|
onSubmit: (e) => {
|
|
16
16
|
e.preventDefault(), d({
|
|
@@ -149,7 +149,6 @@ var c = ({ request: c, pending: l, error: u, onSubmit: d }) => {
|
|
|
149
149
|
]
|
|
150
150
|
});
|
|
151
151
|
};
|
|
152
|
-
//#endregion
|
|
153
152
|
export { c as ProcurementOutcomeForm };
|
|
154
153
|
|
|
155
154
|
//# sourceMappingURL=ProcurementOutcomeForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcurementOutcomeForm.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Outcome form used by the procurement desk to close a request (BOFF-4158).\n * Savings and the success fee are computed by the service from the baseline\n * (the vendor quote, else the current price); the form previews them.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubProcurementOutcome,\n SubProcurementRequest,\n SubRecordProcurementOutcomeInput,\n} from '../../types/procurement';\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 labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface ProcurementOutcomeFormProps {\n request: SubProcurementRequest;\n pending: boolean;\n error?: string | null;\n onSubmit: (input: SubRecordProcurementOutcomeInput) => void;\n}\n\n/** First-year savings preview, mirroring the service maths. */\nfunction previewSavings(\n baseline: number | null,\n finalValue: number,\n termMonths: number,\n credit: number\n): number {\n if (baseline == null || !Number.isFinite(finalValue)) return 0;\n const annual = Math.max(0, baseline - finalValue);\n return Math.round(((annual * Math.min(12, Math.max(0, termMonths))) / 12 + credit) * 100) / 100;\n}\n\nexport const ProcurementOutcomeForm: FC<ProcurementOutcomeFormProps> = ({\n request,\n pending,\n error,\n onSubmit,\n}) => {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubProcurementOutcome>('SUCCEEDED');\n const [finalValue, setFinalValue] = useState('');\n const [finalTerm, setFinalTerm] = useState(String(request.termMonths));\n const [credit, setCredit] = useState('');\n const [wins, setWins] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(request.relationshipId));\n\n const finalNumber = Number(finalValue);\n const termNumber = Number(finalTerm) || request.termMonths;\n const creditNumber = Number(credit) || 0;\n const firstYear = finalValue\n ? previewSavings(request.baselineAnnualValue, finalNumber, termNumber, creditNumber)\n : 0;\n const fee = Math.round(firstYear * request.feeRate * 100) / 100;\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(finalValue ? { finalAnnualValue: finalNumber } : {}),\n ...(finalTerm ? { finalTermMonths: termNumber } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: creditNumber } : {}),\n ...(wins.trim() ? { nonPriceWins: wins.trim() } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && request.relationshipId ? { applyToRelationship: apply } : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"procurement-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('procurement.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('procurement.outcome.succeeded', 'Savings secured')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('procurement.outcome.noSavings', 'No savings')}\n </label>\n </fieldset>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <div>\n <label htmlFor={`final-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalValue', 'Final annual value ({{currency}})', {\n currency: request.currency,\n })}\n </label>\n <input\n id={`final-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={finalValue}\n onChange={(e) => setFinalValue(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`term-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalTerm', 'Final term (months)')}\n </label>\n <input\n id={`term-${request.id}`}\n type=\"number\"\n min=\"1\"\n max=\"60\"\n step=\"1\"\n value={finalTerm}\n onChange={(e) => setFinalTerm(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && (\n <div>\n <label htmlFor={`credit-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.credit', 'One-off credit')}\n </label>\n <input\n id={`credit-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n )}\n </div>\n <div>\n <label htmlFor={`wins-${request.id}`} className={labelCls}>\n {tr(\n 'procurement.outcome.wins',\n 'Non-price wins (price caps, extra seats, payment terms)'\n )}\n </label>\n <input\n id={`wins-${request.id}`}\n value={wins}\n onChange={(e) => setWins(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`summary-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.summary', 'Summary for the customer')}\n </label>\n <textarea\n id={`summary-${request.id}`}\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && request.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('procurement.outcome.apply', 'Update the tracked subscription to the new price')}\n </label>\n )}\n {outcome === 'SUCCEEDED' && finalValue && (\n <p className=\"text-xs text-text-secondary\" data-testid=\"procurement-outcome-preview\">\n {tr(\n 'procurement.outcome.preview',\n 'First-year savings {{savings}} · success fee {{fee}}',\n {\n savings: formatCurrency(firstYear, request.currency),\n fee: formatCurrency(fee, request.currency),\n }\n )}\n </p>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending || (outcome === 'SUCCEEDED' && !finalValue)}\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 >\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ER,MAAY,eAAe,KAC1B,kBAAC,KAAD;IAAG,WAAU;IAA8B,eAAY;cACpD,EACC,+BACA,wDACA;KACE,SAAS,EAAe,GAAW,EAAQ,QAAQ;KACnD,KAAK,EAAe,GAAK,EAAQ,QAAQ;IAC3C,CACF;GACC,CAAA;GAEJ,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB;GACA,CAAA;GAEL,kBAAC,UAAD;IACE,MAAK;IACL,UAAU,KAAY,MAAY,eAAe,CAAC;IAClD,WAAU;cAET,EAAG,4BAA4B,2BAA2B;GACrD,CAAA;EACJ;;AAEV"}
|
|
1
|
+
{"version":3,"file":"ProcurementOutcomeForm.js","names":["inputCls","labelCls","previewSavings","baseline","finalValue","annual","termMonths","credit","ProcurementOutcomeForm","useFormatters","tr","useTr","outcome","setOutcome","useState","setFinalValue","finalTerm","setFinalTerm","request","setCredit","wins","setWins","summary","setSummary","apply","setApply","finalNumber","termNumber","creditNumber","firstYear","fee","onSubmit","formatCurrency","error","pending"],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementOutcomeForm.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Outcome form used by the procurement desk to close a request (BOFF-4158).\n * Savings and the success fee are computed by the service from the baseline\n * (the vendor quote, else the current price); the form previews them.\n */\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useTr } from '../../hooks/useTr';\n\nimport type {\n SubProcurementOutcome,\n SubProcurementRequest,\n SubRecordProcurementOutcomeInput,\n} from '../../types/procurement';\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 labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\n\ninterface ProcurementOutcomeFormProps {\n request: SubProcurementRequest;\n pending: boolean;\n error?: string | null;\n onSubmit: (input: SubRecordProcurementOutcomeInput) => void;\n}\n\n/** First-year savings preview, mirroring the service maths. */\nfunction previewSavings(\n baseline: number | null,\n finalValue: number,\n termMonths: number,\n credit: number\n): number {\n if (baseline == null || !Number.isFinite(finalValue)) return 0;\n const annual = Math.max(0, baseline - finalValue);\n return Math.round(((annual * Math.min(12, Math.max(0, termMonths))) / 12 + credit) * 100) / 100;\n}\n\nexport const ProcurementOutcomeForm: FC<ProcurementOutcomeFormProps> = ({\n request,\n pending,\n error,\n onSubmit,\n}) => {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const [outcome, setOutcome] = useState<SubProcurementOutcome>('SUCCEEDED');\n const [finalValue, setFinalValue] = useState('');\n const [finalTerm, setFinalTerm] = useState(String(request.termMonths));\n const [credit, setCredit] = useState('');\n const [wins, setWins] = useState('');\n const [summary, setSummary] = useState('');\n const [apply, setApply] = useState(Boolean(request.relationshipId));\n\n const finalNumber = Number(finalValue);\n const termNumber = Number(finalTerm) || request.termMonths;\n const creditNumber = Number(credit) || 0;\n const firstYear = finalValue\n ? previewSavings(request.baselineAnnualValue, finalNumber, termNumber, creditNumber)\n : 0;\n const fee = Math.round(firstYear * request.feeRate * 100) / 100;\n\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n onSubmit({\n outcome,\n ...(finalValue ? { finalAnnualValue: finalNumber } : {}),\n ...(finalTerm ? { finalTermMonths: termNumber } : {}),\n ...(outcome === 'SUCCEEDED' && credit ? { oneTimeCredit: creditNumber } : {}),\n ...(wins.trim() ? { nonPriceWins: wins.trim() } : {}),\n ...(summary.trim() ? { summary: summary.trim() } : {}),\n ...(outcome === 'SUCCEEDED' && request.relationshipId ? { applyToRelationship: apply } : {}),\n });\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"space-y-3\" data-testid=\"procurement-outcome-form\">\n <fieldset className=\"flex flex-wrap gap-4 text-sm text-text-primary\">\n <legend className={labelCls}>{tr('procurement.outcome.result', 'Result')}</legend>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'SUCCEEDED'}\n onChange={() => setOutcome('SUCCEEDED')}\n />\n {tr('procurement.outcome.succeeded', 'Savings secured')}\n </label>\n <label className=\"inline-flex items-center gap-2\">\n <input\n type=\"radio\"\n name={`outcome-${request.id}`}\n checked={outcome === 'NO_SAVINGS'}\n onChange={() => setOutcome('NO_SAVINGS')}\n />\n {tr('procurement.outcome.noSavings', 'No savings')}\n </label>\n </fieldset>\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <div>\n <label htmlFor={`final-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalValue', 'Final annual value ({{currency}})', {\n currency: request.currency,\n })}\n </label>\n <input\n id={`final-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={finalValue}\n onChange={(e) => setFinalValue(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`term-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.finalTerm', 'Final term (months)')}\n </label>\n <input\n id={`term-${request.id}`}\n type=\"number\"\n min=\"1\"\n max=\"60\"\n step=\"1\"\n value={finalTerm}\n onChange={(e) => setFinalTerm(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && (\n <div>\n <label htmlFor={`credit-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.credit', 'One-off credit')}\n </label>\n <input\n id={`credit-${request.id}`}\n type=\"number\"\n min=\"0\"\n step=\"0.01\"\n value={credit}\n onChange={(e) => setCredit(e.target.value)}\n className={inputCls}\n />\n </div>\n )}\n </div>\n <div>\n <label htmlFor={`wins-${request.id}`} className={labelCls}>\n {tr(\n 'procurement.outcome.wins',\n 'Non-price wins (price caps, extra seats, payment terms)'\n )}\n </label>\n <input\n id={`wins-${request.id}`}\n value={wins}\n onChange={(e) => setWins(e.target.value)}\n className={inputCls}\n />\n </div>\n <div>\n <label htmlFor={`summary-${request.id}`} className={labelCls}>\n {tr('procurement.outcome.summary', 'Summary for the customer')}\n </label>\n <textarea\n id={`summary-${request.id}`}\n rows={2}\n value={summary}\n onChange={(e) => setSummary(e.target.value)}\n className={inputCls}\n />\n </div>\n {outcome === 'SUCCEEDED' && request.relationshipId && (\n <label className=\"inline-flex items-center gap-2 text-sm text-text-primary\">\n <input type=\"checkbox\" checked={apply} onChange={(e) => setApply(e.target.checked)} />\n {tr('procurement.outcome.apply', 'Update the tracked subscription to the new price')}\n </label>\n )}\n {outcome === 'SUCCEEDED' && finalValue && (\n <p className=\"text-xs text-text-secondary\" data-testid=\"procurement-outcome-preview\">\n {tr(\n 'procurement.outcome.preview',\n 'First-year savings {{savings}} · success fee {{fee}}',\n {\n savings: formatCurrency(firstYear, request.currency),\n fee: formatCurrency(fee, request.currency),\n }\n )}\n </p>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <button\n type=\"submit\"\n disabled={pending || (outcome === 'SUCCEEDED' && !finalValue)}\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('procurement.outcome.save', 'Save outcome and bill fee')}\n </button>\n </form>\n );\n};\n"],"mappings":";;;;;AAeA,IAAMA,IACJ,wMACIC,IAAW;AAUjB,SAASC,EACP,GACA,GACA,GACA,GACQ;CACR,IAAIC,KAAY,QAAQ,CAAC,OAAO,SAASC,CAAU,GAAG,OAAO;CAC7D,IAAMC,IAAS,KAAK,IAAI,GAAGF,IAAWC,CAAU;CAChD,OAAO,KAAK,OAAQC,IAAS,KAAK,IAAI,IAAI,KAAK,IAAI,GAAGC,CAAU,CAAC,IAAK,KAAKC,KAAU,GAAG,IAAI;AAC9F;AAEA,IAAaC,KAA2D,EACtE,YACA,YACA,UACA,kBACI;CACJ,IAAM,EAAE,sBAAmBC,EAAc,GAEnCC,IAAKC,EAAM,GACX,CAACC,GAASC,KAAcC,EAAgC,WAAW,GACnE,CAACV,GAAYW,KAAiBD,EAAS,EAAE,GACzC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R;IAClD,WAAU;IAET,UAAAM,EAAG,4BAA4B,2BAA2B;GACrD,CAAA;EACJ;;AAEV"}
|
|
@@ -2,7 +2,7 @@ import { useTr as e } from "../../hooks/useTr.js";
|
|
|
2
2
|
import { cn as t } from "../../utils/cn.js";
|
|
3
3
|
import { STATUS_LABEL as n, procurementStatusTone as r } from "./labels.js";
|
|
4
4
|
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/subscriberbot/components/procurement/ProcurementStatusPill.tsx
|
|
6
6
|
var a = ({ status: a, className: o }) => {
|
|
7
7
|
let s = e(), c = n[a];
|
|
8
8
|
return /* @__PURE__ */ i("span", {
|
|
@@ -12,7 +12,6 @@ var a = ({ status: a, className: o }) => {
|
|
|
12
12
|
children: s(c.key, c.fallback)
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { a as ProcurementStatusPill };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=ProcurementStatusPill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcurementStatusPill.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementStatusPill.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport type { SubProcurementStatus } from '../../types/procurement';\nimport { STATUS_LABEL, procurementStatusTone } from './labels';\n\nexport const ProcurementStatusPill: FC<{ status: SubProcurementStatus; className?: string }> = ({\n status,\n className,\n}) => {\n const tr = useTr();\n const label = STATUS_LABEL[status];\n return (\n <span\n data-testid=\"procurement-status\"\n data-status={status}\n className={cn(\n 'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium',\n procurementStatusTone(status),\n className\n )}\n >\n {tr(label.key, label.fallback)}\n </span>\n );\n};\n"],"mappings":";;;;;AAMA,
|
|
1
|
+
{"version":3,"file":"ProcurementStatusPill.js","names":["ProcurementStatusPill","tr","useTr","label","STATUS_LABEL","status","cn","procurementStatusTone","className"],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementStatusPill.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\nimport type { SubProcurementStatus } from '../../types/procurement';\nimport { STATUS_LABEL, procurementStatusTone } from './labels';\n\nexport const ProcurementStatusPill: FC<{ status: SubProcurementStatus; className?: string }> = ({\n status,\n className,\n}) => {\n const tr = useTr();\n const label = STATUS_LABEL[status];\n return (\n <span\n data-testid=\"procurement-status\"\n data-status={status}\n className={cn(\n 'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium',\n procurementStatusTone(status),\n className\n )}\n >\n {tr(label.key, label.fallback)}\n </span>\n );\n};\n"],"mappings":";;;;;AAMA,IAAaA,KAAmF,EAC9F,WACA,mBACI;CACJ,IAAMC,IAAKC,EAAM,GACXC,IAAQC,EAAaC;CAC3B,OACE,kBAAC,QAAD;EACE,eAAY;EACZ,eAAaA;EACb,WAAWC,EACT,2EACAC,EAAsBF,CAAM,GAC5BG,CACF;EAEC,UAAAP,EAAGE,EAAM,KAAKA,EAAM,QAAQ;CACzB,CAAA;AAEV"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useFormatters as e } from "../../hooks/useFormatters.js";
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
3
|
import { cn as n } from "../../utils/cn.js";
|
|
4
4
|
import { EVENT_LABEL as r, STATUS_LABEL as i } from "./labels.js";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/subscriberbot/components/procurement/ProcurementThread.tsx
|
|
7
7
|
var s = {
|
|
8
8
|
customer: {
|
|
9
9
|
key: "procurement.role.customer",
|
|
@@ -18,7 +18,7 @@ var s = {
|
|
|
18
18
|
fallback: "Subscriber Bot"
|
|
19
19
|
}
|
|
20
20
|
}, c = ({ events: c, customerLabel: l }) => {
|
|
21
|
-
let { formatDateTime: u } =
|
|
21
|
+
let { formatDateTime: u } = e(), d = t();
|
|
22
22
|
return c.length === 0 ? null : /* @__PURE__ */ a("ol", {
|
|
23
23
|
className: "space-y-3",
|
|
24
24
|
"data-testid": "procurement-thread",
|
|
@@ -45,7 +45,6 @@ var s = {
|
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
-
//#endregion
|
|
49
48
|
export { c as ProcurementThread };
|
|
50
49
|
|
|
51
50
|
//# sourceMappingURL=ProcurementThread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcurementThread.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementThread.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport type { SubProcurementEvent } from '../../types/procurement';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'procurement.role.customer', fallback: 'You' },\n expert: { key: 'procurement.role.expert', fallback: 'Procurement expert' },\n system: { key: 'procurement.role.system', fallback: 'Subscriber Bot' },\n};\n\n/**\n * The request's message thread and timeline, oldest first. Internal desk notes\n * only ever reach the desk (the API filters them for customers); they are\n * highlighted so an expert never mistakes one for a customer-visible message.\n */\nexport const ProcurementThread: FC<{ events: SubProcurementEvent[]; customerLabel?: string }> = ({\n events,\n customerLabel,\n}) => {\n const { formatDateTime } = useFormatters();\n\n const tr = useTr();\n if (events.length === 0) return null;\n return (\n <ol className=\"space-y-3\" data-testid=\"procurement-thread\">\n {events.map((event) => {\n const role = ROLE_LABEL[event.actorRole] ?? ROLE_LABEL.system!;\n const who =\n event.actorRole === 'customer' && customerLabel\n ? customerLabel\n : tr(role.key, role.fallback);\n const label = EVENT_LABEL[event.kind];\n const to = event.toStatus ? STATUS_LABEL[event.toStatus] : null;\n return (\n <li\n key={event.id}\n data-kind={event.kind}\n className={cn(\n 'rounded-lg border p-3',\n event.internal\n ? 'border-status-warning-text/30 bg-status-warning-bg-subtle'\n : 'border-border-subtle bg-bg-surface'\n )}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {tr(label.key, label.fallback)}\n {to && event.kind !== 'CREATED' && event.fromStatus !== event.toStatus\n ? ` → ${tr(to.key, to.fallback)}`\n : ''}\n </span>\n <span>\n {who} · {formatDateTime(event.createdAt)}\n </span>\n </div>\n {event.message && (\n <p className=\"mt-1.5 whitespace-pre-wrap text-sm text-text-primary\">\n {event.message}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n"],"mappings":";;;;;;AAQA,
|
|
1
|
+
{"version":3,"file":"ProcurementThread.js","names":["ROLE_LABEL","ProcurementThread","useFormatters","tr","useTr","events","role","event","who","customerLabel","label","EVENT_LABEL","to","STATUS_LABEL","cn","formatDateTime"],"sources":["../../../../src/subscriberbot/components/procurement/ProcurementThread.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\nimport type { FC } from 'react';\nimport { useTr } from '../../hooks/useTr';\nimport { cn } from '../../utils/cn';\n\nimport type { SubProcurementEvent } from '../../types/procurement';\nimport { EVENT_LABEL, STATUS_LABEL } from './labels';\n\nconst ROLE_LABEL: Record<string, { key: string; fallback: string }> = {\n customer: { key: 'procurement.role.customer', fallback: 'You' },\n expert: { key: 'procurement.role.expert', fallback: 'Procurement expert' },\n system: { key: 'procurement.role.system', fallback: 'Subscriber Bot' },\n};\n\n/**\n * The request's message thread and timeline, oldest first. Internal desk notes\n * only ever reach the desk (the API filters them for customers); they are\n * highlighted so an expert never mistakes one for a customer-visible message.\n */\nexport const ProcurementThread: FC<{ events: SubProcurementEvent[]; customerLabel?: string }> = ({\n events,\n customerLabel,\n}) => {\n const { formatDateTime } = useFormatters();\n\n const tr = useTr();\n if (events.length === 0) return null;\n return (\n <ol className=\"space-y-3\" data-testid=\"procurement-thread\">\n {events.map((event) => {\n const role = ROLE_LABEL[event.actorRole] ?? ROLE_LABEL.system!;\n const who =\n event.actorRole === 'customer' && customerLabel\n ? customerLabel\n : tr(role.key, role.fallback);\n const label = EVENT_LABEL[event.kind];\n const to = event.toStatus ? STATUS_LABEL[event.toStatus] : null;\n return (\n <li\n key={event.id}\n data-kind={event.kind}\n className={cn(\n 'rounded-lg border p-3',\n event.internal\n ? 'border-status-warning-text/30 bg-status-warning-bg-subtle'\n : 'border-border-subtle bg-bg-surface'\n )}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">\n {tr(label.key, label.fallback)}\n {to && event.kind !== 'CREATED' && event.fromStatus !== event.toStatus\n ? ` → ${tr(to.key, to.fallback)}`\n : ''}\n </span>\n <span>\n {who} · {formatDateTime(event.createdAt)}\n </span>\n </div>\n {event.message && (\n <p className=\"mt-1.5 whitespace-pre-wrap text-sm text-text-primary\">\n {event.message}\n </p>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n"],"mappings":";;;;;;AAQA,IAAMA,IAAgE;CACpE,UAAU;EAAE,KAAK;EAA6B,UAAU;CAAM;CAC9D,QAAQ;EAAE,KAAK;EAA2B,UAAU;CAAqB;CACzE,QAAQ;EAAE,KAAK;EAA2B,UAAU;CAAiB;AACvE,GAOaC,KAAoF,EAC/F,WACA,uBACI;CACJ,IAAM,EAAE,sBAAmBC,EAAc,GAEnCC,IAAKC,EAAM;CAEjB,OADIC,EAAO,WAAW,IAAU,OAE9B,kBAAC,MAAD;EAAI,WAAU;EAAY,eAAY;EACnC,UAAAA,EAAO,KAAK,MAAU;GACrB,IAAMC,IAAON,EAAWO,EAAM,cAAcP,EAAW,QACjDQ,IACJD,EAAM,cAAc,cAAcE,IAC9BA,IACAN,EAAGG,EAAK,KAAKA,EAAK,QAAQ,GAC1BI,IAAQC,EAAYJ,EAAM,OAC1BK,IAAKL,EAAM,WAAWM,EAAaN,EAAM,YAAY;GAC3D,OACE,kBAAC,MAAD;IAEE,aAAWA,EAAM;IACjB,WAAWO,EACT,yBACAP,EAAM,WACF,8DACA,oCACN;IARF,UAAA,CAUE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACGJ,EAAGO,EAAM,KAAKA,EAAM,QAAQ,GAC5BE,KAAML,EAAM,SAAS,aAAaA,EAAM,eAAeA,EAAM,WAC1D,MAAMJ,EAAGS,EAAG,KAAKA,EAAG,QAAQ,MAC5B,EACA;KACN,CAAA,GAAA,kBAAC,QAAD,EAAA,UAAA;MACGJ;MAAI;MAAIO,EAAeR,EAAM,SAAS;KACnC,EAAA,CAAA,CACH;IACJ,CAAA,GAAAA,EAAM,WACL,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAA,EAAM;IACN,CAAA,CAEH;GAzBG,GAAAA,EAAM,EAyBT;EAER,CAAC;CACC,CAAA;AAER"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./labels.js";
|
|
2
|
-
import "./ProcurementStatusPill.js";
|
|
3
|
-
import "./ProcurementThread.js";
|
|
4
|
-
import "./ProcurementOutcomeForm.js";
|
|
1
|
+
import { EVENT_LABEL as e, FEE_STATUS_LABEL as t, OPEN_STATUSES as n, REQUEST_TYPES as r, REQUEST_TYPE_LABEL as i, STATUS_LABEL as a, WORKING_STATUSES as o, procurementStatusTone as s } from "./labels.js";
|
|
2
|
+
import { ProcurementStatusPill as c } from "./ProcurementStatusPill.js";
|
|
3
|
+
import { ProcurementThread as l } from "./ProcurementThread.js";
|
|
4
|
+
import { ProcurementOutcomeForm as u } from "./ProcurementOutcomeForm.js";
|
|
5
|
+
export { e as EVENT_LABEL, t as FEE_STATUS_LABEL, n as OPEN_STATUSES, u as ProcurementOutcomeForm, c as ProcurementStatusPill, l as ProcurementThread, r as REQUEST_TYPES, i as REQUEST_TYPE_LABEL, a as STATUS_LABEL, o as WORKING_STATUSES, s as procurementStatusTone };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/subscriberbot/components/procurement/labels.ts
|
|
2
2
|
var e = [
|
|
3
3
|
"RENEWAL",
|
|
4
4
|
"NEW_PURCHASE",
|
|
@@ -148,7 +148,6 @@ var s = [
|
|
|
148
148
|
"IN_PROGRESS",
|
|
149
149
|
"AWAITING_CUSTOMER"
|
|
150
150
|
];
|
|
151
|
-
//#endregion
|
|
152
151
|
export { i as EVENT_LABEL, r as FEE_STATUS_LABEL, s as OPEN_STATUSES, e as REQUEST_TYPES, t as REQUEST_TYPE_LABEL, n as STATUS_LABEL, c as WORKING_STATUSES, o as procurementStatusTone };
|
|
153
152
|
|
|
154
153
|
//# sourceMappingURL=labels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","names":[],"sources":["../../../../src/subscriberbot/components/procurement/labels.ts"],"sourcesContent":["/**\n * Human procurement labels (BOFF-4158): i18n keys with English fallbacks.\n */\nimport type {\n SubProcurementEventKind,\n SubProcurementFeeStatus,\n SubProcurementRequestType,\n SubProcurementStatus,\n} from '../../types/procurement';\n\nexport type Label = { key: string; fallback: string };\n\nexport const REQUEST_TYPES: SubProcurementRequestType[] = [\n 'RENEWAL',\n 'NEW_PURCHASE',\n 'EXPANSION',\n 'CONSOLIDATION',\n];\n\nexport const REQUEST_TYPE_LABEL: Record<SubProcurementRequestType, Label> = {\n RENEWAL: { key: 'procurement.type.renewal', fallback: 'Renewal' },\n NEW_PURCHASE: { key: 'procurement.type.newPurchase', fallback: 'New purchase' },\n EXPANSION: { key: 'procurement.type.expansion', fallback: 'Expansion (more seats or modules)' },\n CONSOLIDATION: { key: 'procurement.type.consolidation', fallback: 'Consolidation' },\n};\n\nexport const STATUS_LABEL: Record<SubProcurementStatus, Label> = {\n DRAFT: { key: 'procurement.status.draft', fallback: 'Draft' },\n SUBMITTED: { key: 'procurement.status.submitted', fallback: 'Waiting for an expert' },\n ASSIGNED: { key: 'procurement.status.assigned', fallback: 'Expert assigned' },\n IN_PROGRESS: { key: 'procurement.status.inProgress', fallback: 'Negotiating' },\n AWAITING_CUSTOMER: { key: 'procurement.status.awaitingCustomer', fallback: 'Needs your reply' },\n SUCCEEDED: { key: 'procurement.status.succeeded', fallback: 'Savings secured' },\n NO_SAVINGS: { key: 'procurement.status.noSavings', fallback: 'No savings' },\n CANCELLED: { key: 'procurement.status.cancelled', fallback: 'Cancelled' },\n};\n\nexport const FEE_STATUS_LABEL: Record<SubProcurementFeeStatus, Label> = {\n NONE: { key: 'procurement.fee.none', fallback: 'No fee' },\n PENDING_BILLING: { key: 'procurement.fee.pending', fallback: 'Fee pending' },\n BILLING: { key: 'procurement.fee.billing', fallback: 'Billing in progress' },\n BILLED: { key: 'procurement.fee.billed', fallback: 'Fee billed' },\n WAIVED: { key: 'procurement.fee.waived', fallback: 'Fee waived' },\n};\n\nexport const EVENT_LABEL: Record<SubProcurementEventKind, Label> = {\n CREATED: { key: 'procurement.event.created', fallback: 'Request created' },\n UPDATED: { key: 'procurement.event.updated', fallback: 'Details updated' },\n SUBMITTED: { key: 'procurement.event.submitted', fallback: 'Submitted to the desk' },\n ASSIGNED: { key: 'procurement.event.assigned', fallback: 'Expert assigned' },\n STATUS_CHANGED: { key: 'procurement.event.statusChanged', fallback: 'Status changed' },\n MESSAGE: { key: 'procurement.event.message', fallback: 'Message' },\n INTERNAL_NOTE: { key: 'procurement.event.internalNote', fallback: 'Internal note' },\n OUTCOME_RECORDED: { key: 'procurement.event.outcome', fallback: 'Outcome recorded' },\n FEE_BILLED: { key: 'procurement.event.feeBilled', fallback: 'Success fee billed' },\n FEE_BILLING_FAILED: {\n key: 'procurement.event.feeBillingFailed',\n fallback: 'Fee billing failed (will be retried)',\n },\n FEE_WAIVED: { key: 'procurement.event.feeWaived', fallback: 'Success fee waived' },\n CANCELLED: { key: 'procurement.event.cancelled', fallback: 'Cancelled' },\n};\n\nconst STATUS_TONE: Record<SubProcurementStatus, string> = {\n DRAFT: 'bg-bg-sunken text-text-secondary',\n SUBMITTED: 'bg-[var(--color-accent-soft)] text-text-primary',\n ASSIGNED: 'bg-[var(--color-accent-soft)] text-text-primary',\n IN_PROGRESS: 'bg-[var(--color-accent-soft)] text-text-primary',\n AWAITING_CUSTOMER: 'bg-status-warning-bg-subtle text-status-warning-text',\n SUCCEEDED: 'bg-status-success-bg-subtle text-status-success-text',\n NO_SAVINGS: 'bg-bg-sunken text-text-secondary',\n CANCELLED: 'bg-bg-sunken text-text-secondary',\n};\n\nexport function procurementStatusTone(status: SubProcurementStatus): string {\n return STATUS_TONE[status];\n}\n\nexport const OPEN_STATUSES: SubProcurementStatus[] = [\n 'DRAFT',\n 'SUBMITTED',\n 'ASSIGNED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n];\n\n/** Statuses an expert is actively working (outcome can be recorded). */\nexport const WORKING_STATUSES: SubProcurementStatus[] = [\n 'ASSIGNED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n];\n"],"mappings":";AAYA,
|
|
1
|
+
{"version":3,"file":"labels.js","names":["REQUEST_TYPES","REQUEST_TYPE_LABEL","STATUS_LABEL","FEE_STATUS_LABEL","EVENT_LABEL","STATUS_TONE","procurementStatusTone","status","OPEN_STATUSES","WORKING_STATUSES"],"sources":["../../../../src/subscriberbot/components/procurement/labels.ts"],"sourcesContent":["/**\n * Human procurement labels (BOFF-4158): i18n keys with English fallbacks.\n */\nimport type {\n SubProcurementEventKind,\n SubProcurementFeeStatus,\n SubProcurementRequestType,\n SubProcurementStatus,\n} from '../../types/procurement';\n\nexport type Label = { key: string; fallback: string };\n\nexport const REQUEST_TYPES: SubProcurementRequestType[] = [\n 'RENEWAL',\n 'NEW_PURCHASE',\n 'EXPANSION',\n 'CONSOLIDATION',\n];\n\nexport const REQUEST_TYPE_LABEL: Record<SubProcurementRequestType, Label> = {\n RENEWAL: { key: 'procurement.type.renewal', fallback: 'Renewal' },\n NEW_PURCHASE: { key: 'procurement.type.newPurchase', fallback: 'New purchase' },\n EXPANSION: { key: 'procurement.type.expansion', fallback: 'Expansion (more seats or modules)' },\n CONSOLIDATION: { key: 'procurement.type.consolidation', fallback: 'Consolidation' },\n};\n\nexport const STATUS_LABEL: Record<SubProcurementStatus, Label> = {\n DRAFT: { key: 'procurement.status.draft', fallback: 'Draft' },\n SUBMITTED: { key: 'procurement.status.submitted', fallback: 'Waiting for an expert' },\n ASSIGNED: { key: 'procurement.status.assigned', fallback: 'Expert assigned' },\n IN_PROGRESS: { key: 'procurement.status.inProgress', fallback: 'Negotiating' },\n AWAITING_CUSTOMER: { key: 'procurement.status.awaitingCustomer', fallback: 'Needs your reply' },\n SUCCEEDED: { key: 'procurement.status.succeeded', fallback: 'Savings secured' },\n NO_SAVINGS: { key: 'procurement.status.noSavings', fallback: 'No savings' },\n CANCELLED: { key: 'procurement.status.cancelled', fallback: 'Cancelled' },\n};\n\nexport const FEE_STATUS_LABEL: Record<SubProcurementFeeStatus, Label> = {\n NONE: { key: 'procurement.fee.none', fallback: 'No fee' },\n PENDING_BILLING: { key: 'procurement.fee.pending', fallback: 'Fee pending' },\n BILLING: { key: 'procurement.fee.billing', fallback: 'Billing in progress' },\n BILLED: { key: 'procurement.fee.billed', fallback: 'Fee billed' },\n WAIVED: { key: 'procurement.fee.waived', fallback: 'Fee waived' },\n};\n\nexport const EVENT_LABEL: Record<SubProcurementEventKind, Label> = {\n CREATED: { key: 'procurement.event.created', fallback: 'Request created' },\n UPDATED: { key: 'procurement.event.updated', fallback: 'Details updated' },\n SUBMITTED: { key: 'procurement.event.submitted', fallback: 'Submitted to the desk' },\n ASSIGNED: { key: 'procurement.event.assigned', fallback: 'Expert assigned' },\n STATUS_CHANGED: { key: 'procurement.event.statusChanged', fallback: 'Status changed' },\n MESSAGE: { key: 'procurement.event.message', fallback: 'Message' },\n INTERNAL_NOTE: { key: 'procurement.event.internalNote', fallback: 'Internal note' },\n OUTCOME_RECORDED: { key: 'procurement.event.outcome', fallback: 'Outcome recorded' },\n FEE_BILLED: { key: 'procurement.event.feeBilled', fallback: 'Success fee billed' },\n FEE_BILLING_FAILED: {\n key: 'procurement.event.feeBillingFailed',\n fallback: 'Fee billing failed (will be retried)',\n },\n FEE_WAIVED: { key: 'procurement.event.feeWaived', fallback: 'Success fee waived' },\n CANCELLED: { key: 'procurement.event.cancelled', fallback: 'Cancelled' },\n};\n\nconst STATUS_TONE: Record<SubProcurementStatus, string> = {\n DRAFT: 'bg-bg-sunken text-text-secondary',\n SUBMITTED: 'bg-[var(--color-accent-soft)] text-text-primary',\n ASSIGNED: 'bg-[var(--color-accent-soft)] text-text-primary',\n IN_PROGRESS: 'bg-[var(--color-accent-soft)] text-text-primary',\n AWAITING_CUSTOMER: 'bg-status-warning-bg-subtle text-status-warning-text',\n SUCCEEDED: 'bg-status-success-bg-subtle text-status-success-text',\n NO_SAVINGS: 'bg-bg-sunken text-text-secondary',\n CANCELLED: 'bg-bg-sunken text-text-secondary',\n};\n\nexport function procurementStatusTone(status: SubProcurementStatus): string {\n return STATUS_TONE[status];\n}\n\nexport const OPEN_STATUSES: SubProcurementStatus[] = [\n 'DRAFT',\n 'SUBMITTED',\n 'ASSIGNED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n];\n\n/** Statuses an expert is actively working (outcome can be recorded). */\nexport const WORKING_STATUSES: SubProcurementStatus[] = [\n 'ASSIGNED',\n 'IN_PROGRESS',\n 'AWAITING_CUSTOMER',\n];\n"],"mappings":";AAYA,IAAaA,IAA6C;CACxD;CACA;CACA;CACA;AACF,GAEaC,IAA+D;CAC1E,SAAS;EAAE,KAAK;EAA4B,UAAU;CAAU;CAChE,cAAc;EAAE,KAAK;EAAgC,UAAU;CAAe;CAC9E,WAAW;EAAE,KAAK;EAA8B,UAAU;CAAoC;CAC9F,eAAe;EAAE,KAAK;EAAkC,UAAU;CAAgB;AACpF,GAEaC,IAAoD;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