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