@powerhousedao/network-admin 0.0.49 → 0.0.50

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.
Files changed (96) hide show
  1. package/dist/document-models/builders/src/reducers/builders.d.ts.map +1 -1
  2. package/dist/document-models/builders/src/reducers/builders.js +2 -2
  3. package/dist/document-models/network-profile/gen/document-schema.d.ts +16 -16
  4. package/dist/document-models/network-profile/gen/document-schema.d.ts.map +1 -1
  5. package/dist/document-models/network-profile/gen/schema/types.d.ts +2 -2
  6. package/dist/document-models/network-profile/gen/schema/types.d.ts.map +1 -1
  7. package/dist/document-models/network-profile/src/reducers/network-profile-management.d.ts.map +1 -1
  8. package/dist/document-models/network-profile/src/reducers/network-profile-management.js +1 -1
  9. package/dist/document-models/payment-terms/gen/document-schema.d.ts +48 -48
  10. package/dist/document-models/payment-terms/gen/document-schema.d.ts.map +1 -1
  11. package/dist/document-models/payment-terms/gen/schema/types.d.ts +12 -12
  12. package/dist/document-models/payment-terms/gen/schema/types.d.ts.map +1 -1
  13. package/dist/document-models/payment-terms/src/reducers/clauses.d.ts.map +1 -1
  14. package/dist/document-models/payment-terms/src/reducers/clauses.js +10 -10
  15. package/dist/document-models/payment-terms/src/reducers/milestones.d.ts.map +1 -1
  16. package/dist/document-models/payment-terms/src/reducers/milestones.js +14 -11
  17. package/dist/document-models/payment-terms/src/reducers/terms.js +4 -4
  18. package/dist/document-models/request-for-proposals/gen/document-schema.d.ts +16 -16
  19. package/dist/document-models/request-for-proposals/gen/document-schema.d.ts.map +1 -1
  20. package/dist/document-models/request-for-proposals/gen/schema/types.d.ts +9 -9
  21. package/dist/document-models/request-for-proposals/gen/schema/types.d.ts.map +1 -1
  22. package/dist/document-models/request-for-proposals/src/reducers/contex-document.d.ts.map +1 -1
  23. package/dist/document-models/request-for-proposals/src/reducers/contex-document.js +3 -3
  24. package/dist/document-models/request-for-proposals/src/reducers/proposals.d.ts.map +1 -1
  25. package/dist/document-models/request-for-proposals/src/reducers/proposals.js +16 -12
  26. package/dist/document-models/request-for-proposals/src/reducers/rfp-state.d.ts.map +1 -1
  27. package/dist/document-models/request-for-proposals/src/reducers/rfp-state.js +7 -3
  28. package/dist/document-models/workstream/gen/document-schema.d.ts +16 -16
  29. package/dist/document-models/workstream/gen/document-schema.d.ts.map +1 -1
  30. package/dist/document-models/workstream/gen/schema/types.d.ts +6 -6
  31. package/dist/document-models/workstream/gen/schema/types.d.ts.map +1 -1
  32. package/dist/document-models/workstream/src/reducers/proposals.d.ts.map +1 -1
  33. package/dist/document-models/workstream/src/reducers/proposals.js +78 -0
  34. package/dist/editors/network-admin/components/builders.d.ts.map +1 -1
  35. package/dist/editors/network-admin/components/icons/PaymentIcon.d.ts.map +1 -1
  36. package/dist/editors/network-admin/components/icons/RfpIcon.d.ts.map +1 -1
  37. package/dist/editors/network-admin/components/icons/SowIcon.d.ts.map +1 -1
  38. package/dist/editors/network-admin/components/icons/WorkstreamIcon.d.ts.map +1 -1
  39. package/dist/editors/network-profile/editor.d.ts.map +1 -1
  40. package/dist/editors/payment-terms/components/clauses-section.d.ts +12 -0
  41. package/dist/editors/payment-terms/components/clauses-section.d.ts.map +1 -0
  42. package/dist/editors/payment-terms/components/clauses-section.js +269 -0
  43. package/dist/editors/payment-terms/components/escrow-section.d.ts +13 -0
  44. package/dist/editors/payment-terms/components/escrow-section.d.ts.map +1 -0
  45. package/dist/editors/payment-terms/components/escrow-section.js +72 -0
  46. package/dist/editors/payment-terms/components/evaluation-section.d.ts +13 -0
  47. package/dist/editors/payment-terms/components/evaluation-section.d.ts.map +1 -0
  48. package/dist/editors/payment-terms/components/evaluation-section.js +94 -0
  49. package/dist/editors/payment-terms/components/header-section.d.ts +16 -0
  50. package/dist/editors/payment-terms/components/header-section.d.ts.map +1 -0
  51. package/dist/editors/payment-terms/components/header-section.js +67 -0
  52. package/dist/editors/payment-terms/components/milestones-section.d.ts +11 -0
  53. package/dist/editors/payment-terms/components/milestones-section.d.ts.map +1 -0
  54. package/dist/editors/payment-terms/components/milestones-section.js +268 -0
  55. package/dist/editors/payment-terms/components/parties-section.d.ts +11 -0
  56. package/dist/editors/payment-terms/components/parties-section.d.ts.map +1 -0
  57. package/dist/editors/payment-terms/components/parties-section.js +36 -0
  58. package/dist/editors/payment-terms/components/payment-config-section.d.ts +11 -0
  59. package/dist/editors/payment-terms/components/payment-config-section.d.ts.map +1 -0
  60. package/dist/editors/payment-terms/components/payment-config-section.js +68 -0
  61. package/dist/editors/payment-terms/components/styles.d.ts +2 -0
  62. package/dist/editors/payment-terms/components/styles.d.ts.map +1 -0
  63. package/dist/editors/payment-terms/components/styles.js +741 -0
  64. package/dist/editors/payment-terms/components/time-materials-section.d.ts +11 -0
  65. package/dist/editors/payment-terms/components/time-materials-section.d.ts.map +1 -0
  66. package/dist/editors/payment-terms/components/time-materials-section.js +68 -0
  67. package/dist/editors/payment-terms/editor.d.ts +0 -2
  68. package/dist/editors/payment-terms/editor.d.ts.map +1 -1
  69. package/dist/editors/payment-terms/editor.js +36 -52
  70. package/dist/editors/payment-terms/evaluation-tab.d.ts +1 -1
  71. package/dist/editors/payment-terms/evaluation-tab.d.ts.map +1 -1
  72. package/dist/editors/payment-terms/evaluation-tab.js +17 -8
  73. package/dist/editors/payment-terms/milestones-tab.d.ts.map +1 -1
  74. package/dist/editors/payment-terms/milestones-tab.js +9 -1
  75. package/dist/editors/request-for-proposals/markdown-editor.d.ts.map +1 -1
  76. package/dist/editors/request-for-proposals/markdown-editor.js +3 -3
  77. package/dist/editors/workstream/editor.d.ts.map +1 -1
  78. package/dist/editors/workstream/editor.js +114 -26
  79. package/dist/processors/workstreams/index.d.ts +1 -0
  80. package/dist/processors/workstreams/index.d.ts.map +1 -1
  81. package/dist/processors/workstreams/index.js +91 -29
  82. package/dist/processors/workstreams/migrations.d.ts.map +1 -1
  83. package/dist/processors/workstreams/migrations.js +9 -10
  84. package/dist/scripts/sow-mirror/mirror_sow_state.d.ts +3 -0
  85. package/dist/scripts/sow-mirror/mirror_sow_state.d.ts.map +1 -0
  86. package/dist/scripts/sow-mirror/mirror_sow_state.js +446 -0
  87. package/dist/style.css +464 -232
  88. package/dist/subgraphs/networks/resolvers.d.ts.map +1 -1
  89. package/dist/subgraphs/networks/resolvers.js +4 -3
  90. package/dist/subgraphs/networks/schema.d.ts.map +1 -1
  91. package/dist/subgraphs/networks/schema.js +0 -1
  92. package/dist/subgraphs/workstreams/resolvers.d.ts.map +1 -1
  93. package/dist/subgraphs/workstreams/resolvers.js +17 -11
  94. package/dist/subgraphs/workstreams/schema.d.ts.map +1 -1
  95. package/dist/subgraphs/workstreams/schema.js +130 -27
  96. package/package.json +2 -2
