@burdenoff/microfe-subscriberbot 2026.1102.1 → 2026.1102.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/stories/pages/ProcurementDetailPage.stories.d.ts +10 -0
- package/dist/stories/pages/ProcurementDetailPage.stories.d.ts.map +1 -0
- package/dist/stories/pages/ProcurementNewPage.stories.d.ts +9 -0
- package/dist/stories/pages/ProcurementNewPage.stories.d.ts.map +1 -0
- package/dist/stories/pages/ProcurementPage.stories.d.ts +11 -0
- package/dist/stories/pages/ProcurementPage.stories.d.ts.map +1 -0
- package/dist/stories/support/procurementFixtures.d.ts +14 -0
- package/dist/stories/support/procurementFixtures.d.ts.map +1 -0
- package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.js +20 -8
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.js +170 -160
- package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts +4 -0
- package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +1 -0
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js +450 -0
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -0
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts +12 -0
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +1 -0
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +155 -0
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -0
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.d.ts +8 -0
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.d.ts.map +1 -0
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +18 -0
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js.map +1 -0
- package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts +13 -0
- package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +1 -0
- package/dist/subscriberbot/components/procurement/ProcurementThread.js +51 -0
- package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -0
- package/dist/subscriberbot/components/procurement/index.d.ts +5 -0
- package/dist/subscriberbot/components/procurement/index.d.ts.map +1 -0
- package/dist/subscriberbot/components/procurement/index.js +4 -0
- package/dist/subscriberbot/components/procurement/labels.d.ts +16 -0
- package/dist/subscriberbot/components/procurement/labels.d.ts.map +1 -0
- package/dist/subscriberbot/components/procurement/labels.js +154 -0
- package/dist/subscriberbot/components/procurement/labels.js.map +1 -0
- package/dist/subscriberbot/hooks/useProcurementApi.d.ts +58 -0
- package/dist/subscriberbot/hooks/useProcurementApi.d.ts.map +1 -0
- package/dist/subscriberbot/hooks/useProcurementApi.js +128 -0
- package/dist/subscriberbot/hooks/useProcurementApi.js.map +1 -0
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +11 -0
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +1 -0
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +276 -0
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -0
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +12 -0
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +1 -0
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +362 -0
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -0
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +11 -0
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +1 -0
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js +156 -0
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -0
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +323 -312
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/types/procurement.d.ts +127 -0
- package/dist/subscriberbot/types/procurement.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SubConnection } from '../types';
|
|
2
|
+
import { SubCreateProcurementRequestInput, SubProcurementExpert, SubProcurementRequest, SubProcurementStatus, SubProcurementSummary, SubProcurementTerms, SubRecordProcurementOutcomeInput, SubUpsertProcurementExpertInput } from '../types/procurement';
|
|
3
|
+
|
|
4
|
+
export type ProcurementDeskView = 'ALL' | 'UNASSIGNED' | 'MINE';
|
|
5
|
+
export declare const useProcurementTerms: () => import('@tanstack/react-query').UseQueryResult<SubProcurementTerms, Error>;
|
|
6
|
+
/** Cursor-paged list of the workspace's requests; `fetchNextPage` loads more. */
|
|
7
|
+
export declare const useProcurementRequests: (status?: SubProcurementStatus | null) => import('@tanstack/react-query').UseInfiniteQueryResult<import('@tanstack/query-core').InfiniteData<SubConnection<SubProcurementRequest>, unknown>, Error>;
|
|
8
|
+
export declare const useProcurementRequest: (id: string | undefined) => import('@tanstack/react-query').UseQueryResult<SubProcurementRequest | null, Error>;
|
|
9
|
+
export declare const useProcurementSummary: () => import('@tanstack/react-query').UseQueryResult<SubProcurementSummary, Error>;
|
|
10
|
+
export declare const useCreateProcurementRequest: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
11
|
+
input: SubCreateProcurementRequestInput;
|
|
12
|
+
}, unknown>;
|
|
13
|
+
export declare const useSubmitProcurementRequest: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
14
|
+
id: string;
|
|
15
|
+
input: {
|
|
16
|
+
acceptAuthorization: boolean;
|
|
17
|
+
authorizationVersion: string;
|
|
18
|
+
};
|
|
19
|
+
}, unknown>;
|
|
20
|
+
export declare const useCancelProcurementRequest: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
21
|
+
id: string;
|
|
22
|
+
reason?: string | null;
|
|
23
|
+
}, unknown>;
|
|
24
|
+
export declare const useSendProcurementMessage: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
25
|
+
id: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}, unknown>;
|
|
28
|
+
export declare const useDeskProcurementRequests: (status?: SubProcurementStatus | null, view?: ProcurementDeskView) => import('@tanstack/react-query').UseInfiniteQueryResult<import('@tanstack/query-core').InfiniteData<SubConnection<SubProcurementRequest>, unknown>, Error>;
|
|
29
|
+
export declare const useProcurementExperts: () => import('@tanstack/react-query').UseQueryResult<SubProcurementExpert[], Error>;
|
|
30
|
+
export declare const useUpsertProcurementExpert: () => import('@tanstack/react-query').UseMutationResult<SubProcurementExpert, Error, {
|
|
31
|
+
input: SubUpsertProcurementExpertInput;
|
|
32
|
+
}, unknown>;
|
|
33
|
+
export declare const useDeskAssignProcurement: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
34
|
+
id: string;
|
|
35
|
+
expertId?: string | null;
|
|
36
|
+
}, unknown>;
|
|
37
|
+
export declare const useDeskSetProcurementStatus: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
38
|
+
id: string;
|
|
39
|
+
status: SubProcurementStatus;
|
|
40
|
+
message?: string | null;
|
|
41
|
+
}, unknown>;
|
|
42
|
+
export declare const useDeskSendProcurementMessage: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
43
|
+
id: string;
|
|
44
|
+
message: string;
|
|
45
|
+
internal?: boolean;
|
|
46
|
+
}, unknown>;
|
|
47
|
+
export declare const useDeskRecordProcurementOutcome: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
48
|
+
id: string;
|
|
49
|
+
input: SubRecordProcurementOutcomeInput;
|
|
50
|
+
}, unknown>;
|
|
51
|
+
export declare const useDeskRetryProcurementFee: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
52
|
+
id: string;
|
|
53
|
+
}, unknown>;
|
|
54
|
+
export declare const useDeskWaiveProcurementFee: () => import('@tanstack/react-query').UseMutationResult<SubProcurementRequest, Error, {
|
|
55
|
+
id: string;
|
|
56
|
+
reason: string;
|
|
57
|
+
}, unknown>;
|
|
58
|
+
//# sourceMappingURL=useProcurementApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProcurementApi.d.ts","sourceRoot":"","sources":["../../../src/subscriberbot/hooks/useProcurementApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EACV,gCAAgC,EAChC,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAG9B,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC;AA2BhE,eAAO,MAAM,mBAAmB,kFAgB/B,CAAC;AAQF,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,GAAI,SAAQ,oBAAoB,GAAG,IAAW,8JAsBhF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,IAAI,MAAM,GAAG,SAAS,wFAgB3D,CAAC;AAEF,eAAO,MAAM,qBAAqB,oFAkBjC,CAAC;AA4BF,eAAO,MAAM,2BAA2B;WACN,gCAAgC;WAG/D,CAAC;AAEJ,eAAO,MAAM,2BAA2B;QAEhC,MAAM;WACH;QAAE,mBAAmB,EAAE,OAAO,CAAC;QAAC,oBAAoB,EAAE,MAAM,CAAA;KAAE;WAItE,CAAC;AAEJ,eAAO,MAAM,2BAA2B;QACT,MAAM;aAAW,MAAM,GAAG,IAAI;WAG1D,CAAC;AAEJ,eAAO,MAAM,yBAAyB;QACP,MAAM;aAAW,MAAM;WAGnD,CAAC;AAMJ,eAAO,MAAM,0BAA0B,GACrC,SAAQ,oBAAoB,GAAG,IAAW,EAC1C,OAAM,mBAA2B,8JA4BlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,qFAajC,CAAC;AAEF,eAAO,MAAM,0BAA0B;WACL,+BAA+B;WAG9D,CAAC;AAEJ,eAAO,MAAM,wBAAwB;QACN,MAAM;eAAa,MAAM,GAAG,IAAI;WAG5D,CAAC;AAEJ,eAAO,MAAM,2BAA2B;QACT,MAAM;YAAU,oBAAoB;cAAY,MAAM,GAAG,IAAI;WAGzF,CAAC;AAEJ,eAAO,MAAM,6BAA6B;QACX,MAAM;aAAW,MAAM;eAAa,OAAO;WAGvE,CAAC;AAEJ,eAAO,MAAM,+BAA+B;QACb,MAAM;WAAS,gCAAgC;WAG3E,CAAC;AAEJ,eAAO,MAAM,0BAA0B;QACR,MAAM;WAGlC,CAAC;AAEJ,eAAO,MAAM,0BAA0B;QACR,MAAM;YAAU,MAAM;WAGlD,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useSubscriberBot as e } from "../context/SubscriberBotContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { subQuery as t } from "./useSubscriberBotApi.js";
|
|
4
|
+
import { useInfiniteQuery as n, useMutation as r, useQuery as i, useQueryClient as a } from "@tanstack/react-query";
|
|
5
|
+
//#region src/subscriberbot/hooks/useProcurementApi.ts
|
|
6
|
+
var o = {
|
|
7
|
+
all: ["subscriberbot", "procurement"],
|
|
8
|
+
list: (e) => [
|
|
9
|
+
"subscriberbot",
|
|
10
|
+
"procurement",
|
|
11
|
+
"list",
|
|
12
|
+
e
|
|
13
|
+
],
|
|
14
|
+
one: (e) => [
|
|
15
|
+
"subscriberbot",
|
|
16
|
+
"procurement",
|
|
17
|
+
"one",
|
|
18
|
+
e
|
|
19
|
+
],
|
|
20
|
+
summary: [
|
|
21
|
+
"subscriberbot",
|
|
22
|
+
"procurement",
|
|
23
|
+
"summary"
|
|
24
|
+
],
|
|
25
|
+
terms: [
|
|
26
|
+
"subscriberbot",
|
|
27
|
+
"procurement",
|
|
28
|
+
"terms"
|
|
29
|
+
],
|
|
30
|
+
desk: (e, t) => [
|
|
31
|
+
"subscriberbot",
|
|
32
|
+
"procurement",
|
|
33
|
+
"desk",
|
|
34
|
+
e,
|
|
35
|
+
t
|
|
36
|
+
],
|
|
37
|
+
experts: [
|
|
38
|
+
"subscriberbot",
|
|
39
|
+
"procurement",
|
|
40
|
+
"experts"
|
|
41
|
+
]
|
|
42
|
+
}, s = "\n id workspaceId ownerId relationshipId vendorName productName category requestType status\n currency currentAnnualValue quotedAnnualValue targetAnnualValue baselineAnnualValue termMonths\n seats deadline notes authorizationVersion authorizedAt submittedAt expertId expertName assignedAt\n startedAt completedAt finalAnnualValue finalTermMonths oneTimeCredit annualSavings\n firstYearSavings contractSavings nonPriceWins outcomeSummary feeRate feeAmount feeStatus\n feeBilledAt feeWaivedReason createdAt updatedAt\n", c = "events { id kind fromStatus toStatus message internal actorRole createdAt }", l = "id userId displayName email specialties maxOpenRequests active openRequests createdAt updatedAt", u = () => {
|
|
43
|
+
let { apiGatewayUrl: n } = e();
|
|
44
|
+
return i({
|
|
45
|
+
queryKey: o.terms,
|
|
46
|
+
queryFn: async () => (await t("query SubProcurementTerms {\n subProcurementTerms { authorizationVersion authorizationText feeRate maxTermMonths }\n }", {}, n)).subProcurementTerms,
|
|
47
|
+
staleTime: 300 * 1e3
|
|
48
|
+
});
|
|
49
|
+
}, d = 50, f = (e) => e.pageInfo.hasMore && e.pageInfo.cursor ? e.pageInfo.cursor : void 0, p = (r = null) => {
|
|
50
|
+
let { apiGatewayUrl: i } = e();
|
|
51
|
+
return n({
|
|
52
|
+
queryKey: o.list(r),
|
|
53
|
+
initialPageParam: null,
|
|
54
|
+
getNextPageParam: f,
|
|
55
|
+
queryFn: async ({ pageParam: e }) => (await t(`query SubListProcurementRequests($pagination: PaginationInput, $status: SubProcurementStatus) {
|
|
56
|
+
subListProcurementRequests(pagination: $pagination, status: $status) {
|
|
57
|
+
items { ${s} }
|
|
58
|
+
pageInfo { hasMore cursor }
|
|
59
|
+
}
|
|
60
|
+
}`, {
|
|
61
|
+
pagination: {
|
|
62
|
+
limit: d,
|
|
63
|
+
cursor: e
|
|
64
|
+
},
|
|
65
|
+
status: r
|
|
66
|
+
}, i)).subListProcurementRequests
|
|
67
|
+
});
|
|
68
|
+
}, m = (n) => {
|
|
69
|
+
let { apiGatewayUrl: r } = e();
|
|
70
|
+
return i({
|
|
71
|
+
queryKey: o.one(n ?? ""),
|
|
72
|
+
enabled: !!n,
|
|
73
|
+
queryFn: async () => (await t(`query SubProcurementRequest($id: ID!) {
|
|
74
|
+
subProcurementRequest(id: $id) { ${s} ${c} }
|
|
75
|
+
}`, { id: n }, r)).subProcurementRequest
|
|
76
|
+
});
|
|
77
|
+
}, h = () => {
|
|
78
|
+
let { apiGatewayUrl: n } = e();
|
|
79
|
+
return i({
|
|
80
|
+
queryKey: o.summary,
|
|
81
|
+
queryFn: async () => (await t("query SubProcurementSummary {\n subProcurementSummary {\n totalCount openCount succeededCount noSavingsCount\n totals { currency firstYearSavings contractSavings feesCharged succeededCount }\n }\n }", {}, n)).subProcurementSummary
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
function g(n, i) {
|
|
85
|
+
let s = a(), { apiGatewayUrl: c } = e();
|
|
86
|
+
return r({
|
|
87
|
+
mutationFn: async (e) => {
|
|
88
|
+
let r = (await t(i, e, c))[n];
|
|
89
|
+
if (!r) throw Error(`${n} returned no data`);
|
|
90
|
+
return r;
|
|
91
|
+
},
|
|
92
|
+
onSuccess: () => {
|
|
93
|
+
s.invalidateQueries({ queryKey: o.all });
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
var _ = `{ ${s} ${c} }`, v = () => g("subCreateProcurementRequest", `mutation SubCreateProcurementRequest($input: SubCreateProcurementRequestInput!) { subCreateProcurementRequest(input: $input) ${_} }`), y = () => g("subSubmitProcurementRequest", `mutation SubSubmitProcurementRequest($id: ID!, $input: SubSubmitProcurementRequestInput!) { subSubmitProcurementRequest(id: $id, input: $input) ${_} }`), b = () => g("subCancelProcurementRequest", `mutation SubCancelProcurementRequest($id: ID!, $reason: String) { subCancelProcurementRequest(id: $id, reason: $reason) ${_} }`), x = () => g("subSendProcurementMessage", `mutation SubSendProcurementMessage($id: ID!, $message: String!) { subSendProcurementMessage(id: $id, message: $message) ${_} }`), S = (r = null, i = "ALL") => {
|
|
98
|
+
let { apiGatewayUrl: a } = e();
|
|
99
|
+
return n({
|
|
100
|
+
queryKey: o.desk(r, i),
|
|
101
|
+
initialPageParam: null,
|
|
102
|
+
getNextPageParam: f,
|
|
103
|
+
queryFn: async ({ pageParam: e }) => (await t(`query SubAdminListProcurementRequests($pagination: PaginationInput, $status: SubProcurementStatus, $unassignedOnly: Boolean, $mine: Boolean) {
|
|
104
|
+
subAdminListProcurementRequests(pagination: $pagination, status: $status, unassignedOnly: $unassignedOnly, mine: $mine) {
|
|
105
|
+
items { ${s} ${c} }
|
|
106
|
+
pageInfo { hasMore cursor }
|
|
107
|
+
}
|
|
108
|
+
}`, {
|
|
109
|
+
pagination: {
|
|
110
|
+
limit: d,
|
|
111
|
+
cursor: e
|
|
112
|
+
},
|
|
113
|
+
status: r,
|
|
114
|
+
unassignedOnly: i === "UNASSIGNED",
|
|
115
|
+
mine: i === "MINE"
|
|
116
|
+
}, a)).subAdminListProcurementRequests
|
|
117
|
+
});
|
|
118
|
+
}, C = () => {
|
|
119
|
+
let { apiGatewayUrl: n } = e();
|
|
120
|
+
return i({
|
|
121
|
+
queryKey: o.experts,
|
|
122
|
+
queryFn: async () => (await t(`query SubAdminListProcurementExperts { subAdminListProcurementExperts(includeInactive: true) { ${l} } }`, {}, n)).subAdminListProcurementExperts
|
|
123
|
+
});
|
|
124
|
+
}, w = () => g("subAdminUpsertProcurementExpert", `mutation SubAdminUpsertProcurementExpert($input: SubUpsertProcurementExpertInput!) { subAdminUpsertProcurementExpert(input: $input) { ${l} } }`), T = () => g("subAdminAssignProcurementRequest", `mutation SubAdminAssignProcurementRequest($id: ID!, $expertId: ID) { subAdminAssignProcurementRequest(id: $id, expertId: $expertId) ${_} }`), E = () => g("subAdminSetProcurementStatus", `mutation SubAdminSetProcurementStatus($id: ID!, $status: SubProcurementStatus!, $message: String) { subAdminSetProcurementStatus(id: $id, status: $status, message: $message) ${_} }`), D = () => g("subAdminSendProcurementMessage", `mutation SubAdminSendProcurementMessage($id: ID!, $message: String!, $internal: Boolean) { subAdminSendProcurementMessage(id: $id, message: $message, internal: $internal) ${_} }`), O = () => g("subAdminRecordProcurementOutcome", `mutation SubAdminRecordProcurementOutcome($id: ID!, $input: SubRecordProcurementOutcomeInput!) { subAdminRecordProcurementOutcome(id: $id, input: $input) ${_} }`), k = () => g("subAdminRetryProcurementFeeBilling", `mutation SubAdminRetryProcurementFeeBilling($id: ID!) { subAdminRetryProcurementFeeBilling(id: $id) ${_} }`), A = () => g("subAdminWaiveProcurementFee", `mutation SubAdminWaiveProcurementFee($id: ID!, $reason: String!) { subAdminWaiveProcurementFee(id: $id, reason: $reason) ${_} }`);
|
|
125
|
+
//#endregion
|
|
126
|
+
export { b as useCancelProcurementRequest, v as useCreateProcurementRequest, T as useDeskAssignProcurement, S as useDeskProcurementRequests, O as useDeskRecordProcurementOutcome, k as useDeskRetryProcurementFee, D as useDeskSendProcurementMessage, E as useDeskSetProcurementStatus, A as useDeskWaiveProcurementFee, C as useProcurementExperts, m as useProcurementRequest, p as useProcurementRequests, h as useProcurementSummary, u as useProcurementTerms, x as useSendProcurementMessage, y as useSubmitProcurementRequest, w as useUpsertProcurementExpert };
|
|
127
|
+
|
|
128
|
+
//# sourceMappingURL=useProcurementApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProcurementApi.js","names":[],"sources":["../../../src/subscriberbot/hooks/useProcurementApi.ts"],"sourcesContent":["/**\n * Human procurement / negotiation support hooks (BOFF-4158)\n * @module subscriberbot/hooks\n *\n * React-Query hooks for the `SubProcurement*` contract of\n * wspace-subscriberbot-svc: the workspace's procurement requests, the service\n * terms, the summary, and the procurement desk (expert queue, assignment,\n * expert roster) used by super admins in admin-app. Same transport as every\n * other Subscriber Bot hook (`subQuery`).\n */\n\nimport { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useSubscriberBot } from '../context';\nimport type { SubConnection } from '../types';\nimport type {\n SubCreateProcurementRequestInput,\n SubProcurementExpert,\n SubProcurementRequest,\n SubProcurementStatus,\n SubProcurementSummary,\n SubProcurementTerms,\n SubRecordProcurementOutcomeInput,\n SubUpsertProcurementExpertInput,\n} from '../types/procurement';\nimport { subQuery } from './useSubscriberBotApi';\n\nexport type ProcurementDeskView = 'ALL' | 'UNASSIGNED' | 'MINE';\n\nconst KEY = {\n all: ['subscriberbot', 'procurement'] as const,\n list: (status: SubProcurementStatus | null) =>\n ['subscriberbot', 'procurement', 'list', status] as const,\n one: (id: string) => ['subscriberbot', 'procurement', 'one', id] as const,\n summary: ['subscriberbot', 'procurement', 'summary'] as const,\n terms: ['subscriberbot', 'procurement', 'terms'] as const,\n desk: (status: SubProcurementStatus | null, view: ProcurementDeskView) =>\n ['subscriberbot', 'procurement', 'desk', status, view] as const,\n experts: ['subscriberbot', 'procurement', 'experts'] as const,\n};\n\nconst REQUEST_FIELDS = `\n id workspaceId ownerId relationshipId vendorName productName category requestType status\n currency currentAnnualValue quotedAnnualValue targetAnnualValue baselineAnnualValue termMonths\n seats deadline notes authorizationVersion authorizedAt submittedAt expertId expertName assignedAt\n startedAt completedAt finalAnnualValue finalTermMonths oneTimeCredit annualSavings\n firstYearSavings contractSavings nonPriceWins outcomeSummary feeRate feeAmount feeStatus\n feeBilledAt feeWaivedReason createdAt updatedAt\n`;\n\nconst EVENT_FIELDS = `events { id kind fromStatus toStatus message internal actorRole createdAt }`;\n\nconst EXPERT_FIELDS = `id userId displayName email specialties maxOpenRequests active openRequests createdAt updatedAt`;\n\nexport const useProcurementTerms = () => {\n const { apiGatewayUrl } = useSubscriberBot();\n return useQuery({\n queryKey: KEY.terms,\n queryFn: async () => {\n const result = await subQuery<{ subProcurementTerms: SubProcurementTerms }>(\n `query SubProcurementTerms {\n subProcurementTerms { authorizationVersion authorizationText feeRate maxTermMonths }\n }`,\n {},\n apiGatewayUrl\n );\n return result.subProcurementTerms;\n },\n staleTime: 5 * 60 * 1000,\n });\n};\n\nconst PAGE_SIZE = 50;\n\n/** Next cursor of a connection page, or undefined when it was the last page. */\nconst nextCursor = (page: SubConnection<SubProcurementRequest>): string | undefined =>\n page.pageInfo.hasMore && page.pageInfo.cursor ? page.pageInfo.cursor : undefined;\n\n/** Cursor-paged list of the workspace's requests; `fetchNextPage` loads more. */\nexport const useProcurementRequests = (status: SubProcurementStatus | null = null) => {\n const { apiGatewayUrl } = useSubscriberBot();\n return useInfiniteQuery({\n queryKey: KEY.list(status),\n initialPageParam: null as string | null,\n getNextPageParam: nextCursor,\n queryFn: async ({ pageParam }) => {\n const result = await subQuery<{\n subListProcurementRequests: SubConnection<SubProcurementRequest>;\n }>(\n `query SubListProcurementRequests($pagination: PaginationInput, $status: SubProcurementStatus) {\n subListProcurementRequests(pagination: $pagination, status: $status) {\n items { ${REQUEST_FIELDS} }\n pageInfo { hasMore cursor }\n }\n }`,\n { pagination: { limit: PAGE_SIZE, cursor: pageParam }, status },\n apiGatewayUrl\n );\n return result.subListProcurementRequests;\n },\n });\n};\n\nexport const useProcurementRequest = (id: string | undefined) => {\n const { apiGatewayUrl } = useSubscriberBot();\n return useQuery({\n queryKey: KEY.one(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await subQuery<{ subProcurementRequest: SubProcurementRequest | null }>(\n `query SubProcurementRequest($id: ID!) {\n subProcurementRequest(id: $id) { ${REQUEST_FIELDS} ${EVENT_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.subProcurementRequest;\n },\n });\n};\n\nexport const useProcurementSummary = () => {\n const { apiGatewayUrl } = useSubscriberBot();\n return useQuery({\n queryKey: KEY.summary,\n queryFn: async () => {\n const result = await subQuery<{ subProcurementSummary: SubProcurementSummary }>(\n `query SubProcurementSummary {\n subProcurementSummary {\n totalCount openCount succeededCount noSavingsCount\n totals { currency firstYearSavings contractSavings feesCharged succeededCount }\n }\n }`,\n {},\n apiGatewayUrl\n );\n return result.subProcurementSummary;\n },\n });\n};\n\n/** Shared mutation plumbing: every write refreshes every procurement query. */\nfunction useProcurementMutation<TVars, TResult = SubProcurementRequest>(\n operation: string,\n document: string\n) {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useSubscriberBot();\n return useMutation({\n mutationFn: async (variables: TVars) => {\n const result = await subQuery<Record<string, TResult>>(\n document,\n variables as Record<string, unknown>,\n apiGatewayUrl\n );\n const value = result[operation];\n if (!value) throw new Error(`${operation} returned no data`);\n return value;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: KEY.all });\n },\n });\n}\n\nconst RETURNING = `{ ${REQUEST_FIELDS} ${EVENT_FIELDS} }`;\n\nexport const useCreateProcurementRequest = () =>\n useProcurementMutation<{ input: SubCreateProcurementRequestInput }>(\n 'subCreateProcurementRequest',\n `mutation SubCreateProcurementRequest($input: SubCreateProcurementRequestInput!) { subCreateProcurementRequest(input: $input) ${RETURNING} }`\n );\n\nexport const useSubmitProcurementRequest = () =>\n useProcurementMutation<{\n id: string;\n input: { acceptAuthorization: boolean; authorizationVersion: string };\n }>(\n 'subSubmitProcurementRequest',\n `mutation SubSubmitProcurementRequest($id: ID!, $input: SubSubmitProcurementRequestInput!) { subSubmitProcurementRequest(id: $id, input: $input) ${RETURNING} }`\n );\n\nexport const useCancelProcurementRequest = () =>\n useProcurementMutation<{ id: string; reason?: string | null }>(\n 'subCancelProcurementRequest',\n `mutation SubCancelProcurementRequest($id: ID!, $reason: String) { subCancelProcurementRequest(id: $id, reason: $reason) ${RETURNING} }`\n );\n\nexport const useSendProcurementMessage = () =>\n useProcurementMutation<{ id: string; message: string }>(\n 'subSendProcurementMessage',\n `mutation SubSendProcurementMessage($id: ID!, $message: String!) { subSendProcurementMessage(id: $id, message: $message) ${RETURNING} }`\n );\n\n// ---------------------------------------------------------------------------\n// Procurement desk (super admin, admin-app)\n// ---------------------------------------------------------------------------\n\nexport const useDeskProcurementRequests = (\n status: SubProcurementStatus | null = null,\n view: ProcurementDeskView = 'ALL'\n) => {\n const { apiGatewayUrl } = useSubscriberBot();\n return useInfiniteQuery({\n queryKey: KEY.desk(status, view),\n initialPageParam: null as string | null,\n getNextPageParam: nextCursor,\n queryFn: async ({ pageParam }) => {\n const result = await subQuery<{\n subAdminListProcurementRequests: SubConnection<SubProcurementRequest>;\n }>(\n `query SubAdminListProcurementRequests($pagination: PaginationInput, $status: SubProcurementStatus, $unassignedOnly: Boolean, $mine: Boolean) {\n subAdminListProcurementRequests(pagination: $pagination, status: $status, unassignedOnly: $unassignedOnly, mine: $mine) {\n items { ${REQUEST_FIELDS} ${EVENT_FIELDS} }\n pageInfo { hasMore cursor }\n }\n }`,\n {\n pagination: { limit: PAGE_SIZE, cursor: pageParam },\n status,\n unassignedOnly: view === 'UNASSIGNED',\n mine: view === 'MINE',\n },\n apiGatewayUrl\n );\n return result.subAdminListProcurementRequests;\n },\n });\n};\n\nexport const useProcurementExperts = () => {\n const { apiGatewayUrl } = useSubscriberBot();\n return useQuery({\n queryKey: KEY.experts,\n queryFn: async () => {\n const result = await subQuery<{ subAdminListProcurementExperts: SubProcurementExpert[] }>(\n `query SubAdminListProcurementExperts { subAdminListProcurementExperts(includeInactive: true) { ${EXPERT_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return result.subAdminListProcurementExperts;\n },\n });\n};\n\nexport const useUpsertProcurementExpert = () =>\n useProcurementMutation<{ input: SubUpsertProcurementExpertInput }, SubProcurementExpert>(\n 'subAdminUpsertProcurementExpert',\n `mutation SubAdminUpsertProcurementExpert($input: SubUpsertProcurementExpertInput!) { subAdminUpsertProcurementExpert(input: $input) { ${EXPERT_FIELDS} } }`\n );\n\nexport const useDeskAssignProcurement = () =>\n useProcurementMutation<{ id: string; expertId?: string | null }>(\n 'subAdminAssignProcurementRequest',\n `mutation SubAdminAssignProcurementRequest($id: ID!, $expertId: ID) { subAdminAssignProcurementRequest(id: $id, expertId: $expertId) ${RETURNING} }`\n );\n\nexport const useDeskSetProcurementStatus = () =>\n useProcurementMutation<{ id: string; status: SubProcurementStatus; message?: string | null }>(\n 'subAdminSetProcurementStatus',\n `mutation SubAdminSetProcurementStatus($id: ID!, $status: SubProcurementStatus!, $message: String) { subAdminSetProcurementStatus(id: $id, status: $status, message: $message) ${RETURNING} }`\n );\n\nexport const useDeskSendProcurementMessage = () =>\n useProcurementMutation<{ id: string; message: string; internal?: boolean }>(\n 'subAdminSendProcurementMessage',\n `mutation SubAdminSendProcurementMessage($id: ID!, $message: String!, $internal: Boolean) { subAdminSendProcurementMessage(id: $id, message: $message, internal: $internal) ${RETURNING} }`\n );\n\nexport const useDeskRecordProcurementOutcome = () =>\n useProcurementMutation<{ id: string; input: SubRecordProcurementOutcomeInput }>(\n 'subAdminRecordProcurementOutcome',\n `mutation SubAdminRecordProcurementOutcome($id: ID!, $input: SubRecordProcurementOutcomeInput!) { subAdminRecordProcurementOutcome(id: $id, input: $input) ${RETURNING} }`\n );\n\nexport const useDeskRetryProcurementFee = () =>\n useProcurementMutation<{ id: string }>(\n 'subAdminRetryProcurementFeeBilling',\n `mutation SubAdminRetryProcurementFeeBilling($id: ID!) { subAdminRetryProcurementFeeBilling(id: $id) ${RETURNING} }`\n );\n\nexport const useDeskWaiveProcurementFee = () =>\n useProcurementMutation<{ id: string; reason: string }>(\n 'subAdminWaiveProcurementFee',\n `mutation SubAdminWaiveProcurementFee($id: ID!, $reason: String!) { subAdminWaiveProcurementFee(id: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GAEa,UACX,EACE,mCACA,yIAAyI,EAAc,KACzJ,GAEW,UACX,EACE,oCACA,uIAAuI,EAAU,GACnJ,GAEW,UACX,EACE,gCACA,iLAAiL,EAAU,GAC7L,GAEW,UACX,EACE,kCACA,8KAA8K,EAAU,GAC1L,GAEW,UACX,EACE,oCACA,6JAA6J,EAAU,GACzK,GAEW,UACX,EACE,sCACA,uGAAuG,EAAU,GACnH,GAEW,UACX,EACE,+BACA,4HAA4H,EAAU,GACxI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expert procurement request detail
|
|
3
|
+
* @module subscriberbot/pages/procurement
|
|
4
|
+
*
|
|
5
|
+
* `/subscriberbot/procurement/:id` — the contract details, submission under
|
|
6
|
+
* the procurement authorisation, the assigned expert, the message thread with
|
|
7
|
+
* the expert, the negotiated outcome with savings and the success fee. Every
|
|
8
|
+
* action is a real `Sub*Procurement*` mutation.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ProcurementDetailPage(): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=ProcurementDetailPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcurementDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/procurement/ProcurementDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0MH,wBAAgB,qBAAqB,gCA0IpC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { useSubscriberBot as e } from "../../context/SubscriberBotContext.js";
|
|
2
|
+
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
+
import { formatCurrency as n, formatDate as r, formatDateTime as i } from "../../utils/formatters.js";
|
|
4
|
+
import { useTr as a } from "../../hooks/useTr.js";
|
|
5
|
+
import { ErrorView as o, LoadingView as s, Section as c } from "../../components/StateViews.js";
|
|
6
|
+
import "../../components/index.js";
|
|
7
|
+
import { FEE_STATUS_LABEL as l, OPEN_STATUSES as u, REQUEST_TYPE_LABEL as d } from "../../components/procurement/labels.js";
|
|
8
|
+
import { ProcurementStatusPill as f } from "../../components/procurement/ProcurementStatusPill.js";
|
|
9
|
+
import { ProcurementThread as p } from "../../components/procurement/ProcurementThread.js";
|
|
10
|
+
import "../../components/procurement/index.js";
|
|
11
|
+
import { useCancelProcurementRequest as m, useProcurementRequest as h, useProcurementTerms as g, useSendProcurementMessage as _, useSubmitProcurementRequest as v } from "../../hooks/useProcurementApi.js";
|
|
12
|
+
import { useState as y } from "react";
|
|
13
|
+
import { ArrowLeft as b, UserRoundCheck as x } from "lucide-react";
|
|
14
|
+
import { useParams as S } from "react-router";
|
|
15
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
16
|
+
import { GlassCard as T } from "@burdenoff/fe-libs/ui";
|
|
17
|
+
//#region src/subscriberbot/pages/procurement/ProcurementDetailPage.tsx
|
|
18
|
+
var E = "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)]", D = "rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50", O = "rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50", k = (e) => e ? e instanceof Error ? e.message : String(e) : null;
|
|
19
|
+
function A({ label: e, value: t }) {
|
|
20
|
+
return /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("dt", {
|
|
21
|
+
className: "text-xs text-text-secondary",
|
|
22
|
+
children: e
|
|
23
|
+
}), /* @__PURE__ */ C("dd", {
|
|
24
|
+
className: "mt-0.5 text-sm font-medium text-text-primary",
|
|
25
|
+
children: t
|
|
26
|
+
})] });
|
|
27
|
+
}
|
|
28
|
+
function j({ request: e }) {
|
|
29
|
+
let t = a(), n = g(), r = v(), [i, o] = y(!1);
|
|
30
|
+
return /* @__PURE__ */ w(T, {
|
|
31
|
+
treatment: "metric",
|
|
32
|
+
className: "space-y-3 p-5",
|
|
33
|
+
"data-testid": "procurement-submit",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ C("p", {
|
|
36
|
+
className: "text-sm text-text-primary",
|
|
37
|
+
children: t("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
|
+
}),
|
|
39
|
+
n.data && /* @__PURE__ */ w("div", {
|
|
40
|
+
className: "rounded-lg border border-border-subtle bg-bg-sunken p-3",
|
|
41
|
+
children: [/* @__PURE__ */ C("p", {
|
|
42
|
+
className: "text-xs leading-relaxed text-text-secondary",
|
|
43
|
+
"data-testid": "procurement-terms",
|
|
44
|
+
children: n.data.authorizationText
|
|
45
|
+
}), /* @__PURE__ */ w("label", {
|
|
46
|
+
className: "mt-3 inline-flex items-start gap-2 text-sm text-text-primary",
|
|
47
|
+
children: [/* @__PURE__ */ C("input", {
|
|
48
|
+
type: "checkbox",
|
|
49
|
+
checked: i,
|
|
50
|
+
onChange: (e) => o(e.target.checked),
|
|
51
|
+
className: "mt-0.5"
|
|
52
|
+
}), t("procurement.submit.accept", "I authorise the procurement desk on these terms")]
|
|
53
|
+
})]
|
|
54
|
+
}),
|
|
55
|
+
r.error && /* @__PURE__ */ C("p", {
|
|
56
|
+
role: "alert",
|
|
57
|
+
className: "text-sm text-status-error-text",
|
|
58
|
+
children: k(r.error)
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ C("button", {
|
|
61
|
+
type: "button",
|
|
62
|
+
onClick: () => n.data && r.mutate({
|
|
63
|
+
id: e.id,
|
|
64
|
+
input: {
|
|
65
|
+
acceptAuthorization: i,
|
|
66
|
+
authorizationVersion: n.data.authorizationVersion
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
disabled: r.isPending || !i || !n.data,
|
|
70
|
+
className: D,
|
|
71
|
+
children: t("procurement.submit.cta", "Submit to the procurement desk")
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function M({ request: e }) {
|
|
77
|
+
let t = a(), n = _(), [r, i] = y(""), o = e.status === "AWAITING_CUSTOMER";
|
|
78
|
+
return /* @__PURE__ */ w("div", {
|
|
79
|
+
className: "space-y-2",
|
|
80
|
+
"data-testid": "procurement-message",
|
|
81
|
+
children: [
|
|
82
|
+
o && /* @__PURE__ */ C("p", {
|
|
83
|
+
className: "rounded-lg bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text",
|
|
84
|
+
children: t("procurement.message.awaiting", "Your procurement expert is waiting for your reply. See the latest message below.")
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ C("label", {
|
|
87
|
+
htmlFor: "proc-message",
|
|
88
|
+
className: "sr-only",
|
|
89
|
+
children: t("procurement.message.label", "Message")
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ C("textarea", {
|
|
92
|
+
id: "proc-message",
|
|
93
|
+
rows: 2,
|
|
94
|
+
value: r,
|
|
95
|
+
onChange: (e) => i(e.target.value),
|
|
96
|
+
placeholder: t("procurement.message.placeholder", "Write to your procurement expert…"),
|
|
97
|
+
className: E
|
|
98
|
+
}),
|
|
99
|
+
n.error && /* @__PURE__ */ C("p", {
|
|
100
|
+
role: "alert",
|
|
101
|
+
className: "text-sm text-status-error-text",
|
|
102
|
+
children: k(n.error)
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ C("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
disabled: n.isPending || !r.trim(),
|
|
107
|
+
onClick: () => n.mutate({
|
|
108
|
+
id: e.id,
|
|
109
|
+
message: r
|
|
110
|
+
}, { onSuccess: () => i("") }),
|
|
111
|
+
className: O,
|
|
112
|
+
children: o ? t("procurement.message.reply", "Reply to the expert") : t("procurement.message.send", "Send message")
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function N({ request: e }) {
|
|
118
|
+
let t = a(), r = l[e.feeStatus];
|
|
119
|
+
return /* @__PURE__ */ w(T, {
|
|
120
|
+
treatment: "metric",
|
|
121
|
+
className: "p-5",
|
|
122
|
+
"data-testid": "procurement-outcome",
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ w("dl", {
|
|
125
|
+
className: "grid grid-cols-2 gap-4 sm:grid-cols-4",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ C(A, {
|
|
128
|
+
label: t("procurement.outcome.baseline", "Baseline per year"),
|
|
129
|
+
value: e.baselineAnnualValue == null ? "—" : n(e.baselineAnnualValue, e.currency)
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ C(A, {
|
|
132
|
+
label: t("procurement.outcome.final", "Negotiated per year"),
|
|
133
|
+
value: e.finalAnnualValue == null ? "—" : n(e.finalAnnualValue, e.currency)
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ C(A, {
|
|
136
|
+
label: t("procurement.outcome.firstYear", "First-year savings"),
|
|
137
|
+
value: n(e.firstYearSavings, e.currency)
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ C(A, {
|
|
140
|
+
label: t("procurement.outcome.contract", "Savings over the term"),
|
|
141
|
+
value: n(e.contractSavings, e.currency)
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ C(A, {
|
|
144
|
+
label: t("procurement.outcome.term", "Final term"),
|
|
145
|
+
value: t("procurement.fact.months", "{{count}} months", { count: e.finalTermMonths ?? e.termMonths })
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ C(A, {
|
|
148
|
+
label: t("procurement.outcome.fee", "Success fee"),
|
|
149
|
+
value: e.feeStatus === "NONE" ? t(r.key, r.fallback) : `${n(e.feeAmount, e.currency)} · ${t(r.key, r.fallback)}`
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
e.nonPriceWins && /* @__PURE__ */ C("p", {
|
|
154
|
+
className: "mt-4 text-sm text-text-primary",
|
|
155
|
+
children: t("procurement.outcome.winsLabel", "Non-price wins: {{wins}}", { wins: e.nonPriceWins })
|
|
156
|
+
}),
|
|
157
|
+
e.outcomeSummary && /* @__PURE__ */ C("p", {
|
|
158
|
+
className: "mt-2 text-sm text-text-primary",
|
|
159
|
+
children: e.outcomeSummary
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function P() {
|
|
165
|
+
let l = a(), { id: g } = S(), { navigateTo: _ } = e(), { data: v, isLoading: y, isError: E, error: D, refetch: P } = h(g), F = m(), I = /* @__PURE__ */ w("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
onClick: () => _("/procurement"),
|
|
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
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ C(b, { className: "h-4 w-4" }),
|
|
171
|
+
" ",
|
|
172
|
+
l("procurement.back", "Back")
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
if (y) return /* @__PURE__ */ C(s, { label: l("procurement.loadingOne", "Loading request…") });
|
|
176
|
+
if (E || !v) return /* @__PURE__ */ C(t, {
|
|
177
|
+
title: l("procurement.title", "Expert procurement"),
|
|
178
|
+
actions: I,
|
|
179
|
+
children: /* @__PURE__ */ C(o, {
|
|
180
|
+
title: l("procurement.notFound", "Procurement request not found"),
|
|
181
|
+
message: D instanceof Error ? D.message : void 0,
|
|
182
|
+
onRetry: () => void P()
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
let L = u.includes(v.status), R = v.status === "SUCCEEDED" || v.status === "NO_SAVINGS", z = d[v.requestType];
|
|
186
|
+
return /* @__PURE__ */ w(t, {
|
|
187
|
+
title: v.productName ? `${v.vendorName} · ${v.productName}` : v.vendorName,
|
|
188
|
+
description: `${l(z.key, z.fallback)}${v.category ? ` · ${v.category}` : ""}`,
|
|
189
|
+
actions: I,
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ w("div", {
|
|
192
|
+
className: "flex flex-wrap items-center gap-3",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ C(f, { status: v.status }),
|
|
195
|
+
/* @__PURE__ */ C("span", {
|
|
196
|
+
className: "text-sm text-text-secondary",
|
|
197
|
+
children: l("procurement.deadline", "Decide by {{date}}", { date: r(v.deadline) })
|
|
198
|
+
}),
|
|
199
|
+
v.submittedAt && /* @__PURE__ */ C("span", {
|
|
200
|
+
className: "text-xs text-text-secondary",
|
|
201
|
+
children: l("procurement.submittedAt", "Submitted {{when}}", { when: i(v.submittedAt) })
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
v.expertName && /* @__PURE__ */ w("p", {
|
|
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
|
+
"data-testid": "procurement-expert",
|
|
208
|
+
children: [/* @__PURE__ */ C(x, {
|
|
209
|
+
className: "h-4 w-4",
|
|
210
|
+
"aria-hidden": !0
|
|
211
|
+
}), l("procurement.expert", "Your procurement expert: {{name}}", { name: v.expertName })]
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ w(T, {
|
|
214
|
+
treatment: "metric",
|
|
215
|
+
className: "mt-4 p-5",
|
|
216
|
+
children: [/* @__PURE__ */ w("dl", {
|
|
217
|
+
className: "grid grid-cols-2 gap-4 sm:grid-cols-4",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ C(A, {
|
|
220
|
+
label: l("procurement.fact.current", "Current per year"),
|
|
221
|
+
value: v.currentAnnualValue == null ? "—" : n(v.currentAnnualValue, v.currency)
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ C(A, {
|
|
224
|
+
label: l("procurement.fact.quoted", "Vendor quote per year"),
|
|
225
|
+
value: v.quotedAnnualValue == null ? "—" : n(v.quotedAnnualValue, v.currency)
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ C(A, {
|
|
228
|
+
label: l("procurement.fact.target", "Target per year"),
|
|
229
|
+
value: v.targetAnnualValue == null ? "—" : n(v.targetAnnualValue, v.currency)
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ C(A, {
|
|
232
|
+
label: l("procurement.fact.term", "Term and seats"),
|
|
233
|
+
value: `${l("procurement.fact.months", "{{count}} months", { count: v.termMonths })}${v.seats == null ? "" : ` · ${v.seats}`}`
|
|
234
|
+
})
|
|
235
|
+
]
|
|
236
|
+
}), v.notes && /* @__PURE__ */ C("p", {
|
|
237
|
+
className: "mt-3 whitespace-pre-wrap text-sm text-text-secondary",
|
|
238
|
+
children: v.notes
|
|
239
|
+
})]
|
|
240
|
+
}),
|
|
241
|
+
R && /* @__PURE__ */ C(c, {
|
|
242
|
+
title: l("procurement.section.outcome", "Outcome"),
|
|
243
|
+
children: /* @__PURE__ */ C(N, { request: v })
|
|
244
|
+
}),
|
|
245
|
+
v.status === "DRAFT" && /* @__PURE__ */ C(c, {
|
|
246
|
+
title: l("procurement.section.submit", "Submit"),
|
|
247
|
+
children: /* @__PURE__ */ C(j, { request: v })
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ w(c, {
|
|
250
|
+
title: l("procurement.section.thread", "Messages and timeline"),
|
|
251
|
+
children: [L && v.status !== "DRAFT" && /* @__PURE__ */ C("div", {
|
|
252
|
+
className: "mb-4",
|
|
253
|
+
children: /* @__PURE__ */ C(M, { request: v })
|
|
254
|
+
}), /* @__PURE__ */ C(p, { events: v.events ?? [] })]
|
|
255
|
+
}),
|
|
256
|
+
L && /* @__PURE__ */ w("div", {
|
|
257
|
+
className: "mt-8 border-t border-border-subtle pt-4",
|
|
258
|
+
children: [F.error && /* @__PURE__ */ C("p", {
|
|
259
|
+
role: "alert",
|
|
260
|
+
className: "mb-2 text-sm text-status-error-text",
|
|
261
|
+
children: k(F.error)
|
|
262
|
+
}), /* @__PURE__ */ C("button", {
|
|
263
|
+
type: "button",
|
|
264
|
+
disabled: F.isPending,
|
|
265
|
+
onClick: () => F.mutate({ id: v.id }),
|
|
266
|
+
className: O,
|
|
267
|
+
children: v.status === "DRAFT" ? l("procurement.cancel.draft", "Discard draft") : l("procurement.cancel.submitted", "Withdraw request and authorisation")
|
|
268
|
+
})]
|
|
269
|
+
})
|
|
270
|
+
]
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
//#endregion
|
|
274
|
+
export { P as ProcurementDetailPage };
|
|
275
|
+
|
|
276
|
+
//# sourceMappingURL=ProcurementDetailPage.js.map
|
|
@@ -0,0 +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,EAA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B;OACnD,OAAO,GAAG,EAAG,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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export declare function ProcurementNewPage(): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=ProcurementNewPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProcurementNewPage.d.ts","sourceRoot":"","sources":["../../../../src/subscriberbot/pages/procurement/ProcurementNewPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqEH,wBAAgB,kBAAkB,gCA0YjC"}
|