@nice2dev/ui-api 1.0.10
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/README.md +94 -0
- package/dist/NiceAPIDesigner.d.ts +8 -0
- package/dist/NiceAPITester.d.ts +8 -0
- package/dist/NiceIntegrationBuilder.d.ts +8 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +1820 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +403 -0
- package/package.json +63 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1820 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useCallback as T, useRef as Z, useEffect as se } from "react";
|
|
3
|
+
const ce = {
|
|
4
|
+
openapi: "3.0.3",
|
|
5
|
+
info: {
|
|
6
|
+
title: "New API",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
description: "API description"
|
|
9
|
+
},
|
|
10
|
+
paths: {},
|
|
11
|
+
components: {
|
|
12
|
+
schemas: {},
|
|
13
|
+
securitySchemes: {}
|
|
14
|
+
},
|
|
15
|
+
tags: []
|
|
16
|
+
}, ne = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
17
|
+
function ie(i) {
|
|
18
|
+
var c, n;
|
|
19
|
+
const a = [];
|
|
20
|
+
return i.openapi || a.push({ path: "openapi", message: "OpenAPI version is required", severity: "error" }), (c = i.info) != null && c.title || a.push({ path: "info.title", message: "API title is required", severity: "error" }), (n = i.info) != null && n.version || a.push({ path: "info.version", message: "API version is required", severity: "error" }), Object.entries(i.paths || {}).forEach(([r, d]) => {
|
|
21
|
+
r.startsWith("/") || a.push({ path: `paths.${r}`, message: "Path must start with /", severity: "error" }), ne.forEach((o) => {
|
|
22
|
+
const b = d[o.toLowerCase()];
|
|
23
|
+
b && !b.responses && a.push({
|
|
24
|
+
path: `paths.${r}.${o.toLowerCase()}.responses`,
|
|
25
|
+
message: "Responses are required",
|
|
26
|
+
severity: "error"
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}), a;
|
|
30
|
+
}
|
|
31
|
+
function Pe({
|
|
32
|
+
schema: i,
|
|
33
|
+
onChange: a,
|
|
34
|
+
onSave: c,
|
|
35
|
+
readOnly: n = !1,
|
|
36
|
+
className: r = ""
|
|
37
|
+
}) {
|
|
38
|
+
var O, q;
|
|
39
|
+
const [d, o] = w(i || ce), [b, u] = w(null), [p, x] = w(null), [h, _] = w("info"), [S, C] = w([]), E = T(
|
|
40
|
+
(v) => {
|
|
41
|
+
o((f) => {
|
|
42
|
+
const N = v(f);
|
|
43
|
+
return a == null || a(N), C(ie(N)), N;
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
[a]
|
|
47
|
+
), $ = T(() => {
|
|
48
|
+
const v = "/new-endpoint";
|
|
49
|
+
E((f) => ({
|
|
50
|
+
...f,
|
|
51
|
+
paths: {
|
|
52
|
+
...f.paths,
|
|
53
|
+
[v]: {
|
|
54
|
+
get: {
|
|
55
|
+
summary: "New endpoint",
|
|
56
|
+
responses: { 200: { description: "Success" } }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
})), u(v), x("get");
|
|
61
|
+
}, [E]), I = T(
|
|
62
|
+
(v) => {
|
|
63
|
+
E((f) => {
|
|
64
|
+
const { [v]: N, ...U } = f.paths;
|
|
65
|
+
return { ...f, paths: U };
|
|
66
|
+
}), u(null), x(null);
|
|
67
|
+
},
|
|
68
|
+
[E]
|
|
69
|
+
), F = T(() => {
|
|
70
|
+
const v = "NewSchema";
|
|
71
|
+
E((f) => {
|
|
72
|
+
var N;
|
|
73
|
+
return {
|
|
74
|
+
...f,
|
|
75
|
+
components: {
|
|
76
|
+
...f.components,
|
|
77
|
+
schemas: {
|
|
78
|
+
...(N = f.components) == null ? void 0 : N.schemas,
|
|
79
|
+
[v]: { type: "object", properties: {} }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
}, [E]), P = T(() => {
|
|
85
|
+
const v = ie(d);
|
|
86
|
+
C(v), v.filter((f) => f.severity === "error").length === 0 && (c == null || c(d));
|
|
87
|
+
}, [d, c]), j = Object.entries(d.paths).flatMap(
|
|
88
|
+
([v, f]) => ne.filter((N) => f[N.toLowerCase()]).map(
|
|
89
|
+
(N) => ({
|
|
90
|
+
path: v,
|
|
91
|
+
method: N,
|
|
92
|
+
operation: f[N.toLowerCase()]
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
return /* @__PURE__ */ t("div", { className: `nice-api-designer ${r}`, children: [
|
|
97
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__toolbar", children: [
|
|
98
|
+
/* @__PURE__ */ e("div", { className: "nice-api-designer__tabs", children: ["info", "paths", "schemas", "security", "preview"].map((v) => /* @__PURE__ */ e(
|
|
99
|
+
"button",
|
|
100
|
+
{
|
|
101
|
+
className: `nice-api-designer__tab ${h === v ? "nice-api-designer__tab--active" : ""}`,
|
|
102
|
+
onClick: () => _(v),
|
|
103
|
+
children: v.charAt(0).toUpperCase() + v.slice(1)
|
|
104
|
+
},
|
|
105
|
+
v
|
|
106
|
+
)) }),
|
|
107
|
+
!n && /* @__PURE__ */ e("button", { className: "nice-api-designer__save-btn", onClick: P, children: "Save" })
|
|
108
|
+
] }),
|
|
109
|
+
S.length > 0 && /* @__PURE__ */ e("div", { className: "nice-api-designer__errors", children: S.map((v, f) => /* @__PURE__ */ t(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: `nice-api-designer__error nice-api-designer__error--${v.severity}`,
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ t("strong", { children: [
|
|
115
|
+
v.path,
|
|
116
|
+
":"
|
|
117
|
+
] }),
|
|
118
|
+
" ",
|
|
119
|
+
v.message
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
f
|
|
123
|
+
)) }),
|
|
124
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__content", children: [
|
|
125
|
+
h === "info" && /* @__PURE__ */ e(le, { schema: d, onChange: E, readOnly: n }),
|
|
126
|
+
h === "paths" && /* @__PURE__ */ e(
|
|
127
|
+
oe,
|
|
128
|
+
{
|
|
129
|
+
endpoints: j,
|
|
130
|
+
schema: d,
|
|
131
|
+
selectedPath: b,
|
|
132
|
+
selectedMethod: p,
|
|
133
|
+
onSelectEndpoint: (v, f) => {
|
|
134
|
+
u(v), x(f);
|
|
135
|
+
},
|
|
136
|
+
onAdd: $,
|
|
137
|
+
onDelete: I,
|
|
138
|
+
onChange: E,
|
|
139
|
+
readOnly: n
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
h === "schemas" && /* @__PURE__ */ e(
|
|
143
|
+
de,
|
|
144
|
+
{
|
|
145
|
+
schemas: ((O = d.components) == null ? void 0 : O.schemas) || {},
|
|
146
|
+
onAdd: F,
|
|
147
|
+
onChange: (v) => E((f) => ({
|
|
148
|
+
...f,
|
|
149
|
+
components: { ...f.components, schemas: v }
|
|
150
|
+
})),
|
|
151
|
+
readOnly: n
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
h === "security" && /* @__PURE__ */ e(
|
|
155
|
+
pe,
|
|
156
|
+
{
|
|
157
|
+
schemes: ((q = d.components) == null ? void 0 : q.securitySchemes) || {},
|
|
158
|
+
onChange: (v) => E((f) => ({
|
|
159
|
+
...f,
|
|
160
|
+
components: { ...f.components, securitySchemes: v }
|
|
161
|
+
})),
|
|
162
|
+
readOnly: n
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
h === "preview" && /* @__PURE__ */ e(ue, { schema: d })
|
|
166
|
+
] })
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
function le({ schema: i, onChange: a, readOnly: c }) {
|
|
170
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-designer__info-editor", children: [
|
|
171
|
+
/* @__PURE__ */ e("h3", { children: "API Information" }),
|
|
172
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
173
|
+
/* @__PURE__ */ e("label", { children: "Title" }),
|
|
174
|
+
/* @__PURE__ */ e(
|
|
175
|
+
"input",
|
|
176
|
+
{
|
|
177
|
+
type: "text",
|
|
178
|
+
value: i.info.title,
|
|
179
|
+
onChange: (n) => a((r) => ({
|
|
180
|
+
...r,
|
|
181
|
+
info: { ...r.info, title: n.target.value }
|
|
182
|
+
})),
|
|
183
|
+
disabled: c
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] }),
|
|
187
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
188
|
+
/* @__PURE__ */ e("label", { children: "Version" }),
|
|
189
|
+
/* @__PURE__ */ e(
|
|
190
|
+
"input",
|
|
191
|
+
{
|
|
192
|
+
type: "text",
|
|
193
|
+
value: i.info.version,
|
|
194
|
+
onChange: (n) => a((r) => ({
|
|
195
|
+
...r,
|
|
196
|
+
info: { ...r.info, version: n.target.value }
|
|
197
|
+
})),
|
|
198
|
+
disabled: c
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
203
|
+
/* @__PURE__ */ e("label", { children: "Description" }),
|
|
204
|
+
/* @__PURE__ */ e(
|
|
205
|
+
"textarea",
|
|
206
|
+
{
|
|
207
|
+
value: i.info.description || "",
|
|
208
|
+
onChange: (n) => a((r) => ({
|
|
209
|
+
...r,
|
|
210
|
+
info: { ...r.info, description: n.target.value }
|
|
211
|
+
})),
|
|
212
|
+
disabled: c,
|
|
213
|
+
rows: 5
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ e("h4", { children: "Servers" }),
|
|
218
|
+
(i.servers || []).map((n, r) => /* @__PURE__ */ t("div", { className: "nice-api-designer__server", children: [
|
|
219
|
+
/* @__PURE__ */ e(
|
|
220
|
+
"input",
|
|
221
|
+
{
|
|
222
|
+
type: "text",
|
|
223
|
+
value: n.url,
|
|
224
|
+
placeholder: "Server URL",
|
|
225
|
+
onChange: (d) => a((o) => {
|
|
226
|
+
var b;
|
|
227
|
+
return {
|
|
228
|
+
...o,
|
|
229
|
+
servers: (b = o.servers) == null ? void 0 : b.map(
|
|
230
|
+
(u, p) => p === r ? { ...u, url: d.target.value } : u
|
|
231
|
+
)
|
|
232
|
+
};
|
|
233
|
+
}),
|
|
234
|
+
disabled: c
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ e(
|
|
238
|
+
"input",
|
|
239
|
+
{
|
|
240
|
+
type: "text",
|
|
241
|
+
value: n.description || "",
|
|
242
|
+
placeholder: "Description",
|
|
243
|
+
onChange: (d) => a((o) => {
|
|
244
|
+
var b;
|
|
245
|
+
return {
|
|
246
|
+
...o,
|
|
247
|
+
servers: (b = o.servers) == null ? void 0 : b.map(
|
|
248
|
+
(u, p) => p === r ? { ...u, description: d.target.value } : u
|
|
249
|
+
)
|
|
250
|
+
};
|
|
251
|
+
}),
|
|
252
|
+
disabled: c
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] }, r)),
|
|
256
|
+
!c && /* @__PURE__ */ e(
|
|
257
|
+
"button",
|
|
258
|
+
{
|
|
259
|
+
onClick: () => a((n) => ({
|
|
260
|
+
...n,
|
|
261
|
+
servers: [...n.servers || [], { url: "https://api.example.com" }]
|
|
262
|
+
})),
|
|
263
|
+
children: "Add Server"
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
] });
|
|
267
|
+
}
|
|
268
|
+
function oe({
|
|
269
|
+
endpoints: i,
|
|
270
|
+
schema: a,
|
|
271
|
+
selectedPath: c,
|
|
272
|
+
selectedMethod: n,
|
|
273
|
+
onSelectEndpoint: r,
|
|
274
|
+
onAdd: d,
|
|
275
|
+
onDelete: o,
|
|
276
|
+
onChange: b,
|
|
277
|
+
readOnly: u
|
|
278
|
+
}) {
|
|
279
|
+
var x;
|
|
280
|
+
const p = c && n ? (x = a.paths[c]) == null ? void 0 : x[n] : null;
|
|
281
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-designer__paths-editor", children: [
|
|
282
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__endpoints-list", children: [
|
|
283
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__list-header", children: [
|
|
284
|
+
/* @__PURE__ */ e("h3", { children: "Endpoints" }),
|
|
285
|
+
!u && /* @__PURE__ */ e("button", { onClick: d, children: "+ Add" })
|
|
286
|
+
] }),
|
|
287
|
+
i.map(({ path: h, method: _ }) => /* @__PURE__ */ t(
|
|
288
|
+
"div",
|
|
289
|
+
{
|
|
290
|
+
className: `nice-api-designer__endpoint ${c === h && n === _.toLowerCase() ? "nice-api-designer__endpoint--selected" : ""}`,
|
|
291
|
+
onClick: () => r(h, _.toLowerCase()),
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ e(
|
|
294
|
+
"span",
|
|
295
|
+
{
|
|
296
|
+
className: `nice-api-designer__method nice-api-designer__method--${_.toLowerCase()}`,
|
|
297
|
+
children: _
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
/* @__PURE__ */ e("span", { className: "nice-api-designer__path", children: h })
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
`${_}-${h}`
|
|
304
|
+
))
|
|
305
|
+
] }),
|
|
306
|
+
p && c && n && /* @__PURE__ */ t("div", { className: "nice-api-designer__operation-editor", children: [
|
|
307
|
+
/* @__PURE__ */ t("h3", { children: [
|
|
308
|
+
n.toUpperCase(),
|
|
309
|
+
" ",
|
|
310
|
+
c
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
313
|
+
/* @__PURE__ */ e("label", { children: "Summary" }),
|
|
314
|
+
/* @__PURE__ */ e(
|
|
315
|
+
"input",
|
|
316
|
+
{
|
|
317
|
+
type: "text",
|
|
318
|
+
value: p.summary || "",
|
|
319
|
+
onChange: (h) => b((_) => ({
|
|
320
|
+
..._,
|
|
321
|
+
paths: {
|
|
322
|
+
..._.paths,
|
|
323
|
+
[c]: {
|
|
324
|
+
..._.paths[c],
|
|
325
|
+
[n]: {
|
|
326
|
+
...p,
|
|
327
|
+
summary: h.target.value
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
})),
|
|
332
|
+
disabled: u
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
337
|
+
/* @__PURE__ */ e("label", { children: "Description" }),
|
|
338
|
+
/* @__PURE__ */ e(
|
|
339
|
+
"textarea",
|
|
340
|
+
{
|
|
341
|
+
value: p.description || "",
|
|
342
|
+
onChange: (h) => b((_) => ({
|
|
343
|
+
..._,
|
|
344
|
+
paths: {
|
|
345
|
+
..._.paths,
|
|
346
|
+
[c]: {
|
|
347
|
+
..._.paths[c],
|
|
348
|
+
[n]: {
|
|
349
|
+
...p,
|
|
350
|
+
description: h.target.value
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
})),
|
|
355
|
+
disabled: u,
|
|
356
|
+
rows: 3
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
361
|
+
/* @__PURE__ */ e("label", { children: "Operation ID" }),
|
|
362
|
+
/* @__PURE__ */ e(
|
|
363
|
+
"input",
|
|
364
|
+
{
|
|
365
|
+
type: "text",
|
|
366
|
+
value: p.operationId || "",
|
|
367
|
+
onChange: (h) => b((_) => ({
|
|
368
|
+
..._,
|
|
369
|
+
paths: {
|
|
370
|
+
..._.paths,
|
|
371
|
+
[c]: {
|
|
372
|
+
..._.paths[c],
|
|
373
|
+
[n]: {
|
|
374
|
+
...p,
|
|
375
|
+
operationId: h.target.value
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
})),
|
|
380
|
+
disabled: u
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
] }),
|
|
384
|
+
!u && /* @__PURE__ */ e(
|
|
385
|
+
"button",
|
|
386
|
+
{
|
|
387
|
+
className: "nice-api-designer__delete-btn",
|
|
388
|
+
onClick: () => o(c),
|
|
389
|
+
children: "Delete Endpoint"
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
] })
|
|
393
|
+
] });
|
|
394
|
+
}
|
|
395
|
+
function de({
|
|
396
|
+
schemas: i,
|
|
397
|
+
onAdd: a,
|
|
398
|
+
onChange: c,
|
|
399
|
+
readOnly: n
|
|
400
|
+
}) {
|
|
401
|
+
const [r, d] = w(null);
|
|
402
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-designer__schemas-editor", children: [
|
|
403
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__schemas-list", children: [
|
|
404
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__list-header", children: [
|
|
405
|
+
/* @__PURE__ */ e("h3", { children: "Schemas" }),
|
|
406
|
+
!n && /* @__PURE__ */ e("button", { onClick: a, children: "+ Add" })
|
|
407
|
+
] }),
|
|
408
|
+
Object.keys(i).map((o) => /* @__PURE__ */ e(
|
|
409
|
+
"div",
|
|
410
|
+
{
|
|
411
|
+
className: `nice-api-designer__schema-item ${r === o ? "nice-api-designer__schema-item--selected" : ""}`,
|
|
412
|
+
onClick: () => d(o),
|
|
413
|
+
children: o
|
|
414
|
+
},
|
|
415
|
+
o
|
|
416
|
+
))
|
|
417
|
+
] }),
|
|
418
|
+
r && i[r] && /* @__PURE__ */ t("div", { className: "nice-api-designer__schema-editor", children: [
|
|
419
|
+
/* @__PURE__ */ e("h3", { children: r }),
|
|
420
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
421
|
+
/* @__PURE__ */ e("label", { children: "Type" }),
|
|
422
|
+
/* @__PURE__ */ t(
|
|
423
|
+
"select",
|
|
424
|
+
{
|
|
425
|
+
value: i[r].type || "object",
|
|
426
|
+
onChange: (o) => c({
|
|
427
|
+
...i,
|
|
428
|
+
[r]: {
|
|
429
|
+
...i[r],
|
|
430
|
+
type: o.target.value
|
|
431
|
+
}
|
|
432
|
+
}),
|
|
433
|
+
disabled: n,
|
|
434
|
+
children: [
|
|
435
|
+
/* @__PURE__ */ e("option", { value: "object", children: "object" }),
|
|
436
|
+
/* @__PURE__ */ e("option", { value: "array", children: "array" }),
|
|
437
|
+
/* @__PURE__ */ e("option", { value: "string", children: "string" }),
|
|
438
|
+
/* @__PURE__ */ e("option", { value: "number", children: "number" }),
|
|
439
|
+
/* @__PURE__ */ e("option", { value: "integer", children: "integer" }),
|
|
440
|
+
/* @__PURE__ */ e("option", { value: "boolean", children: "boolean" })
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
)
|
|
444
|
+
] }),
|
|
445
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
446
|
+
/* @__PURE__ */ e("label", { children: "Description" }),
|
|
447
|
+
/* @__PURE__ */ e(
|
|
448
|
+
"textarea",
|
|
449
|
+
{
|
|
450
|
+
value: i[r].description || "",
|
|
451
|
+
onChange: (o) => c({
|
|
452
|
+
...i,
|
|
453
|
+
[r]: { ...i[r], description: o.target.value }
|
|
454
|
+
}),
|
|
455
|
+
disabled: n,
|
|
456
|
+
rows: 3
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] }),
|
|
460
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
|
|
461
|
+
/* @__PURE__ */ e("label", { children: "JSON Schema" }),
|
|
462
|
+
/* @__PURE__ */ e(
|
|
463
|
+
"textarea",
|
|
464
|
+
{
|
|
465
|
+
value: JSON.stringify(i[r], null, 2),
|
|
466
|
+
onChange: (o) => {
|
|
467
|
+
try {
|
|
468
|
+
const b = JSON.parse(o.target.value);
|
|
469
|
+
c({ ...i, [r]: b });
|
|
470
|
+
} catch {
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
disabled: n,
|
|
474
|
+
rows: 10,
|
|
475
|
+
className: "nice-api-designer__code"
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
] })
|
|
479
|
+
] })
|
|
480
|
+
] });
|
|
481
|
+
}
|
|
482
|
+
function pe({ schemes: i, onChange: a, readOnly: c }) {
|
|
483
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-designer__security-editor", children: [
|
|
484
|
+
/* @__PURE__ */ t("div", { className: "nice-api-designer__list-header", children: [
|
|
485
|
+
/* @__PURE__ */ e("h3", { children: "Security Schemes" }),
|
|
486
|
+
!c && /* @__PURE__ */ e("button", { onClick: () => {
|
|
487
|
+
a({
|
|
488
|
+
...i,
|
|
489
|
+
newScheme: { type: "apiKey", name: "X-API-Key", in: "header" }
|
|
490
|
+
});
|
|
491
|
+
}, children: "+ Add" })
|
|
492
|
+
] }),
|
|
493
|
+
Object.entries(i).map(([r, d]) => /* @__PURE__ */ t("div", { className: "nice-api-designer__security-item", children: [
|
|
494
|
+
/* @__PURE__ */ e("h4", { children: r }),
|
|
495
|
+
/* @__PURE__ */ e("pre", { children: JSON.stringify(d, null, 2) })
|
|
496
|
+
] }, r))
|
|
497
|
+
] });
|
|
498
|
+
}
|
|
499
|
+
function ue({ schema: i }) {
|
|
500
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-designer__json-preview", children: [
|
|
501
|
+
/* @__PURE__ */ e("h3", { children: "OpenAPI Specification" }),
|
|
502
|
+
/* @__PURE__ */ e("pre", { className: "nice-api-designer__code", children: JSON.stringify(i, null, 2) })
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
const he = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], me = {
|
|
506
|
+
id: "",
|
|
507
|
+
name: "New Request",
|
|
508
|
+
method: "GET",
|
|
509
|
+
url: "",
|
|
510
|
+
headers: {},
|
|
511
|
+
queryParams: {}
|
|
512
|
+
};
|
|
513
|
+
function Q(i, a) {
|
|
514
|
+
return i.replace(/\{\{(\w+)\}\}/g, (c, n) => a[n] || `{{${n}}}`);
|
|
515
|
+
}
|
|
516
|
+
function _e(i, a) {
|
|
517
|
+
const c = Object.entries(a).filter(([, n]) => n).map(([n, r]) => `${encodeURIComponent(n)}=${encodeURIComponent(r)}`).join("&");
|
|
518
|
+
return c ? `${i}?${c}` : i;
|
|
519
|
+
}
|
|
520
|
+
function Oe({
|
|
521
|
+
collections: i = [],
|
|
522
|
+
environments: a = [],
|
|
523
|
+
onRequest: c,
|
|
524
|
+
onSaveCollection: n,
|
|
525
|
+
className: r = ""
|
|
526
|
+
}) {
|
|
527
|
+
const [d, o] = w(i), [b, u] = w(a), [p, x] = w(
|
|
528
|
+
a.find((s) => s.isActive) || null
|
|
529
|
+
), [h, _] = w({
|
|
530
|
+
...me,
|
|
531
|
+
id: crypto.randomUUID()
|
|
532
|
+
}), [S, C] = w(null), [E, $] = w(!1), [I, F] = w("none"), [P, j] = w(
|
|
533
|
+
"params"
|
|
534
|
+
), [O, q] = w("body"), [v, f] = w(""), [N, U] = w(""), [L, V] = w([]), [H, J] = w([]), K = Z(null), z = T(async () => {
|
|
535
|
+
var B;
|
|
536
|
+
if (!h.url)
|
|
537
|
+
return;
|
|
538
|
+
$(!0), C(null), V([]);
|
|
539
|
+
const s = Object.fromEntries(
|
|
540
|
+
Object.entries((p == null ? void 0 : p.variables) || {}).map(([A, D]) => [A, D.value])
|
|
541
|
+
), g = {
|
|
542
|
+
...h,
|
|
543
|
+
url: Q(h.url, s),
|
|
544
|
+
headers: Object.fromEntries(
|
|
545
|
+
Object.entries(h.headers).map(([A, D]) => [A, Q(D, s)])
|
|
546
|
+
),
|
|
547
|
+
queryParams: Object.fromEntries(
|
|
548
|
+
Object.entries(h.queryParams).map(([A, D]) => [
|
|
549
|
+
A,
|
|
550
|
+
Q(D, s)
|
|
551
|
+
])
|
|
552
|
+
)
|
|
553
|
+
}, k = performance.now();
|
|
554
|
+
try {
|
|
555
|
+
let A;
|
|
556
|
+
if (c)
|
|
557
|
+
A = await c(g);
|
|
558
|
+
else {
|
|
559
|
+
K.current = new AbortController();
|
|
560
|
+
const D = { ...g.headers };
|
|
561
|
+
h.auth && ge(D, h.auth);
|
|
562
|
+
const ae = _e(g.url, g.queryParams), ee = {
|
|
563
|
+
method: g.method,
|
|
564
|
+
headers: D,
|
|
565
|
+
signal: K.current.signal
|
|
566
|
+
};
|
|
567
|
+
["POST", "PUT", "PATCH"].includes(g.method) && ((B = h.body) != null && B.content) && (ee.body = typeof h.body.content == "string" ? h.body.content : JSON.stringify(h.body.content), h.body.type === "json" && (D["Content-Type"] = "application/json"));
|
|
568
|
+
const M = await fetch(ae, ee), X = await M.text();
|
|
569
|
+
let Y;
|
|
570
|
+
try {
|
|
571
|
+
Y = JSON.parse(X);
|
|
572
|
+
} catch {
|
|
573
|
+
Y = X;
|
|
574
|
+
}
|
|
575
|
+
const re = performance.now();
|
|
576
|
+
A = {
|
|
577
|
+
status: M.status,
|
|
578
|
+
statusText: M.statusText,
|
|
579
|
+
headers: Object.fromEntries(M.headers.entries()),
|
|
580
|
+
body: Y,
|
|
581
|
+
time: Math.round(re - k),
|
|
582
|
+
size: new Blob([X]).size,
|
|
583
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
if (C(A), J(
|
|
587
|
+
(D) => [...D, { request: h, response: A }].slice(-50)
|
|
588
|
+
), N) {
|
|
589
|
+
const D = ve(N, A);
|
|
590
|
+
V(D);
|
|
591
|
+
}
|
|
592
|
+
} catch (A) {
|
|
593
|
+
A.name !== "AbortError" && C({
|
|
594
|
+
status: 0,
|
|
595
|
+
statusText: "Error",
|
|
596
|
+
headers: {},
|
|
597
|
+
body: { error: A.message },
|
|
598
|
+
time: Math.round(performance.now() - k),
|
|
599
|
+
size: 0,
|
|
600
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
601
|
+
});
|
|
602
|
+
} finally {
|
|
603
|
+
$(!1), K.current = null;
|
|
604
|
+
}
|
|
605
|
+
}, [h, p, c, N]), G = T(() => {
|
|
606
|
+
var s;
|
|
607
|
+
(s = K.current) == null || s.abort(), $(!1);
|
|
608
|
+
}, []), l = T(() => {
|
|
609
|
+
_((s) => ({
|
|
610
|
+
...s,
|
|
611
|
+
headers: { ...s.headers, "": "" }
|
|
612
|
+
}));
|
|
613
|
+
}, []), m = T(() => {
|
|
614
|
+
_((s) => ({
|
|
615
|
+
...s,
|
|
616
|
+
queryParams: { ...s.queryParams, "": "" }
|
|
617
|
+
}));
|
|
618
|
+
}, []), y = T(() => {
|
|
619
|
+
if (d.length === 0) {
|
|
620
|
+
const s = {
|
|
621
|
+
id: crypto.randomUUID(),
|
|
622
|
+
name: "My Collection",
|
|
623
|
+
requests: [h]
|
|
624
|
+
};
|
|
625
|
+
o([s]), n == null || n(s);
|
|
626
|
+
} else {
|
|
627
|
+
const s = {
|
|
628
|
+
...d[0],
|
|
629
|
+
requests: [...d[0].requests, h]
|
|
630
|
+
};
|
|
631
|
+
o((g) => [s, ...g.slice(1)]), n == null || n(s);
|
|
632
|
+
}
|
|
633
|
+
}, [d, h, n]);
|
|
634
|
+
return /* @__PURE__ */ t("div", { className: `nice-api-tester ${r}`, children: [
|
|
635
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__toolbar", children: /* @__PURE__ */ e("div", { className: "nice-api-tester__env-selector", children: /* @__PURE__ */ t(
|
|
636
|
+
"select",
|
|
637
|
+
{
|
|
638
|
+
value: (p == null ? void 0 : p.id) || "",
|
|
639
|
+
onChange: (s) => x(b.find((g) => g.id === s.target.value) || null),
|
|
640
|
+
children: [
|
|
641
|
+
/* @__PURE__ */ e("option", { value: "", children: "No Environment" }),
|
|
642
|
+
b.map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.name }, s.id))
|
|
643
|
+
]
|
|
644
|
+
}
|
|
645
|
+
) }) }),
|
|
646
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__request-bar", children: [
|
|
647
|
+
/* @__PURE__ */ e(
|
|
648
|
+
"select",
|
|
649
|
+
{
|
|
650
|
+
value: h.method,
|
|
651
|
+
onChange: (s) => _((g) => ({
|
|
652
|
+
...g,
|
|
653
|
+
method: s.target.value
|
|
654
|
+
})),
|
|
655
|
+
className: `nice-api-tester__method nice-api-tester__method--${h.method.toLowerCase()}`,
|
|
656
|
+
children: he.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ e(
|
|
660
|
+
"input",
|
|
661
|
+
{
|
|
662
|
+
type: "text",
|
|
663
|
+
value: h.url,
|
|
664
|
+
onChange: (s) => _((g) => ({ ...g, url: s.target.value })),
|
|
665
|
+
placeholder: "Enter request URL",
|
|
666
|
+
className: "nice-api-tester__url-input"
|
|
667
|
+
}
|
|
668
|
+
),
|
|
669
|
+
/* @__PURE__ */ e(
|
|
670
|
+
"button",
|
|
671
|
+
{
|
|
672
|
+
onClick: E ? G : z,
|
|
673
|
+
className: `nice-api-tester__send-btn ${E ? "nice-api-tester__send-btn--loading" : ""}`,
|
|
674
|
+
children: E ? "Cancel" : "Send"
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
/* @__PURE__ */ e("button", { onClick: y, className: "nice-api-tester__save-btn", children: "Save" })
|
|
678
|
+
] }),
|
|
679
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__main", children: [
|
|
680
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__request-panel", children: [
|
|
681
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["params", "headers", "body", "auth", "tests"].map((s) => /* @__PURE__ */ e(
|
|
682
|
+
"button",
|
|
683
|
+
{
|
|
684
|
+
className: `nice-api-tester__tab ${P === s ? "nice-api-tester__tab--active" : ""}`,
|
|
685
|
+
onClick: () => j(s),
|
|
686
|
+
children: s.charAt(0).toUpperCase() + s.slice(1)
|
|
687
|
+
},
|
|
688
|
+
s
|
|
689
|
+
)) }),
|
|
690
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__tab-content", children: [
|
|
691
|
+
P === "params" && /* @__PURE__ */ e(
|
|
692
|
+
fe,
|
|
693
|
+
{
|
|
694
|
+
params: h.queryParams,
|
|
695
|
+
onChange: (s) => _((g) => ({ ...g, queryParams: s })),
|
|
696
|
+
onAdd: m
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
P === "headers" && /* @__PURE__ */ e(
|
|
700
|
+
ye,
|
|
701
|
+
{
|
|
702
|
+
headers: h.headers,
|
|
703
|
+
onChange: (s) => _((g) => ({ ...g, headers: s })),
|
|
704
|
+
onAdd: l
|
|
705
|
+
}
|
|
706
|
+
),
|
|
707
|
+
P === "body" && /* @__PURE__ */ e(
|
|
708
|
+
Ne,
|
|
709
|
+
{
|
|
710
|
+
body: h.body,
|
|
711
|
+
bodyTab: I,
|
|
712
|
+
onBodyTabChange: F,
|
|
713
|
+
onChange: (s) => _((g) => ({ ...g, body: s }))
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
P === "auth" && /* @__PURE__ */ e(
|
|
717
|
+
we,
|
|
718
|
+
{
|
|
719
|
+
auth: h.auth,
|
|
720
|
+
onChange: (s) => _((g) => ({ ...g, auth: s }))
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
P === "tests" && /* @__PURE__ */ e(
|
|
724
|
+
Ce,
|
|
725
|
+
{
|
|
726
|
+
preRequestScript: v,
|
|
727
|
+
testScript: N,
|
|
728
|
+
onPreRequestChange: f,
|
|
729
|
+
onTestChange: U
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
] })
|
|
733
|
+
] }),
|
|
734
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__response-panel", children: S ? /* @__PURE__ */ t(R, { children: [
|
|
735
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__response-meta", children: [
|
|
736
|
+
/* @__PURE__ */ t(
|
|
737
|
+
"span",
|
|
738
|
+
{
|
|
739
|
+
className: `nice-api-tester__status nice-api-tester__status--${Math.floor(S.status / 100)}`,
|
|
740
|
+
children: [
|
|
741
|
+
S.status,
|
|
742
|
+
" ",
|
|
743
|
+
S.statusText
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
),
|
|
747
|
+
/* @__PURE__ */ t("span", { className: "nice-api-tester__time", children: [
|
|
748
|
+
S.time,
|
|
749
|
+
"ms"
|
|
750
|
+
] }),
|
|
751
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__size", children: be(S.size) })
|
|
752
|
+
] }),
|
|
753
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["body", "headers", "tests"].map((s) => /* @__PURE__ */ t(
|
|
754
|
+
"button",
|
|
755
|
+
{
|
|
756
|
+
className: `nice-api-tester__tab ${O === s ? "nice-api-tester__tab--active" : ""}`,
|
|
757
|
+
onClick: () => q(s),
|
|
758
|
+
children: [
|
|
759
|
+
s.charAt(0).toUpperCase() + s.slice(1),
|
|
760
|
+
s === "tests" && L.length > 0 && /* @__PURE__ */ t("span", { className: "nice-api-tester__test-badge", children: [
|
|
761
|
+
L.filter((g) => g.passed).length,
|
|
762
|
+
"/",
|
|
763
|
+
L.length
|
|
764
|
+
] })
|
|
765
|
+
]
|
|
766
|
+
},
|
|
767
|
+
s
|
|
768
|
+
)) }),
|
|
769
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__response-content", children: [
|
|
770
|
+
O === "body" && /* @__PURE__ */ e("pre", { className: "nice-api-tester__response-body", children: typeof S.body == "string" ? S.body : JSON.stringify(S.body, null, 2) }),
|
|
771
|
+
O === "headers" && /* @__PURE__ */ e("div", { className: "nice-api-tester__response-headers", children: Object.entries(S.headers).map(([s, g]) => /* @__PURE__ */ t("div", { className: "nice-api-tester__header-row", children: [
|
|
772
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__header-key", children: s }),
|
|
773
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__header-value", children: g })
|
|
774
|
+
] }, s)) }),
|
|
775
|
+
O === "tests" && /* @__PURE__ */ e("div", { className: "nice-api-tester__test-results", children: L.map((s, g) => /* @__PURE__ */ t(
|
|
776
|
+
"div",
|
|
777
|
+
{
|
|
778
|
+
className: `nice-api-tester__test-result nice-api-tester__test-result--${s.passed ? "pass" : "fail"}`,
|
|
779
|
+
children: [
|
|
780
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__test-icon", children: s.passed ? "✓" : "✗" }),
|
|
781
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__test-name", children: s.name }),
|
|
782
|
+
s.message && /* @__PURE__ */ e("span", { className: "nice-api-tester__test-message", children: s.message })
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
g
|
|
786
|
+
)) })
|
|
787
|
+
] })
|
|
788
|
+
] }) : /* @__PURE__ */ e("div", { className: "nice-api-tester__empty-response", children: E ? "Loading..." : "Send a request to see the response" }) })
|
|
789
|
+
] }),
|
|
790
|
+
H.length > 0 && /* @__PURE__ */ t("div", { className: "nice-api-tester__history", children: [
|
|
791
|
+
/* @__PURE__ */ e("h4", { children: "History" }),
|
|
792
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__history-list", children: H.slice().reverse().map(({ request: s, response: g }, k) => /* @__PURE__ */ t(
|
|
793
|
+
"div",
|
|
794
|
+
{
|
|
795
|
+
className: "nice-api-tester__history-item",
|
|
796
|
+
onClick: () => _(s),
|
|
797
|
+
children: [
|
|
798
|
+
/* @__PURE__ */ e(
|
|
799
|
+
"span",
|
|
800
|
+
{
|
|
801
|
+
className: `nice-api-tester__method nice-api-tester__method--${s.method.toLowerCase()}`,
|
|
802
|
+
children: s.method
|
|
803
|
+
}
|
|
804
|
+
),
|
|
805
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__history-url", children: s.url }),
|
|
806
|
+
/* @__PURE__ */ e(
|
|
807
|
+
"span",
|
|
808
|
+
{
|
|
809
|
+
className: `nice-api-tester__status nice-api-tester__status--${Math.floor(
|
|
810
|
+
g.status / 100
|
|
811
|
+
)}`,
|
|
812
|
+
children: g.status
|
|
813
|
+
}
|
|
814
|
+
)
|
|
815
|
+
]
|
|
816
|
+
},
|
|
817
|
+
k
|
|
818
|
+
)) })
|
|
819
|
+
] })
|
|
820
|
+
] });
|
|
821
|
+
}
|
|
822
|
+
function ge(i, a) {
|
|
823
|
+
var c, n, r, d, o;
|
|
824
|
+
switch (a.type) {
|
|
825
|
+
case "bearer":
|
|
826
|
+
i.Authorization = `${((c = a.bearer) == null ? void 0 : c.prefix) || "Bearer"} ${(n = a.bearer) == null ? void 0 : n.token}`;
|
|
827
|
+
break;
|
|
828
|
+
case "basic":
|
|
829
|
+
i.Authorization = `Basic ${btoa(`${(r = a.basic) == null ? void 0 : r.username}:${(d = a.basic) == null ? void 0 : d.password}`)}`;
|
|
830
|
+
break;
|
|
831
|
+
case "api-key":
|
|
832
|
+
((o = a.apiKey) == null ? void 0 : o.in) === "header" && (i[a.apiKey.key] = a.apiKey.value);
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function be(i) {
|
|
837
|
+
return i < 1024 ? `${i} B` : i < 1024 * 1024 ? `${(i / 1024).toFixed(1)} KB` : `${(i / (1024 * 1024)).toFixed(1)} MB`;
|
|
838
|
+
}
|
|
839
|
+
function ve(i, a) {
|
|
840
|
+
const c = [], n = {
|
|
841
|
+
response: {
|
|
842
|
+
code: a.status,
|
|
843
|
+
status: a.statusText,
|
|
844
|
+
headers: a.headers,
|
|
845
|
+
json: () => a.body,
|
|
846
|
+
text: () => typeof a.body == "string" ? a.body : JSON.stringify(a.body),
|
|
847
|
+
responseTime: a.time
|
|
848
|
+
},
|
|
849
|
+
test: (r, d) => {
|
|
850
|
+
const o = performance.now();
|
|
851
|
+
try {
|
|
852
|
+
d(), c.push({ name: r, passed: !0, duration: performance.now() - o });
|
|
853
|
+
} catch (b) {
|
|
854
|
+
c.push({
|
|
855
|
+
name: r,
|
|
856
|
+
passed: !1,
|
|
857
|
+
message: b.message,
|
|
858
|
+
duration: performance.now() - o
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
expect: (r) => ({
|
|
863
|
+
to: {
|
|
864
|
+
equal: (d) => {
|
|
865
|
+
if (r !== d)
|
|
866
|
+
throw new Error(`Expected ${d} but got ${r}`);
|
|
867
|
+
},
|
|
868
|
+
be: {
|
|
869
|
+
oneOf: (d) => {
|
|
870
|
+
if (!d.includes(r))
|
|
871
|
+
throw new Error(`Expected ${r} to be one of ${d}`);
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
have: {
|
|
875
|
+
property: (d) => {
|
|
876
|
+
if (typeof r != "object" || r === null || !(d in r))
|
|
877
|
+
throw new Error(`Expected object to have property ${d}`);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
})
|
|
882
|
+
};
|
|
883
|
+
try {
|
|
884
|
+
new Function("pm", i)(n);
|
|
885
|
+
} catch (r) {
|
|
886
|
+
c.push({
|
|
887
|
+
name: "Script Error",
|
|
888
|
+
passed: !1,
|
|
889
|
+
message: r.message,
|
|
890
|
+
duration: 0
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
return c;
|
|
894
|
+
}
|
|
895
|
+
function te({
|
|
896
|
+
items: i,
|
|
897
|
+
onChange: a,
|
|
898
|
+
onAdd: c,
|
|
899
|
+
keyPlaceholder: n = "Key",
|
|
900
|
+
valuePlaceholder: r = "Value"
|
|
901
|
+
}) {
|
|
902
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-tester__kv-editor", children: [
|
|
903
|
+
Object.entries(i).map(([d, o], b) => /* @__PURE__ */ t("div", { className: "nice-api-tester__kv-row", children: [
|
|
904
|
+
/* @__PURE__ */ e(
|
|
905
|
+
"input",
|
|
906
|
+
{
|
|
907
|
+
type: "text",
|
|
908
|
+
value: d,
|
|
909
|
+
placeholder: n,
|
|
910
|
+
onChange: (u) => {
|
|
911
|
+
const p = Object.entries(i);
|
|
912
|
+
p[b] = [u.target.value, o], a(Object.fromEntries(p));
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
),
|
|
916
|
+
/* @__PURE__ */ e(
|
|
917
|
+
"input",
|
|
918
|
+
{
|
|
919
|
+
type: "text",
|
|
920
|
+
value: o,
|
|
921
|
+
placeholder: r,
|
|
922
|
+
onChange: (u) => a({ ...i, [d]: u.target.value })
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ e(
|
|
926
|
+
"button",
|
|
927
|
+
{
|
|
928
|
+
onClick: () => {
|
|
929
|
+
const { [d]: u, ...p } = i;
|
|
930
|
+
a(p);
|
|
931
|
+
},
|
|
932
|
+
children: "×"
|
|
933
|
+
}
|
|
934
|
+
)
|
|
935
|
+
] }, b)),
|
|
936
|
+
/* @__PURE__ */ e("button", { onClick: c, className: "nice-api-tester__add-btn", children: "+ Add" })
|
|
937
|
+
] });
|
|
938
|
+
}
|
|
939
|
+
function fe({
|
|
940
|
+
params: i,
|
|
941
|
+
onChange: a,
|
|
942
|
+
onAdd: c
|
|
943
|
+
}) {
|
|
944
|
+
return /* @__PURE__ */ e(
|
|
945
|
+
te,
|
|
946
|
+
{
|
|
947
|
+
items: i,
|
|
948
|
+
onChange: a,
|
|
949
|
+
onAdd: c,
|
|
950
|
+
keyPlaceholder: "Parameter",
|
|
951
|
+
valuePlaceholder: "Value"
|
|
952
|
+
}
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
function ye({
|
|
956
|
+
headers: i,
|
|
957
|
+
onChange: a,
|
|
958
|
+
onAdd: c
|
|
959
|
+
}) {
|
|
960
|
+
return /* @__PURE__ */ e(
|
|
961
|
+
te,
|
|
962
|
+
{
|
|
963
|
+
items: i,
|
|
964
|
+
onChange: a,
|
|
965
|
+
onAdd: c,
|
|
966
|
+
keyPlaceholder: "Header",
|
|
967
|
+
valuePlaceholder: "Value"
|
|
968
|
+
}
|
|
969
|
+
);
|
|
970
|
+
}
|
|
971
|
+
function Ne({
|
|
972
|
+
body: i,
|
|
973
|
+
bodyTab: a,
|
|
974
|
+
onBodyTabChange: c,
|
|
975
|
+
onChange: n
|
|
976
|
+
}) {
|
|
977
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-tester__body-editor", children: [
|
|
978
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__body-tabs", children: ["none", "json", "form-data", "raw"].map((r) => /* @__PURE__ */ t("label", { children: [
|
|
979
|
+
/* @__PURE__ */ e(
|
|
980
|
+
"input",
|
|
981
|
+
{
|
|
982
|
+
type: "radio",
|
|
983
|
+
checked: a === r,
|
|
984
|
+
onChange: () => {
|
|
985
|
+
c(r), n({ type: r, content: "" });
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
),
|
|
989
|
+
r
|
|
990
|
+
] }, r)) }),
|
|
991
|
+
a !== "none" && /* @__PURE__ */ e(
|
|
992
|
+
"textarea",
|
|
993
|
+
{
|
|
994
|
+
value: typeof (i == null ? void 0 : i.content) == "string" ? i.content : JSON.stringify(i == null ? void 0 : i.content, null, 2),
|
|
995
|
+
onChange: (r) => n({ type: a, content: r.target.value }),
|
|
996
|
+
placeholder: a === "json" ? '{ "key": "value" }' : "Enter body content",
|
|
997
|
+
rows: 10,
|
|
998
|
+
className: "nice-api-tester__body-textarea"
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] });
|
|
1002
|
+
}
|
|
1003
|
+
function we({
|
|
1004
|
+
auth: i,
|
|
1005
|
+
onChange: a
|
|
1006
|
+
}) {
|
|
1007
|
+
var c, n, r, d, o, b;
|
|
1008
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-tester__auth-editor", children: [
|
|
1009
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1010
|
+
/* @__PURE__ */ e("label", { children: "Type" }),
|
|
1011
|
+
/* @__PURE__ */ t(
|
|
1012
|
+
"select",
|
|
1013
|
+
{
|
|
1014
|
+
value: (i == null ? void 0 : i.type) || "none",
|
|
1015
|
+
onChange: (u) => a({ type: u.target.value }),
|
|
1016
|
+
children: [
|
|
1017
|
+
/* @__PURE__ */ e("option", { value: "none", children: "No Auth" }),
|
|
1018
|
+
/* @__PURE__ */ e("option", { value: "api-key", children: "API Key" }),
|
|
1019
|
+
/* @__PURE__ */ e("option", { value: "bearer", children: "Bearer Token" }),
|
|
1020
|
+
/* @__PURE__ */ e("option", { value: "basic", children: "Basic Auth" }),
|
|
1021
|
+
/* @__PURE__ */ e("option", { value: "oauth2", children: "OAuth 2.0" })
|
|
1022
|
+
]
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
] }),
|
|
1026
|
+
(i == null ? void 0 : i.type) === "api-key" && /* @__PURE__ */ t(R, { children: [
|
|
1027
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1028
|
+
/* @__PURE__ */ e("label", { children: "Key" }),
|
|
1029
|
+
/* @__PURE__ */ e(
|
|
1030
|
+
"input",
|
|
1031
|
+
{
|
|
1032
|
+
type: "text",
|
|
1033
|
+
value: ((c = i.apiKey) == null ? void 0 : c.key) || "",
|
|
1034
|
+
onChange: (u) => {
|
|
1035
|
+
var p, x;
|
|
1036
|
+
return a({
|
|
1037
|
+
...i,
|
|
1038
|
+
apiKey: {
|
|
1039
|
+
...i.apiKey,
|
|
1040
|
+
key: u.target.value,
|
|
1041
|
+
value: ((p = i.apiKey) == null ? void 0 : p.value) || "",
|
|
1042
|
+
in: ((x = i.apiKey) == null ? void 0 : x.in) || "header"
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
},
|
|
1046
|
+
placeholder: "X-API-Key"
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
] }),
|
|
1050
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1051
|
+
/* @__PURE__ */ e("label", { children: "Value" }),
|
|
1052
|
+
/* @__PURE__ */ e(
|
|
1053
|
+
"input",
|
|
1054
|
+
{
|
|
1055
|
+
type: "text",
|
|
1056
|
+
value: ((n = i.apiKey) == null ? void 0 : n.value) || "",
|
|
1057
|
+
onChange: (u) => {
|
|
1058
|
+
var p, x;
|
|
1059
|
+
return a({
|
|
1060
|
+
...i,
|
|
1061
|
+
apiKey: {
|
|
1062
|
+
...i.apiKey,
|
|
1063
|
+
value: u.target.value,
|
|
1064
|
+
key: ((p = i.apiKey) == null ? void 0 : p.key) || "",
|
|
1065
|
+
in: ((x = i.apiKey) == null ? void 0 : x.in) || "header"
|
|
1066
|
+
}
|
|
1067
|
+
});
|
|
1068
|
+
},
|
|
1069
|
+
placeholder: "your-api-key"
|
|
1070
|
+
}
|
|
1071
|
+
)
|
|
1072
|
+
] }),
|
|
1073
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1074
|
+
/* @__PURE__ */ e("label", { children: "Add to" }),
|
|
1075
|
+
/* @__PURE__ */ t(
|
|
1076
|
+
"select",
|
|
1077
|
+
{
|
|
1078
|
+
value: ((r = i.apiKey) == null ? void 0 : r.in) || "header",
|
|
1079
|
+
onChange: (u) => {
|
|
1080
|
+
var p, x;
|
|
1081
|
+
return a({
|
|
1082
|
+
...i,
|
|
1083
|
+
apiKey: {
|
|
1084
|
+
...i.apiKey,
|
|
1085
|
+
in: u.target.value,
|
|
1086
|
+
key: ((p = i.apiKey) == null ? void 0 : p.key) || "",
|
|
1087
|
+
value: ((x = i.apiKey) == null ? void 0 : x.value) || ""
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
},
|
|
1091
|
+
children: [
|
|
1092
|
+
/* @__PURE__ */ e("option", { value: "header", children: "Header" }),
|
|
1093
|
+
/* @__PURE__ */ e("option", { value: "query", children: "Query Params" })
|
|
1094
|
+
]
|
|
1095
|
+
}
|
|
1096
|
+
)
|
|
1097
|
+
] })
|
|
1098
|
+
] }),
|
|
1099
|
+
(i == null ? void 0 : i.type) === "bearer" && /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1100
|
+
/* @__PURE__ */ e("label", { children: "Token" }),
|
|
1101
|
+
/* @__PURE__ */ e(
|
|
1102
|
+
"input",
|
|
1103
|
+
{
|
|
1104
|
+
type: "text",
|
|
1105
|
+
value: ((d = i.bearer) == null ? void 0 : d.token) || "",
|
|
1106
|
+
onChange: (u) => a({ ...i, bearer: { token: u.target.value } }),
|
|
1107
|
+
placeholder: "your-bearer-token"
|
|
1108
|
+
}
|
|
1109
|
+
)
|
|
1110
|
+
] }),
|
|
1111
|
+
(i == null ? void 0 : i.type) === "basic" && /* @__PURE__ */ t(R, { children: [
|
|
1112
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1113
|
+
/* @__PURE__ */ e("label", { children: "Username" }),
|
|
1114
|
+
/* @__PURE__ */ e(
|
|
1115
|
+
"input",
|
|
1116
|
+
{
|
|
1117
|
+
type: "text",
|
|
1118
|
+
value: ((o = i.basic) == null ? void 0 : o.username) || "",
|
|
1119
|
+
onChange: (u) => {
|
|
1120
|
+
var p;
|
|
1121
|
+
return a({
|
|
1122
|
+
...i,
|
|
1123
|
+
basic: {
|
|
1124
|
+
...i.basic,
|
|
1125
|
+
username: u.target.value,
|
|
1126
|
+
password: ((p = i.basic) == null ? void 0 : p.password) || ""
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
)
|
|
1132
|
+
] }),
|
|
1133
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
|
|
1134
|
+
/* @__PURE__ */ e("label", { children: "Password" }),
|
|
1135
|
+
/* @__PURE__ */ e(
|
|
1136
|
+
"input",
|
|
1137
|
+
{
|
|
1138
|
+
type: "password",
|
|
1139
|
+
value: ((b = i.basic) == null ? void 0 : b.password) || "",
|
|
1140
|
+
onChange: (u) => {
|
|
1141
|
+
var p;
|
|
1142
|
+
return a({
|
|
1143
|
+
...i,
|
|
1144
|
+
basic: {
|
|
1145
|
+
...i.basic,
|
|
1146
|
+
password: u.target.value,
|
|
1147
|
+
username: ((p = i.basic) == null ? void 0 : p.username) || ""
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] })
|
|
1154
|
+
] })
|
|
1155
|
+
] });
|
|
1156
|
+
}
|
|
1157
|
+
function Ce({
|
|
1158
|
+
preRequestScript: i,
|
|
1159
|
+
testScript: a,
|
|
1160
|
+
onPreRequestChange: c,
|
|
1161
|
+
onTestChange: n
|
|
1162
|
+
}) {
|
|
1163
|
+
return /* @__PURE__ */ t("div", { className: "nice-api-tester__tests-editor", children: [
|
|
1164
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__script-section", children: [
|
|
1165
|
+
/* @__PURE__ */ e("h4", { children: "Pre-request Script" }),
|
|
1166
|
+
/* @__PURE__ */ e(
|
|
1167
|
+
"textarea",
|
|
1168
|
+
{
|
|
1169
|
+
value: i,
|
|
1170
|
+
onChange: (r) => c(r.target.value),
|
|
1171
|
+
placeholder: "// Code to run before the request",
|
|
1172
|
+
rows: 5
|
|
1173
|
+
}
|
|
1174
|
+
)
|
|
1175
|
+
] }),
|
|
1176
|
+
/* @__PURE__ */ t("div", { className: "nice-api-tester__script-section", children: [
|
|
1177
|
+
/* @__PURE__ */ e("h4", { children: "Tests" }),
|
|
1178
|
+
/* @__PURE__ */ e(
|
|
1179
|
+
"textarea",
|
|
1180
|
+
{
|
|
1181
|
+
value: a,
|
|
1182
|
+
onChange: (r) => n(r.target.value),
|
|
1183
|
+
placeholder: `pm.test("Status code is 200", function () {
|
|
1184
|
+
pm.expect(pm.response.code).to.equal(200);
|
|
1185
|
+
});`,
|
|
1186
|
+
rows: 8
|
|
1187
|
+
}
|
|
1188
|
+
)
|
|
1189
|
+
] })
|
|
1190
|
+
] });
|
|
1191
|
+
}
|
|
1192
|
+
const W = [
|
|
1193
|
+
{ type: "trigger", label: "Trigger", icon: "⚡", category: "Control" },
|
|
1194
|
+
{ type: "http-request", label: "HTTP Request", icon: "🌐", category: "Actions" },
|
|
1195
|
+
{ type: "transform", label: "Transform", icon: "🔄", category: "Data" },
|
|
1196
|
+
{ type: "filter", label: "Filter", icon: "🔍", category: "Data" },
|
|
1197
|
+
{ type: "switch", label: "Switch", icon: "⑂", category: "Control" },
|
|
1198
|
+
{ type: "loop", label: "Loop", icon: "🔁", category: "Control" },
|
|
1199
|
+
{ type: "delay", label: "Delay", icon: "⏱️", category: "Control" },
|
|
1200
|
+
{ type: "set-variable", label: "Set Variable", icon: "📝", category: "Data" },
|
|
1201
|
+
{ type: "database", label: "Database", icon: "🗄️", category: "Actions" },
|
|
1202
|
+
{ type: "email", label: "Email", icon: "✉️", category: "Actions" },
|
|
1203
|
+
{ type: "webhook", label: "Webhook", icon: "🔗", category: "Actions" },
|
|
1204
|
+
{ type: "function", label: "Function", icon: "ƒ", category: "Actions" },
|
|
1205
|
+
{ type: "error-handler", label: "Error Handler", icon: "⚠️", category: "Control" }
|
|
1206
|
+
], Ee = {
|
|
1207
|
+
id: "",
|
|
1208
|
+
name: "New Flow",
|
|
1209
|
+
nodes: [],
|
|
1210
|
+
connections: [],
|
|
1211
|
+
variables: {},
|
|
1212
|
+
triggers: [],
|
|
1213
|
+
errorHandling: { strategy: "stop" }
|
|
1214
|
+
};
|
|
1215
|
+
function Ie({
|
|
1216
|
+
flow: i,
|
|
1217
|
+
connectors: a = [],
|
|
1218
|
+
onChange: c,
|
|
1219
|
+
onSave: n,
|
|
1220
|
+
onRun: r,
|
|
1221
|
+
className: d = ""
|
|
1222
|
+
}) {
|
|
1223
|
+
const [o, b] = w(
|
|
1224
|
+
i || { ...Ee, id: crypto.randomUUID() }
|
|
1225
|
+
), [u, p] = w(null), [x, h] = w(!0), [_, S] = w("canvas"), [C, E] = w(!1), [$, I] = w(null), [F, P] = w(!1), [j, O] = w(null), [q, v] = w(!1), f = Z(null), N = T(
|
|
1226
|
+
(l) => {
|
|
1227
|
+
b((m) => {
|
|
1228
|
+
const y = l(m);
|
|
1229
|
+
return c == null || c(y), y;
|
|
1230
|
+
});
|
|
1231
|
+
},
|
|
1232
|
+
[c]
|
|
1233
|
+
), U = T(
|
|
1234
|
+
(l, m) => {
|
|
1235
|
+
var s;
|
|
1236
|
+
const y = {
|
|
1237
|
+
id: crypto.randomUUID(),
|
|
1238
|
+
type: l,
|
|
1239
|
+
name: ((s = W.find((g) => g.type === l)) == null ? void 0 : s.label) || l,
|
|
1240
|
+
position: m,
|
|
1241
|
+
config: xe(l),
|
|
1242
|
+
inputs: l !== "trigger" ? ["input"] : [],
|
|
1243
|
+
outputs: ["output"]
|
|
1244
|
+
};
|
|
1245
|
+
N((g) => ({
|
|
1246
|
+
...g,
|
|
1247
|
+
nodes: [...g.nodes, y]
|
|
1248
|
+
})), p(y);
|
|
1249
|
+
},
|
|
1250
|
+
[N]
|
|
1251
|
+
), L = T(
|
|
1252
|
+
(l) => {
|
|
1253
|
+
N((m) => ({
|
|
1254
|
+
...m,
|
|
1255
|
+
nodes: m.nodes.filter((y) => y.id !== l),
|
|
1256
|
+
connections: m.connections.filter(
|
|
1257
|
+
(y) => y.sourceNodeId !== l && y.targetNodeId !== l
|
|
1258
|
+
)
|
|
1259
|
+
})), p(null);
|
|
1260
|
+
},
|
|
1261
|
+
[N]
|
|
1262
|
+
), V = T(
|
|
1263
|
+
(l, m) => {
|
|
1264
|
+
N((y) => ({
|
|
1265
|
+
...y,
|
|
1266
|
+
nodes: y.nodes.map((s) => s.id === l ? { ...s, ...m } : s)
|
|
1267
|
+
})), (u == null ? void 0 : u.id) === l && p((y) => y ? { ...y, ...m } : null);
|
|
1268
|
+
},
|
|
1269
|
+
[N, u]
|
|
1270
|
+
), H = T(
|
|
1271
|
+
(l, m, y, s) => {
|
|
1272
|
+
l === y || o.connections.some(
|
|
1273
|
+
(k) => k.sourceNodeId === l && k.targetNodeId === y && k.sourceOutput === m && k.targetInput === s
|
|
1274
|
+
) || N((k) => ({
|
|
1275
|
+
...k,
|
|
1276
|
+
connections: [
|
|
1277
|
+
...k.connections,
|
|
1278
|
+
{
|
|
1279
|
+
id: crypto.randomUUID(),
|
|
1280
|
+
sourceNodeId: l,
|
|
1281
|
+
sourceOutput: m,
|
|
1282
|
+
targetNodeId: y,
|
|
1283
|
+
targetInput: s
|
|
1284
|
+
}
|
|
1285
|
+
]
|
|
1286
|
+
}));
|
|
1287
|
+
},
|
|
1288
|
+
[o.connections, N]
|
|
1289
|
+
), J = T(
|
|
1290
|
+
(l) => {
|
|
1291
|
+
N((m) => ({
|
|
1292
|
+
...m,
|
|
1293
|
+
connections: m.connections.filter((y) => y.id !== l)
|
|
1294
|
+
}));
|
|
1295
|
+
},
|
|
1296
|
+
[N]
|
|
1297
|
+
), K = T(
|
|
1298
|
+
(l) => {
|
|
1299
|
+
if (l.preventDefault(), !$ || !f.current)
|
|
1300
|
+
return;
|
|
1301
|
+
const m = f.current.getBoundingClientRect(), y = l.clientX - m.left, s = l.clientY - m.top;
|
|
1302
|
+
U($, { x: y, y: s }), E(!1), I(null);
|
|
1303
|
+
},
|
|
1304
|
+
[$, U]
|
|
1305
|
+
), z = T(async () => {
|
|
1306
|
+
if (r) {
|
|
1307
|
+
v(!0);
|
|
1308
|
+
try {
|
|
1309
|
+
await r(o);
|
|
1310
|
+
} finally {
|
|
1311
|
+
v(!1);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}, [o, r]), G = T(() => {
|
|
1315
|
+
n == null || n(o);
|
|
1316
|
+
}, [o, n]);
|
|
1317
|
+
return /* @__PURE__ */ t("div", { className: `nice-integration-builder ${d}`, children: [
|
|
1318
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__toolbar", children: [
|
|
1319
|
+
/* @__PURE__ */ e(
|
|
1320
|
+
"input",
|
|
1321
|
+
{
|
|
1322
|
+
type: "text",
|
|
1323
|
+
value: o.name,
|
|
1324
|
+
onChange: (l) => N((m) => ({ ...m, name: l.target.value })),
|
|
1325
|
+
className: "nice-integration-builder__name-input"
|
|
1326
|
+
}
|
|
1327
|
+
),
|
|
1328
|
+
/* @__PURE__ */ e("div", { className: "nice-integration-builder__tabs", children: ["canvas", "code", "variables", "settings"].map((l) => /* @__PURE__ */ e(
|
|
1329
|
+
"button",
|
|
1330
|
+
{
|
|
1331
|
+
className: `nice-integration-builder__tab ${_ === l ? "nice-integration-builder__tab--active" : ""}`,
|
|
1332
|
+
onClick: () => S(l),
|
|
1333
|
+
children: l.charAt(0).toUpperCase() + l.slice(1)
|
|
1334
|
+
},
|
|
1335
|
+
l
|
|
1336
|
+
)) }),
|
|
1337
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__actions", children: [
|
|
1338
|
+
/* @__PURE__ */ e(
|
|
1339
|
+
"button",
|
|
1340
|
+
{
|
|
1341
|
+
onClick: z,
|
|
1342
|
+
disabled: q,
|
|
1343
|
+
className: "nice-integration-builder__run-btn",
|
|
1344
|
+
children: q ? "⏳ Running..." : "▶ Run"
|
|
1345
|
+
}
|
|
1346
|
+
),
|
|
1347
|
+
/* @__PURE__ */ e("button", { onClick: G, className: "nice-integration-builder__save-btn", children: "💾 Save" })
|
|
1348
|
+
] })
|
|
1349
|
+
] }),
|
|
1350
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__main", children: [
|
|
1351
|
+
x && _ === "canvas" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__palette", children: [
|
|
1352
|
+
/* @__PURE__ */ e("h4", { children: "Nodes" }),
|
|
1353
|
+
["Control", "Actions", "Data"].map((l) => /* @__PURE__ */ t("div", { className: "nice-integration-builder__category", children: [
|
|
1354
|
+
/* @__PURE__ */ e("h5", { children: l }),
|
|
1355
|
+
W.filter((m) => m.category === l).map((m) => /* @__PURE__ */ t(
|
|
1356
|
+
"div",
|
|
1357
|
+
{
|
|
1358
|
+
className: "nice-integration-builder__palette-item",
|
|
1359
|
+
draggable: !0,
|
|
1360
|
+
onDragStart: () => {
|
|
1361
|
+
E(!0), I(m.type);
|
|
1362
|
+
},
|
|
1363
|
+
onDragEnd: () => {
|
|
1364
|
+
E(!1), I(null);
|
|
1365
|
+
},
|
|
1366
|
+
children: [
|
|
1367
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__palette-icon", children: m.icon }),
|
|
1368
|
+
/* @__PURE__ */ e("span", { children: m.label })
|
|
1369
|
+
]
|
|
1370
|
+
},
|
|
1371
|
+
m.type
|
|
1372
|
+
))
|
|
1373
|
+
] }, l)),
|
|
1374
|
+
a.length > 0 && /* @__PURE__ */ t("div", { className: "nice-integration-builder__category", children: [
|
|
1375
|
+
/* @__PURE__ */ e("h5", { children: "Connectors" }),
|
|
1376
|
+
a.map((l) => /* @__PURE__ */ t("div", { className: "nice-integration-builder__palette-item", children: [
|
|
1377
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__palette-icon", children: "🔌" }),
|
|
1378
|
+
/* @__PURE__ */ e("span", { children: l.name })
|
|
1379
|
+
] }, l.id))
|
|
1380
|
+
] })
|
|
1381
|
+
] }),
|
|
1382
|
+
_ === "canvas" && /* @__PURE__ */ t(
|
|
1383
|
+
"div",
|
|
1384
|
+
{
|
|
1385
|
+
ref: f,
|
|
1386
|
+
className: `nice-integration-builder__canvas ${C ? "nice-integration-builder__canvas--dragging" : ""}`,
|
|
1387
|
+
onDragOver: (l) => l.preventDefault(),
|
|
1388
|
+
onDrop: K,
|
|
1389
|
+
onClick: () => p(null),
|
|
1390
|
+
children: [
|
|
1391
|
+
/* @__PURE__ */ e("svg", { className: "nice-integration-builder__connections", children: o.connections.map((l) => {
|
|
1392
|
+
const m = o.nodes.find((D) => D.id === l.sourceNodeId), y = o.nodes.find((D) => D.id === l.targetNodeId);
|
|
1393
|
+
if (!m || !y)
|
|
1394
|
+
return null;
|
|
1395
|
+
const s = m.position.x + 150, g = m.position.y + 30, k = y.position.x, B = y.position.y + 30, A = (s + k) / 2;
|
|
1396
|
+
return /* @__PURE__ */ e("g", { onClick: () => J(l.id), children: /* @__PURE__ */ e(
|
|
1397
|
+
"path",
|
|
1398
|
+
{
|
|
1399
|
+
d: `M ${s} ${g} C ${A} ${g}, ${A} ${B}, ${k} ${B}`,
|
|
1400
|
+
className: "nice-integration-builder__connection"
|
|
1401
|
+
}
|
|
1402
|
+
) }, l.id);
|
|
1403
|
+
}) }),
|
|
1404
|
+
o.nodes.map((l) => /* @__PURE__ */ e(
|
|
1405
|
+
Te,
|
|
1406
|
+
{
|
|
1407
|
+
node: l,
|
|
1408
|
+
isSelected: (u == null ? void 0 : u.id) === l.id,
|
|
1409
|
+
onSelect: () => p(l),
|
|
1410
|
+
onDelete: () => L(l.id),
|
|
1411
|
+
onPositionChange: (m) => V(l.id, { position: m }),
|
|
1412
|
+
onStartConnection: (m) => {
|
|
1413
|
+
P(!0), O({ nodeId: l.id, output: m });
|
|
1414
|
+
},
|
|
1415
|
+
onEndConnection: (m) => {
|
|
1416
|
+
j && H(j.nodeId, j.output, l.id, m), P(!1), O(null);
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
l.id
|
|
1420
|
+
)),
|
|
1421
|
+
o.nodes.length === 0 && /* @__PURE__ */ e("div", { className: "nice-integration-builder__empty", children: "Drag nodes from the palette to build your flow" })
|
|
1422
|
+
]
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
_ === "code" && /* @__PURE__ */ e("div", { className: "nice-integration-builder__code-view", children: /* @__PURE__ */ e("pre", { children: JSON.stringify(o, null, 2) }) }),
|
|
1426
|
+
_ === "variables" && /* @__PURE__ */ e(
|
|
1427
|
+
Ae,
|
|
1428
|
+
{
|
|
1429
|
+
variables: o.variables,
|
|
1430
|
+
onChange: (l) => N((m) => ({ ...m, variables: l }))
|
|
1431
|
+
}
|
|
1432
|
+
),
|
|
1433
|
+
_ === "settings" && /* @__PURE__ */ e(
|
|
1434
|
+
De,
|
|
1435
|
+
{
|
|
1436
|
+
errorHandling: o.errorHandling,
|
|
1437
|
+
schedule: o.schedule,
|
|
1438
|
+
onChange: (l, m) => N((y) => ({ ...y, errorHandling: l, schedule: m }))
|
|
1439
|
+
}
|
|
1440
|
+
),
|
|
1441
|
+
u && _ === "canvas" && /* @__PURE__ */ e(
|
|
1442
|
+
Se,
|
|
1443
|
+
{
|
|
1444
|
+
node: u,
|
|
1445
|
+
onChange: (l) => V(u.id, l),
|
|
1446
|
+
onClose: () => p(null)
|
|
1447
|
+
}
|
|
1448
|
+
)
|
|
1449
|
+
] })
|
|
1450
|
+
] });
|
|
1451
|
+
}
|
|
1452
|
+
function xe(i) {
|
|
1453
|
+
switch (i) {
|
|
1454
|
+
case "http-request":
|
|
1455
|
+
return { method: "GET", url: "", headers: {}, body: "" };
|
|
1456
|
+
case "transform":
|
|
1457
|
+
return { mapping: [] };
|
|
1458
|
+
case "filter":
|
|
1459
|
+
return { condition: "" };
|
|
1460
|
+
case "switch":
|
|
1461
|
+
return { cases: [] };
|
|
1462
|
+
case "loop":
|
|
1463
|
+
return { collection: "", itemVariable: "item" };
|
|
1464
|
+
case "delay":
|
|
1465
|
+
return { duration: 1e3 };
|
|
1466
|
+
case "set-variable":
|
|
1467
|
+
return { name: "", value: "" };
|
|
1468
|
+
case "database":
|
|
1469
|
+
return { operation: "query", query: "" };
|
|
1470
|
+
case "email":
|
|
1471
|
+
return { to: "", subject: "", body: "" };
|
|
1472
|
+
case "webhook":
|
|
1473
|
+
return { method: "POST", url: "" };
|
|
1474
|
+
case "function":
|
|
1475
|
+
return { code: `// Your code here
|
|
1476
|
+
return input;` };
|
|
1477
|
+
case "error-handler":
|
|
1478
|
+
return { strategy: "retry", maxRetries: 3 };
|
|
1479
|
+
default:
|
|
1480
|
+
return {};
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
function Te({
|
|
1484
|
+
node: i,
|
|
1485
|
+
isSelected: a,
|
|
1486
|
+
onSelect: c,
|
|
1487
|
+
onDelete: n,
|
|
1488
|
+
onPositionChange: r,
|
|
1489
|
+
onStartConnection: d,
|
|
1490
|
+
onEndConnection: o
|
|
1491
|
+
}) {
|
|
1492
|
+
const [b, u] = w(!1), [p, x] = w({ x: 0, y: 0 }), h = Z(null), _ = W.find((C) => C.type === i.type), S = (C) => {
|
|
1493
|
+
C.button === 0 && (C.stopPropagation(), u(!0), x({
|
|
1494
|
+
x: C.clientX - i.position.x,
|
|
1495
|
+
y: C.clientY - i.position.y
|
|
1496
|
+
}), c());
|
|
1497
|
+
};
|
|
1498
|
+
return se(() => {
|
|
1499
|
+
if (!b)
|
|
1500
|
+
return;
|
|
1501
|
+
const C = ($) => {
|
|
1502
|
+
r({
|
|
1503
|
+
x: $.clientX - p.x,
|
|
1504
|
+
y: $.clientY - p.y
|
|
1505
|
+
});
|
|
1506
|
+
}, E = () => {
|
|
1507
|
+
u(!1);
|
|
1508
|
+
};
|
|
1509
|
+
return window.addEventListener("mousemove", C), window.addEventListener("mouseup", E), () => {
|
|
1510
|
+
window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", E);
|
|
1511
|
+
};
|
|
1512
|
+
}, [b, p, r]), /* @__PURE__ */ t(
|
|
1513
|
+
"div",
|
|
1514
|
+
{
|
|
1515
|
+
ref: h,
|
|
1516
|
+
className: `nice-integration-builder__node nice-integration-builder__node--${i.type} ${a ? "nice-integration-builder__node--selected" : ""}`,
|
|
1517
|
+
style: {
|
|
1518
|
+
left: i.position.x,
|
|
1519
|
+
top: i.position.y
|
|
1520
|
+
},
|
|
1521
|
+
onMouseDown: S,
|
|
1522
|
+
children: [
|
|
1523
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__node-header", children: [
|
|
1524
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__node-icon", children: (_ == null ? void 0 : _.icon) || "📦" }),
|
|
1525
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__node-name", children: i.name }),
|
|
1526
|
+
/* @__PURE__ */ e(
|
|
1527
|
+
"button",
|
|
1528
|
+
{
|
|
1529
|
+
className: "nice-integration-builder__node-delete",
|
|
1530
|
+
onClick: (C) => {
|
|
1531
|
+
C.stopPropagation(), n();
|
|
1532
|
+
},
|
|
1533
|
+
children: "×"
|
|
1534
|
+
}
|
|
1535
|
+
)
|
|
1536
|
+
] }),
|
|
1537
|
+
i.inputs.map((C) => /* @__PURE__ */ t(
|
|
1538
|
+
"div",
|
|
1539
|
+
{
|
|
1540
|
+
className: "nice-integration-builder__port nice-integration-builder__port--input",
|
|
1541
|
+
onMouseUp: () => o(C),
|
|
1542
|
+
children: [
|
|
1543
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__port-dot" }),
|
|
1544
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__port-label", children: C })
|
|
1545
|
+
]
|
|
1546
|
+
},
|
|
1547
|
+
C
|
|
1548
|
+
)),
|
|
1549
|
+
i.outputs.map((C) => /* @__PURE__ */ t(
|
|
1550
|
+
"div",
|
|
1551
|
+
{
|
|
1552
|
+
className: "nice-integration-builder__port nice-integration-builder__port--output",
|
|
1553
|
+
onMouseDown: (E) => {
|
|
1554
|
+
E.stopPropagation(), d(C);
|
|
1555
|
+
},
|
|
1556
|
+
children: [
|
|
1557
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__port-label", children: C }),
|
|
1558
|
+
/* @__PURE__ */ e("span", { className: "nice-integration-builder__port-dot" })
|
|
1559
|
+
]
|
|
1560
|
+
},
|
|
1561
|
+
C
|
|
1562
|
+
))
|
|
1563
|
+
]
|
|
1564
|
+
}
|
|
1565
|
+
);
|
|
1566
|
+
}
|
|
1567
|
+
function Se({
|
|
1568
|
+
node: i,
|
|
1569
|
+
onChange: a,
|
|
1570
|
+
onClose: c
|
|
1571
|
+
}) {
|
|
1572
|
+
return /* @__PURE__ */ t("div", { className: "nice-integration-builder__properties", children: [
|
|
1573
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__properties-header", children: [
|
|
1574
|
+
/* @__PURE__ */ e("h4", { children: i.name }),
|
|
1575
|
+
/* @__PURE__ */ e("button", { onClick: c, children: "×" })
|
|
1576
|
+
] }),
|
|
1577
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__properties-content", children: [
|
|
1578
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1579
|
+
/* @__PURE__ */ e("label", { children: "Name" }),
|
|
1580
|
+
/* @__PURE__ */ e(
|
|
1581
|
+
"input",
|
|
1582
|
+
{
|
|
1583
|
+
type: "text",
|
|
1584
|
+
value: i.name,
|
|
1585
|
+
onChange: (n) => a({ name: n.target.value })
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
] }),
|
|
1589
|
+
i.type === "http-request" && /* @__PURE__ */ t(R, { children: [
|
|
1590
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1591
|
+
/* @__PURE__ */ e("label", { children: "Method" }),
|
|
1592
|
+
/* @__PURE__ */ e(
|
|
1593
|
+
"select",
|
|
1594
|
+
{
|
|
1595
|
+
value: i.config.method || "GET",
|
|
1596
|
+
onChange: (n) => a({ config: { ...i.config, method: n.target.value } }),
|
|
1597
|
+
children: ["GET", "POST", "PUT", "PATCH", "DELETE"].map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
|
|
1598
|
+
}
|
|
1599
|
+
)
|
|
1600
|
+
] }),
|
|
1601
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1602
|
+
/* @__PURE__ */ e("label", { children: "URL" }),
|
|
1603
|
+
/* @__PURE__ */ e(
|
|
1604
|
+
"input",
|
|
1605
|
+
{
|
|
1606
|
+
type: "text",
|
|
1607
|
+
value: i.config.url || "",
|
|
1608
|
+
onChange: (n) => a({ config: { ...i.config, url: n.target.value } }),
|
|
1609
|
+
placeholder: "https://api.example.com/endpoint"
|
|
1610
|
+
}
|
|
1611
|
+
)
|
|
1612
|
+
] })
|
|
1613
|
+
] }),
|
|
1614
|
+
i.type === "delay" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1615
|
+
/* @__PURE__ */ e("label", { children: "Duration (ms)" }),
|
|
1616
|
+
/* @__PURE__ */ e(
|
|
1617
|
+
"input",
|
|
1618
|
+
{
|
|
1619
|
+
type: "number",
|
|
1620
|
+
value: i.config.duration || 1e3,
|
|
1621
|
+
onChange: (n) => a({ config: { ...i.config, duration: parseInt(n.target.value, 10) } })
|
|
1622
|
+
}
|
|
1623
|
+
)
|
|
1624
|
+
] }),
|
|
1625
|
+
i.type === "set-variable" && /* @__PURE__ */ t(R, { children: [
|
|
1626
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1627
|
+
/* @__PURE__ */ e("label", { children: "Variable Name" }),
|
|
1628
|
+
/* @__PURE__ */ e(
|
|
1629
|
+
"input",
|
|
1630
|
+
{
|
|
1631
|
+
type: "text",
|
|
1632
|
+
value: i.config.name || "",
|
|
1633
|
+
onChange: (n) => a({ config: { ...i.config, name: n.target.value } })
|
|
1634
|
+
}
|
|
1635
|
+
)
|
|
1636
|
+
] }),
|
|
1637
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1638
|
+
/* @__PURE__ */ e("label", { children: "Value" }),
|
|
1639
|
+
/* @__PURE__ */ e(
|
|
1640
|
+
"input",
|
|
1641
|
+
{
|
|
1642
|
+
type: "text",
|
|
1643
|
+
value: i.config.value || "",
|
|
1644
|
+
onChange: (n) => a({ config: { ...i.config, value: n.target.value } })
|
|
1645
|
+
}
|
|
1646
|
+
)
|
|
1647
|
+
] })
|
|
1648
|
+
] }),
|
|
1649
|
+
i.type === "function" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1650
|
+
/* @__PURE__ */ e("label", { children: "Code" }),
|
|
1651
|
+
/* @__PURE__ */ e(
|
|
1652
|
+
"textarea",
|
|
1653
|
+
{
|
|
1654
|
+
value: i.config.code || "",
|
|
1655
|
+
onChange: (n) => a({ config: { ...i.config, code: n.target.value } }),
|
|
1656
|
+
rows: 10,
|
|
1657
|
+
className: "nice-integration-builder__code-input"
|
|
1658
|
+
}
|
|
1659
|
+
)
|
|
1660
|
+
] }),
|
|
1661
|
+
i.type === "email" && /* @__PURE__ */ t(R, { children: [
|
|
1662
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1663
|
+
/* @__PURE__ */ e("label", { children: "To" }),
|
|
1664
|
+
/* @__PURE__ */ e(
|
|
1665
|
+
"input",
|
|
1666
|
+
{
|
|
1667
|
+
type: "text",
|
|
1668
|
+
value: i.config.to || "",
|
|
1669
|
+
onChange: (n) => a({ config: { ...i.config, to: n.target.value } })
|
|
1670
|
+
}
|
|
1671
|
+
)
|
|
1672
|
+
] }),
|
|
1673
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1674
|
+
/* @__PURE__ */ e("label", { children: "Subject" }),
|
|
1675
|
+
/* @__PURE__ */ e(
|
|
1676
|
+
"input",
|
|
1677
|
+
{
|
|
1678
|
+
type: "text",
|
|
1679
|
+
value: i.config.subject || "",
|
|
1680
|
+
onChange: (n) => a({ config: { ...i.config, subject: n.target.value } })
|
|
1681
|
+
}
|
|
1682
|
+
)
|
|
1683
|
+
] }),
|
|
1684
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1685
|
+
/* @__PURE__ */ e("label", { children: "Body" }),
|
|
1686
|
+
/* @__PURE__ */ e(
|
|
1687
|
+
"textarea",
|
|
1688
|
+
{
|
|
1689
|
+
value: i.config.body || "",
|
|
1690
|
+
onChange: (n) => a({ config: { ...i.config, body: n.target.value } }),
|
|
1691
|
+
rows: 5
|
|
1692
|
+
}
|
|
1693
|
+
)
|
|
1694
|
+
] })
|
|
1695
|
+
] })
|
|
1696
|
+
] })
|
|
1697
|
+
] });
|
|
1698
|
+
}
|
|
1699
|
+
function Ae({ variables: i, onChange: a }) {
|
|
1700
|
+
const c = () => {
|
|
1701
|
+
a({ ...i, newVariable: "" });
|
|
1702
|
+
};
|
|
1703
|
+
return /* @__PURE__ */ t("div", { className: "nice-integration-builder__variables", children: [
|
|
1704
|
+
/* @__PURE__ */ e("h4", { children: "Flow Variables" }),
|
|
1705
|
+
/* @__PURE__ */ e("div", { className: "nice-integration-builder__variables-list", children: Object.entries(i).map(([n, r]) => /* @__PURE__ */ t("div", { className: "nice-integration-builder__variable-row", children: [
|
|
1706
|
+
/* @__PURE__ */ e(
|
|
1707
|
+
"input",
|
|
1708
|
+
{
|
|
1709
|
+
type: "text",
|
|
1710
|
+
value: n,
|
|
1711
|
+
onChange: (d) => {
|
|
1712
|
+
const { [n]: o, ...b } = i;
|
|
1713
|
+
a({ ...b, [d.target.value]: r });
|
|
1714
|
+
},
|
|
1715
|
+
placeholder: "Name"
|
|
1716
|
+
}
|
|
1717
|
+
),
|
|
1718
|
+
/* @__PURE__ */ e(
|
|
1719
|
+
"input",
|
|
1720
|
+
{
|
|
1721
|
+
type: "text",
|
|
1722
|
+
value: String(r),
|
|
1723
|
+
onChange: (d) => a({ ...i, [n]: d.target.value }),
|
|
1724
|
+
placeholder: "Value"
|
|
1725
|
+
}
|
|
1726
|
+
),
|
|
1727
|
+
/* @__PURE__ */ e(
|
|
1728
|
+
"button",
|
|
1729
|
+
{
|
|
1730
|
+
onClick: () => {
|
|
1731
|
+
const { [n]: d, ...o } = i;
|
|
1732
|
+
a(o);
|
|
1733
|
+
},
|
|
1734
|
+
children: "×"
|
|
1735
|
+
}
|
|
1736
|
+
)
|
|
1737
|
+
] }, n)) }),
|
|
1738
|
+
/* @__PURE__ */ e("button", { onClick: c, children: "+ Add Variable" })
|
|
1739
|
+
] });
|
|
1740
|
+
}
|
|
1741
|
+
function De({
|
|
1742
|
+
errorHandling: i,
|
|
1743
|
+
schedule: a,
|
|
1744
|
+
onChange: c
|
|
1745
|
+
}) {
|
|
1746
|
+
return /* @__PURE__ */ t("div", { className: "nice-integration-builder__settings", children: [
|
|
1747
|
+
/* @__PURE__ */ e("h4", { children: "Error Handling" }),
|
|
1748
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1749
|
+
/* @__PURE__ */ e("label", { children: "Strategy" }),
|
|
1750
|
+
/* @__PURE__ */ t(
|
|
1751
|
+
"select",
|
|
1752
|
+
{
|
|
1753
|
+
value: i.strategy,
|
|
1754
|
+
onChange: (n) => c(
|
|
1755
|
+
{ ...i, strategy: n.target.value },
|
|
1756
|
+
a
|
|
1757
|
+
),
|
|
1758
|
+
children: [
|
|
1759
|
+
/* @__PURE__ */ e("option", { value: "stop", children: "Stop on error" }),
|
|
1760
|
+
/* @__PURE__ */ e("option", { value: "continue", children: "Continue on error" }),
|
|
1761
|
+
/* @__PURE__ */ e("option", { value: "retry", children: "Retry on error" })
|
|
1762
|
+
]
|
|
1763
|
+
}
|
|
1764
|
+
)
|
|
1765
|
+
] }),
|
|
1766
|
+
i.strategy === "retry" && /* @__PURE__ */ t(R, { children: [
|
|
1767
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1768
|
+
/* @__PURE__ */ e("label", { children: "Max Retries" }),
|
|
1769
|
+
/* @__PURE__ */ e(
|
|
1770
|
+
"input",
|
|
1771
|
+
{
|
|
1772
|
+
type: "number",
|
|
1773
|
+
value: i.maxRetries || 3,
|
|
1774
|
+
onChange: (n) => c({ ...i, maxRetries: parseInt(n.target.value, 10) }, a)
|
|
1775
|
+
}
|
|
1776
|
+
)
|
|
1777
|
+
] }),
|
|
1778
|
+
/* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1779
|
+
/* @__PURE__ */ e("label", { children: "Retry Delay (ms)" }),
|
|
1780
|
+
/* @__PURE__ */ e(
|
|
1781
|
+
"input",
|
|
1782
|
+
{
|
|
1783
|
+
type: "number",
|
|
1784
|
+
value: i.retryDelay || 1e3,
|
|
1785
|
+
onChange: (n) => c({ ...i, retryDelay: parseInt(n.target.value, 10) }, a)
|
|
1786
|
+
}
|
|
1787
|
+
)
|
|
1788
|
+
] })
|
|
1789
|
+
] }),
|
|
1790
|
+
/* @__PURE__ */ e("h4", { children: "Schedule" }),
|
|
1791
|
+
/* @__PURE__ */ e("div", { className: "nice-integration-builder__field", children: /* @__PURE__ */ t("label", { children: [
|
|
1792
|
+
/* @__PURE__ */ e(
|
|
1793
|
+
"input",
|
|
1794
|
+
{
|
|
1795
|
+
type: "checkbox",
|
|
1796
|
+
checked: (a == null ? void 0 : a.enabled) || !1,
|
|
1797
|
+
onChange: (n) => c(i, { ...a, enabled: n.target.checked })
|
|
1798
|
+
}
|
|
1799
|
+
),
|
|
1800
|
+
"Enable scheduled execution"
|
|
1801
|
+
] }) }),
|
|
1802
|
+
(a == null ? void 0 : a.enabled) && /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
|
|
1803
|
+
/* @__PURE__ */ e("label", { children: "Cron Expression" }),
|
|
1804
|
+
/* @__PURE__ */ e(
|
|
1805
|
+
"input",
|
|
1806
|
+
{
|
|
1807
|
+
type: "text",
|
|
1808
|
+
value: a.cron || "",
|
|
1809
|
+
onChange: (n) => c(i, { ...a, cron: n.target.value }),
|
|
1810
|
+
placeholder: "0 0 * * *"
|
|
1811
|
+
}
|
|
1812
|
+
)
|
|
1813
|
+
] })
|
|
1814
|
+
] });
|
|
1815
|
+
}
|
|
1816
|
+
export {
|
|
1817
|
+
Pe as NiceAPIDesigner,
|
|
1818
|
+
Oe as NiceAPITester,
|
|
1819
|
+
Ie as NiceIntegrationBuilder
|
|
1820
|
+
};
|