@powerhousedao/vetra 4.1.0-dev.82 → 4.1.0-dev.83

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 (60) hide show
  1. package/dist/document-models/app-module/src/reducers/base-operations.d.ts.map +1 -1
  2. package/dist/document-models/app-module/src/reducers/base-operations.js +5 -1
  3. package/dist/document-models/app-module/src/tests/base-operations.test.js +157 -30
  4. package/dist/document-models/app-module/src/tests/dnd-operations.test.js +38 -7
  5. package/dist/document-models/app-module/src/tests/document-model.test.js +80 -8
  6. package/dist/document-models/document-editor/src/reducers/base-operations.d.ts.map +1 -1
  7. package/dist/document-models/document-editor/src/reducers/base-operations.js +10 -1
  8. package/dist/document-models/document-editor/src/tests/base-operations.test.js +137 -23
  9. package/dist/document-models/document-editor/src/tests/document-model.test.js +91 -8
  10. package/dist/document-models/processor-module/src/reducers/base-operations.d.ts.map +1 -1
  11. package/dist/document-models/processor-module/src/reducers/base-operations.js +15 -2
  12. package/dist/document-models/processor-module/src/tests/base-operations.test.js +153 -33
  13. package/dist/document-models/processor-module/src/tests/document-model.test.js +96 -8
  14. package/dist/document-models/subgraph-module/src/reducers/base-operations.d.ts.map +1 -1
  15. package/dist/document-models/subgraph-module/src/reducers/base-operations.js +5 -1
  16. package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +33 -12
  17. package/dist/document-models/subgraph-module/src/tests/document-model.test.js +25 -8
  18. package/dist/document-models/vetra-package/src/reducers/base-operations.d.ts.map +1 -1
  19. package/dist/document-models/vetra-package/src/reducers/base-operations.js +5 -0
  20. package/dist/document-models/vetra-package/src/tests/base-operations.test.js +171 -75
  21. package/dist/document-models/vetra-package/src/tests/document-model.test.js +101 -8
  22. package/dist/editors/app-editor/components/AppEditorForm.d.ts.map +1 -1
  23. package/dist/editors/app-editor/components/AppEditorForm.js +2 -2
  24. package/dist/editors/app-editor/editor.test.d.ts +2 -0
  25. package/dist/editors/app-editor/editor.test.d.ts.map +1 -0
  26. package/dist/editors/app-editor/editor.test.js +422 -0
  27. package/dist/editors/document-editor/components/DocumentEditorForm.d.ts.map +1 -1
  28. package/dist/editors/document-editor/components/DocumentEditorForm.js +1 -1
  29. package/dist/editors/document-editor/editor.test.d.ts +2 -0
  30. package/dist/editors/document-editor/editor.test.d.ts.map +1 -0
  31. package/dist/editors/document-editor/editor.test.js +374 -0
  32. package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts.map +1 -1
  33. package/dist/editors/processor-editor/components/ProcessorEditorForm.js +1 -1
  34. package/dist/editors/processor-editor/editor.test.d.ts +2 -0
  35. package/dist/editors/processor-editor/editor.test.d.ts.map +1 -0
  36. package/dist/editors/processor-editor/editor.test.js +459 -0
  37. package/dist/editors/subgraph-editor/components/SubgraphEditorForm.d.ts.map +1 -1
  38. package/dist/editors/subgraph-editor/components/SubgraphEditorForm.js +3 -3
  39. package/dist/editors/subgraph-editor/editor.test.d.ts +2 -0
  40. package/dist/editors/subgraph-editor/editor.test.d.ts.map +1 -0
  41. package/dist/editors/subgraph-editor/editor.test.js +201 -0
  42. package/dist/editors/vetra-package/components/MetaForm.d.ts.map +1 -1
  43. package/dist/editors/vetra-package/components/MetaForm.js +3 -3
  44. package/dist/editors/vetra-package/editor.test.d.ts +2 -0
  45. package/dist/editors/vetra-package/editor.test.d.ts.map +1 -0
  46. package/dist/editors/vetra-package/editor.test.js +330 -0
  47. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.d.ts +2 -0
  48. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.d.ts.map +1 -0
  49. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +615 -0
  50. package/dist/processors/codegen/__tests__/factory.test.d.ts +2 -0
  51. package/dist/processors/codegen/__tests__/factory.test.d.ts.map +1 -0
  52. package/dist/processors/codegen/__tests__/factory.test.js +190 -0
  53. package/dist/setupTests.d.ts +2 -0
  54. package/dist/setupTests.d.ts.map +1 -0
  55. package/dist/setupTests.js +1 -0
  56. package/dist/style.css +9 -0
  57. package/dist/tsconfig.tsbuildinfo +1 -1
  58. package/dist/vitest.config.d.ts.map +1 -1
  59. package/dist/vitest.config.js +9 -0
  60. package/package.json +19 -14
