@nice2dev/ui-api 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +548 -532
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { NiceAppShell as ye, NiceButton as U, NiceTextInput as
|
|
3
|
-
import { useNiceTranslation as
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { NiceAppShell as ye, NiceButton as U, NiceTextInput as L, NiceTextArea as oe, NiceSelect as se, NiceCheckbox as fe, NiceIcon as ee } from "@nice2dev/ui";
|
|
3
|
+
import { useNiceTranslation as $, NiceTutorialButton as ce, resolveTutorial as le, NiceIcon as B, createId as re } from "@nice2dev/ui-core";
|
|
4
4
|
import { useState as C, useCallback as I, useRef as de, useEffect as Ne, forwardRef as Ce, useMemo as Se } from "react";
|
|
5
5
|
const Ee = [
|
|
6
6
|
{
|
|
@@ -122,13 +122,13 @@ const Ee = [
|
|
|
122
122
|
"boolean"
|
|
123
123
|
], De = ["query", "path", "header", "cookie"], Ae = ["apiKey", "http", "oauth2", "openIdConnect"];
|
|
124
124
|
function ue(t) {
|
|
125
|
-
var o,
|
|
125
|
+
var o, i;
|
|
126
126
|
const a = [];
|
|
127
|
-
return t.openapi || a.push({ path: "openapi", message: "OpenAPI version is required", severity: "error" }), (o = t.info) != null && o.title || a.push({ path: "info.title", message: "API title is required", severity: "error" }), (
|
|
128
|
-
|
|
127
|
+
return t.openapi || a.push({ path: "openapi", message: "OpenAPI version is required", severity: "error" }), (o = t.info) != null && o.title || a.push({ path: "info.title", message: "API title is required", severity: "error" }), (i = t.info) != null && i.version || a.push({ path: "info.version", message: "API version is required", severity: "error" }), Object.entries(t.paths || {}).forEach(([r, c]) => {
|
|
128
|
+
r.startsWith("/") || a.push({ path: `paths.${r}`, message: "Path must start with /", severity: "error" }), we.forEach((l) => {
|
|
129
129
|
const d = c[l.toLowerCase()];
|
|
130
130
|
d && !d.responses && a.push({
|
|
131
|
-
path: `paths.${
|
|
131
|
+
path: `paths.${r}.${l.toLowerCase()}.responses`,
|
|
132
132
|
message: "Responses are required",
|
|
133
133
|
severity: "error"
|
|
134
134
|
});
|
|
@@ -143,14 +143,14 @@ function ot({
|
|
|
143
143
|
schema: t,
|
|
144
144
|
onChange: a,
|
|
145
145
|
onSave: o,
|
|
146
|
-
readOnly:
|
|
147
|
-
className:
|
|
146
|
+
readOnly: i = !1,
|
|
147
|
+
className: r = "",
|
|
148
148
|
tutorial: c
|
|
149
149
|
}) {
|
|
150
150
|
var V, G;
|
|
151
|
-
const { t: l } =
|
|
151
|
+
const { t: l } = $(), [d, p] = C(t || ge), [v, u] = C("/pets"), [N, b] = C("get"), [y, T] = C("paths"), [m, S] = C(
|
|
152
152
|
() => ue(t || ge)
|
|
153
|
-
),
|
|
153
|
+
), w = I(
|
|
154
154
|
(k) => {
|
|
155
155
|
p((f) => {
|
|
156
156
|
const x = k(f);
|
|
@@ -160,7 +160,7 @@ function ot({
|
|
|
160
160
|
[a]
|
|
161
161
|
), A = I(() => {
|
|
162
162
|
const k = "/new-endpoint";
|
|
163
|
-
|
|
163
|
+
w((f) => ({
|
|
164
164
|
...f,
|
|
165
165
|
paths: {
|
|
166
166
|
...f.paths,
|
|
@@ -169,18 +169,18 @@ function ot({
|
|
|
169
169
|
get: { summary: "New endpoint", responses: { 200: { description: "Success" } } }
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
})), u(k),
|
|
173
|
-
}, [
|
|
172
|
+
})), u(k), b("get");
|
|
173
|
+
}, [w]), J = I(
|
|
174
174
|
(k) => {
|
|
175
|
-
|
|
175
|
+
w((f) => {
|
|
176
176
|
const { [k]: x, ...j } = f.paths;
|
|
177
177
|
return { ...f, paths: j };
|
|
178
|
-
}), u(null),
|
|
178
|
+
}), u(null), b(null);
|
|
179
179
|
},
|
|
180
|
-
[
|
|
180
|
+
[w]
|
|
181
181
|
), te = I(() => {
|
|
182
182
|
let k = "NewSchema";
|
|
183
|
-
|
|
183
|
+
w((f) => {
|
|
184
184
|
var j, F, R;
|
|
185
185
|
let x = 1;
|
|
186
186
|
for (; (F = (j = f.components) == null ? void 0 : j.schemas) != null && F[k]; )
|
|
@@ -193,10 +193,10 @@ function ot({
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
});
|
|
196
|
-
}, [
|
|
196
|
+
}, [w]), z = I(() => {
|
|
197
197
|
const k = ue(d);
|
|
198
198
|
S(k), k.filter((f) => f.severity === "error").length === 0 && (o == null || o(d));
|
|
199
|
-
}, [d, o]),
|
|
199
|
+
}, [d, o]), M = Object.entries(d.paths).flatMap(
|
|
200
200
|
([k, f]) => we.filter((x) => f[x.toLowerCase()]).map(
|
|
201
201
|
(x) => ({
|
|
202
202
|
path: k,
|
|
@@ -205,16 +205,16 @@ function ot({
|
|
|
205
205
|
})
|
|
206
206
|
)
|
|
207
207
|
), O = ["info", "paths", "schemas", "security", "preview"];
|
|
208
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ n("div", { style: { position: "relative", height: "100%" }, children: [
|
|
209
209
|
c && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(c, Ee) }) }),
|
|
210
210
|
/* @__PURE__ */ e(
|
|
211
211
|
ye,
|
|
212
212
|
{
|
|
213
213
|
flush: !0,
|
|
214
|
-
className: `nice-api-designer ${
|
|
214
|
+
className: `nice-api-designer ${r}`,
|
|
215
215
|
height: "100%",
|
|
216
216
|
style: { minHeight: 600 },
|
|
217
|
-
toolbar: /* @__PURE__ */
|
|
217
|
+
toolbar: /* @__PURE__ */ n("div", { className: "nice-api-designer__toolbar", children: [
|
|
218
218
|
/* @__PURE__ */ e("div", { className: "nice-api-designer__tabs", children: O.map((k) => /* @__PURE__ */ e(
|
|
219
219
|
U,
|
|
220
220
|
{
|
|
@@ -225,23 +225,23 @@ function ot({
|
|
|
225
225
|
},
|
|
226
226
|
k
|
|
227
227
|
)) }),
|
|
228
|
-
!
|
|
228
|
+
!i && /* @__PURE__ */ e(
|
|
229
229
|
U,
|
|
230
230
|
{
|
|
231
231
|
size: "sm",
|
|
232
232
|
variant: "primary",
|
|
233
|
-
leftIcon: /* @__PURE__ */ e(
|
|
234
|
-
onClick:
|
|
233
|
+
leftIcon: /* @__PURE__ */ e(B, { name: "check", size: 14 }),
|
|
234
|
+
onClick: z,
|
|
235
235
|
children: l("apiDesigner.save", "Save")
|
|
236
236
|
}
|
|
237
237
|
)
|
|
238
238
|
] }),
|
|
239
|
-
bottomPanel: m.length > 0 ? /* @__PURE__ */ e("div", { className: "nice-api-designer__errors", children: m.map((k, f) => /* @__PURE__ */
|
|
239
|
+
bottomPanel: m.length > 0 ? /* @__PURE__ */ e("div", { className: "nice-api-designer__errors", children: m.map((k, f) => /* @__PURE__ */ n(
|
|
240
240
|
"div",
|
|
241
241
|
{
|
|
242
242
|
className: `nice-api-designer__error nice-api-designer__error--${k.severity}`,
|
|
243
243
|
children: [
|
|
244
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ n("strong", { children: [
|
|
245
245
|
k.path,
|
|
246
246
|
":"
|
|
247
247
|
] }),
|
|
@@ -251,22 +251,22 @@ function ot({
|
|
|
251
251
|
},
|
|
252
252
|
f
|
|
253
253
|
)) }) : void 0,
|
|
254
|
-
children: /* @__PURE__ */
|
|
255
|
-
y === "info" && /* @__PURE__ */ e(xe, { schema: d, onChange:
|
|
254
|
+
children: /* @__PURE__ */ n("div", { className: "nice-api-designer__content", children: [
|
|
255
|
+
y === "info" && /* @__PURE__ */ e(xe, { schema: d, onChange: w, readOnly: i }),
|
|
256
256
|
y === "paths" && /* @__PURE__ */ e(
|
|
257
257
|
Ie,
|
|
258
258
|
{
|
|
259
|
-
endpoints:
|
|
259
|
+
endpoints: M,
|
|
260
260
|
schema: d,
|
|
261
|
-
selectedPath:
|
|
262
|
-
selectedMethod:
|
|
261
|
+
selectedPath: v,
|
|
262
|
+
selectedMethod: N,
|
|
263
263
|
onSelectEndpoint: (k, f) => {
|
|
264
|
-
u(k),
|
|
264
|
+
u(k), b(f);
|
|
265
265
|
},
|
|
266
266
|
onAdd: A,
|
|
267
267
|
onDelete: J,
|
|
268
|
-
onChange:
|
|
269
|
-
readOnly:
|
|
268
|
+
onChange: w,
|
|
269
|
+
readOnly: i
|
|
270
270
|
}
|
|
271
271
|
),
|
|
272
272
|
y === "schemas" && /* @__PURE__ */ e(
|
|
@@ -274,89 +274,89 @@ function ot({
|
|
|
274
274
|
{
|
|
275
275
|
schemas: ((V = d.components) == null ? void 0 : V.schemas) || {},
|
|
276
276
|
onAdd: te,
|
|
277
|
-
onChange: (k) =>
|
|
277
|
+
onChange: (k) => w((f) => ({
|
|
278
278
|
...f,
|
|
279
279
|
components: { ...f.components, schemas: k }
|
|
280
280
|
})),
|
|
281
|
-
readOnly:
|
|
281
|
+
readOnly: i
|
|
282
282
|
}
|
|
283
283
|
),
|
|
284
284
|
y === "security" && /* @__PURE__ */ e(
|
|
285
|
-
|
|
285
|
+
qe,
|
|
286
286
|
{
|
|
287
287
|
schemes: ((G = d.components) == null ? void 0 : G.securitySchemes) || {},
|
|
288
|
-
onChange: (k) =>
|
|
288
|
+
onChange: (k) => w((f) => ({
|
|
289
289
|
...f,
|
|
290
290
|
components: { ...f.components, securitySchemes: k }
|
|
291
291
|
})),
|
|
292
|
-
readOnly:
|
|
292
|
+
readOnly: i
|
|
293
293
|
}
|
|
294
294
|
),
|
|
295
|
-
y === "preview" && /* @__PURE__ */ e(
|
|
295
|
+
y === "preview" && /* @__PURE__ */ e($e, { schema: d })
|
|
296
296
|
] })
|
|
297
297
|
}
|
|
298
298
|
)
|
|
299
299
|
] });
|
|
300
300
|
}
|
|
301
301
|
function xe({ schema: t, onChange: a, readOnly: o }) {
|
|
302
|
-
const { t:
|
|
303
|
-
return /* @__PURE__ */
|
|
304
|
-
/* @__PURE__ */ e("h3", { children:
|
|
302
|
+
const { t: i } = $();
|
|
303
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-designer__info-editor", children: [
|
|
304
|
+
/* @__PURE__ */ e("h3", { children: i("apiDesigner.apiInformation", "API information") }),
|
|
305
305
|
/* @__PURE__ */ e(
|
|
306
|
-
|
|
306
|
+
L,
|
|
307
307
|
{
|
|
308
|
-
label:
|
|
308
|
+
label: i("apiDesigner.title", "Title"),
|
|
309
309
|
value: t.info.title,
|
|
310
|
-
onChange: (
|
|
310
|
+
onChange: (r) => a((c) => ({ ...c, info: { ...c.info, title: r } })),
|
|
311
311
|
readOnly: o
|
|
312
312
|
}
|
|
313
313
|
),
|
|
314
314
|
/* @__PURE__ */ e(
|
|
315
|
-
|
|
315
|
+
L,
|
|
316
316
|
{
|
|
317
|
-
label:
|
|
317
|
+
label: i("apiDesigner.version", "Version"),
|
|
318
318
|
value: t.info.version,
|
|
319
|
-
onChange: (
|
|
319
|
+
onChange: (r) => a((c) => ({ ...c, info: { ...c.info, version: r } })),
|
|
320
320
|
readOnly: o
|
|
321
321
|
}
|
|
322
322
|
),
|
|
323
323
|
/* @__PURE__ */ e(
|
|
324
324
|
oe,
|
|
325
325
|
{
|
|
326
|
-
label:
|
|
326
|
+
label: i("apiDesigner.description", "Description"),
|
|
327
327
|
value: t.info.description || "",
|
|
328
|
-
onChange: (
|
|
328
|
+
onChange: (r) => a((c) => ({ ...c, info: { ...c.info, description: r } })),
|
|
329
329
|
readOnly: o,
|
|
330
330
|
rows: 4
|
|
331
331
|
}
|
|
332
332
|
),
|
|
333
|
-
/* @__PURE__ */ e("h4", { children:
|
|
334
|
-
(t.servers || []).map((
|
|
333
|
+
/* @__PURE__ */ e("h4", { children: i("apiDesigner.servers", "Servers") }),
|
|
334
|
+
(t.servers || []).map((r, c) => /* @__PURE__ */ n("div", { className: "nice-api-designer__server", children: [
|
|
335
335
|
/* @__PURE__ */ e(
|
|
336
|
-
|
|
336
|
+
L,
|
|
337
337
|
{
|
|
338
|
-
value:
|
|
339
|
-
placeholder:
|
|
338
|
+
value: r.url,
|
|
339
|
+
placeholder: i("apiDesigner.serverUrl", "Server URL"),
|
|
340
340
|
onChange: (l) => a((d) => {
|
|
341
341
|
var p;
|
|
342
342
|
return {
|
|
343
343
|
...d,
|
|
344
|
-
servers: (p = d.servers) == null ? void 0 : p.map((
|
|
344
|
+
servers: (p = d.servers) == null ? void 0 : p.map((v, u) => u === c ? { ...v, url: l } : v)
|
|
345
345
|
};
|
|
346
346
|
}),
|
|
347
347
|
readOnly: o
|
|
348
348
|
}
|
|
349
349
|
),
|
|
350
350
|
/* @__PURE__ */ e(
|
|
351
|
-
|
|
351
|
+
L,
|
|
352
352
|
{
|
|
353
|
-
value:
|
|
354
|
-
placeholder:
|
|
353
|
+
value: r.description || "",
|
|
354
|
+
placeholder: i("apiDesigner.description", "Description"),
|
|
355
355
|
onChange: (l) => a((d) => {
|
|
356
356
|
var p;
|
|
357
357
|
return {
|
|
358
358
|
...d,
|
|
359
|
-
servers: (p = d.servers) == null ? void 0 : p.map((
|
|
359
|
+
servers: (p = d.servers) == null ? void 0 : p.map((v, u) => u === c ? { ...v, description: l } : v)
|
|
360
360
|
};
|
|
361
361
|
}),
|
|
362
362
|
readOnly: o
|
|
@@ -371,11 +371,11 @@ function xe({ schema: t, onChange: a, readOnly: o }) {
|
|
|
371
371
|
var d;
|
|
372
372
|
return {
|
|
373
373
|
...l,
|
|
374
|
-
servers: (d = l.servers) == null ? void 0 : d.filter((p,
|
|
374
|
+
servers: (d = l.servers) == null ? void 0 : d.filter((p, v) => v !== c)
|
|
375
375
|
};
|
|
376
376
|
}),
|
|
377
|
-
"aria-label":
|
|
378
|
-
children: /* @__PURE__ */ e(
|
|
377
|
+
"aria-label": i("apiDesigner.removeServer", "Remove server"),
|
|
378
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
|
|
379
379
|
}
|
|
380
380
|
)
|
|
381
381
|
] }, c)),
|
|
@@ -384,12 +384,12 @@ function xe({ schema: t, onChange: a, readOnly: o }) {
|
|
|
384
384
|
{
|
|
385
385
|
size: "sm",
|
|
386
386
|
variant: "outline",
|
|
387
|
-
leftIcon: /* @__PURE__ */ e(
|
|
388
|
-
onClick: () => a((
|
|
389
|
-
...
|
|
390
|
-
servers: [...
|
|
387
|
+
leftIcon: /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
|
|
388
|
+
onClick: () => a((r) => ({
|
|
389
|
+
...r,
|
|
390
|
+
servers: [...r.servers || [], { url: "https://api.example.com" }]
|
|
391
391
|
})),
|
|
392
|
-
children:
|
|
392
|
+
children: i("apiDesigner.addServer", "Add server")
|
|
393
393
|
}
|
|
394
394
|
)
|
|
395
395
|
] });
|
|
@@ -398,40 +398,41 @@ function Ie({
|
|
|
398
398
|
endpoints: t,
|
|
399
399
|
schema: a,
|
|
400
400
|
selectedPath: o,
|
|
401
|
-
selectedMethod:
|
|
402
|
-
onSelectEndpoint:
|
|
401
|
+
selectedMethod: i,
|
|
402
|
+
onSelectEndpoint: r,
|
|
403
403
|
onAdd: c,
|
|
404
404
|
onDelete: l,
|
|
405
405
|
onChange: d,
|
|
406
406
|
readOnly: p
|
|
407
407
|
}) {
|
|
408
408
|
var y;
|
|
409
|
-
const { t:
|
|
410
|
-
!o || !
|
|
409
|
+
const { t: v } = $(), u = o && i ? (y = a.paths[o]) == null ? void 0 : y[i] : null, N = (T) => {
|
|
410
|
+
!o || !i || !u || d((m) => ({
|
|
411
411
|
...m,
|
|
412
412
|
paths: {
|
|
413
413
|
...m.paths,
|
|
414
414
|
[o]: {
|
|
415
415
|
...m.paths[o],
|
|
416
|
-
[
|
|
416
|
+
[i]: { ...u, ...T }
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
}));
|
|
420
|
-
},
|
|
421
|
-
return /* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */ e("h3", { children:
|
|
425
|
-
!p && /* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */ e(
|
|
427
|
-
"
|
|
420
|
+
}, b = (u == null ? void 0 : u.parameters) ?? [];
|
|
421
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-designer__paths-editor", children: [
|
|
422
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__endpoints-list", children: [
|
|
423
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__list-header", children: [
|
|
424
|
+
/* @__PURE__ */ e("h3", { children: v("apiDesigner.endpoints", "Endpoints") }),
|
|
425
|
+
!p && /* @__PURE__ */ n(U, { size: "sm", variant: "ghost", onClick: c, children: [
|
|
426
|
+
/* @__PURE__ */ e(B, { name: "plus", size: 14 }),
|
|
427
|
+
" ",
|
|
428
|
+
v("apiDesigner.add", "Add")
|
|
428
429
|
] })
|
|
429
430
|
] }),
|
|
430
|
-
t.map(({ path: T, method: m }) => /* @__PURE__ */
|
|
431
|
+
t.map(({ path: T, method: m }) => /* @__PURE__ */ n(
|
|
431
432
|
"div",
|
|
432
433
|
{
|
|
433
|
-
className: `nice-api-designer__endpoint ${o === T &&
|
|
434
|
-
onClick: () =>
|
|
434
|
+
className: `nice-api-designer__endpoint ${o === T && i === m.toLowerCase() ? "nice-api-designer__endpoint--selected" : ""}`,
|
|
435
|
+
onClick: () => r(T, m.toLowerCase()),
|
|
435
436
|
children: [
|
|
436
437
|
/* @__PURE__ */ e(
|
|
437
438
|
"span",
|
|
@@ -446,75 +447,76 @@ function Ie({
|
|
|
446
447
|
`${m}-${T}`
|
|
447
448
|
))
|
|
448
449
|
] }),
|
|
449
|
-
u && o &&
|
|
450
|
-
/* @__PURE__ */
|
|
450
|
+
u && o && i && /* @__PURE__ */ n("div", { className: "nice-api-designer__operation-editor", children: [
|
|
451
|
+
/* @__PURE__ */ n("h3", { children: [
|
|
451
452
|
/* @__PURE__ */ e(
|
|
452
453
|
"span",
|
|
453
454
|
{
|
|
454
|
-
className: `nice-api-designer__method nice-api-designer__method--${
|
|
455
|
-
children:
|
|
455
|
+
className: `nice-api-designer__method nice-api-designer__method--${i}`,
|
|
456
|
+
children: i.toUpperCase()
|
|
456
457
|
}
|
|
457
458
|
),
|
|
458
459
|
" ",
|
|
459
460
|
o
|
|
460
461
|
] }),
|
|
461
462
|
/* @__PURE__ */ e(
|
|
462
|
-
|
|
463
|
+
L,
|
|
463
464
|
{
|
|
464
|
-
label:
|
|
465
|
+
label: v("apiDesigner.summary", "Summary"),
|
|
465
466
|
value: u.summary || "",
|
|
466
|
-
onChange: (T) =>
|
|
467
|
+
onChange: (T) => N({ summary: T }),
|
|
467
468
|
readOnly: p
|
|
468
469
|
}
|
|
469
470
|
),
|
|
470
471
|
/* @__PURE__ */ e(
|
|
471
472
|
oe,
|
|
472
473
|
{
|
|
473
|
-
label:
|
|
474
|
+
label: v("apiDesigner.description", "Description"),
|
|
474
475
|
value: u.description || "",
|
|
475
|
-
onChange: (T) =>
|
|
476
|
+
onChange: (T) => N({ description: T }),
|
|
476
477
|
readOnly: p,
|
|
477
478
|
rows: 3
|
|
478
479
|
}
|
|
479
480
|
),
|
|
480
481
|
/* @__PURE__ */ e(
|
|
481
|
-
|
|
482
|
+
L,
|
|
482
483
|
{
|
|
483
|
-
label:
|
|
484
|
+
label: v("apiDesigner.operationId", "Operation ID"),
|
|
484
485
|
value: u.operationId || "",
|
|
485
|
-
onChange: (T) =>
|
|
486
|
+
onChange: (T) => N({ operationId: T }),
|
|
486
487
|
readOnly: p
|
|
487
488
|
}
|
|
488
489
|
),
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */ e("h4", { children:
|
|
491
|
-
!p && /* @__PURE__ */
|
|
490
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__subhead", children: [
|
|
491
|
+
/* @__PURE__ */ e("h4", { children: v("apiDesigner.parameters", "Parameters") }),
|
|
492
|
+
!p && /* @__PURE__ */ n(
|
|
492
493
|
U,
|
|
493
494
|
{
|
|
494
495
|
size: "sm",
|
|
495
496
|
variant: "ghost",
|
|
496
|
-
onClick: () =>
|
|
497
|
+
onClick: () => N({
|
|
497
498
|
parameters: [
|
|
498
|
-
...
|
|
499
|
+
...b,
|
|
499
500
|
{ name: "param", in: "query", required: !1, schema: { type: "string" } }
|
|
500
501
|
]
|
|
501
502
|
}),
|
|
502
503
|
children: [
|
|
503
|
-
/* @__PURE__ */ e(
|
|
504
|
-
"
|
|
504
|
+
/* @__PURE__ */ e(B, { name: "plus", size: 14 }),
|
|
505
|
+
" ",
|
|
506
|
+
v("apiDesigner.add", "Add")
|
|
505
507
|
]
|
|
506
508
|
}
|
|
507
509
|
)
|
|
508
510
|
] }),
|
|
509
|
-
|
|
510
|
-
|
|
511
|
+
b.length === 0 && /* @__PURE__ */ e("p", { className: "nice-api-designer__muted", children: v("apiDesigner.noParameters", "No parameters.") }),
|
|
512
|
+
b.map((T, m) => /* @__PURE__ */ n("div", { className: "nice-api-designer__param-row", children: [
|
|
511
513
|
/* @__PURE__ */ e(
|
|
512
|
-
|
|
514
|
+
L,
|
|
513
515
|
{
|
|
514
516
|
size: "sm",
|
|
515
517
|
value: T.name,
|
|
516
518
|
placeholder: "name",
|
|
517
|
-
onChange: (S) =>
|
|
519
|
+
onChange: (S) => N({ parameters: b.map((w, A) => A === m ? { ...w, name: S } : w) }),
|
|
518
520
|
readOnly: p
|
|
519
521
|
}
|
|
520
522
|
),
|
|
@@ -524,9 +526,9 @@ function Ie({
|
|
|
524
526
|
size: "sm",
|
|
525
527
|
value: T.in,
|
|
526
528
|
options: De.map((S) => ({ value: String(S), label: String(S) })),
|
|
527
|
-
onChange: (S) =>
|
|
528
|
-
parameters:
|
|
529
|
-
(
|
|
529
|
+
onChange: (S) => N({
|
|
530
|
+
parameters: b.map(
|
|
531
|
+
(w, A) => A === m ? { ...w, in: S } : w
|
|
530
532
|
)
|
|
531
533
|
})
|
|
532
534
|
}
|
|
@@ -535,8 +537,8 @@ function Ie({
|
|
|
535
537
|
fe,
|
|
536
538
|
{
|
|
537
539
|
checked: !!T.required,
|
|
538
|
-
onChange: (S) =>
|
|
539
|
-
parameters:
|
|
540
|
+
onChange: (S) => N({
|
|
541
|
+
parameters: b.map((w, A) => A === m ? { ...w, required: S } : w)
|
|
540
542
|
}),
|
|
541
543
|
label: "required"
|
|
542
544
|
}
|
|
@@ -546,9 +548,12 @@ function Ie({
|
|
|
546
548
|
{
|
|
547
549
|
size: "sm",
|
|
548
550
|
variant: "ghost",
|
|
549
|
-
onClick: () =>
|
|
550
|
-
"aria-label":
|
|
551
|
-
|
|
551
|
+
onClick: () => N({ parameters: b.filter((S, w) => w !== m) }),
|
|
552
|
+
"aria-label": v("apiDesigner.remove", "Remove {name}").replace(
|
|
553
|
+
"{name}",
|
|
554
|
+
String(T.name)
|
|
555
|
+
),
|
|
556
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
|
|
552
557
|
}
|
|
553
558
|
)
|
|
554
559
|
] }, m)),
|
|
@@ -558,9 +563,9 @@ function Ie({
|
|
|
558
563
|
className: "nice-api-designer__delete-btn",
|
|
559
564
|
size: "sm",
|
|
560
565
|
variant: "danger",
|
|
561
|
-
leftIcon: /* @__PURE__ */ e(
|
|
566
|
+
leftIcon: /* @__PURE__ */ e(B, { name: "trash", size: 14 }),
|
|
562
567
|
onClick: () => l(o),
|
|
563
|
-
children:
|
|
568
|
+
children: v("apiDesigner.deleteEndpoint", "Delete endpoint")
|
|
564
569
|
}
|
|
565
570
|
)
|
|
566
571
|
] })
|
|
@@ -570,94 +575,96 @@ function Re({
|
|
|
570
575
|
schemas: t,
|
|
571
576
|
onAdd: a,
|
|
572
577
|
onChange: o,
|
|
573
|
-
readOnly:
|
|
578
|
+
readOnly: i
|
|
574
579
|
}) {
|
|
575
|
-
const { t:
|
|
576
|
-
!l || !p || o({ ...t, [l]: { ...p, ...
|
|
577
|
-
},
|
|
578
|
-
u({ properties: { ...
|
|
580
|
+
const { t: r } = $(), c = Object.keys(t), [l, d] = C(c[0] ?? null), p = l ? t[l] : null, v = (p == null ? void 0 : p.properties) ?? {}, u = (b) => {
|
|
581
|
+
!l || !p || o({ ...t, [l]: { ...p, ...b } });
|
|
582
|
+
}, N = (b, y) => {
|
|
583
|
+
u({ properties: { ...v, [b]: y } });
|
|
579
584
|
};
|
|
580
|
-
return /* @__PURE__ */
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */ e("h3", { children:
|
|
584
|
-
!
|
|
585
|
-
/* @__PURE__ */ e(
|
|
586
|
-
"
|
|
585
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-designer__schemas-editor", children: [
|
|
586
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__schemas-list", children: [
|
|
587
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__list-header", children: [
|
|
588
|
+
/* @__PURE__ */ e("h3", { children: r("apiDesigner.schemas", "Schemas") }),
|
|
589
|
+
!i && /* @__PURE__ */ n(U, { size: "sm", variant: "ghost", onClick: a, children: [
|
|
590
|
+
/* @__PURE__ */ e(B, { name: "plus", size: 14 }),
|
|
591
|
+
" ",
|
|
592
|
+
r("apiDesigner.add", "Add")
|
|
587
593
|
] })
|
|
588
594
|
] }),
|
|
589
|
-
c.map((
|
|
595
|
+
c.map((b) => /* @__PURE__ */ e(
|
|
590
596
|
"div",
|
|
591
597
|
{
|
|
592
|
-
className: `nice-api-designer__schema-item ${l ===
|
|
593
|
-
onClick: () => d(
|
|
594
|
-
children:
|
|
598
|
+
className: `nice-api-designer__schema-item ${l === b ? "nice-api-designer__schema-item--selected" : ""}`,
|
|
599
|
+
onClick: () => d(b),
|
|
600
|
+
children: b
|
|
595
601
|
},
|
|
596
|
-
|
|
602
|
+
b
|
|
597
603
|
))
|
|
598
604
|
] }),
|
|
599
|
-
l && p && /* @__PURE__ */
|
|
605
|
+
l && p && /* @__PURE__ */ n("div", { className: "nice-api-designer__schema-editor", children: [
|
|
600
606
|
/* @__PURE__ */ e("h3", { children: l }),
|
|
601
607
|
/* @__PURE__ */ e(
|
|
602
608
|
se,
|
|
603
609
|
{
|
|
604
|
-
label:
|
|
610
|
+
label: r("apiDesigner.type", "Type"),
|
|
605
611
|
value: p.type || "object",
|
|
606
612
|
options: _e,
|
|
607
|
-
onChange: (
|
|
613
|
+
onChange: (b) => u({ type: b })
|
|
608
614
|
}
|
|
609
615
|
),
|
|
610
616
|
/* @__PURE__ */ e(
|
|
611
617
|
oe,
|
|
612
618
|
{
|
|
613
|
-
label:
|
|
619
|
+
label: r("apiDesigner.description", "Description"),
|
|
614
620
|
value: p.description || "",
|
|
615
|
-
onChange: (
|
|
616
|
-
readOnly:
|
|
621
|
+
onChange: (b) => u({ description: b }),
|
|
622
|
+
readOnly: i,
|
|
617
623
|
rows: 2
|
|
618
624
|
}
|
|
619
625
|
),
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */ e("h4", { children:
|
|
622
|
-
!
|
|
626
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__subhead", children: [
|
|
627
|
+
/* @__PURE__ */ e("h4", { children: r("apiDesigner.properties", "Properties") }),
|
|
628
|
+
!i && /* @__PURE__ */ n(
|
|
623
629
|
U,
|
|
624
630
|
{
|
|
625
631
|
size: "sm",
|
|
626
632
|
variant: "ghost",
|
|
627
633
|
onClick: () => {
|
|
628
|
-
let
|
|
629
|
-
for (; b
|
|
630
|
-
|
|
631
|
-
|
|
634
|
+
let b = "field", y = 1;
|
|
635
|
+
for (; v[b]; )
|
|
636
|
+
b = `field${y++}`;
|
|
637
|
+
N(b, { type: "string" });
|
|
632
638
|
},
|
|
633
639
|
children: [
|
|
634
|
-
/* @__PURE__ */ e(
|
|
635
|
-
"
|
|
640
|
+
/* @__PURE__ */ e(B, { name: "plus", size: 14 }),
|
|
641
|
+
" ",
|
|
642
|
+
r("apiDesigner.add", "Add")
|
|
636
643
|
]
|
|
637
644
|
}
|
|
638
645
|
)
|
|
639
646
|
] }),
|
|
640
|
-
Object.keys(
|
|
641
|
-
Object.entries(
|
|
642
|
-
const T = (p.required || []).includes(
|
|
643
|
-
return /* @__PURE__ */
|
|
647
|
+
Object.keys(v).length === 0 && /* @__PURE__ */ e("p", { className: "nice-api-designer__muted", children: r("apiDesigner.noProperties", "No properties.") }),
|
|
648
|
+
Object.entries(v).map(([b, y]) => {
|
|
649
|
+
const T = (p.required || []).includes(b);
|
|
650
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-designer__param-row", children: [
|
|
644
651
|
/* @__PURE__ */ e(
|
|
645
|
-
|
|
652
|
+
L,
|
|
646
653
|
{
|
|
647
654
|
size: "sm",
|
|
648
|
-
value:
|
|
655
|
+
value: b,
|
|
649
656
|
onChange: (m) => {
|
|
650
|
-
if (!m || m ===
|
|
657
|
+
if (!m || m === b || v[m])
|
|
651
658
|
return;
|
|
652
659
|
const S = {};
|
|
653
|
-
Object.entries(
|
|
654
|
-
S[
|
|
660
|
+
Object.entries(v).forEach(([w, A]) => {
|
|
661
|
+
S[w === b ? m : w] = A;
|
|
655
662
|
}), u({
|
|
656
663
|
properties: S,
|
|
657
|
-
required: (p.required || []).map((
|
|
664
|
+
required: (p.required || []).map((w) => w === b ? m : w)
|
|
658
665
|
});
|
|
659
666
|
},
|
|
660
|
-
readOnly:
|
|
667
|
+
readOnly: i
|
|
661
668
|
}
|
|
662
669
|
),
|
|
663
670
|
/* @__PURE__ */ e(
|
|
@@ -666,7 +673,7 @@ function Re({
|
|
|
666
673
|
size: "sm",
|
|
667
674
|
value: y.type || "string",
|
|
668
675
|
options: _e,
|
|
669
|
-
onChange: (m) =>
|
|
676
|
+
onChange: (m) => N(b, { ...y, type: m })
|
|
670
677
|
}
|
|
671
678
|
),
|
|
672
679
|
/* @__PURE__ */ e(
|
|
@@ -674,43 +681,46 @@ function Re({
|
|
|
674
681
|
{
|
|
675
682
|
checked: T,
|
|
676
683
|
onChange: (m) => u({
|
|
677
|
-
required: m ? [...p.required || [],
|
|
684
|
+
required: m ? [...p.required || [], b] : (p.required || []).filter((S) => S !== b)
|
|
678
685
|
}),
|
|
679
686
|
label: "required"
|
|
680
687
|
}
|
|
681
688
|
),
|
|
682
|
-
!
|
|
689
|
+
!i && /* @__PURE__ */ e(
|
|
683
690
|
U,
|
|
684
691
|
{
|
|
685
692
|
size: "sm",
|
|
686
693
|
variant: "ghost",
|
|
687
694
|
onClick: () => {
|
|
688
|
-
const { [
|
|
695
|
+
const { [b]: m, ...S } = v;
|
|
689
696
|
u({
|
|
690
697
|
properties: S,
|
|
691
|
-
required: (p.required || []).filter((
|
|
698
|
+
required: (p.required || []).filter((w) => w !== b)
|
|
692
699
|
});
|
|
693
700
|
},
|
|
694
|
-
"aria-label":
|
|
695
|
-
|
|
701
|
+
"aria-label": r("apiDesigner.remove2", "Remove {propName}").replace(
|
|
702
|
+
"{propName}",
|
|
703
|
+
String(b)
|
|
704
|
+
),
|
|
705
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
|
|
696
706
|
}
|
|
697
707
|
)
|
|
698
|
-
] },
|
|
708
|
+
] }, b);
|
|
699
709
|
}),
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */ e("summary", { children:
|
|
710
|
+
/* @__PURE__ */ n("details", { className: "nice-api-designer__raw", children: [
|
|
711
|
+
/* @__PURE__ */ e("summary", { children: r("apiDesigner.rawJsonSchema", "Raw JSON schema") }),
|
|
702
712
|
/* @__PURE__ */ e(
|
|
703
713
|
oe,
|
|
704
714
|
{
|
|
705
715
|
value: JSON.stringify(p, null, 2),
|
|
706
|
-
onChange: (
|
|
716
|
+
onChange: (b) => {
|
|
707
717
|
try {
|
|
708
|
-
const y = JSON.parse(
|
|
718
|
+
const y = JSON.parse(b);
|
|
709
719
|
o({ ...t, [l]: y });
|
|
710
720
|
} catch {
|
|
711
721
|
}
|
|
712
722
|
},
|
|
713
|
-
readOnly:
|
|
723
|
+
readOnly: i,
|
|
714
724
|
rows: 8,
|
|
715
725
|
className: "nice-api-designer__code"
|
|
716
726
|
}
|
|
@@ -719,12 +729,12 @@ function Re({
|
|
|
719
729
|
] })
|
|
720
730
|
] });
|
|
721
731
|
}
|
|
722
|
-
function
|
|
723
|
-
const { t:
|
|
724
|
-
return /* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */ e("h3", { children:
|
|
727
|
-
!o && /* @__PURE__ */
|
|
732
|
+
function qe({ schemes: t, onChange: a, readOnly: o }) {
|
|
733
|
+
const { t: i } = $(), r = (c, l) => a({ ...t, [c]: l });
|
|
734
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-designer__security-editor", children: [
|
|
735
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__list-header", children: [
|
|
736
|
+
/* @__PURE__ */ e("h3", { children: i("apiDesigner.securitySchemes", "Security schemes") }),
|
|
737
|
+
!o && /* @__PURE__ */ n(
|
|
728
738
|
U,
|
|
729
739
|
{
|
|
730
740
|
size: "sm",
|
|
@@ -733,17 +743,18 @@ function $e({ schemes: t, onChange: a, readOnly: o }) {
|
|
|
733
743
|
let c = "newScheme", l = 1;
|
|
734
744
|
for (; t[c]; )
|
|
735
745
|
c = `newScheme${l++}`;
|
|
736
|
-
|
|
746
|
+
r(c, { type: "apiKey", name: "X-API-Key", in: "header" });
|
|
737
747
|
},
|
|
738
748
|
children: [
|
|
739
|
-
/* @__PURE__ */ e(
|
|
740
|
-
"
|
|
749
|
+
/* @__PURE__ */ e(B, { name: "plus", size: 14 }),
|
|
750
|
+
" ",
|
|
751
|
+
i("apiDesigner.add", "Add")
|
|
741
752
|
]
|
|
742
753
|
}
|
|
743
754
|
)
|
|
744
755
|
] }),
|
|
745
|
-
Object.entries(t).map(([c, l]) => /* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
756
|
+
Object.entries(t).map(([c, l]) => /* @__PURE__ */ n("div", { className: "nice-api-designer__security-item", children: [
|
|
757
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__subhead", children: [
|
|
747
758
|
/* @__PURE__ */ e("h4", { children: c }),
|
|
748
759
|
!o && /* @__PURE__ */ e(
|
|
749
760
|
U,
|
|
@@ -754,29 +765,32 @@ function $e({ schemes: t, onChange: a, readOnly: o }) {
|
|
|
754
765
|
const { [c]: d, ...p } = t;
|
|
755
766
|
a(p);
|
|
756
767
|
},
|
|
757
|
-
"aria-label":
|
|
758
|
-
|
|
768
|
+
"aria-label": i("apiDesigner.remove", "Remove {name}").replace(
|
|
769
|
+
"{name}",
|
|
770
|
+
String(c)
|
|
771
|
+
),
|
|
772
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
|
|
759
773
|
}
|
|
760
774
|
)
|
|
761
775
|
] }),
|
|
762
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ n("div", { className: "nice-api-designer__param-row", children: [
|
|
763
777
|
/* @__PURE__ */ e(
|
|
764
778
|
se,
|
|
765
779
|
{
|
|
766
780
|
size: "sm",
|
|
767
781
|
value: l.type,
|
|
768
782
|
options: Ae.map((d) => ({ value: String(d), label: String(d) })),
|
|
769
|
-
onChange: (d) =>
|
|
783
|
+
onChange: (d) => r(c, { ...l, type: d })
|
|
770
784
|
}
|
|
771
785
|
),
|
|
772
|
-
l.type === "apiKey" && /* @__PURE__ */
|
|
786
|
+
l.type === "apiKey" && /* @__PURE__ */ n(Q, { children: [
|
|
773
787
|
/* @__PURE__ */ e(
|
|
774
|
-
|
|
788
|
+
L,
|
|
775
789
|
{
|
|
776
790
|
size: "sm",
|
|
777
791
|
value: l.name || "",
|
|
778
|
-
placeholder:
|
|
779
|
-
onChange: (d) =>
|
|
792
|
+
placeholder: i("apiDesigner.headerParamName", "header/param name"),
|
|
793
|
+
onChange: (d) => r(c, { ...l, name: d }),
|
|
780
794
|
readOnly: o
|
|
781
795
|
}
|
|
782
796
|
),
|
|
@@ -786,54 +800,54 @@ function $e({ schemes: t, onChange: a, readOnly: o }) {
|
|
|
786
800
|
size: "sm",
|
|
787
801
|
value: l.in || "header",
|
|
788
802
|
options: ["header", "query", "cookie"].map((d) => ({ value: d, label: d })),
|
|
789
|
-
onChange: (d) =>
|
|
803
|
+
onChange: (d) => r(c, { ...l, in: d })
|
|
790
804
|
}
|
|
791
805
|
)
|
|
792
806
|
] }),
|
|
793
|
-
l.type === "http" && /* @__PURE__ */
|
|
807
|
+
l.type === "http" && /* @__PURE__ */ n(Q, { children: [
|
|
794
808
|
/* @__PURE__ */ e(
|
|
795
|
-
|
|
809
|
+
L,
|
|
796
810
|
{
|
|
797
811
|
size: "sm",
|
|
798
812
|
value: l.scheme || "",
|
|
799
|
-
placeholder:
|
|
800
|
-
onChange: (d) =>
|
|
813
|
+
placeholder: i("apiDesigner.schemeBearerBasic", "scheme (bearer/basic)"),
|
|
814
|
+
onChange: (d) => r(c, { ...l, scheme: d }),
|
|
801
815
|
readOnly: o
|
|
802
816
|
}
|
|
803
817
|
),
|
|
804
818
|
/* @__PURE__ */ e(
|
|
805
|
-
|
|
819
|
+
L,
|
|
806
820
|
{
|
|
807
821
|
size: "sm",
|
|
808
822
|
value: l.bearerFormat || "",
|
|
809
|
-
placeholder:
|
|
810
|
-
onChange: (d) =>
|
|
823
|
+
placeholder: i("apiDesigner.bearerformatJwt", "bearerFormat (JWT)"),
|
|
824
|
+
onChange: (d) => r(c, { ...l, bearerFormat: d }),
|
|
811
825
|
readOnly: o
|
|
812
826
|
}
|
|
813
827
|
)
|
|
814
828
|
] })
|
|
815
829
|
] }),
|
|
816
830
|
/* @__PURE__ */ e(
|
|
817
|
-
|
|
831
|
+
L,
|
|
818
832
|
{
|
|
819
833
|
size: "sm",
|
|
820
834
|
value: l.description || "",
|
|
821
|
-
placeholder:
|
|
822
|
-
onChange: (d) =>
|
|
835
|
+
placeholder: i("apiDesigner.description", "Description"),
|
|
836
|
+
onChange: (d) => r(c, { ...l, description: d }),
|
|
823
837
|
readOnly: o
|
|
824
838
|
}
|
|
825
839
|
)
|
|
826
840
|
] }, c))
|
|
827
841
|
] });
|
|
828
842
|
}
|
|
829
|
-
function
|
|
830
|
-
const { t: a } =
|
|
831
|
-
return /* @__PURE__ */
|
|
843
|
+
function $e({ schema: t }) {
|
|
844
|
+
const { t: a } = $();
|
|
845
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-designer__json-preview", children: [
|
|
832
846
|
/* @__PURE__ */ e("h3", { children: a("apiDesigner.openapiSpecification", "OpenAPI specification") }),
|
|
833
847
|
/* @__PURE__ */ e("pre", { className: "nice-api-designer__code", children: JSON.stringify(t, null, 2) })
|
|
834
848
|
] });
|
|
835
849
|
}
|
|
836
|
-
const
|
|
850
|
+
const Be = [
|
|
837
851
|
{
|
|
838
852
|
target: ".nice-api-tester",
|
|
839
853
|
titleKey: "tutorial.apiTester.intro.title",
|
|
@@ -842,7 +856,7 @@ const ze = [
|
|
|
842
856
|
content: "Build requests with collections and environment variables, send them and assert on the responses.",
|
|
843
857
|
placement: "auto"
|
|
844
858
|
}
|
|
845
|
-
],
|
|
859
|
+
], ze = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], Oe = {
|
|
846
860
|
id: "",
|
|
847
861
|
name: "New Request",
|
|
848
862
|
method: "GET",
|
|
@@ -851,26 +865,26 @@ const ze = [
|
|
|
851
865
|
queryParams: {}
|
|
852
866
|
};
|
|
853
867
|
function he(t, a) {
|
|
854
|
-
return t.replace(/\{\{(\w+)\}\}/g, (o,
|
|
868
|
+
return t.replace(/\{\{(\w+)\}\}/g, (o, i) => a[i] || `{{${i}}}`);
|
|
855
869
|
}
|
|
856
870
|
function je(t, a) {
|
|
857
|
-
const o = Object.entries(a).filter(([,
|
|
871
|
+
const o = Object.entries(a).filter(([, i]) => i).map(([i, r]) => `${encodeURIComponent(i)}=${encodeURIComponent(r)}`).join("&");
|
|
858
872
|
return o ? `${t}?${o}` : t;
|
|
859
873
|
}
|
|
860
874
|
function ct({
|
|
861
875
|
collections: t = [],
|
|
862
876
|
environments: a = [],
|
|
863
877
|
onRequest: o,
|
|
864
|
-
onSaveCollection:
|
|
865
|
-
className:
|
|
878
|
+
onSaveCollection: i,
|
|
879
|
+
className: r = "",
|
|
866
880
|
tutorial: c
|
|
867
881
|
}) {
|
|
868
|
-
const { t: l } =
|
|
882
|
+
const { t: l } = $(), [d, p] = C(t), [v, u] = C(a), [N, b] = C(
|
|
869
883
|
a.find((s) => s.isActive) || null
|
|
870
884
|
), [y, T] = C({
|
|
871
885
|
...Oe,
|
|
872
886
|
id: re()
|
|
873
|
-
}), [m, S] = C(null), [
|
|
887
|
+
}), [m, S] = C(null), [w, A] = C(!1), [J, te] = C("none"), [z, M] = C(
|
|
874
888
|
"params"
|
|
875
889
|
), [O, V] = C("body"), [G, k] = C(""), [f, x] = C(""), [j, F] = C([]), [R, ie] = C([]), K = de(null), Y = I(async () => {
|
|
876
890
|
var H;
|
|
@@ -878,7 +892,7 @@ function ct({
|
|
|
878
892
|
return;
|
|
879
893
|
A(!0), S(null), F([]);
|
|
880
894
|
const s = Object.fromEntries(
|
|
881
|
-
Object.entries((
|
|
895
|
+
Object.entries((N == null ? void 0 : N.variables) || {}).map(([E, _]) => [E, _.value])
|
|
882
896
|
), g = {
|
|
883
897
|
...y,
|
|
884
898
|
url: he(y.url, s),
|
|
@@ -900,13 +914,13 @@ function ct({
|
|
|
900
914
|
K.current = new AbortController();
|
|
901
915
|
const _ = { ...g.headers };
|
|
902
916
|
y.auth && Ke(_, y.auth);
|
|
903
|
-
const D = je(g.url, g.queryParams),
|
|
917
|
+
const D = je(g.url, g.queryParams), q = {
|
|
904
918
|
method: g.method,
|
|
905
919
|
headers: _,
|
|
906
920
|
signal: K.current.signal
|
|
907
921
|
};
|
|
908
|
-
["POST", "PUT", "PATCH"].includes(g.method) && ((H = y.body) != null && H.content) && (
|
|
909
|
-
const W = await fetch(D,
|
|
922
|
+
["POST", "PUT", "PATCH"].includes(g.method) && ((H = y.body) != null && H.content) && (q.body = typeof y.body.content == "string" ? y.body.content : JSON.stringify(y.body.content), y.body.type === "json" && (_["Content-Type"] = "application/json"));
|
|
923
|
+
const W = await fetch(D, q), X = await W.text();
|
|
910
924
|
let pe;
|
|
911
925
|
try {
|
|
912
926
|
pe = JSON.parse(X);
|
|
@@ -943,7 +957,7 @@ function ct({
|
|
|
943
957
|
} finally {
|
|
944
958
|
A(!1), K.current = null;
|
|
945
959
|
}
|
|
946
|
-
}, [y,
|
|
960
|
+
}, [y, N, o, f]), ne = I(() => {
|
|
947
961
|
var s;
|
|
948
962
|
(s = K.current) == null || s.abort(), A(!1);
|
|
949
963
|
}, []), Z = I(() => {
|
|
@@ -963,29 +977,29 @@ function ct({
|
|
|
963
977
|
name: "My Collection",
|
|
964
978
|
requests: [y]
|
|
965
979
|
};
|
|
966
|
-
p([s]),
|
|
980
|
+
p([s]), i == null || i(s);
|
|
967
981
|
} else {
|
|
968
982
|
const s = {
|
|
969
983
|
...d[0],
|
|
970
984
|
requests: [...d[0].requests, y]
|
|
971
985
|
};
|
|
972
|
-
p((g) => [s, ...g.slice(1)]),
|
|
986
|
+
p((g) => [s, ...g.slice(1)]), i == null || i(s);
|
|
973
987
|
}
|
|
974
|
-
}, [d, y,
|
|
975
|
-
return /* @__PURE__ */
|
|
976
|
-
c && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(c,
|
|
977
|
-
/* @__PURE__ */ e("div", { className: "nice-api-tester__toolbar", children: /* @__PURE__ */ e("div", { className: "nice-api-tester__env-selector", children: /* @__PURE__ */
|
|
988
|
+
}, [d, y, i]);
|
|
989
|
+
return /* @__PURE__ */ n("div", { className: `nice-api-tester ${r}`, style: { position: "relative" }, children: [
|
|
990
|
+
c && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(c, Be) }) }),
|
|
991
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__toolbar", children: /* @__PURE__ */ e("div", { className: "nice-api-tester__env-selector", children: /* @__PURE__ */ n(
|
|
978
992
|
"select",
|
|
979
993
|
{
|
|
980
|
-
value: (
|
|
981
|
-
onChange: (s) => v
|
|
994
|
+
value: (N == null ? void 0 : N.id) || "",
|
|
995
|
+
onChange: (s) => b(v.find((g) => g.id === s.target.value) || null),
|
|
982
996
|
children: [
|
|
983
997
|
/* @__PURE__ */ e("option", { value: "", children: l("apiTester.noEnvironment", "No Environment") }),
|
|
984
|
-
|
|
998
|
+
v.map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.name }, s.id))
|
|
985
999
|
]
|
|
986
1000
|
}
|
|
987
1001
|
) }) }),
|
|
988
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__request-bar", children: [
|
|
989
1003
|
/* @__PURE__ */ e(
|
|
990
1004
|
"select",
|
|
991
1005
|
{
|
|
@@ -995,7 +1009,7 @@ function ct({
|
|
|
995
1009
|
method: s.target.value
|
|
996
1010
|
})),
|
|
997
1011
|
className: `nice-api-tester__method nice-api-tester__method--${y.method.toLowerCase()}`,
|
|
998
|
-
children:
|
|
1012
|
+
children: ze.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
|
|
999
1013
|
}
|
|
1000
1014
|
),
|
|
1001
1015
|
/* @__PURE__ */ e(
|
|
@@ -1011,42 +1025,42 @@ function ct({
|
|
|
1011
1025
|
/* @__PURE__ */ e(
|
|
1012
1026
|
"button",
|
|
1013
1027
|
{
|
|
1014
|
-
onClick:
|
|
1015
|
-
className: `nice-api-tester__send-btn ${
|
|
1016
|
-
children:
|
|
1028
|
+
onClick: w ? ne : Y,
|
|
1029
|
+
className: `nice-api-tester__send-btn ${w ? "nice-api-tester__send-btn--loading" : ""}`,
|
|
1030
|
+
children: w ? l("apiTester.cancel", "Cancel") : l("apiTester.send", "Send")
|
|
1017
1031
|
}
|
|
1018
1032
|
),
|
|
1019
1033
|
/* @__PURE__ */ e("button", { onClick: h, className: "nice-api-tester__save-btn", children: l("apiTester.save", "Save") })
|
|
1020
1034
|
] }),
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__main", children: [
|
|
1036
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__request-panel", children: [
|
|
1023
1037
|
/* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["params", "headers", "body", "auth", "tests"].map((s) => /* @__PURE__ */ e(
|
|
1024
1038
|
"button",
|
|
1025
1039
|
{
|
|
1026
|
-
className: `nice-api-tester__tab ${
|
|
1027
|
-
onClick: () =>
|
|
1040
|
+
className: `nice-api-tester__tab ${z === s ? "nice-api-tester__tab--active" : ""}`,
|
|
1041
|
+
onClick: () => M(s),
|
|
1028
1042
|
children: s.charAt(0).toUpperCase() + s.slice(1)
|
|
1029
1043
|
},
|
|
1030
1044
|
s
|
|
1031
1045
|
)) }),
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
|
|
1034
|
-
|
|
1046
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__tab-content", children: [
|
|
1047
|
+
z === "params" && /* @__PURE__ */ e(
|
|
1048
|
+
Me,
|
|
1035
1049
|
{
|
|
1036
1050
|
params: y.queryParams,
|
|
1037
1051
|
onChange: (s) => T((g) => ({ ...g, queryParams: s })),
|
|
1038
1052
|
onAdd: ae
|
|
1039
1053
|
}
|
|
1040
1054
|
),
|
|
1041
|
-
|
|
1042
|
-
|
|
1055
|
+
z === "headers" && /* @__PURE__ */ e(
|
|
1056
|
+
Le,
|
|
1043
1057
|
{
|
|
1044
1058
|
headers: y.headers,
|
|
1045
1059
|
onChange: (s) => T((g) => ({ ...g, headers: s })),
|
|
1046
1060
|
onAdd: Z
|
|
1047
1061
|
}
|
|
1048
1062
|
),
|
|
1049
|
-
|
|
1063
|
+
z === "body" && /* @__PURE__ */ e(
|
|
1050
1064
|
Ve,
|
|
1051
1065
|
{
|
|
1052
1066
|
body: y.body,
|
|
@@ -1055,14 +1069,14 @@ function ct({
|
|
|
1055
1069
|
onChange: (s) => T((g) => ({ ...g, body: s }))
|
|
1056
1070
|
}
|
|
1057
1071
|
),
|
|
1058
|
-
|
|
1072
|
+
z === "auth" && /* @__PURE__ */ e(
|
|
1059
1073
|
Fe,
|
|
1060
1074
|
{
|
|
1061
1075
|
auth: y.auth,
|
|
1062
1076
|
onChange: (s) => T((g) => ({ ...g, auth: s }))
|
|
1063
1077
|
}
|
|
1064
1078
|
),
|
|
1065
|
-
|
|
1079
|
+
z === "tests" && /* @__PURE__ */ e(
|
|
1066
1080
|
Je,
|
|
1067
1081
|
{
|
|
1068
1082
|
preRequestScript: G,
|
|
@@ -1073,9 +1087,9 @@ function ct({
|
|
|
1073
1087
|
)
|
|
1074
1088
|
] })
|
|
1075
1089
|
] }),
|
|
1076
|
-
/* @__PURE__ */ e("div", { className: "nice-api-tester__response-panel", children: m ? /* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
1078
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__response-panel", children: m ? /* @__PURE__ */ n(Q, { children: [
|
|
1091
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__response-meta", children: [
|
|
1092
|
+
/* @__PURE__ */ n(
|
|
1079
1093
|
"span",
|
|
1080
1094
|
{
|
|
1081
1095
|
className: `nice-api-tester__status nice-api-tester__status--${Math.floor(m.status / 100)}`,
|
|
@@ -1086,20 +1100,20 @@ function ct({
|
|
|
1086
1100
|
]
|
|
1087
1101
|
}
|
|
1088
1102
|
),
|
|
1089
|
-
/* @__PURE__ */
|
|
1103
|
+
/* @__PURE__ */ n("span", { className: "nice-api-tester__time", children: [
|
|
1090
1104
|
m.time,
|
|
1091
1105
|
"ms"
|
|
1092
1106
|
] }),
|
|
1093
1107
|
/* @__PURE__ */ e("span", { className: "nice-api-tester__size", children: He(m.size) })
|
|
1094
1108
|
] }),
|
|
1095
|
-
/* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["body", "headers", "tests"].map((s) => /* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["body", "headers", "tests"].map((s) => /* @__PURE__ */ n(
|
|
1096
1110
|
"button",
|
|
1097
1111
|
{
|
|
1098
1112
|
className: `nice-api-tester__tab ${O === s ? "nice-api-tester__tab--active" : ""}`,
|
|
1099
1113
|
onClick: () => V(s),
|
|
1100
1114
|
children: [
|
|
1101
1115
|
s.charAt(0).toUpperCase() + s.slice(1),
|
|
1102
|
-
s === "tests" && j.length > 0 && /* @__PURE__ */
|
|
1116
|
+
s === "tests" && j.length > 0 && /* @__PURE__ */ n("span", { className: "nice-api-tester__test-badge", children: [
|
|
1103
1117
|
j.filter((g) => g.passed).length,
|
|
1104
1118
|
"/",
|
|
1105
1119
|
j.length
|
|
@@ -1108,18 +1122,18 @@ function ct({
|
|
|
1108
1122
|
},
|
|
1109
1123
|
s
|
|
1110
1124
|
)) }),
|
|
1111
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__response-content", children: [
|
|
1112
1126
|
O === "body" && /* @__PURE__ */ e("pre", { className: "nice-api-tester__response-body", children: typeof m.body == "string" ? m.body : JSON.stringify(m.body, null, 2) }),
|
|
1113
|
-
O === "headers" && /* @__PURE__ */ e("div", { className: "nice-api-tester__response-headers", children: Object.entries(m.headers).map(([s, g]) => /* @__PURE__ */
|
|
1127
|
+
O === "headers" && /* @__PURE__ */ e("div", { className: "nice-api-tester__response-headers", children: Object.entries(m.headers).map(([s, g]) => /* @__PURE__ */ n("div", { className: "nice-api-tester__header-row", children: [
|
|
1114
1128
|
/* @__PURE__ */ e("span", { className: "nice-api-tester__header-key", children: s }),
|
|
1115
1129
|
/* @__PURE__ */ e("span", { className: "nice-api-tester__header-value", children: g })
|
|
1116
1130
|
] }, s)) }),
|
|
1117
|
-
O === "tests" && /* @__PURE__ */ e("div", { className: "nice-api-tester__test-results", children: j.map((s, g) => /* @__PURE__ */
|
|
1131
|
+
O === "tests" && /* @__PURE__ */ e("div", { className: "nice-api-tester__test-results", children: j.map((s, g) => /* @__PURE__ */ n(
|
|
1118
1132
|
"div",
|
|
1119
1133
|
{
|
|
1120
1134
|
className: `nice-api-tester__test-result nice-api-tester__test-result--${s.passed ? "pass" : "fail"}`,
|
|
1121
1135
|
children: [
|
|
1122
|
-
/* @__PURE__ */ e("span", { className: "nice-api-tester__test-icon", children: /* @__PURE__ */ e(
|
|
1136
|
+
/* @__PURE__ */ e("span", { className: "nice-api-tester__test-icon", children: /* @__PURE__ */ e(B, { name: s.passed ? "check" : "close", size: 14 }) }),
|
|
1123
1137
|
/* @__PURE__ */ e("span", { className: "nice-api-tester__test-name", children: s.name }),
|
|
1124
1138
|
s.message && /* @__PURE__ */ e("span", { className: "nice-api-tester__test-message", children: s.message })
|
|
1125
1139
|
]
|
|
@@ -1127,11 +1141,11 @@ function ct({
|
|
|
1127
1141
|
g
|
|
1128
1142
|
)) })
|
|
1129
1143
|
] })
|
|
1130
|
-
] }) : /* @__PURE__ */ e("div", { className: "nice-api-tester__empty-response", children:
|
|
1144
|
+
] }) : /* @__PURE__ */ e("div", { className: "nice-api-tester__empty-response", children: w ? l("apiTester.loading", "Loading...") : l("apiTester.sendARequestToSee", "Send a request to see the response") }) })
|
|
1131
1145
|
] }),
|
|
1132
|
-
R.length > 0 && /* @__PURE__ */
|
|
1146
|
+
R.length > 0 && /* @__PURE__ */ n("div", { className: "nice-api-tester__history", children: [
|
|
1133
1147
|
/* @__PURE__ */ e("h4", { children: l("apiTester.history", "History") }),
|
|
1134
|
-
/* @__PURE__ */ e("div", { className: "nice-api-tester__history-list", children: R.slice().reverse().map(({ request: s, response: g }, P) => /* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__history-list", children: R.slice().reverse().map(({ request: s, response: g }, P) => /* @__PURE__ */ n(
|
|
1135
1149
|
"div",
|
|
1136
1150
|
{
|
|
1137
1151
|
className: "nice-api-tester__history-item",
|
|
@@ -1162,13 +1176,13 @@ function ct({
|
|
|
1162
1176
|
] });
|
|
1163
1177
|
}
|
|
1164
1178
|
function Ke(t, a) {
|
|
1165
|
-
var o,
|
|
1179
|
+
var o, i, r, c, l;
|
|
1166
1180
|
switch (a.type) {
|
|
1167
1181
|
case "bearer":
|
|
1168
|
-
t.Authorization = `${((o = a.bearer) == null ? void 0 : o.prefix) || "Bearer"} ${(
|
|
1182
|
+
t.Authorization = `${((o = a.bearer) == null ? void 0 : o.prefix) || "Bearer"} ${(i = a.bearer) == null ? void 0 : i.token}`;
|
|
1169
1183
|
break;
|
|
1170
1184
|
case "basic":
|
|
1171
|
-
t.Authorization = `Basic ${btoa(`${(
|
|
1185
|
+
t.Authorization = `Basic ${btoa(`${(r = a.basic) == null ? void 0 : r.username}:${(c = a.basic) == null ? void 0 : c.password}`)}`;
|
|
1172
1186
|
break;
|
|
1173
1187
|
case "api-key":
|
|
1174
1188
|
((l = a.apiKey) == null ? void 0 : l.in) === "header" && (t[a.apiKey.key] = a.apiKey.value);
|
|
@@ -1179,7 +1193,7 @@ function He(t) {
|
|
|
1179
1193
|
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
|
|
1180
1194
|
}
|
|
1181
1195
|
function Ue(t, a) {
|
|
1182
|
-
const o = [],
|
|
1196
|
+
const o = [], i = {
|
|
1183
1197
|
response: {
|
|
1184
1198
|
code: a.status,
|
|
1185
1199
|
status: a.statusText,
|
|
@@ -1188,34 +1202,34 @@ function Ue(t, a) {
|
|
|
1188
1202
|
text: () => typeof a.body == "string" ? a.body : JSON.stringify(a.body),
|
|
1189
1203
|
responseTime: a.time
|
|
1190
1204
|
},
|
|
1191
|
-
test: (
|
|
1205
|
+
test: (r, c) => {
|
|
1192
1206
|
const l = performance.now();
|
|
1193
1207
|
try {
|
|
1194
|
-
c(), o.push({ name:
|
|
1208
|
+
c(), o.push({ name: r, passed: !0, duration: performance.now() - l });
|
|
1195
1209
|
} catch (d) {
|
|
1196
1210
|
o.push({
|
|
1197
|
-
name:
|
|
1211
|
+
name: r,
|
|
1198
1212
|
passed: !1,
|
|
1199
1213
|
message: d.message,
|
|
1200
1214
|
duration: performance.now() - l
|
|
1201
1215
|
});
|
|
1202
1216
|
}
|
|
1203
1217
|
},
|
|
1204
|
-
expect: (
|
|
1218
|
+
expect: (r) => ({
|
|
1205
1219
|
to: {
|
|
1206
1220
|
equal: (c) => {
|
|
1207
|
-
if (
|
|
1208
|
-
throw new Error(`Expected ${c} but got ${
|
|
1221
|
+
if (r !== c)
|
|
1222
|
+
throw new Error(`Expected ${c} but got ${r}`);
|
|
1209
1223
|
},
|
|
1210
1224
|
be: {
|
|
1211
1225
|
oneOf: (c) => {
|
|
1212
|
-
if (!c.includes(
|
|
1213
|
-
throw new Error(`Expected ${
|
|
1226
|
+
if (!c.includes(r))
|
|
1227
|
+
throw new Error(`Expected ${r} to be one of ${c}`);
|
|
1214
1228
|
}
|
|
1215
1229
|
},
|
|
1216
1230
|
have: {
|
|
1217
1231
|
property: (c) => {
|
|
1218
|
-
if (typeof
|
|
1232
|
+
if (typeof r != "object" || r === null || !(c in r))
|
|
1219
1233
|
throw new Error(`Expected object to have property ${c}`);
|
|
1220
1234
|
}
|
|
1221
1235
|
}
|
|
@@ -1223,12 +1237,12 @@ function Ue(t, a) {
|
|
|
1223
1237
|
})
|
|
1224
1238
|
};
|
|
1225
1239
|
try {
|
|
1226
|
-
new Function("pm", t)(
|
|
1227
|
-
} catch (
|
|
1240
|
+
new Function("pm", t)(i);
|
|
1241
|
+
} catch (r) {
|
|
1228
1242
|
o.push({
|
|
1229
1243
|
name: "Script Error",
|
|
1230
1244
|
passed: !1,
|
|
1231
|
-
message:
|
|
1245
|
+
message: r.message,
|
|
1232
1246
|
duration: 0
|
|
1233
1247
|
});
|
|
1234
1248
|
}
|
|
@@ -1238,21 +1252,21 @@ function Te({
|
|
|
1238
1252
|
items: t,
|
|
1239
1253
|
onChange: a,
|
|
1240
1254
|
onAdd: o,
|
|
1241
|
-
keyPlaceholder:
|
|
1242
|
-
valuePlaceholder:
|
|
1255
|
+
keyPlaceholder: i,
|
|
1256
|
+
valuePlaceholder: r
|
|
1243
1257
|
}) {
|
|
1244
|
-
const { t: c } =
|
|
1245
|
-
return /* @__PURE__ */
|
|
1246
|
-
Object.entries(t).map(([
|
|
1258
|
+
const { t: c } = $(), l = i ?? c("apiTester.key", "Key"), d = r ?? c("apiTester.value", "Value");
|
|
1259
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-tester__kv-editor", children: [
|
|
1260
|
+
Object.entries(t).map(([p, v], u) => /* @__PURE__ */ n("div", { className: "nice-api-tester__kv-row", children: [
|
|
1247
1261
|
/* @__PURE__ */ e(
|
|
1248
1262
|
"input",
|
|
1249
1263
|
{
|
|
1250
1264
|
type: "text",
|
|
1251
|
-
value:
|
|
1252
|
-
placeholder:
|
|
1253
|
-
onChange: (
|
|
1254
|
-
const
|
|
1255
|
-
u
|
|
1265
|
+
value: p,
|
|
1266
|
+
placeholder: l,
|
|
1267
|
+
onChange: (N) => {
|
|
1268
|
+
const b = Object.entries(t);
|
|
1269
|
+
b[u] = [N.target.value, v], a(Object.fromEntries(b));
|
|
1256
1270
|
}
|
|
1257
1271
|
}
|
|
1258
1272
|
),
|
|
@@ -1260,9 +1274,9 @@ function Te({
|
|
|
1260
1274
|
"input",
|
|
1261
1275
|
{
|
|
1262
1276
|
type: "text",
|
|
1263
|
-
value:
|
|
1264
|
-
placeholder:
|
|
1265
|
-
onChange: (
|
|
1277
|
+
value: v,
|
|
1278
|
+
placeholder: d,
|
|
1279
|
+
onChange: (N) => a({ ...t, [p]: N.target.value })
|
|
1266
1280
|
}
|
|
1267
1281
|
),
|
|
1268
1282
|
/* @__PURE__ */ e(
|
|
@@ -1270,17 +1284,17 @@ function Te({
|
|
|
1270
1284
|
{
|
|
1271
1285
|
"aria-label": c("apiTester.close", "Close"),
|
|
1272
1286
|
onClick: () => {
|
|
1273
|
-
const { [
|
|
1274
|
-
a(
|
|
1287
|
+
const { [p]: N, ...b } = t;
|
|
1288
|
+
a(b);
|
|
1275
1289
|
},
|
|
1276
|
-
children: /* @__PURE__ */ e(
|
|
1290
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
|
|
1277
1291
|
}
|
|
1278
1292
|
)
|
|
1279
|
-
] },
|
|
1280
|
-
/* @__PURE__ */ e("button", { onClick: o, className: "nice-api-tester__add-btn", children: "+ Add" })
|
|
1293
|
+
] }, u)),
|
|
1294
|
+
/* @__PURE__ */ e("button", { onClick: o, className: "nice-api-tester__add-btn", children: c("apiTester.add", "+ Add") })
|
|
1281
1295
|
] });
|
|
1282
1296
|
}
|
|
1283
|
-
function
|
|
1297
|
+
function Me({
|
|
1284
1298
|
params: t,
|
|
1285
1299
|
onChange: a,
|
|
1286
1300
|
onAdd: o
|
|
@@ -1296,7 +1310,7 @@ function Le({
|
|
|
1296
1310
|
}
|
|
1297
1311
|
);
|
|
1298
1312
|
}
|
|
1299
|
-
function
|
|
1313
|
+
function Le({
|
|
1300
1314
|
headers: t,
|
|
1301
1315
|
onChange: a,
|
|
1302
1316
|
onAdd: o
|
|
@@ -1316,28 +1330,29 @@ function Ve({
|
|
|
1316
1330
|
body: t,
|
|
1317
1331
|
bodyTab: a,
|
|
1318
1332
|
onBodyTabChange: o,
|
|
1319
|
-
onChange:
|
|
1333
|
+
onChange: i
|
|
1320
1334
|
}) {
|
|
1321
|
-
|
|
1322
|
-
|
|
1335
|
+
const { t: r } = $();
|
|
1336
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-tester__body-editor", children: [
|
|
1337
|
+
/* @__PURE__ */ e("div", { className: "nice-api-tester__body-tabs", children: ["none", "json", "form-data", "raw"].map((c) => /* @__PURE__ */ n("label", { children: [
|
|
1323
1338
|
/* @__PURE__ */ e(
|
|
1324
1339
|
"input",
|
|
1325
1340
|
{
|
|
1326
1341
|
type: "radio",
|
|
1327
|
-
checked: a ===
|
|
1342
|
+
checked: a === c,
|
|
1328
1343
|
onChange: () => {
|
|
1329
|
-
o(
|
|
1344
|
+
o(c), i({ type: c, content: "" });
|
|
1330
1345
|
}
|
|
1331
1346
|
}
|
|
1332
1347
|
),
|
|
1333
|
-
|
|
1334
|
-
] },
|
|
1348
|
+
c
|
|
1349
|
+
] }, c)) }),
|
|
1335
1350
|
a !== "none" && /* @__PURE__ */ e(
|
|
1336
1351
|
"textarea",
|
|
1337
1352
|
{
|
|
1338
1353
|
value: typeof (t == null ? void 0 : t.content) == "string" ? t.content : JSON.stringify(t == null ? void 0 : t.content, null, 2),
|
|
1339
|
-
onChange: (
|
|
1340
|
-
placeholder: a === "json" ? '{ "key": "value" }' : "Enter body content",
|
|
1354
|
+
onChange: (c) => i({ type: a, content: c.target.value }),
|
|
1355
|
+
placeholder: a === "json" ? '{ "key": "value" }' : r("apiTester.enterBodyContent", "Enter body content"),
|
|
1341
1356
|
rows: 10,
|
|
1342
1357
|
className: "nice-api-tester__body-textarea"
|
|
1343
1358
|
}
|
|
@@ -1348,16 +1363,16 @@ function Fe({
|
|
|
1348
1363
|
auth: t,
|
|
1349
1364
|
onChange: a
|
|
1350
1365
|
}) {
|
|
1351
|
-
var
|
|
1352
|
-
const { t: o } =
|
|
1353
|
-
return /* @__PURE__ */
|
|
1354
|
-
/* @__PURE__ */
|
|
1366
|
+
var i, r, c, l, d, p;
|
|
1367
|
+
const { t: o } = $();
|
|
1368
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-tester__auth-editor", children: [
|
|
1369
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1355
1370
|
/* @__PURE__ */ e("label", { children: o("apiTester.type", "Type") }),
|
|
1356
|
-
/* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ n(
|
|
1357
1372
|
"select",
|
|
1358
1373
|
{
|
|
1359
1374
|
value: (t == null ? void 0 : t.type) || "none",
|
|
1360
|
-
onChange: (
|
|
1375
|
+
onChange: (v) => a({ type: v.target.value }),
|
|
1361
1376
|
children: [
|
|
1362
1377
|
/* @__PURE__ */ e("option", { value: "none", children: o("apiTester.noAuth", "No Auth") }),
|
|
1363
1378
|
/* @__PURE__ */ e("option", { value: "api-key", children: o("apiTester.apiKey", "API Key") }),
|
|
@@ -1368,23 +1383,23 @@ function Fe({
|
|
|
1368
1383
|
}
|
|
1369
1384
|
)
|
|
1370
1385
|
] }),
|
|
1371
|
-
(t == null ? void 0 : t.type) === "api-key" && /* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */ e("label", { children: "Key" }),
|
|
1386
|
+
(t == null ? void 0 : t.type) === "api-key" && /* @__PURE__ */ n(Q, { children: [
|
|
1387
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1388
|
+
/* @__PURE__ */ e("label", { children: o("apiTester.key", "Key") }),
|
|
1374
1389
|
/* @__PURE__ */ e(
|
|
1375
1390
|
"input",
|
|
1376
1391
|
{
|
|
1377
1392
|
type: "text",
|
|
1378
|
-
value: ((
|
|
1379
|
-
onChange: (
|
|
1380
|
-
var u,
|
|
1393
|
+
value: ((i = t.apiKey) == null ? void 0 : i.key) || "",
|
|
1394
|
+
onChange: (v) => {
|
|
1395
|
+
var u, N;
|
|
1381
1396
|
return a({
|
|
1382
1397
|
...t,
|
|
1383
1398
|
apiKey: {
|
|
1384
1399
|
...t.apiKey,
|
|
1385
|
-
key:
|
|
1400
|
+
key: v.target.value,
|
|
1386
1401
|
value: ((u = t.apiKey) == null ? void 0 : u.value) || "",
|
|
1387
|
-
in: ((
|
|
1402
|
+
in: ((N = t.apiKey) == null ? void 0 : N.in) || "header"
|
|
1388
1403
|
}
|
|
1389
1404
|
});
|
|
1390
1405
|
},
|
|
@@ -1392,22 +1407,22 @@ function Fe({
|
|
|
1392
1407
|
}
|
|
1393
1408
|
)
|
|
1394
1409
|
] }),
|
|
1395
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1396
1411
|
/* @__PURE__ */ e("label", { children: o("apiTester.value", "Value") }),
|
|
1397
1412
|
/* @__PURE__ */ e(
|
|
1398
1413
|
"input",
|
|
1399
1414
|
{
|
|
1400
1415
|
type: "text",
|
|
1401
|
-
value: ((
|
|
1402
|
-
onChange: (
|
|
1403
|
-
var u,
|
|
1416
|
+
value: ((r = t.apiKey) == null ? void 0 : r.value) || "",
|
|
1417
|
+
onChange: (v) => {
|
|
1418
|
+
var u, N;
|
|
1404
1419
|
return a({
|
|
1405
1420
|
...t,
|
|
1406
1421
|
apiKey: {
|
|
1407
1422
|
...t.apiKey,
|
|
1408
|
-
value:
|
|
1423
|
+
value: v.target.value,
|
|
1409
1424
|
key: ((u = t.apiKey) == null ? void 0 : u.key) || "",
|
|
1410
|
-
in: ((
|
|
1425
|
+
in: ((N = t.apiKey) == null ? void 0 : N.in) || "header"
|
|
1411
1426
|
}
|
|
1412
1427
|
});
|
|
1413
1428
|
},
|
|
@@ -1415,21 +1430,21 @@ function Fe({
|
|
|
1415
1430
|
}
|
|
1416
1431
|
)
|
|
1417
1432
|
] }),
|
|
1418
|
-
/* @__PURE__ */
|
|
1433
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1419
1434
|
/* @__PURE__ */ e("label", { children: o("apiTester.addTo", "Add to") }),
|
|
1420
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ n(
|
|
1421
1436
|
"select",
|
|
1422
1437
|
{
|
|
1423
1438
|
value: ((c = t.apiKey) == null ? void 0 : c.in) || "header",
|
|
1424
|
-
onChange: (
|
|
1425
|
-
var u,
|
|
1439
|
+
onChange: (v) => {
|
|
1440
|
+
var u, N;
|
|
1426
1441
|
return a({
|
|
1427
1442
|
...t,
|
|
1428
1443
|
apiKey: {
|
|
1429
1444
|
...t.apiKey,
|
|
1430
|
-
in:
|
|
1445
|
+
in: v.target.value,
|
|
1431
1446
|
key: ((u = t.apiKey) == null ? void 0 : u.key) || "",
|
|
1432
|
-
value: ((
|
|
1447
|
+
value: ((N = t.apiKey) == null ? void 0 : N.value) || ""
|
|
1433
1448
|
}
|
|
1434
1449
|
});
|
|
1435
1450
|
},
|
|
@@ -1441,33 +1456,33 @@ function Fe({
|
|
|
1441
1456
|
)
|
|
1442
1457
|
] })
|
|
1443
1458
|
] }),
|
|
1444
|
-
(t == null ? void 0 : t.type) === "bearer" && /* @__PURE__ */
|
|
1459
|
+
(t == null ? void 0 : t.type) === "bearer" && /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1445
1460
|
/* @__PURE__ */ e("label", { children: o("apiTester.token", "Token") }),
|
|
1446
1461
|
/* @__PURE__ */ e(
|
|
1447
1462
|
"input",
|
|
1448
1463
|
{
|
|
1449
1464
|
type: "text",
|
|
1450
1465
|
value: ((l = t.bearer) == null ? void 0 : l.token) || "",
|
|
1451
|
-
onChange: (
|
|
1466
|
+
onChange: (v) => a({ ...t, bearer: { token: v.target.value } }),
|
|
1452
1467
|
placeholder: "your-bearer-token"
|
|
1453
1468
|
}
|
|
1454
1469
|
)
|
|
1455
1470
|
] }),
|
|
1456
|
-
(t == null ? void 0 : t.type) === "basic" && /* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1471
|
+
(t == null ? void 0 : t.type) === "basic" && /* @__PURE__ */ n(Q, { children: [
|
|
1472
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1458
1473
|
/* @__PURE__ */ e("label", { children: o("apiTester.username", "Username") }),
|
|
1459
1474
|
/* @__PURE__ */ e(
|
|
1460
1475
|
"input",
|
|
1461
1476
|
{
|
|
1462
1477
|
type: "text",
|
|
1463
1478
|
value: ((d = t.basic) == null ? void 0 : d.username) || "",
|
|
1464
|
-
onChange: (
|
|
1479
|
+
onChange: (v) => {
|
|
1465
1480
|
var u;
|
|
1466
1481
|
return a({
|
|
1467
1482
|
...t,
|
|
1468
1483
|
basic: {
|
|
1469
1484
|
...t.basic,
|
|
1470
|
-
username:
|
|
1485
|
+
username: v.target.value,
|
|
1471
1486
|
password: ((u = t.basic) == null ? void 0 : u.password) || ""
|
|
1472
1487
|
}
|
|
1473
1488
|
});
|
|
@@ -1475,20 +1490,20 @@ function Fe({
|
|
|
1475
1490
|
}
|
|
1476
1491
|
)
|
|
1477
1492
|
] }),
|
|
1478
|
-
/* @__PURE__ */
|
|
1493
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
|
|
1479
1494
|
/* @__PURE__ */ e("label", { children: o("apiTester.password", "Password") }),
|
|
1480
1495
|
/* @__PURE__ */ e(
|
|
1481
1496
|
"input",
|
|
1482
1497
|
{
|
|
1483
1498
|
type: "password",
|
|
1484
1499
|
value: ((p = t.basic) == null ? void 0 : p.password) || "",
|
|
1485
|
-
onChange: (
|
|
1500
|
+
onChange: (v) => {
|
|
1486
1501
|
var u;
|
|
1487
1502
|
return a({
|
|
1488
1503
|
...t,
|
|
1489
1504
|
basic: {
|
|
1490
1505
|
...t.basic,
|
|
1491
|
-
password:
|
|
1506
|
+
password: v.target.value,
|
|
1492
1507
|
username: ((u = t.basic) == null ? void 0 : u.username) || ""
|
|
1493
1508
|
}
|
|
1494
1509
|
});
|
|
@@ -1503,12 +1518,12 @@ function Je({
|
|
|
1503
1518
|
preRequestScript: t,
|
|
1504
1519
|
testScript: a,
|
|
1505
1520
|
onPreRequestChange: o,
|
|
1506
|
-
onTestChange:
|
|
1521
|
+
onTestChange: i
|
|
1507
1522
|
}) {
|
|
1508
|
-
const { t:
|
|
1509
|
-
return /* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
1511
|
-
/* @__PURE__ */ e("h4", { children:
|
|
1523
|
+
const { t: r } = $();
|
|
1524
|
+
return /* @__PURE__ */ n("div", { className: "nice-api-tester__tests-editor", children: [
|
|
1525
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__script-section", children: [
|
|
1526
|
+
/* @__PURE__ */ e("h4", { children: r("apiTester.preRequestScript", "Pre-request Script") }),
|
|
1512
1527
|
/* @__PURE__ */ e(
|
|
1513
1528
|
"textarea",
|
|
1514
1529
|
{
|
|
@@ -1519,13 +1534,13 @@ function Je({
|
|
|
1519
1534
|
}
|
|
1520
1535
|
)
|
|
1521
1536
|
] }),
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */ e("h4", { children:
|
|
1537
|
+
/* @__PURE__ */ n("div", { className: "nice-api-tester__script-section", children: [
|
|
1538
|
+
/* @__PURE__ */ e("h4", { children: r("apiTester.tests", "Tests") }),
|
|
1524
1539
|
/* @__PURE__ */ e(
|
|
1525
1540
|
"textarea",
|
|
1526
1541
|
{
|
|
1527
1542
|
value: a,
|
|
1528
|
-
onChange: (c) =>
|
|
1543
|
+
onChange: (c) => i(c.target.value),
|
|
1529
1544
|
placeholder: `pm.test("Status code is 200", function () {
|
|
1530
1545
|
pm.expect(pm.response.code).to.equal(200);
|
|
1531
1546
|
});`,
|
|
@@ -1571,16 +1586,16 @@ function lt({
|
|
|
1571
1586
|
flow: t,
|
|
1572
1587
|
connectors: a = [],
|
|
1573
1588
|
onChange: o,
|
|
1574
|
-
onSave:
|
|
1575
|
-
onRun:
|
|
1589
|
+
onSave: i,
|
|
1590
|
+
onRun: r,
|
|
1576
1591
|
className: c = "",
|
|
1577
1592
|
tutorial: l
|
|
1578
1593
|
}) {
|
|
1579
|
-
const { t: d } =
|
|
1594
|
+
const { t: d } = $(), [p, v] = C(
|
|
1580
1595
|
t || { ...Ge, id: re() }
|
|
1581
|
-
), [u,
|
|
1596
|
+
), [u, N] = C(null), [b, y] = C(!0), [T, m] = C("canvas"), [S, w] = C(!1), [A, J] = C(null), [te, z] = C(!1), [M, O] = C(null), [V, G] = C(!1), k = de(null), f = I(
|
|
1582
1597
|
(h) => {
|
|
1583
|
-
|
|
1598
|
+
v((s) => {
|
|
1584
1599
|
const g = h(s);
|
|
1585
1600
|
return o == null || o(g), g;
|
|
1586
1601
|
});
|
|
@@ -1601,7 +1616,7 @@ function lt({
|
|
|
1601
1616
|
f((H) => ({
|
|
1602
1617
|
...H,
|
|
1603
1618
|
nodes: [...H.nodes, g]
|
|
1604
|
-
})),
|
|
1619
|
+
})), N(g);
|
|
1605
1620
|
},
|
|
1606
1621
|
[f]
|
|
1607
1622
|
), j = I(
|
|
@@ -1612,7 +1627,7 @@ function lt({
|
|
|
1612
1627
|
connections: s.connections.filter(
|
|
1613
1628
|
(g) => g.sourceNodeId !== h && g.targetNodeId !== h
|
|
1614
1629
|
)
|
|
1615
|
-
})),
|
|
1630
|
+
})), N(null);
|
|
1616
1631
|
},
|
|
1617
1632
|
[f]
|
|
1618
1633
|
), F = I(
|
|
@@ -1620,7 +1635,7 @@ function lt({
|
|
|
1620
1635
|
f((g) => ({
|
|
1621
1636
|
...g,
|
|
1622
1637
|
nodes: g.nodes.map((P) => P.id === h ? { ...P, ...s } : P)
|
|
1623
|
-
})), (u == null ? void 0 : u.id) === h &&
|
|
1638
|
+
})), (u == null ? void 0 : u.id) === h && N((g) => g ? { ...g, ...s } : null);
|
|
1624
1639
|
},
|
|
1625
1640
|
[f, u]
|
|
1626
1641
|
), R = I(
|
|
@@ -1655,34 +1670,34 @@ function lt({
|
|
|
1655
1670
|
if (h.preventDefault(), !A || !k.current)
|
|
1656
1671
|
return;
|
|
1657
1672
|
const s = k.current.getBoundingClientRect(), g = h.clientX - s.left, P = h.clientY - s.top;
|
|
1658
|
-
x(A, { x: g, y: P }),
|
|
1673
|
+
x(A, { x: g, y: P }), w(!1), J(null);
|
|
1659
1674
|
},
|
|
1660
1675
|
[A, x]
|
|
1661
1676
|
), Y = I(async () => {
|
|
1662
|
-
if (
|
|
1677
|
+
if (r) {
|
|
1663
1678
|
G(!0);
|
|
1664
1679
|
try {
|
|
1665
|
-
await
|
|
1680
|
+
await r(p);
|
|
1666
1681
|
} finally {
|
|
1667
1682
|
G(!1);
|
|
1668
1683
|
}
|
|
1669
1684
|
}
|
|
1670
|
-
}, [p,
|
|
1671
|
-
|
|
1672
|
-
}, [p,
|
|
1685
|
+
}, [p, r]), ne = I(() => {
|
|
1686
|
+
i == null || i(p);
|
|
1687
|
+
}, [p, i]), Z = b && T === "canvas" ? /* @__PURE__ */ n("div", { className: "nice-integration-builder__palette", children: [
|
|
1673
1688
|
/* @__PURE__ */ e("h4", { children: d("integrationBuilder.nodes", "Nodes") }),
|
|
1674
|
-
["Control", "Actions", "Data"].map((h) => /* @__PURE__ */
|
|
1689
|
+
["Control", "Actions", "Data"].map((h) => /* @__PURE__ */ n("div", { className: "nice-integration-builder__category", children: [
|
|
1675
1690
|
/* @__PURE__ */ e("h5", { children: h }),
|
|
1676
|
-
me.filter((s) => s.category === h).map((s) => /* @__PURE__ */
|
|
1691
|
+
me.filter((s) => s.category === h).map((s) => /* @__PURE__ */ n(
|
|
1677
1692
|
"div",
|
|
1678
1693
|
{
|
|
1679
1694
|
className: "nice-integration-builder__palette-item",
|
|
1680
1695
|
draggable: !0,
|
|
1681
1696
|
onDragStart: () => {
|
|
1682
|
-
|
|
1697
|
+
w(!0), J(s.type);
|
|
1683
1698
|
},
|
|
1684
1699
|
onDragEnd: () => {
|
|
1685
|
-
|
|
1700
|
+
w(!1), J(null);
|
|
1686
1701
|
},
|
|
1687
1702
|
children: [
|
|
1688
1703
|
/* @__PURE__ */ e("span", { className: "nice-integration-builder__palette-icon", children: /* @__PURE__ */ e(ee, { name: s.icon, size: 14 }) }),
|
|
@@ -1692,9 +1707,9 @@ function lt({
|
|
|
1692
1707
|
s.type
|
|
1693
1708
|
))
|
|
1694
1709
|
] }, h)),
|
|
1695
|
-
a.length > 0 && /* @__PURE__ */
|
|
1710
|
+
a.length > 0 && /* @__PURE__ */ n("div", { className: "nice-integration-builder__category", children: [
|
|
1696
1711
|
/* @__PURE__ */ e("h5", { children: d("integrationBuilder.connectors", "Connectors") }),
|
|
1697
|
-
a.map((h) => /* @__PURE__ */
|
|
1712
|
+
a.map((h) => /* @__PURE__ */ n("div", { className: "nice-integration-builder__palette-item", children: [
|
|
1698
1713
|
/* @__PURE__ */ e("span", { className: "nice-integration-builder__palette-icon", children: /* @__PURE__ */ e(ee, { name: "plug", size: 14 }) }),
|
|
1699
1714
|
/* @__PURE__ */ e("span", { children: h.name })
|
|
1700
1715
|
] }, h.id))
|
|
@@ -1704,12 +1719,12 @@ function lt({
|
|
|
1704
1719
|
{
|
|
1705
1720
|
node: u,
|
|
1706
1721
|
onChange: (h) => F(u.id, h),
|
|
1707
|
-
onClose: () =>
|
|
1722
|
+
onClose: () => N(null)
|
|
1708
1723
|
}
|
|
1709
1724
|
) : void 0;
|
|
1710
|
-
return /* @__PURE__ */
|
|
1725
|
+
return /* @__PURE__ */ n("div", { style: { position: "relative", height: "100%" }, children: [
|
|
1711
1726
|
l && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(l, We) }) }),
|
|
1712
|
-
/* @__PURE__ */
|
|
1727
|
+
/* @__PURE__ */ n(
|
|
1713
1728
|
ye,
|
|
1714
1729
|
{
|
|
1715
1730
|
flush: !0,
|
|
@@ -1718,7 +1733,7 @@ function lt({
|
|
|
1718
1733
|
style: { minHeight: 600 },
|
|
1719
1734
|
sidebar: Z,
|
|
1720
1735
|
rightSidebar: ae,
|
|
1721
|
-
toolbar: /* @__PURE__ */
|
|
1736
|
+
toolbar: /* @__PURE__ */ n("div", { className: "nice-integration-builder__toolbar", children: [
|
|
1722
1737
|
/* @__PURE__ */ e(
|
|
1723
1738
|
"input",
|
|
1724
1739
|
{
|
|
@@ -1737,8 +1752,8 @@ function lt({
|
|
|
1737
1752
|
},
|
|
1738
1753
|
h
|
|
1739
1754
|
)) }),
|
|
1740
|
-
/* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__actions", children: [
|
|
1756
|
+
/* @__PURE__ */ n(
|
|
1742
1757
|
"button",
|
|
1743
1758
|
{
|
|
1744
1759
|
onClick: Y,
|
|
@@ -1747,11 +1762,11 @@ function lt({
|
|
|
1747
1762
|
children: [
|
|
1748
1763
|
/* @__PURE__ */ e(ee, { name: V ? "clock" : "play", size: 14 }),
|
|
1749
1764
|
" ",
|
|
1750
|
-
V ? "Running..." : "Run"
|
|
1765
|
+
V ? d("integrationBuilder.running", "Running...") : d("integrationBuilder.run", "Run")
|
|
1751
1766
|
]
|
|
1752
1767
|
}
|
|
1753
1768
|
),
|
|
1754
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ n("button", { onClick: ne, className: "nice-integration-builder__save-btn", children: [
|
|
1755
1770
|
/* @__PURE__ */ e(ee, { name: "save", size: 14 }),
|
|
1756
1771
|
" ",
|
|
1757
1772
|
d("integrationBuilder.save", "Save")
|
|
@@ -1759,17 +1774,17 @@ function lt({
|
|
|
1759
1774
|
] })
|
|
1760
1775
|
] }),
|
|
1761
1776
|
children: [
|
|
1762
|
-
T === "canvas" && /* @__PURE__ */
|
|
1777
|
+
T === "canvas" && /* @__PURE__ */ n(
|
|
1763
1778
|
"div",
|
|
1764
1779
|
{
|
|
1765
1780
|
ref: k,
|
|
1766
1781
|
className: `nice-integration-builder__canvas ${S ? "nice-integration-builder__canvas--dragging" : ""}`,
|
|
1767
1782
|
onDragOver: (h) => h.preventDefault(),
|
|
1768
1783
|
onDrop: K,
|
|
1769
|
-
onClick: () =>
|
|
1784
|
+
onClick: () => N(null),
|
|
1770
1785
|
children: [
|
|
1771
1786
|
/* @__PURE__ */ e("svg", { className: "nice-integration-builder__connections", children: p.connections.map((h) => {
|
|
1772
|
-
const s = p.nodes.find((
|
|
1787
|
+
const s = p.nodes.find((q) => q.id === h.sourceNodeId), g = p.nodes.find((q) => q.id === h.targetNodeId);
|
|
1773
1788
|
if (!s || !g)
|
|
1774
1789
|
return null;
|
|
1775
1790
|
const P = s.position.x + 150, H = s.position.y + 30, E = g.position.x, _ = g.position.y + 30, D = (P + E) / 2;
|
|
@@ -1786,14 +1801,14 @@ function lt({
|
|
|
1786
1801
|
{
|
|
1787
1802
|
node: h,
|
|
1788
1803
|
isSelected: (u == null ? void 0 : u.id) === h.id,
|
|
1789
|
-
onSelect: () =>
|
|
1804
|
+
onSelect: () => N(h),
|
|
1790
1805
|
onDelete: () => j(h.id),
|
|
1791
1806
|
onPositionChange: (s) => F(h.id, { position: s }),
|
|
1792
1807
|
onStartConnection: (s) => {
|
|
1793
|
-
|
|
1808
|
+
z(!0), O({ nodeId: h.id, output: s });
|
|
1794
1809
|
},
|
|
1795
1810
|
onEndConnection: (s) => {
|
|
1796
|
-
|
|
1811
|
+
M && R(M.nodeId, M.output, h.id, s), z(!1), O(null);
|
|
1797
1812
|
}
|
|
1798
1813
|
},
|
|
1799
1814
|
h.id
|
|
@@ -1861,13 +1876,13 @@ function Xe({
|
|
|
1861
1876
|
node: t,
|
|
1862
1877
|
isSelected: a,
|
|
1863
1878
|
onSelect: o,
|
|
1864
|
-
onDelete:
|
|
1865
|
-
onPositionChange:
|
|
1879
|
+
onDelete: i,
|
|
1880
|
+
onPositionChange: r,
|
|
1866
1881
|
onStartConnection: c,
|
|
1867
1882
|
onEndConnection: l
|
|
1868
1883
|
}) {
|
|
1869
|
-
const { t: d } =
|
|
1870
|
-
m.button === 0 && (m.stopPropagation(),
|
|
1884
|
+
const { t: d } = $(), [p, v] = C(!1), [u, N] = C({ x: 0, y: 0 }), b = de(null), y = me.find((m) => m.type === t.type), T = (m) => {
|
|
1885
|
+
m.button === 0 && (m.stopPropagation(), v(!0), N({
|
|
1871
1886
|
x: m.clientX - t.position.x,
|
|
1872
1887
|
y: m.clientY - t.position.y
|
|
1873
1888
|
}), o());
|
|
@@ -1875,21 +1890,21 @@ function Xe({
|
|
|
1875
1890
|
return Ne(() => {
|
|
1876
1891
|
if (!p)
|
|
1877
1892
|
return;
|
|
1878
|
-
const m = (
|
|
1879
|
-
|
|
1880
|
-
x:
|
|
1881
|
-
y:
|
|
1893
|
+
const m = (w) => {
|
|
1894
|
+
r({
|
|
1895
|
+
x: w.clientX - u.x,
|
|
1896
|
+
y: w.clientY - u.y
|
|
1882
1897
|
});
|
|
1883
1898
|
}, S = () => {
|
|
1884
|
-
|
|
1899
|
+
v(!1);
|
|
1885
1900
|
};
|
|
1886
1901
|
return window.addEventListener("mousemove", m), window.addEventListener("mouseup", S), () => {
|
|
1887
1902
|
window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", S);
|
|
1888
1903
|
};
|
|
1889
|
-
}, [p, u,
|
|
1904
|
+
}, [p, u, r]), /* @__PURE__ */ n(
|
|
1890
1905
|
"div",
|
|
1891
1906
|
{
|
|
1892
|
-
ref:
|
|
1907
|
+
ref: b,
|
|
1893
1908
|
className: `nice-integration-builder__node nice-integration-builder__node--${t.type} ${a ? "nice-integration-builder__node--selected" : ""}`,
|
|
1894
1909
|
style: {
|
|
1895
1910
|
left: t.position.x,
|
|
@@ -1897,7 +1912,7 @@ function Xe({
|
|
|
1897
1912
|
},
|
|
1898
1913
|
onMouseDown: T,
|
|
1899
1914
|
children: [
|
|
1900
|
-
/* @__PURE__ */
|
|
1915
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__node-header", children: [
|
|
1901
1916
|
/* @__PURE__ */ e("span", { className: "nice-integration-builder__node-icon", children: /* @__PURE__ */ e(ee, { name: (y == null ? void 0 : y.icon) || "box", size: 14 }) }),
|
|
1902
1917
|
/* @__PURE__ */ e("span", { className: "nice-integration-builder__node-name", children: t.name }),
|
|
1903
1918
|
/* @__PURE__ */ e(
|
|
@@ -1906,13 +1921,13 @@ function Xe({
|
|
|
1906
1921
|
"aria-label": d("integrationBuilder.close", "Close"),
|
|
1907
1922
|
className: "nice-integration-builder__node-delete",
|
|
1908
1923
|
onClick: (m) => {
|
|
1909
|
-
m.stopPropagation(),
|
|
1924
|
+
m.stopPropagation(), i();
|
|
1910
1925
|
},
|
|
1911
1926
|
children: /* @__PURE__ */ e(ee, { name: "close", size: 14 })
|
|
1912
1927
|
}
|
|
1913
1928
|
)
|
|
1914
1929
|
] }),
|
|
1915
|
-
t.inputs.map((m) => /* @__PURE__ */
|
|
1930
|
+
t.inputs.map((m) => /* @__PURE__ */ n(
|
|
1916
1931
|
"div",
|
|
1917
1932
|
{
|
|
1918
1933
|
className: "nice-integration-builder__port nice-integration-builder__port--input",
|
|
@@ -1924,7 +1939,7 @@ function Xe({
|
|
|
1924
1939
|
},
|
|
1925
1940
|
m
|
|
1926
1941
|
)),
|
|
1927
|
-
t.outputs.map((m) => /* @__PURE__ */
|
|
1942
|
+
t.outputs.map((m) => /* @__PURE__ */ n(
|
|
1928
1943
|
"div",
|
|
1929
1944
|
{
|
|
1930
1945
|
className: "nice-integration-builder__port nice-integration-builder__port--output",
|
|
@@ -1947,126 +1962,126 @@ function Qe({
|
|
|
1947
1962
|
onChange: a,
|
|
1948
1963
|
onClose: o
|
|
1949
1964
|
}) {
|
|
1950
|
-
const { t:
|
|
1951
|
-
return /* @__PURE__ */
|
|
1952
|
-
/* @__PURE__ */
|
|
1965
|
+
const { t: i } = $();
|
|
1966
|
+
return /* @__PURE__ */ n("div", { className: "nice-integration-builder__properties", children: [
|
|
1967
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__properties-header", children: [
|
|
1953
1968
|
/* @__PURE__ */ e("h4", { children: t.name }),
|
|
1954
|
-
/* @__PURE__ */ e("button", { "aria-label":
|
|
1969
|
+
/* @__PURE__ */ e("button", { "aria-label": i("integrationBuilder.close", "Close"), onClick: o, children: /* @__PURE__ */ e(ee, { name: "close", size: 14 }) })
|
|
1955
1970
|
] }),
|
|
1956
|
-
/* @__PURE__ */
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */ e("label", { children:
|
|
1971
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__properties-content", children: [
|
|
1972
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
1973
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.name", "Name") }),
|
|
1959
1974
|
/* @__PURE__ */ e(
|
|
1960
1975
|
"input",
|
|
1961
1976
|
{
|
|
1962
1977
|
type: "text",
|
|
1963
1978
|
value: t.name,
|
|
1964
|
-
onChange: (
|
|
1979
|
+
onChange: (r) => a({ name: r.target.value })
|
|
1965
1980
|
}
|
|
1966
1981
|
)
|
|
1967
1982
|
] }),
|
|
1968
|
-
t.type === "http-request" && /* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
/* @__PURE__ */ e("label", { children:
|
|
1983
|
+
t.type === "http-request" && /* @__PURE__ */ n(Q, { children: [
|
|
1984
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
1985
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.method", "Method") }),
|
|
1971
1986
|
/* @__PURE__ */ e(
|
|
1972
1987
|
"select",
|
|
1973
1988
|
{
|
|
1974
1989
|
value: t.config.method || "GET",
|
|
1975
|
-
onChange: (
|
|
1976
|
-
children: ["GET", "POST", "PUT", "PATCH", "DELETE"].map((
|
|
1990
|
+
onChange: (r) => a({ config: { ...t.config, method: r.target.value } }),
|
|
1991
|
+
children: ["GET", "POST", "PUT", "PATCH", "DELETE"].map((r) => /* @__PURE__ */ e("option", { value: r, children: r }, r))
|
|
1977
1992
|
}
|
|
1978
1993
|
)
|
|
1979
1994
|
] }),
|
|
1980
|
-
/* @__PURE__ */
|
|
1995
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
1981
1996
|
/* @__PURE__ */ e("label", { children: "URL" }),
|
|
1982
1997
|
/* @__PURE__ */ e(
|
|
1983
1998
|
"input",
|
|
1984
1999
|
{
|
|
1985
2000
|
type: "text",
|
|
1986
2001
|
value: t.config.url || "",
|
|
1987
|
-
onChange: (
|
|
2002
|
+
onChange: (r) => a({ config: { ...t.config, url: r.target.value } }),
|
|
1988
2003
|
placeholder: "https://api.example.com/endpoint"
|
|
1989
2004
|
}
|
|
1990
2005
|
)
|
|
1991
2006
|
] })
|
|
1992
2007
|
] }),
|
|
1993
|
-
t.type === "delay" && /* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */ e("label", { children: "Duration (ms)" }),
|
|
2008
|
+
t.type === "delay" && /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2009
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.durationMs", "Duration (ms)") }),
|
|
1995
2010
|
/* @__PURE__ */ e(
|
|
1996
2011
|
"input",
|
|
1997
2012
|
{
|
|
1998
2013
|
type: "number",
|
|
1999
2014
|
value: t.config.duration || 1e3,
|
|
2000
|
-
onChange: (
|
|
2015
|
+
onChange: (r) => a({ config: { ...t.config, duration: parseInt(r.target.value, 10) } })
|
|
2001
2016
|
}
|
|
2002
2017
|
)
|
|
2003
2018
|
] }),
|
|
2004
|
-
t.type === "set-variable" && /* @__PURE__ */
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */ e("label", { children:
|
|
2019
|
+
t.type === "set-variable" && /* @__PURE__ */ n(Q, { children: [
|
|
2020
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2021
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.variableName", "Variable Name") }),
|
|
2007
2022
|
/* @__PURE__ */ e(
|
|
2008
2023
|
"input",
|
|
2009
2024
|
{
|
|
2010
2025
|
type: "text",
|
|
2011
2026
|
value: t.config.name || "",
|
|
2012
|
-
onChange: (
|
|
2027
|
+
onChange: (r) => a({ config: { ...t.config, name: r.target.value } })
|
|
2013
2028
|
}
|
|
2014
2029
|
)
|
|
2015
2030
|
] }),
|
|
2016
|
-
/* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */ e("label", { children:
|
|
2031
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2032
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.value", "Value") }),
|
|
2018
2033
|
/* @__PURE__ */ e(
|
|
2019
2034
|
"input",
|
|
2020
2035
|
{
|
|
2021
2036
|
type: "text",
|
|
2022
2037
|
value: t.config.value || "",
|
|
2023
|
-
onChange: (
|
|
2038
|
+
onChange: (r) => a({ config: { ...t.config, value: r.target.value } })
|
|
2024
2039
|
}
|
|
2025
2040
|
)
|
|
2026
2041
|
] })
|
|
2027
2042
|
] }),
|
|
2028
|
-
t.type === "function" && /* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */ e("label", { children:
|
|
2043
|
+
t.type === "function" && /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2044
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.code", "Code") }),
|
|
2030
2045
|
/* @__PURE__ */ e(
|
|
2031
2046
|
"textarea",
|
|
2032
2047
|
{
|
|
2033
2048
|
value: t.config.code || "",
|
|
2034
|
-
onChange: (
|
|
2049
|
+
onChange: (r) => a({ config: { ...t.config, code: r.target.value } }),
|
|
2035
2050
|
rows: 10,
|
|
2036
2051
|
className: "nice-integration-builder__code-input"
|
|
2037
2052
|
}
|
|
2038
2053
|
)
|
|
2039
2054
|
] }),
|
|
2040
|
-
t.type === "email" && /* @__PURE__ */
|
|
2041
|
-
/* @__PURE__ */
|
|
2042
|
-
/* @__PURE__ */ e("label", { children: "To" }),
|
|
2055
|
+
t.type === "email" && /* @__PURE__ */ n(Q, { children: [
|
|
2056
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2057
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.to", "To") }),
|
|
2043
2058
|
/* @__PURE__ */ e(
|
|
2044
2059
|
"input",
|
|
2045
2060
|
{
|
|
2046
2061
|
type: "text",
|
|
2047
2062
|
value: t.config.to || "",
|
|
2048
|
-
onChange: (
|
|
2063
|
+
onChange: (r) => a({ config: { ...t.config, to: r.target.value } })
|
|
2049
2064
|
}
|
|
2050
2065
|
)
|
|
2051
2066
|
] }),
|
|
2052
|
-
/* @__PURE__ */
|
|
2053
|
-
/* @__PURE__ */ e("label", { children:
|
|
2067
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2068
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.subject", "Subject") }),
|
|
2054
2069
|
/* @__PURE__ */ e(
|
|
2055
2070
|
"input",
|
|
2056
2071
|
{
|
|
2057
2072
|
type: "text",
|
|
2058
2073
|
value: t.config.subject || "",
|
|
2059
|
-
onChange: (
|
|
2074
|
+
onChange: (r) => a({ config: { ...t.config, subject: r.target.value } })
|
|
2060
2075
|
}
|
|
2061
2076
|
)
|
|
2062
2077
|
] }),
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */ e("label", { children:
|
|
2078
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2079
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.body", "Body") }),
|
|
2065
2080
|
/* @__PURE__ */ e(
|
|
2066
2081
|
"textarea",
|
|
2067
2082
|
{
|
|
2068
2083
|
value: t.config.body || "",
|
|
2069
|
-
onChange: (
|
|
2084
|
+
onChange: (r) => a({ config: { ...t.config, body: r.target.value } }),
|
|
2070
2085
|
rows: 5
|
|
2071
2086
|
}
|
|
2072
2087
|
)
|
|
@@ -2076,19 +2091,19 @@ function Qe({
|
|
|
2076
2091
|
] });
|
|
2077
2092
|
}
|
|
2078
2093
|
function Ze({ variables: t, onChange: a }) {
|
|
2079
|
-
const { t: o } =
|
|
2094
|
+
const { t: o } = $(), i = () => {
|
|
2080
2095
|
a({ ...t, newVariable: "" });
|
|
2081
2096
|
};
|
|
2082
|
-
return /* @__PURE__ */
|
|
2097
|
+
return /* @__PURE__ */ n("div", { className: "nice-integration-builder__variables", children: [
|
|
2083
2098
|
/* @__PURE__ */ e("h4", { children: o("integrationBuilder.flowVariables", "Flow Variables") }),
|
|
2084
|
-
/* @__PURE__ */ e("div", { className: "nice-integration-builder__variables-list", children: Object.entries(t).map(([
|
|
2099
|
+
/* @__PURE__ */ e("div", { className: "nice-integration-builder__variables-list", children: Object.entries(t).map(([r, c]) => /* @__PURE__ */ n("div", { className: "nice-integration-builder__variable-row", children: [
|
|
2085
2100
|
/* @__PURE__ */ e(
|
|
2086
2101
|
"input",
|
|
2087
2102
|
{
|
|
2088
2103
|
type: "text",
|
|
2089
|
-
value:
|
|
2104
|
+
value: r,
|
|
2090
2105
|
onChange: (l) => {
|
|
2091
|
-
const { [
|
|
2106
|
+
const { [r]: d, ...p } = t;
|
|
2092
2107
|
a({ ...p, [l.target.value]: c });
|
|
2093
2108
|
},
|
|
2094
2109
|
placeholder: o("integrationBuilder.name", "Name")
|
|
@@ -2099,7 +2114,7 @@ function Ze({ variables: t, onChange: a }) {
|
|
|
2099
2114
|
{
|
|
2100
2115
|
type: "text",
|
|
2101
2116
|
value: String(c),
|
|
2102
|
-
onChange: (l) => a({ ...t, [
|
|
2117
|
+
onChange: (l) => a({ ...t, [r]: l.target.value }),
|
|
2103
2118
|
placeholder: o("integrationBuilder.value", "Value")
|
|
2104
2119
|
}
|
|
2105
2120
|
),
|
|
@@ -2108,14 +2123,14 @@ function Ze({ variables: t, onChange: a }) {
|
|
|
2108
2123
|
{
|
|
2109
2124
|
"aria-label": o("integrationBuilder.close", "Close"),
|
|
2110
2125
|
onClick: () => {
|
|
2111
|
-
const { [
|
|
2126
|
+
const { [r]: l, ...d } = t;
|
|
2112
2127
|
a(d);
|
|
2113
2128
|
},
|
|
2114
2129
|
children: /* @__PURE__ */ e(ee, { name: "close", size: 14 })
|
|
2115
2130
|
}
|
|
2116
2131
|
)
|
|
2117
|
-
] },
|
|
2118
|
-
/* @__PURE__ */ e("button", { onClick:
|
|
2132
|
+
] }, r)) }),
|
|
2133
|
+
/* @__PURE__ */ e("button", { onClick: i, children: o("integrationBuilder.addVariable", "+ Add Variable") })
|
|
2119
2134
|
] });
|
|
2120
2135
|
}
|
|
2121
2136
|
function et({
|
|
@@ -2123,71 +2138,71 @@ function et({
|
|
|
2123
2138
|
schedule: a,
|
|
2124
2139
|
onChange: o
|
|
2125
2140
|
}) {
|
|
2126
|
-
const { t:
|
|
2127
|
-
return /* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */ e("h4", { children:
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */ e("label", { children:
|
|
2131
|
-
/* @__PURE__ */
|
|
2141
|
+
const { t: i } = $();
|
|
2142
|
+
return /* @__PURE__ */ n("div", { className: "nice-integration-builder__settings", children: [
|
|
2143
|
+
/* @__PURE__ */ e("h4", { children: i("integrationBuilder.errorHandling", "Error Handling") }),
|
|
2144
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2145
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.strategy", "Strategy") }),
|
|
2146
|
+
/* @__PURE__ */ n(
|
|
2132
2147
|
"select",
|
|
2133
2148
|
{
|
|
2134
2149
|
value: t.strategy,
|
|
2135
|
-
onChange: (
|
|
2136
|
-
{ ...t, strategy:
|
|
2150
|
+
onChange: (r) => o(
|
|
2151
|
+
{ ...t, strategy: r.target.value },
|
|
2137
2152
|
a
|
|
2138
2153
|
),
|
|
2139
2154
|
children: [
|
|
2140
|
-
/* @__PURE__ */ e("option", { value: "stop", children:
|
|
2141
|
-
/* @__PURE__ */ e("option", { value: "continue", children:
|
|
2142
|
-
/* @__PURE__ */ e("option", { value: "retry", children:
|
|
2155
|
+
/* @__PURE__ */ e("option", { value: "stop", children: i("integrationBuilder.stopOnError", "Stop on error") }),
|
|
2156
|
+
/* @__PURE__ */ e("option", { value: "continue", children: i("integrationBuilder.continueOnError", "Continue on error") }),
|
|
2157
|
+
/* @__PURE__ */ e("option", { value: "retry", children: i("integrationBuilder.retryOnError", "Retry on error") })
|
|
2143
2158
|
]
|
|
2144
2159
|
}
|
|
2145
2160
|
)
|
|
2146
2161
|
] }),
|
|
2147
|
-
t.strategy === "retry" && /* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */ e("label", { children:
|
|
2162
|
+
t.strategy === "retry" && /* @__PURE__ */ n(Q, { children: [
|
|
2163
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2164
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.maxRetries", "Max Retries") }),
|
|
2150
2165
|
/* @__PURE__ */ e(
|
|
2151
2166
|
"input",
|
|
2152
2167
|
{
|
|
2153
2168
|
type: "number",
|
|
2154
2169
|
value: t.maxRetries || 3,
|
|
2155
|
-
onChange: (
|
|
2170
|
+
onChange: (r) => o({ ...t, maxRetries: parseInt(r.target.value, 10) }, a)
|
|
2156
2171
|
}
|
|
2157
2172
|
)
|
|
2158
2173
|
] }),
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */ e("label", { children: "Retry Delay (ms)" }),
|
|
2174
|
+
/* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2175
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.retryDelayMs", "Retry Delay (ms)") }),
|
|
2161
2176
|
/* @__PURE__ */ e(
|
|
2162
2177
|
"input",
|
|
2163
2178
|
{
|
|
2164
2179
|
type: "number",
|
|
2165
2180
|
value: t.retryDelay || 1e3,
|
|
2166
|
-
onChange: (
|
|
2181
|
+
onChange: (r) => o({ ...t, retryDelay: parseInt(r.target.value, 10) }, a)
|
|
2167
2182
|
}
|
|
2168
2183
|
)
|
|
2169
2184
|
] })
|
|
2170
2185
|
] }),
|
|
2171
|
-
/* @__PURE__ */ e("h4", { children:
|
|
2172
|
-
/* @__PURE__ */ e("div", { className: "nice-integration-builder__field", children: /* @__PURE__ */
|
|
2186
|
+
/* @__PURE__ */ e("h4", { children: i("integrationBuilder.schedule", "Schedule") }),
|
|
2187
|
+
/* @__PURE__ */ e("div", { className: "nice-integration-builder__field", children: /* @__PURE__ */ n("label", { children: [
|
|
2173
2188
|
/* @__PURE__ */ e(
|
|
2174
2189
|
"input",
|
|
2175
2190
|
{
|
|
2176
2191
|
type: "checkbox",
|
|
2177
2192
|
checked: (a == null ? void 0 : a.enabled) || !1,
|
|
2178
|
-
onChange: (
|
|
2193
|
+
onChange: (r) => o(t, { ...a, enabled: r.target.checked })
|
|
2179
2194
|
}
|
|
2180
2195
|
),
|
|
2181
|
-
|
|
2196
|
+
i("integrationBuilder.enableScheduledExecution", "Enable scheduled execution")
|
|
2182
2197
|
] }) }),
|
|
2183
|
-
(a == null ? void 0 : a.enabled) && /* @__PURE__ */
|
|
2184
|
-
/* @__PURE__ */ e("label", { children:
|
|
2198
|
+
(a == null ? void 0 : a.enabled) && /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
|
|
2199
|
+
/* @__PURE__ */ e("label", { children: i("integrationBuilder.cronExpression", "Cron Expression") }),
|
|
2185
2200
|
/* @__PURE__ */ e(
|
|
2186
2201
|
"input",
|
|
2187
2202
|
{
|
|
2188
2203
|
type: "text",
|
|
2189
2204
|
value: a.cron || "",
|
|
2190
|
-
onChange: (
|
|
2205
|
+
onChange: (r) => o(t, { ...a, cron: r.target.value }),
|
|
2191
2206
|
placeholder: "0 0 * * *"
|
|
2192
2207
|
}
|
|
2193
2208
|
)
|
|
@@ -2218,32 +2233,32 @@ async function it(t, a) {
|
|
|
2218
2233
|
const o = (l = globalThis.crypto) == null ? void 0 : l.subtle;
|
|
2219
2234
|
if (!o)
|
|
2220
2235
|
throw new Error("Web Crypto (crypto.subtle) is unavailable in this environment");
|
|
2221
|
-
const
|
|
2236
|
+
const i = new TextEncoder(), r = await o.importKey(
|
|
2222
2237
|
"raw",
|
|
2223
|
-
|
|
2238
|
+
i.encode(t),
|
|
2224
2239
|
{ name: "HMAC", hash: "SHA-256" },
|
|
2225
2240
|
!1,
|
|
2226
2241
|
["sign"]
|
|
2227
|
-
), c = await o.sign("HMAC",
|
|
2242
|
+
), c = await o.sign("HMAC", r, i.encode(a));
|
|
2228
2243
|
return [...new Uint8Array(c)].map((d) => d.toString(16).padStart(2, "0")).join("");
|
|
2229
2244
|
}
|
|
2230
2245
|
const dt = /* @__PURE__ */ Ce(
|
|
2231
2246
|
function(a, o) {
|
|
2232
|
-
const { t:
|
|
2233
|
-
url:
|
|
2247
|
+
const { t: i } = $(), {
|
|
2248
|
+
url: r = "",
|
|
2234
2249
|
method: c = "POST",
|
|
2235
2250
|
headers: l,
|
|
2236
2251
|
payload: d = "",
|
|
2237
2252
|
samples: p = [],
|
|
2238
|
-
onSend:
|
|
2253
|
+
onSend: v,
|
|
2239
2254
|
signing: u,
|
|
2240
|
-
onSaveSample:
|
|
2241
|
-
tutorial:
|
|
2255
|
+
onSaveSample: N,
|
|
2256
|
+
tutorial: b,
|
|
2242
2257
|
className: y,
|
|
2243
2258
|
style: T,
|
|
2244
2259
|
id: m,
|
|
2245
2260
|
"data-testid": S
|
|
2246
|
-
} = a, [
|
|
2261
|
+
} = a, [w, A] = C(r), [J, te] = C(c), [z, M] = C(() => be(l)), [O, V] = C(d), [G, k] = C(""), [f, x] = C(!1), [j, F] = C(null), [R, ie] = C(null), [K, Y] = C(null), ne = de(null), Z = K !== null;
|
|
2247
2262
|
Ne(() => {
|
|
2248
2263
|
var _;
|
|
2249
2264
|
Z && ((_ = ne.current) == null || _.focus());
|
|
@@ -2256,21 +2271,21 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2256
2271
|
}, [p]), h = (_) => {
|
|
2257
2272
|
k(_);
|
|
2258
2273
|
const D = ae.get(_);
|
|
2259
|
-
D && (V(D.payload), D.headers &&
|
|
2274
|
+
D && (V(D.payload), D.headers && M(be(D.headers)));
|
|
2260
2275
|
}, s = (_, D) => {
|
|
2261
|
-
|
|
2276
|
+
M((q) => q.map((W, X) => X === _ ? { ...W, ...D } : W));
|
|
2262
2277
|
}, g = async () => {
|
|
2263
2278
|
x(!0), F(null), ie(null);
|
|
2264
2279
|
try {
|
|
2265
|
-
const _ = ve(
|
|
2280
|
+
const _ = ve(z);
|
|
2266
2281
|
if (u && u.secret) {
|
|
2267
2282
|
const X = await it(u.secret, O);
|
|
2268
2283
|
_[u.header] = `${u.prefix ?? ""}${X}`;
|
|
2269
2284
|
}
|
|
2270
|
-
const D = typeof performance < "u" ? performance.now() : Date.now(),
|
|
2285
|
+
const D = typeof performance < "u" ? performance.now() : Date.now(), q = await v({ url: w, method: J ?? "POST", headers: _, body: O }), W = Math.round(
|
|
2271
2286
|
(typeof performance < "u" ? performance.now() : Date.now()) - D
|
|
2272
2287
|
);
|
|
2273
|
-
ie({
|
|
2288
|
+
ie({ ...q, durationMs: q.durationMs ?? W });
|
|
2274
2289
|
} catch (_) {
|
|
2275
2290
|
F(_ instanceof Error ? _.message : String(_));
|
|
2276
2291
|
} finally {
|
|
@@ -2278,23 +2293,23 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2278
2293
|
}
|
|
2279
2294
|
}, P = () => {
|
|
2280
2295
|
const _ = K == null ? void 0 : K.trim();
|
|
2281
|
-
!
|
|
2296
|
+
!N || !_ || (N({
|
|
2282
2297
|
id: `sample_${Date.now().toString(36)}`,
|
|
2283
2298
|
name: _,
|
|
2284
2299
|
payload: O,
|
|
2285
|
-
headers: ve(
|
|
2300
|
+
headers: ve(z)
|
|
2286
2301
|
}), Y(null));
|
|
2287
2302
|
}, H = R == null ? "" : R.status >= 200 && R.status < 300 ? " nice-webhook-tester__status--ok" : " nice-webhook-tester__status--error", E = "nice-webhook-tester" + (y ? ` ${y}` : "");
|
|
2288
|
-
return /* @__PURE__ */
|
|
2289
|
-
|
|
2290
|
-
/* @__PURE__ */
|
|
2303
|
+
return /* @__PURE__ */ n("div", { ref: o, id: m, className: E, style: T, "data-testid": S, children: [
|
|
2304
|
+
b && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__tutorial", children: /* @__PURE__ */ e(ce, { steps: le(b, tt) }) }),
|
|
2305
|
+
/* @__PURE__ */ n("div", { className: "nice-webhook-tester__bar", children: [
|
|
2291
2306
|
/* @__PURE__ */ e(
|
|
2292
2307
|
"select",
|
|
2293
2308
|
{
|
|
2294
2309
|
className: "nice-webhook-tester__method",
|
|
2295
2310
|
value: J,
|
|
2296
2311
|
onChange: (_) => te(_.target.value),
|
|
2297
|
-
"aria-label":
|
|
2312
|
+
"aria-label": i("webhookTester.method", "Method"),
|
|
2298
2313
|
children: ["POST", "PUT", "GET", "PATCH", "DELETE"].map((_) => /* @__PURE__ */ e("option", { value: _, children: _ }, _))
|
|
2299
2314
|
}
|
|
2300
2315
|
),
|
|
@@ -2303,10 +2318,10 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2303
2318
|
{
|
|
2304
2319
|
type: "text",
|
|
2305
2320
|
className: "nice-webhook-tester__url",
|
|
2306
|
-
value:
|
|
2321
|
+
value: w,
|
|
2307
2322
|
placeholder: "https://example.com/api/payments/stripe/webhook",
|
|
2308
2323
|
onChange: (_) => A(_.target.value),
|
|
2309
|
-
"aria-label":
|
|
2324
|
+
"aria-label": i("webhookTester.url", "URL")
|
|
2310
2325
|
}
|
|
2311
2326
|
),
|
|
2312
2327
|
/* @__PURE__ */ e(
|
|
@@ -2315,37 +2330,38 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2315
2330
|
type: "button",
|
|
2316
2331
|
className: "nice-webhook-tester__send",
|
|
2317
2332
|
onClick: () => void g(),
|
|
2318
|
-
disabled: f ||
|
|
2319
|
-
children: f ? "Sending…" : "Send"
|
|
2333
|
+
disabled: f || w.trim() === "",
|
|
2334
|
+
children: f ? i("webhookTester.sending", "Sending…") : i("webhookTester.send", "Send")
|
|
2320
2335
|
}
|
|
2321
2336
|
)
|
|
2322
2337
|
] }),
|
|
2323
|
-
p.length > 0 && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__samples", children: /* @__PURE__ */
|
|
2324
|
-
"Sample:",
|
|
2338
|
+
p.length > 0 && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__samples", children: /* @__PURE__ */ n("label", { children: [
|
|
2339
|
+
i("webhookTester.sample", "Sample:"),
|
|
2325
2340
|
" ",
|
|
2326
|
-
/* @__PURE__ */
|
|
2327
|
-
/* @__PURE__ */ e("option", { value: "", children: "— choose a saved payload —" }),
|
|
2341
|
+
/* @__PURE__ */ n("select", { value: G, onChange: (_) => h(_.target.value), children: [
|
|
2342
|
+
/* @__PURE__ */ e("option", { value: "", children: i("webhookTester.chooseASavedPayload", "— choose a saved payload —") }),
|
|
2328
2343
|
p.map((_) => /* @__PURE__ */ e("option", { value: _.id, children: _.name }, _.id))
|
|
2329
2344
|
] })
|
|
2330
2345
|
] }) }),
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
/* @__PURE__ */
|
|
2333
|
-
|
|
2334
|
-
u && /* @__PURE__ */
|
|
2346
|
+
/* @__PURE__ */ n("div", { className: "nice-webhook-tester__headers", children: [
|
|
2347
|
+
/* @__PURE__ */ n("div", { className: "nice-webhook-tester__section-label", children: [
|
|
2348
|
+
i("webhookTester.headers", "Headers"),
|
|
2349
|
+
u && /* @__PURE__ */ n("span", { className: "nice-webhook-tester__signed", children: [
|
|
2350
|
+
" ",
|
|
2351
|
+
i("webhookTester.autoSigns", "· auto-signs"),
|
|
2335
2352
|
" ",
|
|
2336
|
-
"· auto-signs ",
|
|
2337
2353
|
/* @__PURE__ */ e("code", { children: u.header })
|
|
2338
2354
|
] })
|
|
2339
2355
|
] }),
|
|
2340
|
-
|
|
2356
|
+
z.map((_, D) => /* @__PURE__ */ n("div", { className: "nice-webhook-tester__header-row", children: [
|
|
2341
2357
|
/* @__PURE__ */ e(
|
|
2342
2358
|
"input",
|
|
2343
2359
|
{
|
|
2344
2360
|
type: "text",
|
|
2345
2361
|
value: _.key,
|
|
2346
|
-
placeholder:
|
|
2347
|
-
onChange: (
|
|
2348
|
-
"aria-label":
|
|
2362
|
+
placeholder: i("webhookTester.header", "Header"),
|
|
2363
|
+
onChange: (q) => s(D, { key: q.target.value }),
|
|
2364
|
+
"aria-label": i("webhookTester.headerName", "Header name")
|
|
2349
2365
|
}
|
|
2350
2366
|
),
|
|
2351
2367
|
/* @__PURE__ */ e(
|
|
@@ -2353,18 +2369,18 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2353
2369
|
{
|
|
2354
2370
|
type: "text",
|
|
2355
2371
|
value: _.value,
|
|
2356
|
-
placeholder:
|
|
2357
|
-
onChange: (
|
|
2358
|
-
"aria-label":
|
|
2372
|
+
placeholder: i("webhookTester.value", "Value"),
|
|
2373
|
+
onChange: (q) => s(D, { value: q.target.value }),
|
|
2374
|
+
"aria-label": i("webhookTester.headerValue", "Header value")
|
|
2359
2375
|
}
|
|
2360
2376
|
),
|
|
2361
2377
|
/* @__PURE__ */ e(
|
|
2362
2378
|
"button",
|
|
2363
2379
|
{
|
|
2364
2380
|
type: "button",
|
|
2365
|
-
onClick: () =>
|
|
2366
|
-
"aria-label":
|
|
2367
|
-
children: /* @__PURE__ */ e(
|
|
2381
|
+
onClick: () => M((q) => q.filter((W, X) => X !== D)),
|
|
2382
|
+
"aria-label": i("webhookTester.removeHeader", "Remove header"),
|
|
2383
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 12 })
|
|
2368
2384
|
}
|
|
2369
2385
|
)
|
|
2370
2386
|
] }, D)),
|
|
@@ -2373,48 +2389,48 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2373
2389
|
{
|
|
2374
2390
|
type: "button",
|
|
2375
2391
|
className: "nice-webhook-tester__add-header",
|
|
2376
|
-
onClick: () =>
|
|
2377
|
-
children: "+ Header"
|
|
2392
|
+
onClick: () => M((_) => [..._, { key: "", value: "" }]),
|
|
2393
|
+
children: i("webhookTester.header2", "+ Header")
|
|
2378
2394
|
}
|
|
2379
2395
|
)
|
|
2380
2396
|
] }),
|
|
2381
|
-
/* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
|
|
2384
|
-
|
|
2397
|
+
/* @__PURE__ */ n("div", { className: "nice-webhook-tester__payload", children: [
|
|
2398
|
+
/* @__PURE__ */ n("div", { className: "nice-webhook-tester__section-label", children: [
|
|
2399
|
+
i("webhookTester.payload", "Payload"),
|
|
2400
|
+
N && /* @__PURE__ */ e(
|
|
2385
2401
|
"button",
|
|
2386
2402
|
{
|
|
2387
2403
|
type: "button",
|
|
2388
2404
|
className: "nice-webhook-tester__save",
|
|
2389
2405
|
onClick: () => Y(""),
|
|
2390
2406
|
"aria-expanded": Z,
|
|
2391
|
-
children:
|
|
2407
|
+
children: i("webhookTester.saveAsSample", "Save as sample")
|
|
2392
2408
|
}
|
|
2393
2409
|
)
|
|
2394
2410
|
] }),
|
|
2395
|
-
|
|
2411
|
+
N && Z && /* @__PURE__ */ n("div", { className: "nice-webhook-tester__header-row", children: [
|
|
2396
2412
|
/* @__PURE__ */ e(
|
|
2397
2413
|
"input",
|
|
2398
2414
|
{
|
|
2399
2415
|
ref: ne,
|
|
2400
2416
|
type: "text",
|
|
2401
2417
|
value: K,
|
|
2402
|
-
placeholder:
|
|
2403
|
-
"aria-label":
|
|
2418
|
+
placeholder: i("webhookTester.sampleNamePrompt", "Sample name"),
|
|
2419
|
+
"aria-label": i("webhookTester.sampleNamePrompt", "Sample name"),
|
|
2404
2420
|
onChange: (_) => Y(_.target.value),
|
|
2405
2421
|
onKeyDown: (_) => {
|
|
2406
2422
|
_.key === "Enter" ? (_.preventDefault(), P()) : _.key === "Escape" && Y(null);
|
|
2407
2423
|
}
|
|
2408
2424
|
}
|
|
2409
2425
|
),
|
|
2410
|
-
/* @__PURE__ */ e("button", { type: "button", onClick: P, disabled: !K.trim(), children:
|
|
2426
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: P, disabled: !K.trim(), children: i("save", "Save") }),
|
|
2411
2427
|
/* @__PURE__ */ e(
|
|
2412
2428
|
"button",
|
|
2413
2429
|
{
|
|
2414
2430
|
type: "button",
|
|
2415
2431
|
onClick: () => Y(null),
|
|
2416
|
-
"aria-label":
|
|
2417
|
-
children: /* @__PURE__ */ e(
|
|
2432
|
+
"aria-label": i("cancel", "Cancel"),
|
|
2433
|
+
children: /* @__PURE__ */ e(B, { name: "close", size: 12 })
|
|
2418
2434
|
}
|
|
2419
2435
|
)
|
|
2420
2436
|
] }),
|
|
@@ -2425,22 +2441,22 @@ const dt = /* @__PURE__ */ Ce(
|
|
|
2425
2441
|
value: O,
|
|
2426
2442
|
spellCheck: !1,
|
|
2427
2443
|
rows: 8,
|
|
2428
|
-
placeholder:
|
|
2444
|
+
placeholder: i(
|
|
2429
2445
|
"webhookTester.typePaymentSucceededData",
|
|
2430
2446
|
'{ "type": "payment.succeeded", "data": { ... } }'
|
|
2431
2447
|
),
|
|
2432
2448
|
onChange: (_) => V(_.target.value),
|
|
2433
|
-
"aria-label":
|
|
2449
|
+
"aria-label": i("webhookTester.payload", "Payload")
|
|
2434
2450
|
}
|
|
2435
2451
|
)
|
|
2436
2452
|
] }),
|
|
2437
2453
|
j && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__error", children: j }),
|
|
2438
|
-
R && /* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
|
|
2454
|
+
R && /* @__PURE__ */ n("div", { className: "nice-webhook-tester__response", children: [
|
|
2455
|
+
/* @__PURE__ */ n("div", { className: "nice-webhook-tester__section-label", children: [
|
|
2456
|
+
i("webhookTester.response", "Response"),
|
|
2441
2457
|
" ",
|
|
2442
2458
|
/* @__PURE__ */ e("span", { className: "nice-webhook-tester__status" + H, children: R.status }),
|
|
2443
|
-
R.durationMs != null && /* @__PURE__ */
|
|
2459
|
+
R.durationMs != null && /* @__PURE__ */ n("span", { className: "nice-webhook-tester__time", children: [
|
|
2444
2460
|
" · ",
|
|
2445
2461
|
R.durationMs,
|
|
2446
2462
|
" ms"
|