@@ -0,0 +1,268 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { Milestone as MilestoneIcon, Plus, Calendar, CheckCircle2, Clock, AlertCircle, CircleDollarSign, XCircle, } from "lucide-react";
4
+ import { ObjectSetTable, DatePicker, Checkbox, Select, } from "@powerhousedao/document-engineering";
5
+ import { toast } from "@powerhousedao/design-system/connect";
6
+ import { generateId } from "document-model/core";
7
+ import {} from "../../../document-models/payment-terms/index.js";
8
+ const STATUS_CONFIG = {
9
+ PENDING: {
10
+ label: "Pending",
11
+ icon: Clock,
12
+ tagClass: "bg-stone-100 text-slate-500",
13
+ dotClass: "bg-slate-400",
14
+ },
15
+ READY_FOR_REVIEW: {
16
+ label: "Ready for Review",
17
+ icon: AlertCircle,
18
+ tagClass: "bg-amber-100 text-amber-600",
19
+ dotClass: "bg-amber-500",
20
+ },
21
+ APPROVED: {
22
+ label: "Approved",
23
+ icon: CheckCircle2,
24
+ tagClass: "bg-blue-100 text-blue-600",
25
+ dotClass: "bg-blue-500",
26
+ },
27
+ PAID: {
28
+ label: "Paid",
29
+ icon: CircleDollarSign,
30
+ tagClass: "bg-emerald-100 text-emerald-600",
31
+ dotClass: "bg-emerald-500",
32
+ },
33
+ REJECTED: {
34
+ label: "Rejected",
35
+ icon: XCircle,
36
+ tagClass: "bg-rose-100 text-rose-600",
37
+ dotClass: "bg-rose-500",
38
+ },
39
+ };
40
+ export function MilestonesSection({ milestones, dispatch, actions, currency, }) {
41
+ const columns = useMemo(() => [
42
+ {
43
+ field: "name",
44
+ title: "Milestone",
45
+ type: "string",
46
+ editable: true,
47
+ align: "left",
48
+ width: 280,
49
+ onSave: (newValue, context) => {
50
+ if (newValue !== context.row.name && newValue) {
51
+ dispatch(actions.updateMilestone({
52
+ id: context.row.id,
53
+ name: newValue,
54
+ }));
55
+ return true;
56
+ }
57
+ return false;
58
+ },
59
+ renderCell: (value, context) => {
60
+ // Use value from row data, fallback to context.row.name for empty rows
61
+ const displayValue = value || context.row.name || "";
62
+ if (!displayValue) {
63
+ return (_jsx("span", { className: "text-slate-400 italic", children: "+ Double-click to add milestone" }));
64
+ }
65
+ return _jsx("span", { className: "font-medium", children: displayValue });
66
+ },
67
+ },
68
+ {
69
+ field: "amount",
70
+ title: `Amount (${currency})`,
71
+ type: "number",
72
+ editable: true,
73
+ align: "right",
74
+ width: 120,
75
+ renderCell: (value, context) => {
76
+ // Hide for empty/new rows
77
+ if (!context.row.name) {
78
+ return null;
79
+ }
80
+ const numValue = context.row.amount?.value;
81
+ if (numValue === undefined || numValue === null) {
82
+ return _jsx("span", { className: "text-slate-400", children: "\u2014" });
83
+ }
84
+ return (_jsx("span", { className: "font-mono text-sm text-slate-700", children: _jsx("span", { children: numValue.toLocaleString() }) }));
85
+ },
86
+ renderCellEditor: (value, onChange, context) => {
87
+ // Extract numeric value from Amount object
88
+ const amountValue = context.row.amount?.value;
89
+ return (_jsx("input", { className: "w-full bg-white border border-gray-300 rounded-md p-2", name: `amount-${context.row.id}`, defaultValue: amountValue, step: "0.01", type: "number", onBlur: (e) => {
90
+ if (e.target.value !== undefined &&
91
+ e.target.value !== String(context.row.amount?.value)) {
92
+ dispatch(actions.updateMilestone({
93
+ id: context.row.id,
94
+ amount: {
95
+ value: parseFloat(e.target.value),
96
+ unit: currency,
97
+ },
98
+ }));
99
+ toast("Amount updated", { type: "success" });
100
+ }
101
+ } }));
102
+ },
103
+ onSave: (newValue, context) => {
104
+ return true;
105
+ },
106
+ },
107
+ {
108
+ field: "expectedCompletionDate",
109
+ title: "Due Date",
110
+ type: "date",
111
+ editable: true,
112
+ align: "center",
113
+ width: 160,
114
+ className: "bg-white ",
115
+ style: {
116
+ backgroundColor: "white",
117
+ },
118
+ renderCell: (value) => {
119
+ if (!value) {
120
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full", children: _jsx("span", { className: "text-slate-400" }) }));
121
+ }
122
+ try {
123
+ // Extract date parts using UTC methods to avoid timezone conversion
124
+ const date = new Date(value);
125
+ if (isNaN(date.getTime())) {
126
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full", children: _jsx("span", { className: "text-slate-400", children: "\u2014" }) }));
127
+ }
128
+ const year = date.getUTCFullYear();
129
+ const monthNames = [
130
+ "Jan",
131
+ "Feb",
132
+ "Mar",
133
+ "Apr",
134
+ "May",
135
+ "Jun",
136
+ "Jul",
137
+ "Aug",
138
+ "Sep",
139
+ "Oct",
140
+ "Nov",
141
+ "Dec",
142
+ ];
143
+ const month = monthNames[date.getUTCMonth()];
144
+ const day = date.getUTCDate();
145
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full", children: _jsx("span", { className: "text-slate-500", children: `${day} ${month} ${year}` }) }));
146
+ }
147
+ catch {
148
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full", children: _jsx("span", { className: "text-slate-400", children: "\u2014" }) }));
149
+ }
150
+ },
151
+ renderCellEditor: (value, onChange, context) => {
152
+ const dateValue = value
153
+ ? typeof value === "string"
154
+ ? new Date(value)
155
+ : value
156
+ : undefined;
157
+ return (_jsx(DatePicker, { className: "bg-white min-w-[160px]", name: `date-${context.row.id}`, value: dateValue instanceof Date ? dateValue : undefined, onChange: (e) => {
158
+ const date = e.target.value ? new Date(e.target.value) : null;
159
+ dispatch(actions.updateMilestone({
160
+ id: context.row.id,
161
+ expectedCompletionDate: date?.toISOString() || null,
162
+ }));
163
+ } }));
164
+ },
165
+ onSave: (newValue, context) => {
166
+ return true;
167
+ },
168
+ },
169
+ {
170
+ field: "requiresApproval",
171
+ title: "Approval",
172
+ type: "boolean",
173
+ editable: true,
174
+ align: "center",
175
+ width: 90,
176
+ onSave: (newValue, context) => {
177
+ return true;
178
+ },
179
+ renderCell: (value, context) => {
180
+ // Use context.row to get the latest state value
181
+ const requiresApproval = context.row.requiresApproval;
182
+ if (requiresApproval === undefined || requiresApproval === null) {
183
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full", children: _jsx("span", { className: "text-slate-400" }) }));
184
+ }
185
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full", children: requiresApproval === true ? (_jsx("span", { className: "text-emerald-600 font-medium", children: "Yes" })) : (_jsx("span", { className: "text-slate-400", children: "No" })) }));
186
+ },
187
+ renderCellEditor: (value, onChange, context) => {
188
+ const currentValue = context.row.requiresApproval ?? false;
189
+ return (_jsx(Checkbox, { className: "bg-white", name: `requiresApproval-${context.row.id}`, value: currentValue, onChange: (checked) => {
190
+ dispatch(actions.updateMilestone({
191
+ id: context.row.id,
192
+ requiresApproval: checked,
193
+ }));
194
+ toast("Approval requirement updated", { type: "success" });
195
+ } }));
196
+ },
197
+ },
198
+ {
199
+ field: "payoutStatus",
200
+ title: "Status",
201
+ type: "enum",
202
+ getCellValue: (row) => row.payoutStatus,
203
+ editable: true,
204
+ align: "center",
205
+ width: 140,
206
+ onSave: (newValue, context) => {
207
+ return true;
208
+ },
209
+ renderCell: (value, context) => {
210
+ const status = {
211
+ APPROVED: "Approved",
212
+ PAID: "Paid",
213
+ PENDING: "Pending",
214
+ READY_FOR_REVIEW: "Ready for Review",
215
+ REJECTED: "Rejected",
216
+ };
217
+ return (_jsx("div", { className: "flex items-center justify-center w-full h-full text-center", children: _jsx("span", { className: "text-slate-500", children: status[value] }) }));
218
+ },
219
+ renderCellEditor: (value, onChange, context) => {
220
+ return (_jsx(Select, { className: "bg-white min-w-[160px]", name: `payoutStatus-${context.row.id}`, value: value, options: [
221
+ { value: "APPROVED", label: "Approved" },
222
+ { value: "PAID", label: "Paid" },
223
+ { value: "PENDING", label: "Pending" },
224
+ { value: "READY_FOR_REVIEW", label: "Ready for Review" },
225
+ { value: "REJECTED", label: "Rejected" },
226
+ ], onChange: (e) => {
227
+ dispatch(actions.updateMilestoneStatus({
228
+ id: context.row.id,
229
+ payoutStatus: e,
230
+ }));
231
+ } }));
232
+ },
233
+ },
234
+ ], [actions, currency, dispatch]);
235
+ return (_jsxs("div", { className: "bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden transition-shadow hover:shadow-md", children: [_jsx("div", { className: "flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-stone-50", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex items-center justify-center w-9 h-9 rounded-lg bg-blue-100", children: _jsx(MilestoneIcon, { size: 18, className: "text-blue-600" }) }), _jsxs("div", { children: [_jsx("h2", { className: "text-[15px] font-semibold text-slate-800", children: "Milestones" }), _jsxs("p", { className: "text-[13px] text-slate-400 mt-0.5", children: [milestones.length, " milestone", milestones.length !== 1 ? "s" : "", " ", "defined"] })] })] }) }), _jsx("div", { className: "p-5", children: milestones.length > 0 ? (_jsx(ObjectSetTable, { data: milestones, columns: columns, onAdd: (data) => {
236
+ const name = data.name || "";
237
+ if (name.trim()) {
238
+ const milestoneData = {
239
+ id: generateId(),
240
+ name: name.trim(),
241
+ amount: { value: 0, unit: currency },
242
+ requiresApproval: true,
243
+ expectedCompletionDate: null,
244
+ payoutStatus: "PENDING",
245
+ };
246
+ dispatch(actions.addMilestone(milestoneData));
247
+ toast("Milestone added", { type: "success" });
248
+ }
249
+ }, onDelete: (rows) => {
250
+ if (rows.length > 0) {
251
+ rows.forEach((row) => {
252
+ dispatch(actions.deleteMilestone({ id: row.id }));
253
+ });
254
+ toast(`${rows.length} milestone${rows.length > 1 ? "s" : ""} deleted`, { type: "success" });
255
+ }
256
+ }, allowRowSelection: true })) : (_jsxs("div", { className: "flex flex-col items-center justify-center py-10 text-center border-2 border-dashed border-gray-200 rounded-lg bg-stone-50", children: [_jsx(MilestoneIcon, { size: 48, className: "text-slate-400 mb-4" }), _jsx("p", { className: "text-[15px] font-semibold text-slate-800 mb-1", children: "No milestones yet" }), _jsx("p", { className: "text-sm text-slate-400 mb-4", children: "Add milestones to define your payment schedule" }), _jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-4 py-2 text-[13px] font-medium text-white bg-slate-800 border-none rounded-md cursor-pointer transition-colors hover:bg-slate-700", onClick: () => {
257
+ const milestoneData = {
258
+ id: generateId(),
259
+ name: "New Milestone",
260
+ amount: { value: 0, unit: currency },
261
+ requiresApproval: true,
262
+ expectedCompletionDate: null,
263
+ payoutStatus: "PENDING",
264
+ };
265
+ dispatch(actions.addMilestone(milestoneData));
266
+ toast("Milestone added", { type: "success" });
267
+ }, children: [_jsx(Plus, { size: 16 }), "Add First Milestone"] })] })) })] }));
268
+ }
@@ -0,0 +1,11 @@
1
+ import type { PaymentTermsState } from "../../../document-models/payment-terms/gen/types.js";
2
+ import type { PaymentTermsAction } from "../../../document-models/payment-terms/gen/actions.js";
3
+ import { type actions as paymentTermsActions } from "../../../document-models/payment-terms/index.js";
4
+ interface PartiesSectionProps {
5
+ state: PaymentTermsState;
6
+ dispatch: (action: PaymentTermsAction) => void;
7
+ actions: typeof paymentTermsActions;
8
+ }
9
+ export declare function PartiesSection({ state, dispatch, actions, }: PartiesSectionProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=parties-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parties-section.d.ts","sourceRoot":"","sources":["../../../../editors/payment-terms/components/parties-section.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAEtG,UAAU,mBAAmB;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE,mBAAmB,2CAqIrB"}
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useCallback } from "react";
3
+ import { Users, UserCircle, Building2, Pencil, Check, X } from "lucide-react";
4
+ import { TextInput } from "@powerhousedao/document-engineering";
5
+ import { toast } from "@powerhousedao/design-system/connect";
6
+ import {} from "../../../document-models/payment-terms/index.js";
7
+ export function PartiesSection({ state, dispatch, actions, }) {
8
+ const [isEditing, setIsEditing] = useState(false);
9
+ const [formData, setFormData] = useState({
10
+ proposer: state.proposer || "",
11
+ payer: state.payer || "",
12
+ });
13
+ const handleSave = useCallback(() => {
14
+ if (!formData.proposer.trim() || !formData.payer.trim()) {
15
+ toast("Both proposer and payer are required", { type: "error" });
16
+ return;
17
+ }
18
+ dispatch(actions.setBasicTerms({
19
+ proposer: formData.proposer,
20
+ payer: formData.payer,
21
+ currency: state.currency,
22
+ paymentModel: state.paymentModel,
23
+ totalAmount: state.totalAmount || undefined,
24
+ }));
25
+ toast("Parties updated successfully", { type: "success" });
26
+ setIsEditing(false);
27
+ }, [formData, state, dispatch, actions]);
28
+ const handleCancel = useCallback(() => {
29
+ setFormData({
30
+ proposer: state.proposer || "",
31
+ payer: state.payer || "",
32
+ });
33
+ setIsEditing(false);
34
+ }, [state]);
35
+ return (_jsxs("div", { className: "bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden transition-shadow hover:shadow-md", children: [_jsxs("div", { className: "flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-stone-50", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex items-center justify-center w-9 h-9 rounded-lg bg-white text-slate-500", children: _jsx(Users, { size: 18 }) }), _jsxs("div", { children: [_jsx("h2", { className: "text-[15px] font-semibold text-slate-800", children: "Parties" }), _jsx("p", { className: "text-[13px] text-slate-400 mt-0.5", children: "Contract participants" })] })] }), !isEditing ? (_jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-3 py-1.5 text-[13px] font-medium text-slate-500 bg-transparent border-none rounded-md cursor-pointer transition-colors hover:bg-stone-100 hover:text-slate-800", onClick: () => setIsEditing(true), children: [_jsx(Pencil, { size: 14 }), "Edit"] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-3 py-1.5 text-[13px] font-medium text-white bg-emerald-600 border-none rounded-md cursor-pointer transition-colors hover:bg-emerald-700", onClick: handleSave, children: [_jsx(Check, { size: 14 }), "Save"] }), _jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-3 py-1.5 text-[13px] font-medium text-slate-500 bg-transparent border-none rounded-md cursor-pointer transition-colors hover:bg-stone-100 hover:text-slate-800", onClick: handleCancel, children: [_jsx(X, { size: 14 }), "Cancel"] })] }))] }), _jsx("div", { className: "p-5", children: _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("label", { className: "text-[13px] font-medium text-slate-500", children: [_jsx(UserCircle, { size: 14, className: "inline align-middle mr-1.5" }), "Proposer"] }), isEditing ? (_jsx(TextInput, { value: formData.proposer, onChange: (e) => setFormData({ ...formData, proposer: e.target.value }), placeholder: "Enter proposer name or entity" })) : (_jsx("p", { className: `text-[15px] py-2.5 ${!state.proposer ? "text-slate-400 italic" : "text-slate-800"}`, children: state.proposer || "Not specified" }))] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("label", { className: "text-[13px] font-medium text-slate-500", children: [_jsx(Building2, { size: 14, className: "inline align-middle mr-1.5" }), "Payer"] }), isEditing ? (_jsx(TextInput, { value: formData.payer, onChange: (e) => setFormData({ ...formData, payer: e.target.value }), placeholder: "Enter payer name or entity" })) : (_jsx("p", { className: `text-[15px] py-2.5 ${!state.payer ? "text-slate-400 italic" : "text-slate-800"}`, children: state.payer || "Not specified" }))] })] }) })] }));
36
+ }
@@ -0,0 +1,11 @@
1
+ import type { PaymentTermsState } from "../../../document-models/payment-terms/gen/types.js";
2
+ import type { PaymentTermsAction } from "../../../document-models/payment-terms/gen/actions.js";
3
+ import { type actions as paymentTermsActions } from "../../../document-models/payment-terms/index.js";
4
+ interface PaymentConfigSectionProps {
5
+ state: PaymentTermsState;
6
+ dispatch: (action: PaymentTermsAction) => void;
7
+ actions: typeof paymentTermsActions;
8
+ }
9
+ export declare function PaymentConfigSection({ state, dispatch, actions, }: PaymentConfigSectionProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=payment-config-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-config-section.d.ts","sourceRoot":"","sources":["../../../../editors/payment-terms/components/payment-config-section.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,KAAK,OAAO,IAAI,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAEtG,UAAU,yBAAyB;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACrC;AAaD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE,yBAAyB,2CA0L3B"}
@@ -0,0 +1,68 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useCallback } from "react";
3
+ import { Settings, DollarSign, Milestone, Clock, Pencil, Check, X, } from "lucide-react";
4
+ import { TextInput, Select } from "@powerhousedao/document-engineering";
5
+ import { toast } from "@powerhousedao/design-system/connect";
6
+ import {} from "../../../document-models/payment-terms/index.js";
7
+ const CURRENCY_OPTIONS = [
8
+ { value: "USD", label: "USD - US Dollar" },
9
+ { value: "EUR", label: "EUR - Euro" },
10
+ { value: "GBP", label: "GBP - British Pound" },
11
+ ];
12
+ const PAYMENT_MODEL_OPTIONS = [
13
+ { value: "MILESTONE", label: "Milestone-Based" },
14
+ { value: "TIME_AND_MATERIALS", label: "Time & Materials" },
15
+ ];
16
+ export function PaymentConfigSection({ state, dispatch, actions, }) {
17
+ const [isEditing, setIsEditing] = useState(false);
18
+ const [formData, setFormData] = useState({
19
+ currency: state.currency || "USD",
20
+ paymentModel: state.paymentModel || "MILESTONE",
21
+ totalAmount: state.totalAmount?.value?.toString() || "",
22
+ });
23
+ const handleSave = useCallback(() => {
24
+ dispatch(actions.setBasicTerms({
25
+ proposer: state.proposer,
26
+ payer: state.payer,
27
+ currency: formData.currency,
28
+ paymentModel: formData.paymentModel,
29
+ totalAmount: formData.totalAmount
30
+ ? {
31
+ value: parseFloat(formData.totalAmount),
32
+ unit: formData.currency,
33
+ }
34
+ : undefined,
35
+ }));
36
+ toast("Payment configuration updated", { type: "success" });
37
+ setIsEditing(false);
38
+ }, [formData, state, dispatch, actions]);
39
+ const handleCancel = useCallback(() => {
40
+ setFormData({
41
+ currency: state.currency || "USD",
42
+ paymentModel: state.paymentModel || "MILESTONE",
43
+ totalAmount: state.totalAmount?.value?.toString() || "",
44
+ });
45
+ setIsEditing(false);
46
+ }, [state]);
47
+ const formatAmount = (value, currency) => {
48
+ if (!value)
49
+ return null;
50
+ return new Intl.NumberFormat("en-US", {
51
+ style: "currency",
52
+ currency: currency,
53
+ minimumFractionDigits: 0,
54
+ maximumFractionDigits: 2,
55
+ }).format(value);
56
+ };
57
+ const PaymentModelIcon = state.paymentModel === "MILESTONE" ? Milestone : Clock;
58
+ return (_jsxs("div", { className: "bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden transition-shadow hover:shadow-md", children: [_jsxs("div", { className: "flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-stone-50", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex items-center justify-center w-9 h-9 rounded-lg bg-white text-slate-500", children: _jsx(Settings, { size: 18 }) }), _jsxs("div", { children: [_jsx("h2", { className: "text-[15px] font-semibold text-slate-800", children: "Payment Configuration" }), _jsx("p", { className: "text-[13px] text-slate-400 mt-0.5", children: "Currency, model, and total amount" })] })] }), !isEditing ? (_jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-3 py-1.5 text-[13px] font-medium text-slate-500 bg-transparent border-none rounded-md cursor-pointer transition-colors hover:bg-stone-100 hover:text-slate-800", onClick: () => setIsEditing(true), children: [_jsx(Pencil, { size: 14 }), "Edit"] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-3 py-1.5 text-[13px] font-medium text-white bg-emerald-600 border-none rounded-md cursor-pointer transition-colors hover:bg-emerald-700", onClick: handleSave, children: [_jsx(Check, { size: 14 }), "Save"] }), _jsxs("button", { type: "button", className: "inline-flex items-center gap-2 px-3 py-1.5 text-[13px] font-medium text-slate-500 bg-transparent border-none rounded-md cursor-pointer transition-colors hover:bg-stone-100 hover:text-slate-800", onClick: handleCancel, children: [_jsx(X, { size: 14 }), "Cancel"] })] }))] }), _jsx("div", { className: "p-5", children: _jsxs("div", { className: "grid grid-cols-3 gap-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("label", { className: "text-[13px] font-medium text-slate-500", children: [_jsx(DollarSign, { size: 14, className: "inline align-middle mr-1.5" }), "Currency"] }), isEditing ? (_jsx(Select, { value: formData.currency, onChange: (value) => setFormData({
59
+ ...formData,
60
+ currency: value,
61
+ }), options: CURRENCY_OPTIONS })) : (_jsx("p", { className: "text-[15px] py-2.5", children: _jsx("span", { className: "inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded-full bg-stone-100 text-slate-500", children: state.currency }) }))] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("label", { className: "text-[13px] font-medium text-slate-500", children: [_jsx(PaymentModelIcon, { size: 14, className: "inline align-middle mr-1.5" }), "Payment Model"] }), isEditing ? (_jsx(Select, { value: formData.paymentModel, onChange: (value) => setFormData({
62
+ ...formData,
63
+ paymentModel: value,
64
+ }), options: PAYMENT_MODEL_OPTIONS })) : (_jsx("p", { className: "text-[15px] py-2.5", children: _jsx("span", { className: `inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded-full ${state.paymentModel === "MILESTONE" ? "bg-blue-100 text-blue-600" : "bg-amber-100 text-amber-600"}`, children: state.paymentModel === "MILESTONE"
65
+ ? "Milestone-Based"
66
+ : "Time & Materials" }) }))] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("label", { className: "text-[13px] font-medium text-slate-500", children: "Total Contract Value" }), isEditing ? (_jsx(TextInput, { type: "number", value: formData.totalAmount, onChange: (e) => setFormData({ ...formData, totalAmount: e.target.value }), placeholder: "0.00", step: "0.01" })) : (_jsx("p", { className: `text-lg font-mono font-semibold py-2.5 ${!state.totalAmount ? "text-slate-400 italic text-[15px] font-normal" : "text-slate-800"}`, children: formatAmount(state.totalAmount?.value, state.currency) ||
67
+ "Not set" }))] })] }) })] }));
68
+ }
@@ -0,0 +1,2 @@
1
+ export declare function PaymentTermsStyles(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../editors/payment-terms/components/styles.tsx"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,4CAquBjC"}