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