@@ -0,0 +1,459 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen, waitFor } from "@testing-library/react";
3
+ import { userEvent } from "@testing-library/user-event";
4
+ import { beforeEach, describe, expect, it, vi } from "vitest";
5
+ import { useSelectedProcessorModuleDocument } from "../hooks/useVetraDocument.js";
6
+ import { Editor } from "./editor.js";
7
+ vi.mock("../hooks/useVetraDocument.js", () => ({
8
+ useSelectedProcessorModuleDocument: vi.fn(),
9
+ }));
10
+ vi.mock("../hooks/useAvailableDocumentTypes.js", () => ({
11
+ useAvailableDocumentTypes: vi.fn(() => [
12
+ "powerhouse/document-model",
13
+ "powerhouse/budget-statement",
14
+ "powerhouse/project-tracker",
15
+ ]),
16
+ }));
17
+ describe("ProcessorModule Editor", () => {
18
+ let mockDispatch;
19
+ beforeEach(() => {
20
+ mockDispatch = vi.fn();
21
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
22
+ {
23
+ state: {
24
+ global: {
25
+ name: "",
26
+ type: "",
27
+ status: "DRAFT",
28
+ documentTypes: [],
29
+ },
30
+ },
31
+ },
32
+ mockDispatch,
33
+ ]);
34
+ });
35
+ describe("Core Rendering", () => {
36
+ it("should render all main form sections and labels", () => {
37
+ render(_jsx(Editor, {}));
38
+ expect(screen.getByText("Processor Configuration")).toBeInTheDocument();
39
+ expect(screen.getByText("Processor Name")).toBeInTheDocument();
40
+ expect(screen.getByText("Type")).toBeInTheDocument();
41
+ expect(screen.getByText("Document Types")).toBeInTheDocument();
42
+ expect(screen.getByText("Confirm")).toBeInTheDocument();
43
+ });
44
+ it("should display existing processor data when document has values", () => {
45
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
46
+ {
47
+ state: {
48
+ global: {
49
+ name: "test-processor",
50
+ type: "analytics",
51
+ status: "DRAFT",
52
+ documentTypes: [
53
+ { id: "dt-1", documentType: "powerhouse/document-model" },
54
+ { id: "dt-2", documentType: "powerhouse/budget-statement" },
55
+ ],
56
+ },
57
+ },
58
+ },
59
+ mockDispatch,
60
+ ]);
61
+ render(_jsx(Editor, {}));
62
+ expect(screen.getByDisplayValue("test-processor")).toBeInTheDocument();
63
+ // Check that the type select has the correct value
64
+ const typeSelect = screen.getByLabelText("Type");
65
+ expect(typeSelect.value).toBe("analytics");
66
+ expect(screen.getByText("powerhouse/document-model")).toBeInTheDocument();
67
+ expect(screen.getByText("powerhouse/budget-statement")).toBeInTheDocument();
68
+ });
69
+ });
70
+ describe("Processor Name Input", () => {
71
+ it("should dispatch setProcessorName when name changes (debounced)", async () => {
72
+ const user = userEvent.setup();
73
+ render(_jsx(Editor, {}));
74
+ const nameInput = screen.getByLabelText("Processor Name");
75
+ await user.type(nameInput, "new-processor");
76
+ await waitFor(() => {
77
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
78
+ type: "SET_PROCESSOR_NAME",
79
+ input: { name: "new-processor" },
80
+ }));
81
+ }, { timeout: 500 });
82
+ });
83
+ it("should dispatch when clearing a non-empty field", async () => {
84
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
85
+ {
86
+ state: {
87
+ global: {
88
+ name: "existing-processor",
89
+ type: "",
90
+ status: "DRAFT",
91
+ documentTypes: [],
92
+ },
93
+ },
94
+ },
95
+ mockDispatch,
96
+ ]);
97
+ const user = userEvent.setup();
98
+ render(_jsx(Editor, {}));
99
+ const nameInput = screen.getByLabelText("Processor Name");
100
+ await user.clear(nameInput);
101
+ await waitFor(() => {
102
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
103
+ type: "SET_PROCESSOR_NAME",
104
+ input: { name: "" },
105
+ }));
106
+ }, { timeout: 500 });
107
+ });
108
+ it("should NOT dispatch when typing identical value without clearing", async () => {
109
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
110
+ {
111
+ state: {
112
+ global: {
113
+ name: "test",
114
+ type: "",
115
+ status: "DRAFT",
116
+ documentTypes: [],
117
+ },
118
+ },
119
+ },
120
+ mockDispatch,
121
+ ]);
122
+ const user = userEvent.setup();
123
+ render(_jsx(Editor, {}));
124
+ const nameInput = screen.getByLabelText("Processor Name");
125
+ await user.tripleClick(nameInput);
126
+ await user.type(nameInput, "test");
127
+ await waitFor(() => {
128
+ expect(mockDispatch).not.toHaveBeenCalled();
129
+ });
130
+ });
131
+ it("should NOT dispatch when both old and new values are empty", async () => {
132
+ const user = userEvent.setup();
133
+ render(_jsx(Editor, {}));
134
+ const nameInput = screen.getByLabelText("Processor Name");
135
+ await user.click(nameInput);
136
+ await user.tab();
137
+ await waitFor(() => {
138
+ expect(mockDispatch).not.toHaveBeenCalled();
139
+ });
140
+ });
141
+ });
142
+ describe("Processor Type Dropdown", () => {
143
+ it("should dispatch setProcessorType when type changes (debounced)", async () => {
144
+ const user = userEvent.setup();
145
+ render(_jsx(Editor, {}));
146
+ const typeSelect = screen.getByLabelText("Type");
147
+ await user.selectOptions(typeSelect, "analytics");
148
+ await waitFor(() => {
149
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
150
+ type: "SET_PROCESSOR_TYPE",
151
+ input: { type: "analytics" },
152
+ }));
153
+ }, { timeout: 500 });
154
+ });
155
+ it("should NOT dispatch when selecting same type", async () => {
156
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
157
+ {
158
+ state: {
159
+ global: {
160
+ name: "test-processor",
161
+ type: "analytics",
162
+ status: "DRAFT",
163
+ documentTypes: [],
164
+ },
165
+ },
166
+ },
167
+ mockDispatch,
168
+ ]);
169
+ const user = userEvent.setup();
170
+ render(_jsx(Editor, {}));
171
+ const typeSelect = screen.getByLabelText("Type");
172
+ // Select the same type that's already set
173
+ await user.selectOptions(typeSelect, "analytics");
174
+ // Wait to ensure debounce has time to fire (if it would)
175
+ await new Promise((resolve) => setTimeout(resolve, 400));
176
+ // Should NOT have dispatched because "analytics" is already the current value
177
+ expect(mockDispatch).not.toHaveBeenCalled();
178
+ });
179
+ it("should show correct type options", () => {
180
+ render(_jsx(Editor, {}));
181
+ const typeSelect = screen.getByLabelText("Type");
182
+ const options = Array.from(typeSelect.querySelectorAll("option")).map((opt) => opt.value);
183
+ expect(options).toContain("analytics");
184
+ expect(options).toContain("relational");
185
+ });
186
+ });
187
+ describe("Document Types Management", () => {
188
+ it("should add document type from dropdown", async () => {
189
+ const user = userEvent.setup();
190
+ render(_jsx(Editor, {}));
191
+ const select = screen.getByLabelText("Document Types");
192
+ await user.selectOptions(select, "powerhouse/document-model");
193
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
194
+ type: "ADD_DOCUMENT_TYPE",
195
+ input: expect.objectContaining({
196
+ documentType: "powerhouse/document-model",
197
+ id: expect.any(String),
198
+ }),
199
+ }));
200
+ });
201
+ it("should remove document type", async () => {
202
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
203
+ {
204
+ state: {
205
+ global: {
206
+ name: "test-processor",
207
+ type: "analytics",
208
+ status: "DRAFT",
209
+ documentTypes: [
210
+ { id: "dt-1", documentType: "powerhouse/document-model" },
211
+ { id: "dt-2", documentType: "powerhouse/budget-statement" },
212
+ ],
213
+ },
214
+ },
215
+ },
216
+ mockDispatch,
217
+ ]);
218
+ const user = userEvent.setup();
219
+ render(_jsx(Editor, {}));
220
+ const documentModelText = screen.getByText("powerhouse/document-model");
221
+ const removeButton = documentModelText.parentElement?.querySelector("button");
222
+ if (removeButton) {
223
+ await user.click(removeButton);
224
+ }
225
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
226
+ type: "REMOVE_DOCUMENT_TYPE",
227
+ input: { id: "dt-1" },
228
+ }));
229
+ });
230
+ it("should NOT show duplicate document type in dropdown", () => {
231
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
232
+ {
233
+ state: {
234
+ global: {
235
+ name: "test-processor",
236
+ type: "analytics",
237
+ status: "DRAFT",
238
+ documentTypes: [
239
+ { id: "dt-1", documentType: "powerhouse/document-model" },
240
+ ],
241
+ },
242
+ },
243
+ },
244
+ mockDispatch,
245
+ ]);
246
+ render(_jsx(Editor, {}));
247
+ const select = screen.getByLabelText("Document Types");
248
+ const options = Array.from(select.querySelectorAll("option")).map((opt) => opt.value);
249
+ expect(options).not.toContain("powerhouse/document-model");
250
+ expect(options).toContain("powerhouse/budget-statement");
251
+ expect(options).toContain("powerhouse/project-tracker");
252
+ });
253
+ it("should add multiple document types", async () => {
254
+ const user = userEvent.setup();
255
+ render(_jsx(Editor, {}));
256
+ const select = screen.getByLabelText("Document Types");
257
+ await user.selectOptions(select, "powerhouse/document-model");
258
+ await user.selectOptions(select, "powerhouse/budget-statement");
259
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
260
+ type: "ADD_DOCUMENT_TYPE",
261
+ input: expect.objectContaining({
262
+ documentType: "powerhouse/document-model",
263
+ }),
264
+ }));
265
+ expect(mockDispatch).toHaveBeenCalledWith(expect.objectContaining({
266
+ type: "ADD_DOCUMENT_TYPE",
267
+ input: expect.objectContaining({
268
+ documentType: "powerhouse/budget-statement",
269
+ }),
270
+ }));
271
+ });
272
+ it("should display existing document types list", () => {
273
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
274
+ {
275
+ state: {
276
+ global: {
277
+ name: "test-processor",
278
+ type: "analytics",
279
+ status: "DRAFT",
280
+ documentTypes: [
281
+ { id: "dt-1", documentType: "powerhouse/document-model" },
282
+ { id: "dt-2", documentType: "powerhouse/budget-statement" },
283
+ ],
284
+ },
285
+ },
286
+ },
287
+ mockDispatch,
288
+ ]);
289
+ render(_jsx(Editor, {}));
290
+ expect(screen.getByText("powerhouse/document-model")).toBeInTheDocument();
291
+ expect(screen.getByText("powerhouse/budget-statement")).toBeInTheDocument();
292
+ });
293
+ });
294
+ describe("Confirm Button", () => {
295
+ it("should dispatch setProcessorStatus when confirm clicked", async () => {
296
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
297
+ {
298
+ state: {
299
+ global: {
300
+ name: "test-processor",
301
+ type: "analytics",
302
+ status: "DRAFT",
303
+ documentTypes: [
304
+ { id: "dt-1", documentType: "powerhouse/document-model" },
305
+ ],
306
+ },
307
+ },
308
+ },
309
+ mockDispatch,
310
+ ]);
311
+ const user = userEvent.setup();
312
+ render(_jsx(Editor, {}));
313
+ const confirmButton = screen.getByText("Confirm");
314
+ await user.click(confirmButton);
315
+ expect(mockDispatch).toHaveBeenCalledWith([
316
+ expect.objectContaining({
317
+ type: "SET_PROCESSOR_STATUS",
318
+ input: { status: "CONFIRMED" },
319
+ }),
320
+ ]);
321
+ });
322
+ it("should be disabled when processor name is empty", () => {
323
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
324
+ {
325
+ state: {
326
+ global: {
327
+ name: "",
328
+ type: "analytics",
329
+ status: "DRAFT",
330
+ documentTypes: [
331
+ { id: "dt-1", documentType: "powerhouse/document-model" },
332
+ ],
333
+ },
334
+ },
335
+ },
336
+ mockDispatch,
337
+ ]);
338
+ render(_jsx(Editor, {}));
339
+ const confirmButton = screen.getByText("Confirm");
340
+ expect(confirmButton).toBeDisabled();
341
+ });
342
+ it("should be disabled when processor type is empty", () => {
343
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
344
+ {
345
+ state: {
346
+ global: {
347
+ name: "test-processor",
348
+ type: "",
349
+ status: "DRAFT",
350
+ documentTypes: [
351
+ { id: "dt-1", documentType: "powerhouse/document-model" },
352
+ ],
353
+ },
354
+ },
355
+ },
356
+ mockDispatch,
357
+ ]);
358
+ render(_jsx(Editor, {}));
359
+ const confirmButton = screen.getByText("Confirm");
360
+ expect(confirmButton).toBeDisabled();
361
+ });
362
+ it("should be disabled when no document types selected", () => {
363
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
364
+ {
365
+ state: {
366
+ global: {
367
+ name: "test-processor",
368
+ type: "analytics",
369
+ status: "DRAFT",
370
+ documentTypes: [],
371
+ },
372
+ },
373
+ },
374
+ mockDispatch,
375
+ ]);
376
+ render(_jsx(Editor, {}));
377
+ const confirmButton = screen.getByText("Confirm");
378
+ expect(confirmButton).toBeDisabled();
379
+ });
380
+ it("should be hidden when status is CONFIRMED", () => {
381
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
382
+ {
383
+ state: {
384
+ global: {
385
+ name: "test-processor",
386
+ type: "analytics",
387
+ status: "CONFIRMED",
388
+ documentTypes: [
389
+ { id: "dt-1", documentType: "powerhouse/document-model" },
390
+ ],
391
+ },
392
+ },
393
+ },
394
+ mockDispatch,
395
+ ]);
396
+ render(_jsx(Editor, {}));
397
+ const confirmButton = screen.queryByText("Confirm");
398
+ expect(confirmButton).not.toBeInTheDocument();
399
+ });
400
+ });
401
+ describe("Read-only Mode", () => {
402
+ it("should disable form fields when status is CONFIRMED", () => {
403
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
404
+ {
405
+ state: {
406
+ global: {
407
+ name: "test-processor",
408
+ type: "analytics",
409
+ status: "CONFIRMED",
410
+ documentTypes: [
411
+ { id: "dt-1", documentType: "powerhouse/document-model" },
412
+ ],
413
+ },
414
+ },
415
+ },
416
+ mockDispatch,
417
+ ]);
418
+ render(_jsx(Editor, {}));
419
+ const nameInput = screen.getByLabelText("Processor Name");
420
+ const typeSelect = screen.getByLabelText("Type");
421
+ expect(nameInput).toBeDisabled();
422
+ expect(typeSelect).toBeDisabled();
423
+ // Document types dropdown should not be visible in read-only mode
424
+ const select = screen.queryByLabelText("Document Types");
425
+ expect(select).not.toBeInTheDocument();
426
+ // Remove buttons should not be visible
427
+ const removeButtons = screen.queryAllByText("×");
428
+ expect(removeButtons).toHaveLength(0);
429
+ });
430
+ it("should enable form fields when status is DRAFT", () => {
431
+ vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
432
+ {
433
+ state: {
434
+ global: {
435
+ name: "test-processor",
436
+ type: "analytics",
437
+ status: "DRAFT",
438
+ documentTypes: [
439
+ { id: "dt-1", documentType: "powerhouse/document-model" },
440
+ ],
441
+ },
442
+ },
443
+ },
444
+ mockDispatch,
445
+ ]);
446
+ render(_jsx(Editor, {}));
447
+ const nameInput = screen.getByLabelText("Processor Name");
448
+ const typeSelect = screen.getByLabelText("Type");
449
+ expect(nameInput).not.toBeDisabled();
450
+ expect(typeSelect).not.toBeDisabled();
451
+ // Document types dropdown should be visible
452
+ const select = screen.getByLabelText("Document Types");
453
+ expect(select).toBeInTheDocument();
454
+ // Remove button should be visible
455
+ const removeButtons = screen.queryAllByText("×");
456
+ expect(removeButtons.length).toBeGreaterThan(0);
457
+ });
458
+ });
459
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"SubgraphEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/subgraph-editor/components/SubgraphEditorForm.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6EhE,CAAC"}
1
+ {"version":3,"file":"SubgraphEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/subgraph-editor/components/SubgraphEditorForm.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAiFhE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { useDebounce } from "../../hooks/index.js";
2
+ import { useEffect, useState } from "react";
4
3
  import { StatusPill } from "../../components/index.js";
4
+ import { useDebounce } from "../../hooks/index.js";
5
5
  export const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "DRAFT", onNameChange, onConfirm, }) => {
6
6
  const [subgraphName, setSubgraphName] = useState(initialSubgraphName);
7
7
  const [isConfirmed, setIsConfirmed] = useState(false);
@@ -25,5 +25,5 @@ export const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", sta
25
25
  onConfirm?.();
26
26
  }
27
27
  };
28
- return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Subgraph Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { className: "mb-2 block text-sm font-medium text-gray-700", children: "Subgraph Name" }), _jsx("input", { type: "text", value: subgraphName, onChange: (e) => setSubgraphName(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, placeholder: "Enter subgraph name" })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !subgraphName.trim(), className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300", children: "Confirm" }) }))] }));
28
+ return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Subgraph Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "subgraph-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Subgraph Name" }), _jsx("input", { id: "subgraph-name", type: "text", value: subgraphName, onChange: (e) => setSubgraphName(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, placeholder: "Enter subgraph name" })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !subgraphName.trim(), className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300", children: "Confirm" }) }))] }));
29
29
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=editor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.test.d.ts","sourceRoot":"","sources":["../../../editors/subgraph-editor/editor.test.tsx"],"names":[],"mappings":""}