trade-safety 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as u } from "react-i18next";
|
|
3
3
|
import "i18next";
|
|
4
4
|
import "i18next-resources-to-backend";
|
|
5
|
-
import { TRADE_SAFETY_NS as
|
|
6
|
-
import { tradeSafetyTranslations as
|
|
5
|
+
import { TRADE_SAFETY_NS as h } from "./locale.mjs";
|
|
6
|
+
import { tradeSafetyTranslations as we } from "./locale.mjs";
|
|
7
7
|
import * as o from "react";
|
|
8
8
|
import m from "react";
|
|
9
9
|
import { BaseCrudRepository as R } from "@aioia/core";
|
|
10
|
-
import { z as
|
|
10
|
+
import { z as s } from "zod";
|
|
11
11
|
function _(e) {
|
|
12
12
|
var t, r, n = "";
|
|
13
13
|
if (typeof e == "string" || typeof e == "number") n += e;
|
|
14
14
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
15
|
-
var
|
|
16
|
-
for (t = 0; t <
|
|
15
|
+
var l = e.length;
|
|
16
|
+
for (t = 0; t < l; t++) e[t] && (r = _(e[t])) && (n && (n += " "), n += r);
|
|
17
17
|
} else for (r in e) e[r] && (n && (n += " "), n += r);
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
20
|
function S() {
|
|
21
|
-
for (var e, t, r = 0, n = "",
|
|
21
|
+
for (var e, t, r = 0, n = "", l = arguments.length; r < l; r++) (e = arguments[r]) && (t = _(e)) && (n && (n += " "), n += t);
|
|
22
22
|
return n;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const P = {
|
|
25
25
|
default: "border-base-300",
|
|
26
26
|
error: "border-error bg-error/10",
|
|
27
27
|
warning: "border-warning bg-warning/10",
|
|
@@ -34,33 +34,33 @@ function p({
|
|
|
34
34
|
variant: r = "default",
|
|
35
35
|
children: n
|
|
36
36
|
}) {
|
|
37
|
-
return n ? /* @__PURE__ */
|
|
38
|
-
e && /* @__PURE__ */
|
|
37
|
+
return n ? /* @__PURE__ */ i("div", { className: S("rounded-lg border p-6", P[r]), children: [
|
|
38
|
+
e && /* @__PURE__ */ i("h2", { className: "mb-2 flex items-center gap-2 font-bold", children: [
|
|
39
39
|
e,
|
|
40
40
|
t
|
|
41
41
|
] }),
|
|
42
42
|
n
|
|
43
43
|
] }) : null;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const { t } = u(
|
|
45
|
+
function C({ summary: e }) {
|
|
46
|
+
const { t } = u(h);
|
|
47
47
|
return /* @__PURE__ */ a(p, { title: t("result.aiSummary"), children: /* @__PURE__ */ a("p", { className: "rounded-lg bg-base-200 p-6 text-sm leading-relaxed text-base-content", children: e }) });
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const { t, i18n: r } = u(
|
|
51
|
-
return e ? /* @__PURE__ */
|
|
52
|
-
e.market_price_range && /* @__PURE__ */
|
|
49
|
+
function k({ data: e }) {
|
|
50
|
+
const { t, i18n: r } = u(h);
|
|
51
|
+
return e ? /* @__PURE__ */ i(p, { title: t("result.priceAnalysis"), children: [
|
|
52
|
+
e.market_price_range && /* @__PURE__ */ i("div", { className: "mb-2", children: [
|
|
53
53
|
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: t("result.marketPrice") }),
|
|
54
54
|
/* @__PURE__ */ a("p", { className: "text-xs", children: e.market_price_range })
|
|
55
55
|
] }),
|
|
56
|
-
e.offered_price && /* @__PURE__ */
|
|
56
|
+
e.offered_price && /* @__PURE__ */ i("div", { className: "mb-2", children: [
|
|
57
57
|
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: t("result.offeredPrice") }),
|
|
58
58
|
/* @__PURE__ */ a("p", { className: "text-xs", children: new Intl.NumberFormat(r.language, {
|
|
59
59
|
style: "currency",
|
|
60
60
|
currency: e.currency || "USD"
|
|
61
61
|
}).format(e.offered_price) })
|
|
62
62
|
] }),
|
|
63
|
-
e.price_assessment && /* @__PURE__ */
|
|
63
|
+
e.price_assessment && /* @__PURE__ */ i("div", { children: [
|
|
64
64
|
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: t("result.priceAssessment") }),
|
|
65
65
|
/* @__PURE__ */ a("p", { className: "text-xs", children: e.price_assessment })
|
|
66
66
|
] })
|
|
@@ -69,10 +69,10 @@ function P({ data: e }) {
|
|
|
69
69
|
function z({
|
|
70
70
|
recommendation: e
|
|
71
71
|
}) {
|
|
72
|
-
const { t } = u(
|
|
72
|
+
const { t } = u(h);
|
|
73
73
|
return e ? /* @__PURE__ */ a(p, { title: t("result.recommendation"), children: /* @__PURE__ */ a("p", { className: "text-xs", children: e }) }) : null;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function T({
|
|
76
76
|
title: e,
|
|
77
77
|
titleId: t,
|
|
78
78
|
...r
|
|
@@ -93,7 +93,7 @@ function A({
|
|
|
93
93
|
clipRule: "evenodd"
|
|
94
94
|
}));
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const A = /* @__PURE__ */ o.forwardRef(T);
|
|
97
97
|
function D({
|
|
98
98
|
title: e,
|
|
99
99
|
titleId: t,
|
|
@@ -161,14 +161,14 @@ function B({
|
|
|
161
161
|
}
|
|
162
162
|
const H = /* @__PURE__ */ o.forwardRef(B);
|
|
163
163
|
function I({ items: e }) {
|
|
164
|
-
const { t } = u(
|
|
165
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
164
|
+
const { t } = u(h);
|
|
165
|
+
return e.length === 0 ? null : /* @__PURE__ */ i("div", { className: "mb-4", children: [
|
|
166
|
+
/* @__PURE__ */ i("h2", { className: "flex items-center gap-1 py-4 font-bold", children: [
|
|
167
167
|
t("result.safetyChecklist"),
|
|
168
168
|
" ",
|
|
169
|
-
/* @__PURE__ */ a(
|
|
169
|
+
/* @__PURE__ */ a(A, { className: "size-6" })
|
|
170
170
|
] }),
|
|
171
|
-
/* @__PURE__ */ a(p, { variant: "info", children: e.map((r, n) => /* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ a(p, { variant: "info", children: e.map((r, n) => /* @__PURE__ */ i("label", { className: "label w-fit cursor-pointer gap-2", children: [
|
|
172
172
|
/* @__PURE__ */ a(
|
|
173
173
|
"input",
|
|
174
174
|
{
|
|
@@ -184,7 +184,7 @@ const L = {
|
|
|
184
184
|
error: F,
|
|
185
185
|
warning: M,
|
|
186
186
|
success: H
|
|
187
|
-
},
|
|
187
|
+
}, $ = {
|
|
188
188
|
error: "result.riskSignals",
|
|
189
189
|
warning: "result.cautions",
|
|
190
190
|
success: "result.safeIndicators"
|
|
@@ -193,55 +193,55 @@ function v({
|
|
|
193
193
|
signals: e,
|
|
194
194
|
variant: t = "error"
|
|
195
195
|
}) {
|
|
196
|
-
const { t: r } = u(
|
|
196
|
+
const { t: r } = u(h);
|
|
197
197
|
if (e.length === 0) return null;
|
|
198
198
|
const n = L[t];
|
|
199
|
-
return /* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
r(
|
|
199
|
+
return /* @__PURE__ */ i("div", { className: "mb-4", children: [
|
|
200
|
+
/* @__PURE__ */ i("h2", { className: "flex items-center gap-1 py-4 font-bold", children: [
|
|
201
|
+
r($[t]),
|
|
202
202
|
" ",
|
|
203
203
|
/* @__PURE__ */ a(n, { className: "size-6" })
|
|
204
204
|
] }),
|
|
205
|
-
/* @__PURE__ */ a("div", { className: "space-y-3", children: e.map((
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children:
|
|
208
|
-
/* @__PURE__ */ a("p", { className: "text-xs", children:
|
|
205
|
+
/* @__PURE__ */ a("div", { className: "space-y-3", children: e.map((l, c) => /* @__PURE__ */ a(p, { variant: t, children: /* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
206
|
+
/* @__PURE__ */ i("div", { children: [
|
|
207
|
+
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: l.title }),
|
|
208
|
+
/* @__PURE__ */ a("p", { className: "text-xs", children: l.description })
|
|
209
209
|
] }),
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ i("div", { children: [
|
|
211
211
|
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: r("result.whatToDo") }),
|
|
212
|
-
/* @__PURE__ */ a("p", { className: "text-xs", children:
|
|
212
|
+
/* @__PURE__ */ a("p", { className: "text-xs", children: l.what_to_do })
|
|
213
213
|
] })
|
|
214
214
|
] }) }, c)) })
|
|
215
215
|
] });
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function W({
|
|
218
218
|
translation: e,
|
|
219
219
|
nuance: t
|
|
220
220
|
}) {
|
|
221
|
-
const { t: r } = u(
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
-
e && /* @__PURE__ */
|
|
221
|
+
const { t: r } = u(h);
|
|
222
|
+
return /* @__PURE__ */ i(p, { title: r("result.translation"), children: [
|
|
223
|
+
e && /* @__PURE__ */ i("div", { className: "mb-2", children: [
|
|
224
224
|
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: r("result.translationTitle") }),
|
|
225
225
|
/* @__PURE__ */ a("p", { className: "text-xs", children: e })
|
|
226
226
|
] }),
|
|
227
|
-
t && /* @__PURE__ */
|
|
227
|
+
t && /* @__PURE__ */ i("div", { children: [
|
|
228
228
|
/* @__PURE__ */ a("h3", { className: "text-sm font-bold", children: r("result.nuanceTitle") }),
|
|
229
229
|
/* @__PURE__ */ a("p", { className: "text-xs", children: t })
|
|
230
230
|
] })
|
|
231
231
|
] });
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return /* @__PURE__ */
|
|
235
|
-
e.ai_summary && /* @__PURE__ */ a(
|
|
236
|
-
/* @__PURE__ */
|
|
233
|
+
function fe({ analysis: e }) {
|
|
234
|
+
return /* @__PURE__ */ i("div", { children: [
|
|
235
|
+
e.ai_summary && /* @__PURE__ */ a(C, { summary: e.ai_summary }),
|
|
236
|
+
/* @__PURE__ */ i("div", { className: "my-4 flex flex-col gap-4", children: [
|
|
237
237
|
(e.translation || e.nuance_explanation) && /* @__PURE__ */ a(
|
|
238
|
-
|
|
238
|
+
W,
|
|
239
239
|
{
|
|
240
240
|
translation: e.translation,
|
|
241
241
|
nuance: e.nuance_explanation
|
|
242
242
|
}
|
|
243
243
|
),
|
|
244
|
-
e.price_analysis && /* @__PURE__ */ a(
|
|
244
|
+
e.price_analysis && /* @__PURE__ */ a(k, { data: e.price_analysis }),
|
|
245
245
|
e.recommendation && /* @__PURE__ */ a(z, { recommendation: e.recommendation })
|
|
246
246
|
] }),
|
|
247
247
|
e.risk_signals.length > 0 && /* @__PURE__ */ a(v, { signals: e.risk_signals, variant: "error" }),
|
|
@@ -257,17 +257,17 @@ var O = {
|
|
|
257
257
|
style: void 0,
|
|
258
258
|
attr: void 0
|
|
259
259
|
}, y = m.createContext && /* @__PURE__ */ m.createContext(O), K = ["attr", "size", "title"];
|
|
260
|
-
function
|
|
260
|
+
function U(e, t) {
|
|
261
261
|
if (e == null) return {};
|
|
262
|
-
var r =
|
|
262
|
+
var r = V(e, t), n, l;
|
|
263
263
|
if (Object.getOwnPropertySymbols) {
|
|
264
264
|
var c = Object.getOwnPropertySymbols(e);
|
|
265
|
-
for (
|
|
266
|
-
n = c[
|
|
265
|
+
for (l = 0; l < c.length; l++)
|
|
266
|
+
n = c[l], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
|
|
267
267
|
}
|
|
268
268
|
return r;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function V(e, t) {
|
|
271
271
|
if (e == null) return {};
|
|
272
272
|
var r = {};
|
|
273
273
|
for (var n in e)
|
|
@@ -291,8 +291,8 @@ function N(e, t) {
|
|
|
291
291
|
var r = Object.keys(e);
|
|
292
292
|
if (Object.getOwnPropertySymbols) {
|
|
293
293
|
var n = Object.getOwnPropertySymbols(e);
|
|
294
|
-
t && (n = n.filter(function(
|
|
295
|
-
return Object.getOwnPropertyDescriptor(e,
|
|
294
|
+
t && (n = n.filter(function(l) {
|
|
295
|
+
return Object.getOwnPropertyDescriptor(e, l).enumerable;
|
|
296
296
|
})), r.push.apply(r, n);
|
|
297
297
|
}
|
|
298
298
|
return r;
|
|
@@ -301,21 +301,21 @@ function x(e) {
|
|
|
301
301
|
for (var t = 1; t < arguments.length; t++) {
|
|
302
302
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
303
303
|
t % 2 ? N(Object(r), !0).forEach(function(n) {
|
|
304
|
-
|
|
304
|
+
X(e, n, r[n]);
|
|
305
305
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : N(Object(r)).forEach(function(n) {
|
|
306
306
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
return e;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
312
|
-
return t =
|
|
311
|
+
function X(e, t, r) {
|
|
312
|
+
return t = Y(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
var t =
|
|
314
|
+
function Y(e) {
|
|
315
|
+
var t = q(e, "string");
|
|
316
316
|
return typeof t == "symbol" ? t : t + "";
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function q(e, t) {
|
|
319
319
|
if (typeof e != "object" || !e) return e;
|
|
320
320
|
var r = e[Symbol.toPrimitive];
|
|
321
321
|
if (r !== void 0) {
|
|
@@ -331,17 +331,17 @@ function j(e) {
|
|
|
331
331
|
}, t.attr), j(t.child)));
|
|
332
332
|
}
|
|
333
333
|
function E(e) {
|
|
334
|
-
return (t) => /* @__PURE__ */ m.createElement(
|
|
334
|
+
return (t) => /* @__PURE__ */ m.createElement(G, g({
|
|
335
335
|
attr: x({}, e.attr)
|
|
336
336
|
}, t), j(e.child));
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function G(e) {
|
|
339
339
|
var t = (r) => {
|
|
340
340
|
var {
|
|
341
341
|
attr: n,
|
|
342
|
-
size:
|
|
342
|
+
size: l,
|
|
343
343
|
title: c
|
|
344
|
-
} = e, b =
|
|
344
|
+
} = e, b = U(e, K), f = l || r.size || "1em", d;
|
|
345
345
|
return r.className && (d = r.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */ m.createElement("svg", g({
|
|
346
346
|
stroke: "currentColor",
|
|
347
347
|
fill: "currentColor",
|
|
@@ -351,8 +351,8 @@ function q(e) {
|
|
|
351
351
|
style: x(x({
|
|
352
352
|
color: e.color || r.color
|
|
353
353
|
}, r.style), e.style),
|
|
354
|
-
height:
|
|
355
|
-
width:
|
|
354
|
+
height: f,
|
|
355
|
+
width: f,
|
|
356
356
|
xmlns: "http://www.w3.org/2000/svg"
|
|
357
357
|
}), c && /* @__PURE__ */ m.createElement("title", null, c), e.children);
|
|
358
358
|
};
|
|
@@ -364,19 +364,19 @@ function J(e) {
|
|
|
364
364
|
function Q(e) {
|
|
365
365
|
return E({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z" }, child: [] }] })(e);
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function pe({
|
|
368
368
|
value: e,
|
|
369
369
|
onChange: t,
|
|
370
370
|
onSubmit: r,
|
|
371
371
|
isLoading: n,
|
|
372
|
-
error:
|
|
372
|
+
error: l
|
|
373
373
|
}) {
|
|
374
|
-
const { t: c } = u(
|
|
375
|
-
return /* @__PURE__ */ a("div", { className: "flex w-full flex-col items-center justify-center", children: /* @__PURE__ */
|
|
374
|
+
const { t: c } = u(h), b = n ? /* @__PURE__ */ a("span", { className: "loading loading-spinner loading-sm" }) : c("hero.checkSafety"), f = n || !e.trim();
|
|
375
|
+
return /* @__PURE__ */ a("div", { className: "flex w-full flex-col items-center justify-center", children: /* @__PURE__ */ i("div", { className: "w-full lg:max-w-[720px]", children: [
|
|
376
376
|
/* @__PURE__ */ a("h1", { className: "mb-2 text-left text-3xl font-bold text-base-content sm:mb-8 sm:text-center sm:text-4xl md:mb-8", children: c("hero.title") }),
|
|
377
377
|
/* @__PURE__ */ a("p", { className: "mb-4 text-left text-sm text-base-content/70 sm:mb-8 sm:text-center sm:text-base md:mb-16", children: c("hero.subtitle") }),
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ i("div", { className: S("mb-4", !l && "sm:mb-8 md:mb-12"), children: [
|
|
379
|
+
/* @__PURE__ */ i("div", { className: "relative hidden lg:block", children: [
|
|
380
380
|
/* @__PURE__ */ a(
|
|
381
381
|
"input",
|
|
382
382
|
{
|
|
@@ -388,7 +388,7 @@ function ue({
|
|
|
388
388
|
onChange: (d) => t(d.target.value),
|
|
389
389
|
disabled: n,
|
|
390
390
|
onKeyDown: (d) => {
|
|
391
|
-
d.key === "Enter" && !
|
|
391
|
+
d.key === "Enter" && !f && r();
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
),
|
|
@@ -397,18 +397,18 @@ function ue({
|
|
|
397
397
|
{
|
|
398
398
|
className: "btn btn-neutral absolute right-2 top-1/2 h-[56px] min-h-0 -translate-y-1/2 !animate-none px-6 font-bold text-neutral-content",
|
|
399
399
|
onClick: r,
|
|
400
|
-
disabled:
|
|
400
|
+
disabled: f,
|
|
401
401
|
children: b
|
|
402
402
|
}
|
|
403
403
|
)
|
|
404
404
|
] }),
|
|
405
|
-
/* @__PURE__ */ a("div", { className: "block lg:hidden", children: /* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ a("div", { className: "block lg:hidden", children: /* @__PURE__ */ i("div", { className: "relative h-[400px] w-full overflow-hidden rounded-xl border border-base-300 bg-base-100", children: [
|
|
406
406
|
!e && /* @__PURE__ */ a(
|
|
407
407
|
"div",
|
|
408
408
|
{
|
|
409
409
|
className: "pointer-events-none absolute inset-0 overflow-hidden p-5 pb-24 text-base text-base-300",
|
|
410
410
|
"aria-hidden": "true",
|
|
411
|
-
children: /* @__PURE__ */
|
|
411
|
+
children: /* @__PURE__ */ i("div", { className: "whitespace-pre-line leading-relaxed", children: [
|
|
412
412
|
/* @__PURE__ */ a("p", { className: "mb-4 text-base-300", children: c("hero.placeholder") }),
|
|
413
413
|
c("hero.placeholderExample")
|
|
414
414
|
] })
|
|
@@ -430,15 +430,15 @@ function ue({
|
|
|
430
430
|
{
|
|
431
431
|
className: "btn btn-neutral h-16 w-full text-base font-medium text-neutral-content",
|
|
432
432
|
onClick: r,
|
|
433
|
-
disabled:
|
|
433
|
+
disabled: f,
|
|
434
434
|
children: b
|
|
435
435
|
}
|
|
436
436
|
) })
|
|
437
437
|
] }) })
|
|
438
438
|
] }),
|
|
439
|
-
|
|
439
|
+
l && /* @__PURE__ */ a("div", { className: "alert alert-error mb-6 flex items-center gap-2 text-sm", children: /* @__PURE__ */ a("span", { children: l }) }),
|
|
440
440
|
/* @__PURE__ */ a("p", { className: "mb-4 text-left text-xs text-base-content/60 sm:mb-8 sm:text-center md:mb-12", children: c("hero.disclaimer") }),
|
|
441
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-start gap-6 sm:justify-center", children: [
|
|
442
442
|
/* @__PURE__ */ a(
|
|
443
443
|
"a",
|
|
444
444
|
{
|
|
@@ -462,61 +462,83 @@ function ue({
|
|
|
462
462
|
] })
|
|
463
463
|
] }) });
|
|
464
464
|
}
|
|
465
|
-
const w =
|
|
466
|
-
category:
|
|
467
|
-
severity:
|
|
468
|
-
title:
|
|
469
|
-
description:
|
|
470
|
-
what_to_do:
|
|
471
|
-
}), ee =
|
|
472
|
-
market_price_range:
|
|
473
|
-
offered_price:
|
|
474
|
-
currency:
|
|
475
|
-
price_assessment:
|
|
476
|
-
warnings:
|
|
477
|
-
}), te =
|
|
478
|
-
ai_summary:
|
|
479
|
-
translation:
|
|
480
|
-
nuance_explanation:
|
|
481
|
-
risk_signals:
|
|
482
|
-
cautions:
|
|
483
|
-
safe_indicators:
|
|
465
|
+
const w = s.object({
|
|
466
|
+
category: s.enum(["payment", "seller", "platform", "price", "content"]),
|
|
467
|
+
severity: s.enum(["high", "medium", "low"]),
|
|
468
|
+
title: s.string(),
|
|
469
|
+
description: s.string(),
|
|
470
|
+
what_to_do: s.string()
|
|
471
|
+
}), ee = s.object({
|
|
472
|
+
market_price_range: s.string().nullish(),
|
|
473
|
+
offered_price: s.number().nullish(),
|
|
474
|
+
currency: s.string().nullish(),
|
|
475
|
+
price_assessment: s.string(),
|
|
476
|
+
warnings: s.array(s.string())
|
|
477
|
+
}), te = s.object({
|
|
478
|
+
ai_summary: s.string(),
|
|
479
|
+
translation: s.string().nullish(),
|
|
480
|
+
nuance_explanation: s.string().nullish(),
|
|
481
|
+
risk_signals: s.array(w),
|
|
482
|
+
cautions: s.array(w),
|
|
483
|
+
safe_indicators: s.array(w),
|
|
484
484
|
price_analysis: ee,
|
|
485
|
-
safety_checklist:
|
|
486
|
-
safe_score:
|
|
487
|
-
recommendation:
|
|
488
|
-
emotional_support:
|
|
489
|
-
}), re =
|
|
490
|
-
id:
|
|
491
|
-
user_id:
|
|
492
|
-
input_text:
|
|
485
|
+
safety_checklist: s.array(s.string()),
|
|
486
|
+
safe_score: s.number(),
|
|
487
|
+
recommendation: s.string(),
|
|
488
|
+
emotional_support: s.string()
|
|
489
|
+
}), re = s.object({
|
|
490
|
+
id: s.string(),
|
|
491
|
+
user_id: s.string().nullish(),
|
|
492
|
+
input_text: s.string(),
|
|
493
493
|
llm_analysis: te,
|
|
494
|
-
safe_score:
|
|
495
|
-
expert_advice:
|
|
496
|
-
expert_reviewed:
|
|
497
|
-
expert_reviewed_at:
|
|
498
|
-
expert_reviewed_by:
|
|
499
|
-
created_at:
|
|
500
|
-
updated_at:
|
|
494
|
+
safe_score: s.number(),
|
|
495
|
+
expert_advice: s.string().nullish(),
|
|
496
|
+
expert_reviewed: s.boolean(),
|
|
497
|
+
expert_reviewed_at: s.string().nullish(),
|
|
498
|
+
expert_reviewed_by: s.string().nullish(),
|
|
499
|
+
created_at: s.string(),
|
|
500
|
+
updated_at: s.string()
|
|
501
|
+
}), ne = s.enum(["twitter"]), ae = s.object({
|
|
502
|
+
platform: ne,
|
|
503
|
+
author: s.string(),
|
|
504
|
+
created_at: s.string().nullish(),
|
|
505
|
+
text: s.string(),
|
|
506
|
+
text_preview: s.string(),
|
|
507
|
+
images: s.array(s.string())
|
|
508
|
+
}), se = s.object({
|
|
509
|
+
data: ae
|
|
501
510
|
});
|
|
502
|
-
class
|
|
511
|
+
class be extends R {
|
|
503
512
|
constructor() {
|
|
504
513
|
super(...arguments), this.resource = "trade-safety";
|
|
505
514
|
}
|
|
506
515
|
getDataSchema() {
|
|
507
516
|
return re;
|
|
508
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Fetch post preview metadata from a social media URL
|
|
520
|
+
* POST /trade-safety/preview
|
|
521
|
+
*/
|
|
522
|
+
async fetchPreview(t, r) {
|
|
523
|
+
const n = `${this.apiService.buildUrl(this.resource)}/preview`, l = await this.apiService.request(n, {
|
|
524
|
+
...r,
|
|
525
|
+
method: "POST",
|
|
526
|
+
headers: { "Content-Type": "application/json" },
|
|
527
|
+
body: JSON.stringify({ url: t })
|
|
528
|
+
});
|
|
529
|
+
return this.validateResponse(l, se).data;
|
|
530
|
+
}
|
|
509
531
|
}
|
|
510
|
-
const
|
|
532
|
+
const ge = {
|
|
511
533
|
safe: 70,
|
|
512
534
|
caution: 40
|
|
513
535
|
};
|
|
514
536
|
export {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
537
|
+
fe as DetailedResult,
|
|
538
|
+
pe as HomeHeroSection,
|
|
539
|
+
ge as SAFETY_SCORE_THRESHOLDS,
|
|
540
|
+
h as TRADE_SAFETY_NS,
|
|
541
|
+
be as TradeSafetyRepository,
|
|
542
|
+
we as tradeSafetyTranslations
|
|
521
543
|
};
|
|
522
544
|
//# sourceMappingURL=index.mjs.map
|