@burdenoff/microfe-subscriberbot 2026.1103.2 → 2026.1105.2
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/DashboardPage.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/PageLayout.d.ts +6 -0
- package/dist/subscriberbot/components/PageLayout.d.ts.map +1 -1
- package/dist/subscriberbot/components/PageLayout.js +2 -1
- package/dist/subscriberbot/components/PageLayout.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 +2 -0
- package/dist/subscriberbot/components/StateViews.d.ts.map +1 -1
- package/dist/subscriberbot/components/StateViews.js +46 -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 +143 -135
- 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.d.ts +3 -0
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.js +5 -3
- 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 +115 -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 +272 -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 +112 -91
- 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,276 +1,276 @@
|
|
|
1
1
|
import { useSubscriberBot as e } from "../../context/SubscriberBotContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ErrorView as
|
|
2
|
+
import { useTr as t } from "../../hooks/useTr.js";
|
|
3
|
+
import { useFormatters as n } from "../../hooks/useFormatters.js";
|
|
4
|
+
import { PageLayout as r } from "../../components/PageLayout.js";
|
|
5
|
+
import { ErrorView as i, LoadingView as a, Section as o } from "../../components/StateViews.js";
|
|
6
6
|
import "../../components/index.js";
|
|
7
|
-
import { FEE_STATUS_LABEL as
|
|
8
|
-
import { ProcurementStatusPill as
|
|
9
|
-
import { ProcurementThread as
|
|
7
|
+
import { FEE_STATUS_LABEL as s, OPEN_STATUSES as c, REQUEST_TYPE_LABEL as l } from "../../components/procurement/labels.js";
|
|
8
|
+
import { ProcurementStatusPill as u } from "../../components/procurement/ProcurementStatusPill.js";
|
|
9
|
+
import { ProcurementThread as d } from "../../components/procurement/ProcurementThread.js";
|
|
10
10
|
import "../../components/procurement/index.js";
|
|
11
|
-
import { useCancelProcurementRequest as
|
|
12
|
-
import { useState as
|
|
13
|
-
import { ArrowLeft as
|
|
14
|
-
import { useParams as
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { GlassCard as
|
|
11
|
+
import { useCancelProcurementRequest as f, useProcurementRequest as p, useProcurementTerms as m, useSendProcurementMessage as h, useSubmitProcurementRequest as g } from "../../hooks/useProcurementApi.js";
|
|
12
|
+
import { useState as _ } from "react";
|
|
13
|
+
import { ArrowLeft as v, UserRoundCheck as y } from "lucide-react";
|
|
14
|
+
import { useParams as b } from "react-router";
|
|
15
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
16
|
+
import { GlassCard as C } from "@burdenoff/fe-libs/ui";
|
|
17
17
|
//#region src/subscriberbot/pages/procurement/ProcurementDetailPage.tsx
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */
|
|
18
|
+
var w = "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)]", T = "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50", E = "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50", D = (e) => e ? e instanceof Error ? e.message : String(e) : null;
|
|
19
|
+
function O({ label: e, value: t }) {
|
|
20
|
+
return /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("dt", {
|
|
21
21
|
className: "text-xs text-text-secondary",
|
|
22
22
|
children: e
|
|
23
|
-
}), /* @__PURE__ */
|
|
23
|
+
}), /* @__PURE__ */ x("dd", {
|
|
24
24
|
className: "mt-0.5 text-sm font-medium text-text-primary",
|
|
25
25
|
children: t
|
|
26
26
|
})] });
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
let
|
|
30
|
-
return /* @__PURE__ */
|
|
28
|
+
function k({ request: e }) {
|
|
29
|
+
let n = t(), r = m(), i = g(), [a, o] = _(!1);
|
|
30
|
+
return /* @__PURE__ */ S(C, {
|
|
31
31
|
treatment: "metric",
|
|
32
32
|
className: "space-y-3 p-5",
|
|
33
33
|
"data-testid": "procurement-submit",
|
|
34
34
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ x("p", {
|
|
36
36
|
className: "text-sm text-text-primary",
|
|
37
|
-
children:
|
|
37
|
+
children: n("procurement.submit.intro", "Submit this request to the Subscriber Bot procurement desk. An expert is assigned, negotiates with the vendor and keeps you posted here.")
|
|
38
38
|
}),
|
|
39
|
-
|
|
39
|
+
r.data && /* @__PURE__ */ S("div", {
|
|
40
40
|
className: "rounded-lg border border-border-subtle bg-bg-sunken p-3",
|
|
41
|
-
children: [/* @__PURE__ */
|
|
41
|
+
children: [/* @__PURE__ */ x("p", {
|
|
42
42
|
className: "text-xs leading-relaxed text-text-secondary",
|
|
43
43
|
"data-testid": "procurement-terms",
|
|
44
|
-
children:
|
|
45
|
-
}), /* @__PURE__ */
|
|
44
|
+
children: r.data.authorizationText
|
|
45
|
+
}), /* @__PURE__ */ S("label", {
|
|
46
46
|
className: "mt-3 inline-flex items-start gap-2 text-sm text-text-primary",
|
|
47
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ x("input", {
|
|
48
48
|
type: "checkbox",
|
|
49
|
-
checked:
|
|
49
|
+
checked: a,
|
|
50
50
|
onChange: (e) => o(e.target.checked),
|
|
51
51
|
className: "mt-0.5"
|
|
52
|
-
}),
|
|
52
|
+
}), n("procurement.submit.accept", "I authorise the procurement desk on these terms")]
|
|
53
53
|
})]
|
|
54
54
|
}),
|
|
55
|
-
|
|
55
|
+
i.error && /* @__PURE__ */ x("p", {
|
|
56
56
|
role: "alert",
|
|
57
57
|
className: "text-sm text-status-error-text",
|
|
58
|
-
children:
|
|
58
|
+
children: D(i.error)
|
|
59
59
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ x("button", {
|
|
61
61
|
type: "button",
|
|
62
|
-
onClick: () =>
|
|
62
|
+
onClick: () => r.data && i.mutate({
|
|
63
63
|
id: e.id,
|
|
64
64
|
input: {
|
|
65
|
-
acceptAuthorization:
|
|
66
|
-
authorizationVersion:
|
|
65
|
+
acceptAuthorization: a,
|
|
66
|
+
authorizationVersion: r.data.authorizationVersion
|
|
67
67
|
}
|
|
68
68
|
}),
|
|
69
|
-
disabled:
|
|
70
|
-
className:
|
|
71
|
-
children:
|
|
69
|
+
disabled: i.isPending || !a || !r.data,
|
|
70
|
+
className: T,
|
|
71
|
+
children: n("procurement.submit.cta", "Submit to the procurement desk")
|
|
72
72
|
})
|
|
73
73
|
]
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let
|
|
78
|
-
return /* @__PURE__ */
|
|
76
|
+
function A({ request: e }) {
|
|
77
|
+
let n = t(), r = h(), [i, a] = _(""), o = e.status === "AWAITING_CUSTOMER";
|
|
78
|
+
return /* @__PURE__ */ S("div", {
|
|
79
79
|
className: "space-y-2",
|
|
80
80
|
"data-testid": "procurement-message",
|
|
81
81
|
children: [
|
|
82
|
-
o && /* @__PURE__ */
|
|
82
|
+
o && /* @__PURE__ */ x("p", {
|
|
83
83
|
className: "rounded-lg bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text",
|
|
84
|
-
children:
|
|
84
|
+
children: n("procurement.message.awaiting", "Your procurement expert is waiting for your reply. See the latest message below.")
|
|
85
85
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ x("label", {
|
|
87
87
|
htmlFor: "proc-message",
|
|
88
88
|
className: "sr-only",
|
|
89
|
-
children:
|
|
89
|
+
children: n("procurement.message.label", "Message")
|
|
90
90
|
}),
|
|
91
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ x("textarea", {
|
|
92
92
|
id: "proc-message",
|
|
93
93
|
rows: 2,
|
|
94
|
-
value:
|
|
95
|
-
onChange: (e) =>
|
|
96
|
-
placeholder:
|
|
97
|
-
className:
|
|
94
|
+
value: i,
|
|
95
|
+
onChange: (e) => a(e.target.value),
|
|
96
|
+
placeholder: n("procurement.message.placeholder", "Write to your procurement expert…"),
|
|
97
|
+
className: w
|
|
98
98
|
}),
|
|
99
|
-
|
|
99
|
+
r.error && /* @__PURE__ */ x("p", {
|
|
100
100
|
role: "alert",
|
|
101
101
|
className: "text-sm text-status-error-text",
|
|
102
|
-
children:
|
|
102
|
+
children: D(r.error)
|
|
103
103
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ x("button", {
|
|
105
105
|
type: "button",
|
|
106
|
-
disabled:
|
|
107
|
-
onClick: () =>
|
|
106
|
+
disabled: r.isPending || !i.trim(),
|
|
107
|
+
onClick: () => r.mutate({
|
|
108
108
|
id: e.id,
|
|
109
|
-
message:
|
|
110
|
-
}, { onSuccess: () =>
|
|
111
|
-
className:
|
|
112
|
-
children: o ?
|
|
109
|
+
message: i
|
|
110
|
+
}, { onSuccess: () => a("") }),
|
|
111
|
+
className: E,
|
|
112
|
+
children: o ? n("procurement.message.reply", "Reply to the expert") : n("procurement.message.send", "Send message")
|
|
113
113
|
})
|
|
114
114
|
]
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
let
|
|
119
|
-
return /* @__PURE__ */
|
|
117
|
+
function j({ request: e }) {
|
|
118
|
+
let { formatCurrency: r } = n(), i = t(), a = s[e.feeStatus];
|
|
119
|
+
return /* @__PURE__ */ S(C, {
|
|
120
120
|
treatment: "metric",
|
|
121
121
|
className: "p-5",
|
|
122
122
|
"data-testid": "procurement-outcome",
|
|
123
123
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ S("dl", {
|
|
125
125
|
className: "grid grid-cols-2 gap-4 sm:grid-cols-4",
|
|
126
126
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
label:
|
|
129
|
-
value: e.baselineAnnualValue == null ? "—" :
|
|
127
|
+
/* @__PURE__ */ x(O, {
|
|
128
|
+
label: i("procurement.outcome.baseline", "Baseline per year"),
|
|
129
|
+
value: e.baselineAnnualValue == null ? "—" : r(e.baselineAnnualValue, e.currency)
|
|
130
130
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
label:
|
|
133
|
-
value: e.finalAnnualValue == null ? "—" :
|
|
131
|
+
/* @__PURE__ */ x(O, {
|
|
132
|
+
label: i("procurement.outcome.final", "Negotiated per year"),
|
|
133
|
+
value: e.finalAnnualValue == null ? "—" : r(e.finalAnnualValue, e.currency)
|
|
134
134
|
}),
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
label:
|
|
137
|
-
value:
|
|
135
|
+
/* @__PURE__ */ x(O, {
|
|
136
|
+
label: i("procurement.outcome.firstYear", "First-year savings"),
|
|
137
|
+
value: r(e.firstYearSavings, e.currency)
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
label:
|
|
141
|
-
value:
|
|
139
|
+
/* @__PURE__ */ x(O, {
|
|
140
|
+
label: i("procurement.outcome.contract", "Savings over the term"),
|
|
141
|
+
value: r(e.contractSavings, e.currency)
|
|
142
142
|
}),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
label:
|
|
145
|
-
value:
|
|
143
|
+
/* @__PURE__ */ x(O, {
|
|
144
|
+
label: i("procurement.outcome.term", "Final term"),
|
|
145
|
+
value: i("procurement.fact.months", "{{count}} months", { count: e.finalTermMonths ?? e.termMonths })
|
|
146
146
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
label:
|
|
149
|
-
value: e.feeStatus === "NONE" ?
|
|
147
|
+
/* @__PURE__ */ x(O, {
|
|
148
|
+
label: i("procurement.outcome.fee", "Success fee"),
|
|
149
|
+
value: e.feeStatus === "NONE" ? i(a.key, a.fallback) : `${r(e.feeAmount, e.currency)} · ${i(a.key, a.fallback)}`
|
|
150
150
|
})
|
|
151
151
|
]
|
|
152
152
|
}),
|
|
153
|
-
e.nonPriceWins && /* @__PURE__ */
|
|
153
|
+
e.nonPriceWins && /* @__PURE__ */ x("p", {
|
|
154
154
|
className: "mt-4 text-sm text-text-primary",
|
|
155
|
-
children:
|
|
155
|
+
children: i("procurement.outcome.winsLabel", "Non-price wins: {{wins}}", { wins: e.nonPriceWins })
|
|
156
156
|
}),
|
|
157
|
-
e.outcomeSummary && /* @__PURE__ */
|
|
157
|
+
e.outcomeSummary && /* @__PURE__ */ x("p", {
|
|
158
158
|
className: "mt-2 text-sm text-text-primary",
|
|
159
159
|
children: e.outcomeSummary
|
|
160
160
|
})
|
|
161
161
|
]
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
let
|
|
164
|
+
function M() {
|
|
165
|
+
let { formatCurrency: s, formatDate: m, formatDateTime: h } = n(), g = t(), { id: _ } = b(), { navigateTo: w } = e(), { data: T, isLoading: M, isError: N, error: P, refetch: F } = p(_), I = f(), L = /* @__PURE__ */ S("button", {
|
|
166
166
|
type: "button",
|
|
167
|
-
onClick: () =>
|
|
167
|
+
onClick: () => w("/procurement"),
|
|
168
168
|
className: "inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
|
|
169
169
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ x(v, { className: "rtl:rotate-180 h-4 w-4" }),
|
|
171
171
|
" ",
|
|
172
|
-
|
|
172
|
+
g("procurement.back", "Back")
|
|
173
173
|
]
|
|
174
174
|
});
|
|
175
|
-
if (
|
|
176
|
-
if (
|
|
177
|
-
title:
|
|
178
|
-
actions:
|
|
179
|
-
children: /* @__PURE__ */
|
|
180
|
-
title:
|
|
181
|
-
message:
|
|
182
|
-
onRetry: () => void
|
|
175
|
+
if (M) return /* @__PURE__ */ x(a, { label: g("procurement.loadingOne", "Loading request…") });
|
|
176
|
+
if (N || !T) return /* @__PURE__ */ x(r, {
|
|
177
|
+
title: g("procurement.title", "Expert procurement"),
|
|
178
|
+
actions: L,
|
|
179
|
+
children: /* @__PURE__ */ x(i, {
|
|
180
|
+
title: g("procurement.notFound", "Procurement request not found"),
|
|
181
|
+
message: P instanceof Error ? P.message : void 0,
|
|
182
|
+
onRetry: () => void F()
|
|
183
183
|
})
|
|
184
184
|
});
|
|
185
|
-
let
|
|
186
|
-
return /* @__PURE__ */
|
|
187
|
-
title:
|
|
188
|
-
description: `${
|
|
189
|
-
actions:
|
|
185
|
+
let R = c.includes(T.status), z = T.status === "SUCCEEDED" || T.status === "NO_SAVINGS", B = l[T.requestType];
|
|
186
|
+
return /* @__PURE__ */ S(r, {
|
|
187
|
+
title: T.productName ? `${T.vendorName} · ${T.productName}` : T.vendorName,
|
|
188
|
+
description: `${g(B.key, B.fallback)}${T.category ? ` · ${T.category}` : ""}`,
|
|
189
|
+
actions: L,
|
|
190
190
|
children: [
|
|
191
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ S("div", {
|
|
192
192
|
className: "flex flex-wrap items-center gap-3",
|
|
193
193
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ x(u, { status: T.status }),
|
|
195
|
+
/* @__PURE__ */ x("span", {
|
|
196
196
|
className: "text-sm text-text-secondary",
|
|
197
|
-
children:
|
|
197
|
+
children: g("procurement.deadline", "Decide by {{date}}", { date: m(T.deadline) })
|
|
198
198
|
}),
|
|
199
|
-
|
|
199
|
+
T.submittedAt && /* @__PURE__ */ x("span", {
|
|
200
200
|
className: "text-xs text-text-secondary",
|
|
201
|
-
children:
|
|
201
|
+
children: g("procurement.submittedAt", "Submitted {{when}}", { when: h(T.submittedAt) })
|
|
202
202
|
})
|
|
203
203
|
]
|
|
204
204
|
}),
|
|
205
|
-
|
|
205
|
+
T.expertName && /* @__PURE__ */ S("p", {
|
|
206
206
|
className: "mt-3 inline-flex items-center gap-2 rounded-lg bg-[var(--color-accent-soft)] px-3 py-1.5 text-sm text-text-primary",
|
|
207
207
|
"data-testid": "procurement-expert",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
208
|
+
children: [/* @__PURE__ */ x(y, {
|
|
209
209
|
className: "h-4 w-4",
|
|
210
210
|
"aria-hidden": !0
|
|
211
|
-
}),
|
|
211
|
+
}), g("procurement.expert", "Your procurement expert: {{name}}", { name: T.expertName })]
|
|
212
212
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ S(C, {
|
|
214
214
|
treatment: "metric",
|
|
215
215
|
className: "mt-4 p-5",
|
|
216
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ S("dl", {
|
|
217
217
|
className: "grid grid-cols-2 gap-4 sm:grid-cols-4",
|
|
218
218
|
children: [
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
label:
|
|
221
|
-
value:
|
|
219
|
+
/* @__PURE__ */ x(O, {
|
|
220
|
+
label: g("procurement.fact.current", "Current per year"),
|
|
221
|
+
value: T.currentAnnualValue == null ? "—" : s(T.currentAnnualValue, T.currency)
|
|
222
222
|
}),
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
label:
|
|
225
|
-
value:
|
|
223
|
+
/* @__PURE__ */ x(O, {
|
|
224
|
+
label: g("procurement.fact.quoted", "Vendor quote per year"),
|
|
225
|
+
value: T.quotedAnnualValue == null ? "—" : s(T.quotedAnnualValue, T.currency)
|
|
226
226
|
}),
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
label:
|
|
229
|
-
value:
|
|
227
|
+
/* @__PURE__ */ x(O, {
|
|
228
|
+
label: g("procurement.fact.target", "Target per year"),
|
|
229
|
+
value: T.targetAnnualValue == null ? "—" : s(T.targetAnnualValue, T.currency)
|
|
230
230
|
}),
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
label:
|
|
233
|
-
value: `${
|
|
231
|
+
/* @__PURE__ */ x(O, {
|
|
232
|
+
label: g("procurement.fact.term", "Term and seats"),
|
|
233
|
+
value: `${g("procurement.fact.months", "{{count}} months", { count: T.termMonths })}${T.seats == null ? "" : ` · ${T.seats}`}`
|
|
234
234
|
})
|
|
235
235
|
]
|
|
236
|
-
}),
|
|
236
|
+
}), T.notes && /* @__PURE__ */ x("p", {
|
|
237
237
|
className: "mt-3 whitespace-pre-wrap text-sm text-text-secondary",
|
|
238
|
-
children:
|
|
238
|
+
children: T.notes
|
|
239
239
|
})]
|
|
240
240
|
}),
|
|
241
|
-
|
|
242
|
-
title:
|
|
243
|
-
children: /* @__PURE__ */
|
|
241
|
+
z && /* @__PURE__ */ x(o, {
|
|
242
|
+
title: g("procurement.section.outcome", "Outcome"),
|
|
243
|
+
children: /* @__PURE__ */ x(j, { request: T })
|
|
244
244
|
}),
|
|
245
|
-
|
|
246
|
-
title:
|
|
247
|
-
children: /* @__PURE__ */
|
|
245
|
+
T.status === "DRAFT" && /* @__PURE__ */ x(o, {
|
|
246
|
+
title: g("procurement.section.submit", "Submit"),
|
|
247
|
+
children: /* @__PURE__ */ x(k, { request: T })
|
|
248
248
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
title:
|
|
251
|
-
children: [
|
|
249
|
+
/* @__PURE__ */ S(o, {
|
|
250
|
+
title: g("procurement.section.thread", "Messages and timeline"),
|
|
251
|
+
children: [R && T.status !== "DRAFT" && /* @__PURE__ */ x("div", {
|
|
252
252
|
className: "mb-4",
|
|
253
|
-
children: /* @__PURE__ */
|
|
254
|
-
}), /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ x(A, { request: T })
|
|
254
|
+
}), /* @__PURE__ */ x(d, { events: T.events ?? [] })]
|
|
255
255
|
}),
|
|
256
|
-
|
|
256
|
+
R && /* @__PURE__ */ S("div", {
|
|
257
257
|
className: "mt-8 border-t border-border-subtle pt-4",
|
|
258
|
-
children: [
|
|
258
|
+
children: [I.error && /* @__PURE__ */ x("p", {
|
|
259
259
|
role: "alert",
|
|
260
260
|
className: "mb-2 text-sm text-status-error-text",
|
|
261
|
-
children:
|
|
262
|
-
}), /* @__PURE__ */
|
|
261
|
+
children: D(I.error)
|
|
262
|
+
}), /* @__PURE__ */ x("button", {
|
|
263
263
|
type: "button",
|
|
264
|
-
disabled:
|
|
265
|
-
onClick: () =>
|
|
266
|
-
className:
|
|
267
|
-
children:
|
|
264
|
+
disabled: I.isPending,
|
|
265
|
+
onClick: () => I.mutate({ id: T.id }),
|
|
266
|
+
className: E,
|
|
267
|
+
children: T.status === "DRAFT" ? g("procurement.cancel.draft", "Discard draft") : g("procurement.cancel.submitted", "Withdraw request and authorisation")
|
|
268
268
|
})]
|
|
269
269
|
})
|
|
270
270
|
]
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
//#endregion
|
|
274
|
-
export {
|
|
274
|
+
export { M as ProcurementDetailPage };
|
|
275
275
|
|
|
276
276
|
//# sourceMappingURL=ProcurementDetailPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcurementDetailPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/procurement/ProcurementDetailPage.tsx"],"sourcesContent":["/**\n * Expert procurement request detail\n * @module subscriberbot/pages/procurement\n *\n * `/subscriberbot/procurement/:id` — the contract details, submission under\n * the procurement authorisation, the assigned expert, the message thread with\n * the expert, the negotiated outcome with savings and the success fee. Every\n * action is a real `Sub*Procurement*` mutation.\n */\n\nimport { useState } from 'react';\nimport { useParams } from 'react-router';\nimport { ArrowLeft, UserRoundCheck } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { ErrorView, LoadingView, PageLayout, Section } from '../../components';\nimport {\n FEE_STATUS_LABEL,\n OPEN_STATUSES,\n ProcurementStatusPill,\n ProcurementThread,\n REQUEST_TYPE_LABEL,\n} from '../../components/procurement';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useCancelProcurementRequest,\n useProcurementRequest,\n useProcurementTerms,\n useSendProcurementMessage,\n useSubmitProcurementRequest,\n} from '../../hooks/useProcurementApi';\nimport { useTr } from '../../hooks/useTr';\nimport { formatCurrency, formatDate, formatDateTime } from '../../utils/formatters';\nimport type { SubProcurementRequest } 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 primaryBtn =\n 'rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\nconst secondaryBtn =\n 'rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\n\nconst errorText = (err: unknown): string | null =>\n err ? (err instanceof Error ? err.message : String(err)) : null;\n\nfunction Fact({ label, value }: { label: string; value: string }) {\n return (\n <div>\n <dt className=\"text-xs text-text-secondary\">{label}</dt>\n <dd className=\"mt-0.5 text-sm font-medium text-text-primary\">{value}</dd>\n </div>\n );\n}\n\nfunction SubmitPanel({ request }: { request: SubProcurementRequest }) {\n const tr = useTr();\n const terms = useProcurementTerms();\n const submit = useSubmitProcurementRequest();\n const [accepted, setAccepted] = useState(false);\n\n return (\n <GlassCard treatment=\"metric\" className=\"space-y-3 p-5\" data-testid=\"procurement-submit\">\n <p className=\"text-sm text-text-primary\">\n {tr(\n 'procurement.submit.intro',\n 'Submit this request to the Subscriber Bot procurement desk. An expert is assigned, negotiates with the vendor and keeps you posted here.'\n )}\n </p>\n {terms.data && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken p-3\">\n <p\n className=\"text-xs leading-relaxed text-text-secondary\"\n data-testid=\"procurement-terms\"\n >\n {terms.data.authorizationText}\n </p>\n <label className=\"mt-3 inline-flex items-start gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={accepted}\n onChange={(e) => setAccepted(e.target.checked)}\n className=\"mt-0.5\"\n />\n {tr('procurement.submit.accept', 'I authorise the procurement desk on these terms')}\n </label>\n </div>\n )}\n {submit.error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {errorText(submit.error)}\n </p>\n )}\n <button\n type=\"button\"\n onClick={() =>\n terms.data &&\n submit.mutate({\n id: request.id,\n input: {\n acceptAuthorization: accepted,\n authorizationVersion: terms.data.authorizationVersion,\n },\n })\n }\n disabled={submit.isPending || !accepted || !terms.data}\n className={primaryBtn}\n >\n {tr('procurement.submit.cta', 'Submit to the procurement desk')}\n </button>\n </GlassCard>\n );\n}\n\nfunction MessagePanel({ request }: { request: SubProcurementRequest }) {\n const tr = useTr();\n const send = useSendProcurementMessage();\n const [message, setMessage] = useState('');\n const awaiting = request.status === 'AWAITING_CUSTOMER';\n return (\n <div className=\"space-y-2\" data-testid=\"procurement-message\">\n {awaiting && (\n <p className=\"rounded-lg bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text\">\n {tr(\n 'procurement.message.awaiting',\n 'Your procurement expert is waiting for your reply. See the latest message below.'\n )}\n </p>\n )}\n <label htmlFor=\"proc-message\" className=\"sr-only\">\n {tr('procurement.message.label', 'Message')}\n </label>\n <textarea\n id=\"proc-message\"\n rows={2}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={tr('procurement.message.placeholder', 'Write to your procurement expert…')}\n className={inputCls}\n />\n {send.error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {errorText(send.error)}\n </p>\n )}\n <button\n type=\"button\"\n disabled={send.isPending || !message.trim()}\n onClick={() =>\n send.mutate({ id: request.id, message }, { onSuccess: () => setMessage('') })\n }\n className={secondaryBtn}\n >\n {awaiting\n ? tr('procurement.message.reply', 'Reply to the expert')\n : tr('procurement.message.send', 'Send message')}\n </button>\n </div>\n );\n}\n\nfunction OutcomeSummary({ request: p }: { request: SubProcurementRequest }) {\n const tr = useTr();\n const fee = FEE_STATUS_LABEL[p.feeStatus];\n return (\n <GlassCard treatment=\"metric\" className=\"p-5\" data-testid=\"procurement-outcome\">\n <dl className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <Fact\n label={tr('procurement.outcome.baseline', 'Baseline per year')}\n value={\n p.baselineAnnualValue != null ? formatCurrency(p.baselineAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.outcome.final', 'Negotiated per year')}\n value={p.finalAnnualValue != null ? formatCurrency(p.finalAnnualValue, p.currency) : '—'}\n />\n <Fact\n label={tr('procurement.outcome.firstYear', 'First-year savings')}\n value={formatCurrency(p.firstYearSavings, p.currency)}\n />\n <Fact\n label={tr('procurement.outcome.contract', 'Savings over the term')}\n value={formatCurrency(p.contractSavings, p.currency)}\n />\n <Fact\n label={tr('procurement.outcome.term', 'Final term')}\n value={tr('procurement.fact.months', '{{count}} months', {\n count: p.finalTermMonths ?? p.termMonths,\n })}\n />\n <Fact\n label={tr('procurement.outcome.fee', 'Success fee')}\n value={\n p.feeStatus === 'NONE'\n ? tr(fee.key, fee.fallback)\n : `${formatCurrency(p.feeAmount, p.currency)} · ${tr(fee.key, fee.fallback)}`\n }\n />\n </dl>\n {p.nonPriceWins && (\n <p className=\"mt-4 text-sm text-text-primary\">\n {tr('procurement.outcome.winsLabel', 'Non-price wins: {{wins}}', {\n wins: p.nonPriceWins,\n })}\n </p>\n )}\n {p.outcomeSummary && <p className=\"mt-2 text-sm text-text-primary\">{p.outcomeSummary}</p>}\n </GlassCard>\n );\n}\n\nexport function ProcurementDetailPage() {\n const tr = useTr();\n const { id } = useParams<{ id: string }>();\n const { navigateTo } = useSubscriberBot();\n const { data: p, isLoading, isError, error, refetch } = useProcurementRequest(id);\n const cancel = useCancelProcurementRequest();\n\n const back = (\n <button\n type=\"button\"\n onClick={() => navigateTo('/procurement')}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> {tr('procurement.back', 'Back')}\n </button>\n );\n\n if (isLoading) return <LoadingView label={tr('procurement.loadingOne', 'Loading request…')} />;\n if (isError || !p) {\n return (\n <PageLayout title={tr('procurement.title', 'Expert procurement')} actions={back}>\n <ErrorView\n title={tr('procurement.notFound', 'Procurement request not found')}\n message={error instanceof Error ? error.message : undefined}\n onRetry={() => void refetch()}\n />\n </PageLayout>\n );\n }\n\n const open = OPEN_STATUSES.includes(p.status);\n const finished = p.status === 'SUCCEEDED' || p.status === 'NO_SAVINGS';\n const typeLabel = REQUEST_TYPE_LABEL[p.requestType];\n\n return (\n <PageLayout\n title={p.productName ? `${p.vendorName} · ${p.productName}` : p.vendorName}\n description={`${tr(typeLabel.key, typeLabel.fallback)}${p.category ? ` · ${p.category}` : ''}`}\n actions={back}\n >\n <div className=\"flex flex-wrap items-center gap-3\">\n <ProcurementStatusPill status={p.status} />\n <span className=\"text-sm text-text-secondary\">\n {tr('procurement.deadline', 'Decide by {{date}}', { date: formatDate(p.deadline) })}\n </span>\n {p.submittedAt && (\n <span className=\"text-xs text-text-secondary\">\n {tr('procurement.submittedAt', 'Submitted {{when}}', {\n when: formatDateTime(p.submittedAt),\n })}\n </span>\n )}\n </div>\n\n {p.expertName && (\n <p\n className=\"mt-3 inline-flex items-center gap-2 rounded-lg bg-[var(--color-accent-soft)] px-3 py-1.5 text-sm text-text-primary\"\n data-testid=\"procurement-expert\"\n >\n <UserRoundCheck className=\"h-4 w-4\" aria-hidden />\n {tr('procurement.expert', 'Your procurement expert: {{name}}', { name: p.expertName })}\n </p>\n )}\n\n <GlassCard treatment=\"metric\" className=\"mt-4 p-5\">\n <dl className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <Fact\n label={tr('procurement.fact.current', 'Current per year')}\n value={\n p.currentAnnualValue != null ? formatCurrency(p.currentAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.fact.quoted', 'Vendor quote per year')}\n value={\n p.quotedAnnualValue != null ? formatCurrency(p.quotedAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.fact.target', 'Target per year')}\n value={\n p.targetAnnualValue != null ? formatCurrency(p.targetAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.fact.term', 'Term and seats')}\n value={`${tr('procurement.fact.months', '{{count}} months', { count: p.termMonths })}${\n p.seats != null ? ` · ${p.seats}` : ''\n }`}\n />\n </dl>\n {p.notes && (\n <p className=\"mt-3 whitespace-pre-wrap text-sm text-text-secondary\">{p.notes}</p>\n )}\n </GlassCard>\n\n {finished && (\n <Section title={tr('procurement.section.outcome', 'Outcome')}>\n <OutcomeSummary request={p} />\n </Section>\n )}\n\n {p.status === 'DRAFT' && (\n <Section title={tr('procurement.section.submit', 'Submit')}>\n <SubmitPanel request={p} />\n </Section>\n )}\n\n <Section title={tr('procurement.section.thread', 'Messages and timeline')}>\n {open && p.status !== 'DRAFT' && (\n <div className=\"mb-4\">\n <MessagePanel request={p} />\n </div>\n )}\n <ProcurementThread events={p.events ?? []} />\n </Section>\n\n {open && (\n <div className=\"mt-8 border-t border-border-subtle pt-4\">\n {cancel.error && (\n <p role=\"alert\" className=\"mb-2 text-sm text-status-error-text\">\n {errorText(cancel.error)}\n </p>\n )}\n <button\n type=\"button\"\n disabled={cancel.isPending}\n onClick={() => cancel.mutate({ id: p.id })}\n className={secondaryBtn}\n >\n {p.status === 'DRAFT'\n ? tr('procurement.cancel.draft', 'Discard draft')\n : tr('procurement.cancel.submitted', 'Withdraw request and authorisation')}\n </button>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,IAAM,IACJ,wMACI,IACJ,+HACI,IACJ,iIAEI,KAAa,MACjB,IAAO,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,IAAK;AAE7D,SAAS,EAAK,EAAE,UAAO,YAA2C;CAChE,OACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;EAAI,WAAU;YAA+B;CAAU,CAAA,GACvD,kBAAC,MAAD;EAAI,WAAU;YAAgD;CAAU,CAAA,CACrE,EAAA,CAAA;AAET;AAEA,SAAS,EAAY,EAAE,cAA+C;CACpE,IAAM,IAAK,EAAM,GACX,IAAQ,EAAoB,GAC5B,IAAS,EAA4B,GACrC,CAAC,GAAU,KAAe,EAAS,EAAK;CAE9C,OACE,kBAAC,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AAG,2BAA2B,oBAAoB,EAAE,OAAO,EAAE,WAAW,CAAC,IACjF,EAAE,SAAS,OAAyB,KAAlB,MAAM,EAAE;MAE7B,CAAA;KACC;QACH,EAAE,SACD,kBAAC,KAAD;KAAG,WAAU;eAAwD,EAAE;IAAS,CAAA,CAEzE;;GAEV,KACC,kBAAC,GAAD;IAAS,OAAO,EAAG,+BAA+B,SAAS;cACzD,kBAAC,GAAD,EAAgB,SAAS,EAAI,CAAA;GACtB,CAAA;GAGV,EAAE,WAAW,WACZ,kBAAC,GAAD;IAAS,OAAO,EAAG,8BAA8B,QAAQ;cACvD,kBAAC,GAAD,EAAa,SAAS,EAAI,CAAA;GACnB,CAAA;GAGX,kBAAC,GAAD;IAAS,OAAO,EAAG,8BAA8B,uBAAuB;cAAxE,CACG,KAAQ,EAAE,WAAW,WACpB,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAc,SAAS,EAAI,CAAA;IACxB,CAAA,GAEP,kBAAC,GAAD,EAAmB,QAAQ,EAAE,UAAU,CAAC,EAAI,CAAA,CACrC;;GAER,KACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,EAAO,SACN,kBAAC,KAAD;KAAG,MAAK;KAAQ,WAAU;eACvB,EAAU,EAAO,KAAK;IACtB,CAAA,GAEL,kBAAC,UAAD;KACE,MAAK;KACL,UAAU,EAAO;KACjB,eAAe,EAAO,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC;KACzC,WAAW;eAEV,EAAE,WAAW,UACV,EAAG,4BAA4B,eAAe,IAC9C,EAAG,gCAAgC,oCAAoC;IACrE,CAAA,CACL;;EAEG;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"ProcurementDetailPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/procurement/ProcurementDetailPage.tsx"],"sourcesContent":["import { useFormatters } from '../../hooks/useFormatters';\n/**\n * Expert procurement request detail\n * @module subscriberbot/pages/procurement\n *\n * `/subscriberbot/procurement/:id` — the contract details, submission under\n * the procurement authorisation, the assigned expert, the message thread with\n * the expert, the negotiated outcome with savings and the success fee. Every\n * action is a real `Sub*Procurement*` mutation.\n */\n\nimport { useState } from 'react';\nimport { useParams } from 'react-router';\nimport { ArrowLeft, UserRoundCheck } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { ErrorView, LoadingView, PageLayout, Section } from '../../components';\nimport {\n FEE_STATUS_LABEL,\n OPEN_STATUSES,\n ProcurementStatusPill,\n ProcurementThread,\n REQUEST_TYPE_LABEL,\n} from '../../components/procurement';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport {\n useCancelProcurementRequest,\n useProcurementRequest,\n useProcurementTerms,\n useSendProcurementMessage,\n useSubmitProcurementRequest,\n} from '../../hooks/useProcurementApi';\nimport { useTr } from '../../hooks/useTr';\n\nimport type { SubProcurementRequest } 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 primaryBtn =\n 'rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\nconst secondaryBtn =\n 'rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\n\nconst errorText = (err: unknown): string | null =>\n err ? (err instanceof Error ? err.message : String(err)) : null;\n\nfunction Fact({ label, value }: { label: string; value: string }) {\n return (\n <div>\n <dt className=\"text-xs text-text-secondary\">{label}</dt>\n <dd className=\"mt-0.5 text-sm font-medium text-text-primary\">{value}</dd>\n </div>\n );\n}\n\nfunction SubmitPanel({ request }: { request: SubProcurementRequest }) {\n const tr = useTr();\n const terms = useProcurementTerms();\n const submit = useSubmitProcurementRequest();\n const [accepted, setAccepted] = useState(false);\n\n return (\n <GlassCard treatment=\"metric\" className=\"space-y-3 p-5\" data-testid=\"procurement-submit\">\n <p className=\"text-sm text-text-primary\">\n {tr(\n 'procurement.submit.intro',\n 'Submit this request to the Subscriber Bot procurement desk. An expert is assigned, negotiates with the vendor and keeps you posted here.'\n )}\n </p>\n {terms.data && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-sunken p-3\">\n <p\n className=\"text-xs leading-relaxed text-text-secondary\"\n data-testid=\"procurement-terms\"\n >\n {terms.data.authorizationText}\n </p>\n <label className=\"mt-3 inline-flex items-start gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={accepted}\n onChange={(e) => setAccepted(e.target.checked)}\n className=\"mt-0.5\"\n />\n {tr('procurement.submit.accept', 'I authorise the procurement desk on these terms')}\n </label>\n </div>\n )}\n {submit.error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {errorText(submit.error)}\n </p>\n )}\n <button\n type=\"button\"\n onClick={() =>\n terms.data &&\n submit.mutate({\n id: request.id,\n input: {\n acceptAuthorization: accepted,\n authorizationVersion: terms.data.authorizationVersion,\n },\n })\n }\n disabled={submit.isPending || !accepted || !terms.data}\n className={primaryBtn}\n >\n {tr('procurement.submit.cta', 'Submit to the procurement desk')}\n </button>\n </GlassCard>\n );\n}\n\nfunction MessagePanel({ request }: { request: SubProcurementRequest }) {\n const tr = useTr();\n const send = useSendProcurementMessage();\n const [message, setMessage] = useState('');\n const awaiting = request.status === 'AWAITING_CUSTOMER';\n return (\n <div className=\"space-y-2\" data-testid=\"procurement-message\">\n {awaiting && (\n <p className=\"rounded-lg bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text\">\n {tr(\n 'procurement.message.awaiting',\n 'Your procurement expert is waiting for your reply. See the latest message below.'\n )}\n </p>\n )}\n <label htmlFor=\"proc-message\" className=\"sr-only\">\n {tr('procurement.message.label', 'Message')}\n </label>\n <textarea\n id=\"proc-message\"\n rows={2}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={tr('procurement.message.placeholder', 'Write to your procurement expert…')}\n className={inputCls}\n />\n {send.error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {errorText(send.error)}\n </p>\n )}\n <button\n type=\"button\"\n disabled={send.isPending || !message.trim()}\n onClick={() =>\n send.mutate({ id: request.id, message }, { onSuccess: () => setMessage('') })\n }\n className={secondaryBtn}\n >\n {awaiting\n ? tr('procurement.message.reply', 'Reply to the expert')\n : tr('procurement.message.send', 'Send message')}\n </button>\n </div>\n );\n}\n\nfunction OutcomeSummary({ request: p }: { request: SubProcurementRequest }) {\n const { formatCurrency } = useFormatters();\n\n const tr = useTr();\n const fee = FEE_STATUS_LABEL[p.feeStatus];\n return (\n <GlassCard treatment=\"metric\" className=\"p-5\" data-testid=\"procurement-outcome\">\n <dl className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <Fact\n label={tr('procurement.outcome.baseline', 'Baseline per year')}\n value={\n p.baselineAnnualValue != null ? formatCurrency(p.baselineAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.outcome.final', 'Negotiated per year')}\n value={p.finalAnnualValue != null ? formatCurrency(p.finalAnnualValue, p.currency) : '—'}\n />\n <Fact\n label={tr('procurement.outcome.firstYear', 'First-year savings')}\n value={formatCurrency(p.firstYearSavings, p.currency)}\n />\n <Fact\n label={tr('procurement.outcome.contract', 'Savings over the term')}\n value={formatCurrency(p.contractSavings, p.currency)}\n />\n <Fact\n label={tr('procurement.outcome.term', 'Final term')}\n value={tr('procurement.fact.months', '{{count}} months', {\n count: p.finalTermMonths ?? p.termMonths,\n })}\n />\n <Fact\n label={tr('procurement.outcome.fee', 'Success fee')}\n value={\n p.feeStatus === 'NONE'\n ? tr(fee.key, fee.fallback)\n : `${formatCurrency(p.feeAmount, p.currency)} · ${tr(fee.key, fee.fallback)}`\n }\n />\n </dl>\n {p.nonPriceWins && (\n <p className=\"mt-4 text-sm text-text-primary\">\n {tr('procurement.outcome.winsLabel', 'Non-price wins: {{wins}}', {\n wins: p.nonPriceWins,\n })}\n </p>\n )}\n {p.outcomeSummary && <p className=\"mt-2 text-sm text-text-primary\">{p.outcomeSummary}</p>}\n </GlassCard>\n );\n}\n\nexport function ProcurementDetailPage() {\n const { formatCurrency, formatDate, formatDateTime } = useFormatters();\n\n const tr = useTr();\n const { id } = useParams<{ id: string }>();\n const { navigateTo } = useSubscriberBot();\n const { data: p, isLoading, isError, error, refetch } = useProcurementRequest(id);\n const cancel = useCancelProcurementRequest();\n\n const back = (\n <button\n type=\"button\"\n onClick={() => navigateTo('/procurement')}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n >\n <ArrowLeft className=\"rtl:rotate-180 h-4 w-4\" /> {tr('procurement.back', 'Back')}\n </button>\n );\n\n if (isLoading) return <LoadingView label={tr('procurement.loadingOne', 'Loading request…')} />;\n if (isError || !p) {\n return (\n <PageLayout title={tr('procurement.title', 'Expert procurement')} actions={back}>\n <ErrorView\n title={tr('procurement.notFound', 'Procurement request not found')}\n message={error instanceof Error ? error.message : undefined}\n onRetry={() => void refetch()}\n />\n </PageLayout>\n );\n }\n\n const open = OPEN_STATUSES.includes(p.status);\n const finished = p.status === 'SUCCEEDED' || p.status === 'NO_SAVINGS';\n const typeLabel = REQUEST_TYPE_LABEL[p.requestType];\n\n return (\n <PageLayout\n title={p.productName ? `${p.vendorName} · ${p.productName}` : p.vendorName}\n description={`${tr(typeLabel.key, typeLabel.fallback)}${p.category ? ` · ${p.category}` : ''}`}\n actions={back}\n >\n <div className=\"flex flex-wrap items-center gap-3\">\n <ProcurementStatusPill status={p.status} />\n <span className=\"text-sm text-text-secondary\">\n {tr('procurement.deadline', 'Decide by {{date}}', { date: formatDate(p.deadline) })}\n </span>\n {p.submittedAt && (\n <span className=\"text-xs text-text-secondary\">\n {tr('procurement.submittedAt', 'Submitted {{when}}', {\n when: formatDateTime(p.submittedAt),\n })}\n </span>\n )}\n </div>\n\n {p.expertName && (\n <p\n className=\"mt-3 inline-flex items-center gap-2 rounded-lg bg-[var(--color-accent-soft)] px-3 py-1.5 text-sm text-text-primary\"\n data-testid=\"procurement-expert\"\n >\n <UserRoundCheck className=\"h-4 w-4\" aria-hidden />\n {tr('procurement.expert', 'Your procurement expert: {{name}}', { name: p.expertName })}\n </p>\n )}\n\n <GlassCard treatment=\"metric\" className=\"mt-4 p-5\">\n <dl className=\"grid grid-cols-2 gap-4 sm:grid-cols-4\">\n <Fact\n label={tr('procurement.fact.current', 'Current per year')}\n value={\n p.currentAnnualValue != null ? formatCurrency(p.currentAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.fact.quoted', 'Vendor quote per year')}\n value={\n p.quotedAnnualValue != null ? formatCurrency(p.quotedAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.fact.target', 'Target per year')}\n value={\n p.targetAnnualValue != null ? formatCurrency(p.targetAnnualValue, p.currency) : '—'\n }\n />\n <Fact\n label={tr('procurement.fact.term', 'Term and seats')}\n value={`${tr('procurement.fact.months', '{{count}} months', { count: p.termMonths })}${\n p.seats != null ? ` · ${p.seats}` : ''\n }`}\n />\n </dl>\n {p.notes && (\n <p className=\"mt-3 whitespace-pre-wrap text-sm text-text-secondary\">{p.notes}</p>\n )}\n </GlassCard>\n\n {finished && (\n <Section title={tr('procurement.section.outcome', 'Outcome')}>\n <OutcomeSummary request={p} />\n </Section>\n )}\n\n {p.status === 'DRAFT' && (\n <Section title={tr('procurement.section.submit', 'Submit')}>\n <SubmitPanel request={p} />\n </Section>\n )}\n\n <Section title={tr('procurement.section.thread', 'Messages and timeline')}>\n {open && p.status !== 'DRAFT' && (\n <div className=\"mb-4\">\n <MessagePanel request={p} />\n </div>\n )}\n <ProcurementThread events={p.events ?? []} />\n </Section>\n\n {open && (\n <div className=\"mt-8 border-t border-border-subtle pt-4\">\n {cancel.error && (\n <p role=\"alert\" className=\"mb-2 text-sm text-status-error-text\">\n {errorText(cancel.error)}\n </p>\n )}\n <button\n type=\"button\"\n disabled={cancel.isPending}\n onClick={() => cancel.mutate({ id: p.id })}\n className={secondaryBtn}\n >\n {p.status === 'DRAFT'\n ? tr('procurement.cancel.draft', 'Discard draft')\n : tr('procurement.cancel.submitted', 'Withdraw request and authorisation')}\n </button>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,IAAM,IACJ,wMACI,IACJ,+HACI,IACJ,iIAEI,KAAa,MACjB,IAAO,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,IAAK;AAE7D,SAAS,EAAK,EAAE,UAAO,YAA2C;CAChE,OACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;EAAI,WAAU;YAA+B;CAAU,CAAA,GACvD,kBAAC,MAAD;EAAI,WAAU;YAAgD;CAAU,CAAA,CACrE,EAAA,CAAA;AAET;AAEA,SAAS,EAAY,EAAE,cAA+C;CACpE,IAAM,IAAK,EAAM,GACX,IAAQ,EAAoB,GAC5B,IAAS,EAA4B,GACrC,CAAC,GAAU,KAAe,EAAS,EAAK;CAE9C,OACE,kBAAC,GAAD;EAAW,WAAU;EAAS,WAAU;EAAgB,eAAY;YAApE;GACE,kBAAC,KAAD;IAAG,WAAU;cACV,EACC,4BACA,0IACF;GACC,CAAA;GACF,EAAM,QACL,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,KAAD;KACE,WAAU;KACV,eAAY;eAEX,EAAM,KAAK;IACX,CAAA,GACH,kBAAC,SAAD;KAAO,WAAU;eAAjB,CACE,kBAAC,SAAD;MACE,MAAK;MACL,SAAS;MACT,WAAW,MAAM,EAAY,EAAE,OAAO,OAAO;MAC7C,WAAU;KACX,CAAA,GACA,EAAG,6BAA6B,iDAAiD,CAC7E;MACJ;;GAEN,EAAO,SACN,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB,EAAU,EAAO,KAAK;GACtB,CAAA;GAEL,kBAAC,UAAD;IACE,MAAK;IACL,eACE,EAAM,QACN,EAAO,OAAO;KACZ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Q,EAAE,WAAW,WACpB,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAc,SAAS,EAAI,CAAA;IACxB,CAAA,GAEP,kBAAC,GAAD,EAAmB,QAAQ,EAAE,UAAU,CAAC,EAAI,CAAA,CACrC;;GAER,KACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACG,EAAO,SACN,kBAAC,KAAD;KAAG,MAAK;KAAQ,WAAU;eACvB,EAAU,EAAO,KAAK;IACtB,CAAA,GAEL,kBAAC,UAAD;KACE,MAAK;KACL,UAAU,EAAO;KACjB,eAAe,EAAO,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC;KACzC,WAAW;eAEV,EAAE,WAAW,UACV,EAAG,4BAA4B,eAAe,IAC9C,EAAG,gCAAgC,oCAAoC;IACrE,CAAA,CACL;;EAEG;;AAEhB"}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* New expert procurement request
|
|
3
|
-
* @module subscriberbot/pages/procurement
|
|
4
|
-
*
|
|
5
|
-
* `/subscriberbot/procurement/new[?relationshipId=…]` — describe the contract
|
|
6
|
-
* (vendor, current price or quote, term, seats, decision deadline,
|
|
7
|
-
* priorities). Creates a DRAFT through `subCreateProcurementRequest`; the
|
|
8
|
-
* customer accepts the procurement authorisation and submits from the detail
|
|
9
|
-
* page.
|
|
10
|
-
*/
|
|
11
1
|
export declare function ProcurementNewPage(): import("react").JSX.Element;
|
|
12
2
|
//# sourceMappingURL=ProcurementNewPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcurementNewPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/procurement/ProcurementNewPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProcurementNewPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/procurement/ProcurementNewPage.tsx"],"names":[],"mappings":"AA+EA,wBAAgB,kBAAkB,gCAiajC"}
|