trade-safety 1.3.0 → 1.4.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/components/DetailedResult/AISummarySection.d.ts +6 -0
- package/dist/components/DetailedResult/AISummarySection.d.ts.map +1 -0
- package/dist/components/DetailedResult/index.d.ts.map +1 -1
- package/dist/components/PageHeader.d.ts +8 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/i18n/translations.d.ts +90 -0
- package/dist/i18n/translations.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +115 -112
- package/dist/index.mjs.map +1 -1
- package/dist/locale.js +6 -6
- package/dist/locale.js.map +1 -1
- package/dist/locale.mjs +25 -25
- package/dist/repositories/TradeSafetyRepository.d.ts +26 -16
- package/dist/repositories/TradeSafetyRepository.d.ts.map +1 -1
- package/dist/types.d.ts +7 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AISummarySection.d.ts","sourceRoot":"","sources":["../../../src/components/DetailedResult/AISummarySection.tsx"],"names":[],"mappings":"AAQA,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,qBAAqB,+BAUlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DetailedResult/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DetailedResult/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAS9C,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BAgD/D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SafetyLevel } from '../types';
|
|
2
|
+
interface PageHeaderProps {
|
|
3
|
+
level: SafetyLevel;
|
|
4
|
+
score: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function PageHeader({ level, score }: PageHeaderProps): import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=PageHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/components/PageHeader.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,UAAU,eAAe;IACvB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,eAAe,+BAa3D"}
|
|
@@ -88,6 +88,7 @@ export declare const tradeSafetyTranslations: {
|
|
|
88
88
|
priceWarnings: string;
|
|
89
89
|
safetyChecklist: string;
|
|
90
90
|
checklistDescription: string;
|
|
91
|
+
aiSummary: string;
|
|
91
92
|
recommendation: string;
|
|
92
93
|
expertAdvice: string;
|
|
93
94
|
expertName: string;
|
|
@@ -105,6 +106,20 @@ export declare const tradeSafetyTranslations: {
|
|
|
105
106
|
message: string;
|
|
106
107
|
};
|
|
107
108
|
};
|
|
109
|
+
safetyLevel: {
|
|
110
|
+
safe: {
|
|
111
|
+
title: string;
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
caution: {
|
|
115
|
+
title: string;
|
|
116
|
+
description: string;
|
|
117
|
+
};
|
|
118
|
+
danger: {
|
|
119
|
+
title: string;
|
|
120
|
+
description: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
108
123
|
companionCta: {
|
|
109
124
|
title: string;
|
|
110
125
|
description: string;
|
|
@@ -181,6 +196,7 @@ export declare const tradeSafetyTranslations: {
|
|
|
181
196
|
priceWarnings: string;
|
|
182
197
|
safetyChecklist: string;
|
|
183
198
|
checklistDescription: string;
|
|
199
|
+
aiSummary: string;
|
|
184
200
|
recommendation: string;
|
|
185
201
|
expertAdvice: string;
|
|
186
202
|
expertName: string;
|
|
@@ -198,6 +214,20 @@ export declare const tradeSafetyTranslations: {
|
|
|
198
214
|
message: string;
|
|
199
215
|
};
|
|
200
216
|
};
|
|
217
|
+
safetyLevel: {
|
|
218
|
+
safe: {
|
|
219
|
+
title: string;
|
|
220
|
+
description: string;
|
|
221
|
+
};
|
|
222
|
+
caution: {
|
|
223
|
+
title: string;
|
|
224
|
+
description: string;
|
|
225
|
+
};
|
|
226
|
+
danger: {
|
|
227
|
+
title: string;
|
|
228
|
+
description: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
201
231
|
companionCta: {
|
|
202
232
|
title: string;
|
|
203
233
|
description: string;
|
|
@@ -274,6 +304,7 @@ export declare const tradeSafetyTranslations: {
|
|
|
274
304
|
priceWarnings: string;
|
|
275
305
|
safetyChecklist: string;
|
|
276
306
|
checklistDescription: string;
|
|
307
|
+
aiSummary: string;
|
|
277
308
|
recommendation: string;
|
|
278
309
|
expertAdvice: string;
|
|
279
310
|
expertName: string;
|
|
@@ -291,6 +322,20 @@ export declare const tradeSafetyTranslations: {
|
|
|
291
322
|
message: string;
|
|
292
323
|
};
|
|
293
324
|
};
|
|
325
|
+
safetyLevel: {
|
|
326
|
+
safe: {
|
|
327
|
+
title: string;
|
|
328
|
+
description: string;
|
|
329
|
+
};
|
|
330
|
+
caution: {
|
|
331
|
+
title: string;
|
|
332
|
+
description: string;
|
|
333
|
+
};
|
|
334
|
+
danger: {
|
|
335
|
+
title: string;
|
|
336
|
+
description: string;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
294
339
|
companionCta: {
|
|
295
340
|
title: string;
|
|
296
341
|
description: string;
|
|
@@ -367,6 +412,7 @@ export declare const tradeSafetyTranslations: {
|
|
|
367
412
|
priceWarnings: string;
|
|
368
413
|
safetyChecklist: string;
|
|
369
414
|
checklistDescription: string;
|
|
415
|
+
aiSummary: string;
|
|
370
416
|
recommendation: string;
|
|
371
417
|
expertAdvice: string;
|
|
372
418
|
expertName: string;
|
|
@@ -384,6 +430,20 @@ export declare const tradeSafetyTranslations: {
|
|
|
384
430
|
message: string;
|
|
385
431
|
};
|
|
386
432
|
};
|
|
433
|
+
safetyLevel: {
|
|
434
|
+
safe: {
|
|
435
|
+
title: string;
|
|
436
|
+
description: string;
|
|
437
|
+
};
|
|
438
|
+
caution: {
|
|
439
|
+
title: string;
|
|
440
|
+
description: string;
|
|
441
|
+
};
|
|
442
|
+
danger: {
|
|
443
|
+
title: string;
|
|
444
|
+
description: string;
|
|
445
|
+
};
|
|
446
|
+
};
|
|
387
447
|
companionCta: {
|
|
388
448
|
title: string;
|
|
389
449
|
description: string;
|
|
@@ -460,6 +520,7 @@ export declare const tradeSafetyTranslations: {
|
|
|
460
520
|
priceWarnings: string;
|
|
461
521
|
safetyChecklist: string;
|
|
462
522
|
checklistDescription: string;
|
|
523
|
+
aiSummary: string;
|
|
463
524
|
recommendation: string;
|
|
464
525
|
expertAdvice: string;
|
|
465
526
|
expertName: string;
|
|
@@ -477,6 +538,20 @@ export declare const tradeSafetyTranslations: {
|
|
|
477
538
|
message: string;
|
|
478
539
|
};
|
|
479
540
|
};
|
|
541
|
+
safetyLevel: {
|
|
542
|
+
safe: {
|
|
543
|
+
title: string;
|
|
544
|
+
description: string;
|
|
545
|
+
};
|
|
546
|
+
caution: {
|
|
547
|
+
title: string;
|
|
548
|
+
description: string;
|
|
549
|
+
};
|
|
550
|
+
danger: {
|
|
551
|
+
title: string;
|
|
552
|
+
description: string;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
480
555
|
companionCta: {
|
|
481
556
|
title: string;
|
|
482
557
|
description: string;
|
|
@@ -553,6 +628,7 @@ export declare const tradeSafetyTranslations: {
|
|
|
553
628
|
priceWarnings: string;
|
|
554
629
|
safetyChecklist: string;
|
|
555
630
|
checklistDescription: string;
|
|
631
|
+
aiSummary: string;
|
|
556
632
|
recommendation: string;
|
|
557
633
|
expertAdvice: string;
|
|
558
634
|
expertName: string;
|
|
@@ -570,6 +646,20 @@ export declare const tradeSafetyTranslations: {
|
|
|
570
646
|
message: string;
|
|
571
647
|
};
|
|
572
648
|
};
|
|
649
|
+
safetyLevel: {
|
|
650
|
+
safe: {
|
|
651
|
+
title: string;
|
|
652
|
+
description: string;
|
|
653
|
+
};
|
|
654
|
+
caution: {
|
|
655
|
+
title: string;
|
|
656
|
+
description: string;
|
|
657
|
+
};
|
|
658
|
+
danger: {
|
|
659
|
+
title: string;
|
|
660
|
+
description: string;
|
|
661
|
+
};
|
|
662
|
+
};
|
|
573
663
|
companionCta: {
|
|
574
664
|
title: string;
|
|
575
665
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/i18n/translations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,6BAA6B;AAC7B,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/i18n/translations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,6BAA6B;AAC7B,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOnC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),f=require("react-i18next");require("i18next");require("i18next-resources-to-backend");const u=require("./locale.js"),d=require("react"),E=require("@aioia/core"),a=require("zod");function O(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const c=O(d);function w(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(r=w(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function _(){for(var e,t,r=0,s="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=w(e))&&(s&&(s+=" "),s+=t);return s}const R={default:"border-base-300",error:"border-error bg-error/10",warning:"border-warning bg-warning/10",success:"border-success bg-success/10",info:"border-info bg-info/10"};function h({title:e,icon:t,variant:r="default",children:s}){return s?n.jsxs("div",{className:_("rounded-lg border p-6",R[r]),children:[e&&n.jsxs("h2",{className:"mb-2 flex items-center gap-2 font-bold",children:[e,t]}),s]}):null}function T({data:e}){const{t,i18n:r}=f.useTranslation(u.TRADE_SAFETY_NS);return e?n.jsxs(h,{title:t("result.priceAnalysis"),children:[e.market_price_range&&n.jsxs("div",{className:"mb-2",children:[n.jsx("h3",{className:"text-sm font-bold",children:t("result.marketPrice")}),n.jsx("p",{className:"text-xs",children:e.market_price_range})]}),e.offered_price&&n.jsxs("div",{className:"mb-2",children:[n.jsx("h3",{className:"text-sm font-bold",children:t("result.offeredPrice")}),n.jsx("p",{className:"text-xs",children:new Intl.NumberFormat(r.language,{style:"currency",currency:e.currency||"USD"}).format(e.offered_price)})]}),e.price_assessment&&n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold",children:t("result.priceAssessment")}),n.jsx("p",{className:"text-xs",children:e.price_assessment})]})]}):null}function A({recommendation:e}){const{t}=f.useTranslation(u.TRADE_SAFETY_NS);return e?n.jsx(h,{title:t("result.recommendation"),children:n.jsx("p",{className:"text-xs",children:e})}):null}function k({title:e,titleId:t,...r},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))}const P=c.forwardRef(k);function C({title:e,titleId:t,...r},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))}const D=c.forwardRef(C);function F({title:e,titleId:t,...r},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-2.625 6c-.54 0-.828.419-.936.634a1.96 1.96 0 0 0-.189.866c0 .298.059.605.189.866.108.215.395.634.936.634.54 0 .828-.419.936-.634.13-.26.189-.568.189-.866 0-.298-.059-.605-.189-.866-.108-.215-.395-.634-.936-.634Zm4.314.634c.108-.215.395-.634.936-.634.54 0 .828.419.936.634.13.26.189.568.189.866 0 .298-.059.605-.189.866-.108.215-.395.634-.936.634-.54 0-.828-.419-.936-.634a1.96 1.96 0 0 1-.189-.866c0-.298.059-.605.189-.866Zm-4.34 7.964a.75.75 0 0 1-1.061-1.06 5.236 5.236 0 0 1 3.73-1.538 5.236 5.236 0 0 1 3.695 1.538.75.75 0 1 1-1.061 1.06 3.736 3.736 0 0 0-2.639-1.098 3.736 3.736 0 0 0-2.664 1.098Z",clipRule:"evenodd"}))}const M=c.forwardRef(F);function H({title:e,titleId:t,...r},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M11.484 2.17a.75.75 0 0 1 1.032 0 11.209 11.209 0 0 0 7.877 3.08.75.75 0 0 1 .722.515 12.74 12.74 0 0 1 .635 3.985c0 5.942-4.064 10.933-9.563 12.348a.749.749 0 0 1-.374 0C6.314 20.683 2.25 15.692 2.25 9.75c0-1.39.223-2.73.635-3.985a.75.75 0 0 1 .722-.516l.143.001c2.996 0 5.718-1.17 7.734-3.08ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75ZM12 15a.75.75 0 0 0-.75.75v.008c0 .414.336.75.75.75h.008a.75.75 0 0 0 .75-.75v-.008a.75.75 0 0 0-.75-.75H12Z",clipRule:"evenodd"}))}const Z=c.forwardRef(H);function I({items:e}){const{t}=f.useTranslation(u.TRADE_SAFETY_NS);return e.length===0?null:n.jsxs("div",{className:"mb-4",children:[n.jsxs("h2",{className:"flex items-center gap-1 py-4 font-bold",children:[t("result.safetyChecklist")," ",n.jsx(P,{className:"size-6"})]}),n.jsx(h,{variant:"info",children:e.map((r,s)=>n.jsxs("label",{className:"label w-fit cursor-pointer gap-2",children:[n.jsx("input",{type:"checkbox",className:"checkbox rounded-full [--chkbg:theme(colors.neutral)] [--chkfg:theme(colors.neutral-content)]"}),n.jsx("span",{className:"label-text",children:r})]},s))})]})}const B={error:M,warning:D,success:Z},L={error:"result.riskSignals",warning:"result.cautions",success:"result.safeIndicators"};function g({signals:e,variant:t="error"}){const{t:r}=f.useTranslation(u.TRADE_SAFETY_NS);if(e.length===0)return null;const s=B[t];return n.jsxs("div",{className:"mb-4",children:[n.jsxs("h2",{className:"flex items-center gap-1 py-4 font-bold",children:[r(L[t])," ",n.jsx(s,{className:"size-6"})]}),n.jsx("div",{className:"space-y-3",children:e.map((l,i)=>n.jsx(h,{variant:t,children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold",children:l.title}),n.jsx("p",{className:"text-xs",children:l.description})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold",children:r("result.whatToDo")}),n.jsx("p",{className:"text-xs",children:l.what_to_do})]})]})},i))})]})}function q({translation:e,nuance:t}){const{t:r}=f.useTranslation(u.TRADE_SAFETY_NS);return n.jsxs(h,{title:r("result.translation"),children:[e&&n.jsxs("div",{className:"mb-2",children:[n.jsx("h3",{className:"text-sm font-bold",children:r("result.translationTitle")}),n.jsx("p",{className:"text-xs",children:e})]}),t&&n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-bold",children:r("result.nuanceTitle")}),n.jsx("p",{className:"text-xs",children:t})]})]})}function Y({analysis:e}){return n.jsxs("div",{children:[n.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[(e.translation||e.nuance_explanation)&&n.jsx(q,{translation:e.translation,nuance:e.nuance_explanation}),e.price_analysis&&n.jsx(T,{data:e.price_analysis}),e.recommendation&&n.jsx(A,{recommendation:e.recommendation})]}),e.risk_signals.length>0&&n.jsx(g,{signals:e.risk_signals,variant:"error"}),e.cautions.length>0&&n.jsx(g,{signals:e.cautions,variant:"warning"}),e.safe_indicators.length>0&&n.jsx(g,{signals:e.safe_indicators,variant:"success"}),e.safety_checklist.length>0&&n.jsx(I,{items:e.safety_checklist})]})}var N={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},v=d.createContext&&d.createContext(N),K=["attr","size","title"];function W(e,t){if(e==null)return{};var r=$(e,t),s,l;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(l=0;l<i.length;l++)s=i[l],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function $(e,t){if(e==null)return{};var r={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;r[s]=e[s]}return r}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},b.apply(this,arguments)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,s)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?y(Object(r),!0).forEach(function(s){V(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function V(e,t,r){return t=X(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X(e){var t=G(e,"string");return typeof t=="symbol"?t:t+""}function G(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function S(e){return e&&e.map((t,r)=>d.createElement(t.tag,p({key:r},t.attr),S(t.child)))}function z(e){return t=>d.createElement(U,b({attr:p({},e.attr)},t),S(e.child))}function U(e){var t=r=>{var{attr:s,size:l,title:i}=e,x=W(e,K),m=l||r.size||"1em",o;return r.className&&(o=r.className),e.className&&(o=(o?o+" ":"")+e.className),d.createElement("svg",b({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,s,x,{className:o,style:p(p({color:e.color||r.color},r.style),e.style),height:m,width:m,xmlns:"http://www.w3.org/2000/svg"}),i&&d.createElement("title",null,i),e.children)};return v!==void 0?d.createElement(v.Consumer,null,r=>t(r)):t(N)}function J(e){return z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 256C0 114.6 114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256L37.1 512c-13.7 0-20.5-16.5-10.9-26.2L75 437C28.7 390.7 0 326.7 0 256zM349.6 153.6c23.6 0 42.7-19.1 42.7-42.7s-19.1-42.7-42.7-42.7c-20.6 0-37.8 14.6-41.8 34c-34.5 3.7-61.4 33-61.4 68.4l0 .2c-37.5 1.6-71.8 12.3-99 29.1c-10.1-7.8-22.8-12.5-36.5-12.5c-33 0-59.8 26.8-59.8 59.8c0 24 14.1 44.6 34.4 54.1c2 69.4 77.6 125.2 170.6 125.2s168.7-55.9 170.6-125.3c20.2-9.6 34.1-30.2 34.1-54c0-33-26.8-59.8-59.8-59.8c-13.7 0-26.3 4.6-36.4 12.4c-27.4-17-62.1-27.7-100-29.1l0-.2c0-25.4 18.9-46.5 43.4-49.9l0 0c4.4 18.8 21.3 32.8 41.5 32.8zM177.1 246.9c16.7 0 29.5 17.6 28.5 39.3s-13.5 29.6-30.3 29.6s-31.4-8.8-30.4-30.5s15.4-38.3 32.1-38.3zm190.1 38.3c1 21.7-13.7 30.5-30.4 30.5s-29.3-7.9-30.3-29.6c-1-21.7 11.8-39.3 28.5-39.3s31.2 16.6 32.1 38.3zm-48.1 56.7c-10.3 24.6-34.6 41.9-63 41.9s-52.7-17.3-63-41.9c-1.2-2.9 .8-6.2 3.9-6.5c18.4-1.9 38.3-2.9 59.1-2.9s40.7 1 59.1 2.9c3.1 .3 5.1 3.6 3.9 6.5z"},child:[]}]})(e)}function Q(e){return z({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)}function ee({value:e,onChange:t,onSubmit:r,isLoading:s,error:l}){const{t:i}=f.useTranslation(u.TRADE_SAFETY_NS),x=s?n.jsx("span",{className:"loading loading-spinner loading-sm"}):i("hero.checkSafety"),m=s||!e.trim();return n.jsx("div",{className:"flex w-full flex-col items-center justify-center",children:n.jsxs("div",{className:"w-full lg:max-w-[720px]",children:[n.jsx("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:i("hero.title")}),n.jsx("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:i("hero.subtitle")}),n.jsxs("div",{className:_("mb-4",!l&&"sm:mb-8 md:mb-12"),children:[n.jsxs("div",{className:"relative hidden lg:block",children:[n.jsx("input",{type:"text",className:"input input-bordered h-[72px] w-full pr-36 text-sm placeholder:text-base-300 focus:outline-none",placeholder:i("hero.placeholder"),"aria-label":i("hero.placeholder"),value:e,onChange:o=>t(o.target.value),disabled:s,onKeyDown:o=>{o.key==="Enter"&&!m&&r()}}),n.jsx("button",{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",onClick:r,disabled:m,children:x})]}),n.jsx("div",{className:"block lg:hidden",children:n.jsxs("div",{className:"relative h-[400px] w-full overflow-hidden rounded-xl border border-base-300 bg-base-100",children:[!e&&n.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden p-5 pb-24 text-base text-base-300","aria-hidden":"true",children:n.jsxs("div",{className:"whitespace-pre-line leading-relaxed",children:[n.jsx("p",{className:"mb-4 text-base-300",children:i("hero.placeholder")}),i("hero.placeholderExample")]})}),n.jsx("div",{className:"absolute inset-0 overflow-hidden pb-24",children:n.jsx("textarea",{className:"textarea size-full resize-none overflow-auto bg-transparent p-4 leading-6 text-base-content focus:outline-none",value:e,"aria-label":i("hero.placeholder"),onChange:o=>t(o.target.value),disabled:s,placeholder:""})}),n.jsx("div",{className:"absolute inset-x-4 bottom-4 z-10",children:n.jsx("button",{className:"btn btn-neutral h-16 w-full text-base font-medium text-neutral-content",onClick:r,disabled:m,children:x})})]})})]}),l&&n.jsx("div",{className:"alert alert-error mb-6 flex items-center gap-2 text-sm",children:n.jsx("span",{children:l})}),n.jsx("p",{className:"mb-4 text-left text-xs text-base-content/60 sm:mb-8 sm:text-center md:mb-12",children:i("hero.disclaimer")}),n.jsxs("div",{className:"flex items-center justify-start gap-6 sm:justify-center",children:[n.jsx("a",{href:"https://x.com",target:"_blank",rel:"noopener noreferrer","aria-label":"X",children:n.jsx(Q,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})}),n.jsx("a",{href:"https://reddit.com",target:"_blank",rel:"noopener noreferrer","aria-label":"Reddit",children:n.jsx(J,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})})]})]})})}const j=a.z.object({category:a.z.enum(["payment","seller","platform","price","content"]),severity:a.z.enum(["high","medium","low"]),title:a.z.string(),description:a.z.string(),what_to_do:a.z.string()}),te=a.z.object({market_price_range:a.z.string().nullish(),offered_price:a.z.number().nullish(),currency:a.z.string().nullish(),price_assessment:a.z.string(),warnings:a.z.array(a.z.string())}),re=a.z.object({translation:a.z.string().nullish(),nuance_explanation:a.z.string().nullish(),risk_signals:a.z.array(j),cautions:a.z.array(j),safe_indicators:a.z.array(j),price_analysis:te,safety_checklist:a.z.array(a.z.string()),risk_score:a.z.number(),recommendation:a.z.string(),emotional_support:a.z.string()}),ne=a.z.object({id:a.z.string(),user_id:a.z.string().nullish(),input_text:a.z.string(),llm_analysis:re,risk_score:a.z.number(),expert_advice:a.z.string().nullish(),expert_reviewed:a.z.boolean(),expert_reviewed_at:a.z.string().nullish(),expert_reviewed_by:a.z.string().nullish(),created_at:a.z.string(),updated_at:a.z.string()});class se extends E.BaseCrudRepository{constructor(){super(...arguments),this.resource="trade-safety"}getDataSchema(){return ne}}const ae={high:70,medium:40};exports.TRADE_SAFETY_NS=u.TRADE_SAFETY_NS;exports.tradeSafetyTranslations=u.tradeSafetyTranslations;exports.DetailedResult=Y;exports.HomeHeroSection=ee;exports.RISK_SCORE_THRESHOLDS=ae;exports.TradeSafetyRepository=se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react-i18next");require("i18next");require("i18next-resources-to-backend");const d=require("./locale.js"),u=require("react"),E=require("@aioia/core"),a=require("zod");function O(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const c=O(u);function _(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=_(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function w(){for(var e,t,n=0,s="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=_(e))&&(s&&(s+=" "),s+=t);return s}const T={default:"border-base-300",error:"border-error bg-error/10",warning:"border-warning bg-warning/10",success:"border-success bg-success/10",info:"border-info bg-info/10"};function h({title:e,icon:t,variant:n="default",children:s}){return s?r.jsxs("div",{className:w("rounded-lg border p-6",T[n]),children:[e&&r.jsxs("h2",{className:"mb-2 flex items-center gap-2 font-bold",children:[e,t]}),s]}):null}function R({summary:e}){const{t}=m.useTranslation(d.TRADE_SAFETY_NS);return r.jsx(h,{title:t("result.aiSummary"),children:r.jsx("p",{className:"rounded-lg bg-base-200 p-6 text-sm leading-relaxed text-base-content",children:e})})}function A({data:e}){const{t,i18n:n}=m.useTranslation(d.TRADE_SAFETY_NS);return e?r.jsxs(h,{title:t("result.priceAnalysis"),children:[e.market_price_range&&r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"text-sm font-bold",children:t("result.marketPrice")}),r.jsx("p",{className:"text-xs",children:e.market_price_range})]}),e.offered_price&&r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"text-sm font-bold",children:t("result.offeredPrice")}),r.jsx("p",{className:"text-xs",children:new Intl.NumberFormat(n.language,{style:"currency",currency:e.currency||"USD"}).format(e.offered_price)})]}),e.price_assessment&&r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold",children:t("result.priceAssessment")}),r.jsx("p",{className:"text-xs",children:e.price_assessment})]})]}):null}function P({recommendation:e}){const{t}=m.useTranslation(d.TRADE_SAFETY_NS);return e?r.jsx(h,{title:t("result.recommendation"),children:r.jsx("p",{className:"text-xs",children:e})}):null}function C({title:e,titleId:t,...n},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))}const k=c.forwardRef(C);function D({title:e,titleId:t,...n},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))}const F=c.forwardRef(D);function M({title:e,titleId:t,...n},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-2.625 6c-.54 0-.828.419-.936.634a1.96 1.96 0 0 0-.189.866c0 .298.059.605.189.866.108.215.395.634.936.634.54 0 .828-.419.936-.634.13-.26.189-.568.189-.866 0-.298-.059-.605-.189-.866-.108-.215-.395-.634-.936-.634Zm4.314.634c.108-.215.395-.634.936-.634.54 0 .828.419.936.634.13.26.189.568.189.866 0 .298-.059.605-.189.866-.108.215-.395.634-.936.634-.54 0-.828-.419-.936-.634a1.96 1.96 0 0 1-.189-.866c0-.298.059-.605.189-.866Zm-4.34 7.964a.75.75 0 0 1-1.061-1.06 5.236 5.236 0 0 1 3.73-1.538 5.236 5.236 0 0 1 3.695 1.538.75.75 0 1 1-1.061 1.06 3.736 3.736 0 0 0-2.639-1.098 3.736 3.736 0 0 0-2.664 1.098Z",clipRule:"evenodd"}))}const H=c.forwardRef(M);function Z({title:e,titleId:t,...n},s){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},n),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M11.484 2.17a.75.75 0 0 1 1.032 0 11.209 11.209 0 0 0 7.877 3.08.75.75 0 0 1 .722.515 12.74 12.74 0 0 1 .635 3.985c0 5.942-4.064 10.933-9.563 12.348a.749.749 0 0 1-.374 0C6.314 20.683 2.25 15.692 2.25 9.75c0-1.39.223-2.73.635-3.985a.75.75 0 0 1 .722-.516l.143.001c2.996 0 5.718-1.17 7.734-3.08ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75ZM12 15a.75.75 0 0 0-.75.75v.008c0 .414.336.75.75.75h.008a.75.75 0 0 0 .75-.75v-.008a.75.75 0 0 0-.75-.75H12Z",clipRule:"evenodd"}))}const Y=c.forwardRef(Z);function B({items:e}){const{t}=m.useTranslation(d.TRADE_SAFETY_NS);return e.length===0?null:r.jsxs("div",{className:"mb-4",children:[r.jsxs("h2",{className:"flex items-center gap-1 py-4 font-bold",children:[t("result.safetyChecklist")," ",r.jsx(k,{className:"size-6"})]}),r.jsx(h,{variant:"info",children:e.map((n,s)=>r.jsxs("label",{className:"label w-fit cursor-pointer gap-2",children:[r.jsx("input",{type:"checkbox",className:"checkbox rounded-full [--chkbg:theme(colors.neutral)] [--chkfg:theme(colors.neutral-content)]"}),r.jsx("span",{className:"label-text",children:n})]},s))})]})}const I={error:H,warning:F,success:Y},L={error:"result.riskSignals",warning:"result.cautions",success:"result.safeIndicators"};function g({signals:e,variant:t="error"}){const{t:n}=m.useTranslation(d.TRADE_SAFETY_NS);if(e.length===0)return null;const s=I[t];return r.jsxs("div",{className:"mb-4",children:[r.jsxs("h2",{className:"flex items-center gap-1 py-4 font-bold",children:[n(L[t])," ",r.jsx(s,{className:"size-6"})]}),r.jsx("div",{className:"space-y-3",children:e.map((l,i)=>r.jsx(h,{variant:t,children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold",children:l.title}),r.jsx("p",{className:"text-xs",children:l.description})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold",children:n("result.whatToDo")}),r.jsx("p",{className:"text-xs",children:l.what_to_do})]})]})},i))})]})}function q({translation:e,nuance:t}){const{t:n}=m.useTranslation(d.TRADE_SAFETY_NS);return r.jsxs(h,{title:n("result.translation"),children:[e&&r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"text-sm font-bold",children:n("result.translationTitle")}),r.jsx("p",{className:"text-xs",children:e})]}),t&&r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-bold",children:n("result.nuanceTitle")}),r.jsx("p",{className:"text-xs",children:t})]})]})}function W({analysis:e}){return r.jsxs("div",{children:[e.ai_summary&&r.jsx(R,{summary:e.ai_summary}),r.jsxs("div",{className:"my-4 flex flex-col gap-4",children:[(e.translation||e.nuance_explanation)&&r.jsx(q,{translation:e.translation,nuance:e.nuance_explanation}),e.price_analysis&&r.jsx(A,{data:e.price_analysis}),e.recommendation&&r.jsx(P,{recommendation:e.recommendation})]}),e.risk_signals.length>0&&r.jsx(g,{signals:e.risk_signals,variant:"error"}),e.cautions.length>0&&r.jsx(g,{signals:e.cautions,variant:"warning"}),e.safe_indicators.length>0&&r.jsx(g,{signals:e.safe_indicators,variant:"success"}),e.safety_checklist.length>0&&r.jsx(B,{items:e.safety_checklist})]})}var N={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},v=u.createContext&&u.createContext(N),$=["attr","size","title"];function K(e,t){if(e==null)return{};var n=V(e,t),s,l;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(l=0;l<i.length;l++)s=i[l],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function V(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},b.apply(this,arguments)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,s)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(s){X(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function X(e,t,n){return t=G(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G(e){var t=U(e,"string");return typeof t=="symbol"?t:t+""}function U(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function S(e){return e&&e.map((t,n)=>u.createElement(t.tag,p({key:n},t.attr),S(t.child)))}function z(e){return t=>u.createElement(J,b({attr:p({},e.attr)},t),S(e.child))}function J(e){var t=n=>{var{attr:s,size:l,title:i}=e,x=K(e,$),f=l||n.size||"1em",o;return n.className&&(o=n.className),e.className&&(o=(o?o+" ":"")+e.className),u.createElement("svg",b({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,s,x,{className:o,style:p(p({color:e.color||n.color},n.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),i&&u.createElement("title",null,i),e.children)};return v!==void 0?u.createElement(v.Consumer,null,n=>t(n)):t(N)}function Q(e){return z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 256C0 114.6 114.6 0 256 0S512 114.6 512 256s-114.6 256-256 256L37.1 512c-13.7 0-20.5-16.5-10.9-26.2L75 437C28.7 390.7 0 326.7 0 256zM349.6 153.6c23.6 0 42.7-19.1 42.7-42.7s-19.1-42.7-42.7-42.7c-20.6 0-37.8 14.6-41.8 34c-34.5 3.7-61.4 33-61.4 68.4l0 .2c-37.5 1.6-71.8 12.3-99 29.1c-10.1-7.8-22.8-12.5-36.5-12.5c-33 0-59.8 26.8-59.8 59.8c0 24 14.1 44.6 34.4 54.1c2 69.4 77.6 125.2 170.6 125.2s168.7-55.9 170.6-125.3c20.2-9.6 34.1-30.2 34.1-54c0-33-26.8-59.8-59.8-59.8c-13.7 0-26.3 4.6-36.4 12.4c-27.4-17-62.1-27.7-100-29.1l0-.2c0-25.4 18.9-46.5 43.4-49.9l0 0c4.4 18.8 21.3 32.8 41.5 32.8zM177.1 246.9c16.7 0 29.5 17.6 28.5 39.3s-13.5 29.6-30.3 29.6s-31.4-8.8-30.4-30.5s15.4-38.3 32.1-38.3zm190.1 38.3c1 21.7-13.7 30.5-30.4 30.5s-29.3-7.9-30.3-29.6c-1-21.7 11.8-39.3 28.5-39.3s31.2 16.6 32.1 38.3zm-48.1 56.7c-10.3 24.6-34.6 41.9-63 41.9s-52.7-17.3-63-41.9c-1.2-2.9 .8-6.2 3.9-6.5c18.4-1.9 38.3-2.9 59.1-2.9s40.7 1 59.1 2.9c3.1 .3 5.1 3.6 3.9 6.5z"},child:[]}]})(e)}function ee(e){return z({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)}function te({value:e,onChange:t,onSubmit:n,isLoading:s,error:l}){const{t:i}=m.useTranslation(d.TRADE_SAFETY_NS),x=s?r.jsx("span",{className:"loading loading-spinner loading-sm"}):i("hero.checkSafety"),f=s||!e.trim();return r.jsx("div",{className:"flex w-full flex-col items-center justify-center",children:r.jsxs("div",{className:"w-full lg:max-w-[720px]",children:[r.jsx("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:i("hero.title")}),r.jsx("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:i("hero.subtitle")}),r.jsxs("div",{className:w("mb-4",!l&&"sm:mb-8 md:mb-12"),children:[r.jsxs("div",{className:"relative hidden lg:block",children:[r.jsx("input",{type:"text",className:"input input-bordered h-[72px] w-full pr-36 text-sm placeholder:text-base-300 focus:outline-none",placeholder:i("hero.placeholder"),"aria-label":i("hero.placeholder"),value:e,onChange:o=>t(o.target.value),disabled:s,onKeyDown:o=>{o.key==="Enter"&&!f&&n()}}),r.jsx("button",{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",onClick:n,disabled:f,children:x})]}),r.jsx("div",{className:"block lg:hidden",children:r.jsxs("div",{className:"relative h-[400px] w-full overflow-hidden rounded-xl border border-base-300 bg-base-100",children:[!e&&r.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden p-5 pb-24 text-base text-base-300","aria-hidden":"true",children:r.jsxs("div",{className:"whitespace-pre-line leading-relaxed",children:[r.jsx("p",{className:"mb-4 text-base-300",children:i("hero.placeholder")}),i("hero.placeholderExample")]})}),r.jsx("div",{className:"absolute inset-0 overflow-hidden pb-24",children:r.jsx("textarea",{className:"textarea size-full resize-none overflow-auto bg-transparent p-4 leading-6 text-base-content focus:outline-none",value:e,"aria-label":i("hero.placeholder"),onChange:o=>t(o.target.value),disabled:s,placeholder:""})}),r.jsx("div",{className:"absolute inset-x-4 bottom-4 z-10",children:r.jsx("button",{className:"btn btn-neutral h-16 w-full text-base font-medium text-neutral-content",onClick:n,disabled:f,children:x})})]})})]}),l&&r.jsx("div",{className:"alert alert-error mb-6 flex items-center gap-2 text-sm",children:r.jsx("span",{children:l})}),r.jsx("p",{className:"mb-4 text-left text-xs text-base-content/60 sm:mb-8 sm:text-center md:mb-12",children:i("hero.disclaimer")}),r.jsxs("div",{className:"flex items-center justify-start gap-6 sm:justify-center",children:[r.jsx("a",{href:"https://x.com",target:"_blank",rel:"noopener noreferrer","aria-label":"X",children:r.jsx(ee,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})}),r.jsx("a",{href:"https://reddit.com",target:"_blank",rel:"noopener noreferrer","aria-label":"Reddit",children:r.jsx(Q,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})})]})]})})}const j=a.z.object({category:a.z.enum(["payment","seller","platform","price","content"]),severity:a.z.enum(["high","medium","low"]),title:a.z.string(),description:a.z.string(),what_to_do:a.z.string()}),re=a.z.object({market_price_range:a.z.string().nullish(),offered_price:a.z.number().nullish(),currency:a.z.string().nullish(),price_assessment:a.z.string(),warnings:a.z.array(a.z.string())}),ne=a.z.object({ai_summary:a.z.string(),translation:a.z.string().nullish(),nuance_explanation:a.z.string().nullish(),risk_signals:a.z.array(j),cautions:a.z.array(j),safe_indicators:a.z.array(j),price_analysis:re,safety_checklist:a.z.array(a.z.string()),safe_score:a.z.number(),recommendation:a.z.string(),emotional_support:a.z.string()}),se=a.z.object({id:a.z.string(),user_id:a.z.string().nullish(),input_text:a.z.string(),llm_analysis:ne,safe_score:a.z.number(),expert_advice:a.z.string().nullish(),expert_reviewed:a.z.boolean(),expert_reviewed_at:a.z.string().nullish(),expert_reviewed_by:a.z.string().nullish(),created_at:a.z.string(),updated_at:a.z.string()});class ae extends E.BaseCrudRepository{constructor(){super(...arguments),this.resource="trade-safety"}getDataSchema(){return se}}const le={safe:70,caution:40};exports.TRADE_SAFETY_NS=d.TRADE_SAFETY_NS;exports.tradeSafetyTranslations=d.tradeSafetyTranslations;exports.DetailedResult=W;exports.HomeHeroSection=te;exports.SAFETY_SCORE_THRESHOLDS=le;exports.TradeSafetyRepository=ae;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|