trade-safety 1.11.0 → 1.12.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 +2 -2
- package/dist/components/DetailedResult/AISummarySection.d.ts.map +1 -1
- package/dist/components/PageHeader.d.ts.map +1 -1
- package/dist/i18n/translations.d.ts +27 -0
- package/dist/i18n/translations.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1060 -339
- package/dist/index.mjs.map +1 -1
- package/dist/isChromatic-5i32AXac-BWePUv7P.js +2 -0
- package/dist/isChromatic-5i32AXac-BWePUv7P.js.map +1 -0
- package/dist/isChromatic-5i32AXac-CtZ5BKgh.mjs +8 -0
- package/dist/isChromatic-5i32AXac-CtZ5BKgh.mjs.map +1 -0
- package/dist/locale.js +19 -19
- package/dist/locale.mjs +33 -33
- package/dist/lottie-react.esm-BUHy0Xb6.mjs +6105 -0
- package/dist/lottie-react.esm-BUHy0Xb6.mjs.map +1 -0
- package/dist/lottie-react.esm-Bv7L41xK.js +257 -0
- package/dist/lottie-react.esm-Bv7L41xK.js.map +1 -0
- package/dist/repositories/TradeSafetyRepository.d.ts +10 -10
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface AISummarySectionProps {
|
|
2
|
-
summary: string;
|
|
2
|
+
summary: string[];
|
|
3
3
|
}
|
|
4
|
-
export declare function AISummarySection({ summary }: AISummarySectionProps): import("react").JSX.Element;
|
|
4
|
+
export declare function AISummarySection({ summary }: AISummarySectionProps): import("react").JSX.Element | null;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=AISummarySection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AISummarySection.d.ts","sourceRoot":"","sources":["../../../src/components/DetailedResult/AISummarySection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AISummarySection.d.ts","sourceRoot":"","sources":["../../../src/components/DetailedResult/AISummarySection.tsx"],"names":[],"mappings":"AAUA,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,qBAAqB,sCAyBlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/components/PageHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/components/PageHeader.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAQD,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,eAAe,+BAsC3D"}
|
|
@@ -116,14 +116,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
116
116
|
};
|
|
117
117
|
safetyLevel: {
|
|
118
118
|
safe: {
|
|
119
|
+
badge: string;
|
|
119
120
|
title: string;
|
|
120
121
|
description: string;
|
|
121
122
|
};
|
|
122
123
|
caution: {
|
|
124
|
+
badge: string;
|
|
123
125
|
title: string;
|
|
124
126
|
description: string;
|
|
125
127
|
};
|
|
126
128
|
danger: {
|
|
129
|
+
badge: string;
|
|
127
130
|
title: string;
|
|
128
131
|
description: string;
|
|
129
132
|
};
|
|
@@ -244,14 +247,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
244
247
|
};
|
|
245
248
|
safetyLevel: {
|
|
246
249
|
safe: {
|
|
250
|
+
badge: string;
|
|
247
251
|
title: string;
|
|
248
252
|
description: string;
|
|
249
253
|
};
|
|
250
254
|
caution: {
|
|
255
|
+
badge: string;
|
|
251
256
|
title: string;
|
|
252
257
|
description: string;
|
|
253
258
|
};
|
|
254
259
|
danger: {
|
|
260
|
+
badge: string;
|
|
255
261
|
title: string;
|
|
256
262
|
description: string;
|
|
257
263
|
};
|
|
@@ -372,14 +378,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
372
378
|
};
|
|
373
379
|
safetyLevel: {
|
|
374
380
|
safe: {
|
|
381
|
+
badge: string;
|
|
375
382
|
title: string;
|
|
376
383
|
description: string;
|
|
377
384
|
};
|
|
378
385
|
caution: {
|
|
386
|
+
badge: string;
|
|
379
387
|
title: string;
|
|
380
388
|
description: string;
|
|
381
389
|
};
|
|
382
390
|
danger: {
|
|
391
|
+
badge: string;
|
|
383
392
|
title: string;
|
|
384
393
|
description: string;
|
|
385
394
|
};
|
|
@@ -500,14 +509,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
500
509
|
};
|
|
501
510
|
safetyLevel: {
|
|
502
511
|
safe: {
|
|
512
|
+
badge: string;
|
|
503
513
|
title: string;
|
|
504
514
|
description: string;
|
|
505
515
|
};
|
|
506
516
|
caution: {
|
|
517
|
+
badge: string;
|
|
507
518
|
title: string;
|
|
508
519
|
description: string;
|
|
509
520
|
};
|
|
510
521
|
danger: {
|
|
522
|
+
badge: string;
|
|
511
523
|
title: string;
|
|
512
524
|
description: string;
|
|
513
525
|
};
|
|
@@ -628,14 +640,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
628
640
|
};
|
|
629
641
|
safetyLevel: {
|
|
630
642
|
safe: {
|
|
643
|
+
badge: string;
|
|
631
644
|
title: string;
|
|
632
645
|
description: string;
|
|
633
646
|
};
|
|
634
647
|
caution: {
|
|
648
|
+
badge: string;
|
|
635
649
|
title: string;
|
|
636
650
|
description: string;
|
|
637
651
|
};
|
|
638
652
|
danger: {
|
|
653
|
+
badge: string;
|
|
639
654
|
title: string;
|
|
640
655
|
description: string;
|
|
641
656
|
};
|
|
@@ -756,14 +771,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
756
771
|
};
|
|
757
772
|
safetyLevel: {
|
|
758
773
|
safe: {
|
|
774
|
+
badge: string;
|
|
759
775
|
title: string;
|
|
760
776
|
description: string;
|
|
761
777
|
};
|
|
762
778
|
caution: {
|
|
779
|
+
badge: string;
|
|
763
780
|
title: string;
|
|
764
781
|
description: string;
|
|
765
782
|
};
|
|
766
783
|
danger: {
|
|
784
|
+
badge: string;
|
|
767
785
|
title: string;
|
|
768
786
|
description: string;
|
|
769
787
|
};
|
|
@@ -884,14 +902,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
884
902
|
};
|
|
885
903
|
safetyLevel: {
|
|
886
904
|
safe: {
|
|
905
|
+
badge: string;
|
|
887
906
|
title: string;
|
|
888
907
|
description: string;
|
|
889
908
|
};
|
|
890
909
|
caution: {
|
|
910
|
+
badge: string;
|
|
891
911
|
title: string;
|
|
892
912
|
description: string;
|
|
893
913
|
};
|
|
894
914
|
danger: {
|
|
915
|
+
badge: string;
|
|
895
916
|
title: string;
|
|
896
917
|
description: string;
|
|
897
918
|
};
|
|
@@ -1012,14 +1033,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
1012
1033
|
};
|
|
1013
1034
|
safetyLevel: {
|
|
1014
1035
|
safe: {
|
|
1036
|
+
badge: string;
|
|
1015
1037
|
title: string;
|
|
1016
1038
|
description: string;
|
|
1017
1039
|
};
|
|
1018
1040
|
caution: {
|
|
1041
|
+
badge: string;
|
|
1019
1042
|
title: string;
|
|
1020
1043
|
description: string;
|
|
1021
1044
|
};
|
|
1022
1045
|
danger: {
|
|
1046
|
+
badge: string;
|
|
1023
1047
|
title: string;
|
|
1024
1048
|
description: string;
|
|
1025
1049
|
};
|
|
@@ -1140,14 +1164,17 @@ export declare const tradeSafetyTranslations: {
|
|
|
1140
1164
|
};
|
|
1141
1165
|
safetyLevel: {
|
|
1142
1166
|
safe: {
|
|
1167
|
+
badge: string;
|
|
1143
1168
|
title: string;
|
|
1144
1169
|
description: string;
|
|
1145
1170
|
};
|
|
1146
1171
|
caution: {
|
|
1172
|
+
badge: string;
|
|
1147
1173
|
title: string;
|
|
1148
1174
|
description: string;
|
|
1149
1175
|
};
|
|
1150
1176
|
danger: {
|
|
1177
|
+
badge: string;
|
|
1151
1178
|
title: string;
|
|
1152
1179
|
description: string;
|
|
1153
1180
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../src/i18n/translations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,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;AAYH,6BAA6B;AAC7B,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUnC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),d=require("react-i18next");require("i18next");require("i18next-resources-to-backend");const o=require("./locale.js"),u=require("react"),E=require("@aioia/core"),a=require("zod");function k(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 p=k(u);function z(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=z(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function y(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=z(e))&&(s&&(s+=" "),s+=t);return s}const A={danger:"bg-error/10 text-error",caution:"bg-error/10 text-error",safe:"bg-neutral/10 text-neutral"},P={danger:"result.danger.badge",caution:"result.caution.badge",safe:"result.safe.badge"},R={sm:"text-xl font-bold",lg:"text-2xl font-bold"};function x({badgeVariant:e,subtitle:t,icon:r,title:s,titleSize:i="lg",children:l}){const{t:h}=d.useTranslation(o.TRADE_SAFETY_NS);return n.jsxs("section",{className:"rounded-2xl bg-neutral-content p-6 shadow-sm",children:[n.jsxs("header",{className:"mb-4 flex flex-col items-start",children:[e&&n.jsx("div",{className:y("mb-2 rounded-full px-4 py-1 text-sm font-bold",A[e]),children:h(P[e])}),t&&n.jsx("p",{className:"mb-1 break-keep text-lg font-medium text-neutral",children:t}),n.jsxs("div",{className:"flex items-center gap-2 text-neutral",children:[r&&n.jsx("span",{className:"text-base",children:r}),n.jsx("h2",{className:y("whitespace-pre-line break-keep sm:whitespace-normal",R[i]),children:s})]})]}),n.jsx("div",{children:l})]})}function D({summary:e}){const{t}=d.useTranslation(o.TRADE_SAFETY_NS);return n.jsx(x,{title:t("result.aiSummary"),children:n.jsx("p",{className:"rounded-lg bg-base-200 p-6 text-sm leading-relaxed text-base-content",children:e})})}function m({title:e,content:t}){return n.jsxs("div",{className:"text-neutral",children:[n.jsx("h3",{className:"mb-1 break-keep text-lg font-semibold",children:e}),n.jsx("p",{className:"break-keep",children:t})]})}function C({data:e}){const{t,i18n:r}=d.useTranslation(o.TRADE_SAFETY_NS);return e?n.jsx(x,{subtitle:t("result.priceAnalysis.subtitle"),title:t("result.priceAnalysis.title"),children:n.jsxs("div",{className:"space-y-4",children:[e.market_price_range&&n.jsx(m,{title:t("result.marketPrice"),content:e.market_price_range}),e.offered_price&&n.jsx(m,{title:t("result.offeredPrice"),content:new Intl.NumberFormat(r.language,{style:"currency",currency:e.currency||"USD"}).format(e.offered_price)}),e.price_assessment&&n.jsx(m,{title:t("result.priceAssessment"),content:e.price_assessment})]})}):null}function F({title:e,titleId:t,...r},s){return p.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?p.createElement("title",{id:t},e):null,p.createElement("path",{fillRule:"evenodd",d:"M2.625 6.75a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875 0A.75.75 0 0 1 8.25 6h12a.75.75 0 0 1 0 1.5h-12a.75.75 0 0 1-.75-.75ZM2.625 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0ZM7.5 12a.75.75 0 0 1 .75-.75h12a.75.75 0 0 1 0 1.5h-12A.75.75 0 0 1 7.5 12Zm-4.875 5.25a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875 0a.75.75 0 0 1 .75-.75h12a.75.75 0 0 1 0 1.5h-12a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const L=p.forwardRef(F);function H({items:e}){const{t}=d.useTranslation(o.TRADE_SAFETY_NS);return e.length===0?null:n.jsx(x,{icon:n.jsx(L,{className:"size-6"}),title:t("result.safetyChecklist"),titleSize:"sm",children:n.jsx("div",{className:"space-y-4",children:e.map((r,s)=>n.jsxs("label",{className:"label cursor-pointer gap-4 rounded-2xl bg-base-200 p-4",children:[n.jsx("span",{className:"label-text break-keep text-neutral",children:r}),n.jsx("input",{type:"checkbox",className:"checkbox checkbox-sm [--chkbg:theme(colors.neutral)] [--chkfg:theme(colors.neutral-content)]"})]},s))})})}const Y={danger:"result.danger.title",caution:"result.caution.title",safe:"result.safe.title"};function j({signals:e,variant:t}){const{t:r}=d.useTranslation(o.TRADE_SAFETY_NS);return e.length===0?null:n.jsx(x,{badgeVariant:t,title:r(Y[t]),children:n.jsx("div",{className:"divide-y divide-base-300",children:e.map((s,i)=>n.jsxs("div",{className:"space-y-4 py-4 first:pt-0 last:pb-0",children:[n.jsx(m,{title:s.title,content:s.description}),n.jsx(m,{title:r("result.whatToDo"),content:s.what_to_do})]},i))})})}function M({translation:e,nuance:t}){const{t:r}=d.useTranslation(o.TRADE_SAFETY_NS);return n.jsx(x,{subtitle:r("result.translation.subtitle"),title:r("result.translation.title"),children:n.jsxs("div",{className:"space-y-4",children:[e&&n.jsx(m,{title:r("result.translation.label"),content:e}),t&&n.jsx(m,{title:r("result.nuance.label"),content:t})]})})}function q({analysis:e}){return n.jsxs("div",{className:"space-y-6",children:[e.ai_summary&&n.jsx(D,{summary:e.ai_summary}),e.risk_signals.length>0&&n.jsx(j,{signals:e.risk_signals,variant:"danger"}),e.cautions.length>0&&n.jsx(j,{signals:e.cautions,variant:"caution"}),e.safe_indicators.length>0&&n.jsx(j,{signals:e.safe_indicators,variant:"safe"}),e.safety_checklist.length>0&&n.jsx(H,{items:e.safety_checklist}),(e.translation||e.nuance_explanation)&&n.jsx(M,{translation:e.translation,nuance:e.nuance_explanation}),e.price_analysis&&n.jsx(C,{data:e.price_analysis})]})}var w={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},S=u.createContext&&u.createContext(w),B=["attr","size","title"];function I(e,t){if(e==null)return{};var r=Z(e,t),s,i;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i<l.length;i++)s=l[i],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}function Z(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 N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?N(Object(r),!0).forEach(function(s){W(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function W(e,t,r){return t=$(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $(e){var t=K(e,"string");return typeof t=="symbol"?t:t+""}function K(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 T(e){return e&&e.map((t,r)=>u.createElement(t.tag,g({key:r},t.attr),T(t.child)))}function O(e){return t=>u.createElement(U,b({attr:g({},e.attr)},t),T(e.child))}function U(e){var t=r=>{var{attr:s,size:i,title:l}=e,h=I(e,B),f=i||r.size||"1em",c;return r.className&&(c=r.className),e.className&&(c=(c?c+" ":"")+e.className),u.createElement("svg",b({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,s,h,{className:c,style:g(g({color:e.color||r.color},r.style),e.style),height:f,width:f,xmlns:"http://www.w3.org/2000/svg"}),l&&u.createElement("title",null,l),e.children)};return S!==void 0?u.createElement(S.Consumer,null,r=>t(r)):t(w)}function X(e){return O({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 G(e){return O({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 J({value:e,onChange:t,onSubmit:r,isLoading:s,error:i}){const{t:l}=d.useTranslation(o.TRADE_SAFETY_NS),h=s?n.jsx("span",{className:"loading loading-spinner loading-sm"}):l("hero.checkSafety"),f=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:l("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:l("hero.subtitle")}),n.jsxs("div",{className:y("mb-4",!i&&"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:l("hero.placeholder"),"aria-label":l("hero.placeholder"),value:e,onChange:c=>t(c.target.value),disabled:s,onKeyDown:c=>{c.key==="Enter"&&!f&&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:f,children:h})]}),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:l("hero.placeholder")}),l("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":l("hero.placeholder"),onChange:c=>t(c.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:f,children:h})})]})})]}),i&&n.jsx("div",{className:"alert alert-error mb-6 flex items-center gap-2 text-sm",children:n.jsx("span",{children:i})}),n.jsx("p",{className:"mb-4 text-left text-xs text-base-content/60 sm:mb-8 sm:text-center md:mb-12",children:l("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(G,{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(X,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})})]})]})})}function Q({level:e,score:t}){const{t:r}=d.useTranslation(o.TRADE_SAFETY_NS);return n.jsxs("div",{className:"mb-4 rounded-lg",children:[n.jsx("h1",{className:"mb-2 text-3xl font-bold",children:r(`result.safetyLevel.${e}.title`)}),n.jsx("p",{className:"mt-2 text-sm text-neutral",children:r(`result.safetyLevel.${e}.description`,{score:t})})]})}const _={safe:70,caution:40},V=e=>e>=_.safe?"safe":e>=_.caution?"caution":"danger",v=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()}),ee=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())}),te=a.z.object({ai_summary:a.z.string(),translation:a.z.string().nullish(),nuance_explanation:a.z.string().nullish(),risk_signals:a.z.array(v),cautions:a.z.array(v),safe_indicators:a.z.array(v),price_analysis:ee,safety_checklist:a.z.array(a.z.string()),safe_score:a.z.number(),recommendation:a.z.string(),emotional_support:a.z.string()}),re=a.z.object({id:a.z.string(),user_id:a.z.string().nullish(),input_text:a.z.string(),llm_analysis:te,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()}),ne=a.z.enum(["twitter"]),se=a.z.object({platform:ne,author:a.z.string(),created_at:a.z.string().nullish(),text:a.z.string(),text_preview:a.z.string(),images:a.z.array(a.z.string())}),ae=a.z.object({data:se});class ie extends E.BaseCrudRepository{constructor(){super(...arguments),this.resource="trade-safety"}getDataSchema(){return re}async fetchPreview(t,r){const s=`${this.apiService.buildUrl(this.resource)}/preview`,i=await this.apiService.request(s,{...r,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t})});return this.validateResponse(i,ae).data}}exports.TRADE_SAFETY_NS=o.TRADE_SAFETY_NS;exports.tradeSafetyTranslations=o.tradeSafetyTranslations;exports.DetailedResult=q;exports.HomeHeroSection=J;exports.PageHeader=Q;exports.SAFETY_SCORE_THRESHOLDS=_;exports.TradeSafetyRepository=ie;exports.getSafetyLevel=V;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),E=require("react-i18next");require("i18next");require("i18next-resources-to-backend");const R=require("./locale.js"),N=require("react"),zt=require("@aioia/core"),c=require("zod");function Pt(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const D=Pt(N);function Dt({title:t,titleId:r,...a},o){return D.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:o,"aria-labelledby":r},a),t?D.createElement("title",{id:r},t):null,D.createElement("path",{fillRule:"evenodd",d:"M2.625 6.75a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875 0A.75.75 0 0 1 8.25 6h12a.75.75 0 0 1 0 1.5h-12a.75.75 0 0 1-.75-.75ZM2.625 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0ZM7.5 12a.75.75 0 0 1 .75-.75h12a.75.75 0 0 1 0 1.5h-12A.75.75 0 0 1 7.5 12Zm-4.875 5.25a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875 0a.75.75 0 0 1 .75-.75h12a.75.75 0 0 1 0 1.5h-12a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const At=D.forwardRef(Dt);function Ct({title:t,titleId:r,...a},o){return D.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:o,"aria-labelledby":r},a),t?D.createElement("title",{id:r},t):null,D.createElement("path",{fillRule:"evenodd",d:"M9 4.5a.75.75 0 0 1 .721.544l.813 2.846a3.75 3.75 0 0 0 2.576 2.576l2.846.813a.75.75 0 0 1 0 1.442l-2.846.813a3.75 3.75 0 0 0-2.576 2.576l-.813 2.846a.75.75 0 0 1-1.442 0l-.813-2.846a3.75 3.75 0 0 0-2.576-2.576l-2.846-.813a.75.75 0 0 1 0-1.442l2.846-.813A3.75 3.75 0 0 0 7.466 7.89l.813-2.846A.75.75 0 0 1 9 4.5ZM18 1.5a.75.75 0 0 1 .728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 0 1 0 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 0 1-1.456 0l-.258-1.036a2.625 2.625 0 0 0-1.91-1.91l-1.036-.258a.75.75 0 0 1 0-1.456l1.036-.258a2.625 2.625 0 0 0 1.91-1.91l.258-1.036A.75.75 0 0 1 18 1.5ZM16.5 15a.75.75 0 0 1 .712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 0 1 0 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 0 1-1.422 0l-.395-1.183a1.5 1.5 0 0 0-.948-.948l-1.183-.395a.75.75 0 0 1 0-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0 1 16.5 15Z",clipRule:"evenodd"}))}const Ft=D.forwardRef(Ct);function He(t){var r,a,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var p=t.length;for(r=0;r<p;r++)t[r]&&(a=He(t[r]))&&(o&&(o+=" "),o+=a)}else for(a in t)t[a]&&(o&&(o+=" "),o+=a);return o}function V(){for(var t,r,a=0,o="",p=arguments.length;a<p;a++)(t=arguments[a])&&(r=He(t))&&(o&&(o+=" "),o+=r);return o}const $t={danger:"bg-error/10 text-error",caution:"bg-error/10 text-error",safe:"bg-neutral/10 text-neutral"},Lt={danger:"result.danger.badge",caution:"result.caution.badge",safe:"result.safe.badge"},It={sm:"text-xl font-bold",lg:"text-2xl font-bold"};function q({badgeVariant:t,subtitle:r,icon:a,title:o,titleSize:p="lg",children:h}){const{t:j}=E.useTranslation(R.TRADE_SAFETY_NS);return s.jsxs("section",{className:"rounded-2xl bg-neutral-content p-6 shadow-sm",children:[s.jsxs("header",{className:"mb-4 flex flex-col items-start",children:[t&&s.jsx("div",{className:V("mb-2 rounded-full px-4 py-1 text-sm font-bold",$t[t]),children:j(Lt[t])}),r&&s.jsx("p",{className:"mb-1 break-keep text-lg font-medium text-neutral",children:r}),s.jsxs("div",{className:"flex items-center gap-2 text-neutral",children:[a&&s.jsx("span",{className:"text-base",children:a}),s.jsx("h2",{className:V("whitespace-pre-line break-keep sm:whitespace-normal",It[p]),children:o})]})]}),s.jsx("div",{children:h})]})}function Mt({summary:t}){const{t:r}=E.useTranslation(R.TRADE_SAFETY_NS);return t.length===0?null:s.jsx(q,{title:r("result.aiSummary"),icon:s.jsx(Ft,{className:"size-6"}),children:s.jsx("div",{children:t.map((a,o)=>s.jsx("p",{className:V("py-2 text-sm leading-relaxed text-neutral first:pt-0",o<t.length-1&&"border-b border-base-300"),children:a},`${a}-${o}`))})})}function F({title:t,content:r}){return s.jsxs("div",{className:"text-neutral",children:[s.jsx("h3",{className:"mb-1 break-keep text-lg font-semibold",children:t}),s.jsx("p",{className:"break-keep",children:r})]})}function Yt({data:t}){const{t:r,i18n:a}=E.useTranslation(R.TRADE_SAFETY_NS);return t?s.jsx(q,{subtitle:r("result.priceAnalysis.subtitle"),title:r("result.priceAnalysis.title"),children:s.jsxs("div",{className:"space-y-4",children:[t.market_price_range&&s.jsx(F,{title:r("result.marketPrice"),content:t.market_price_range}),t.offered_price&&s.jsx(F,{title:r("result.offeredPrice"),content:new Intl.NumberFormat(a.language,{style:"currency",currency:t.currency||"USD"}).format(t.offered_price)}),t.price_assessment&&s.jsx(F,{title:r("result.priceAssessment"),content:t.price_assessment})]})}):null}function Wt({items:t}){const{t:r}=E.useTranslation(R.TRADE_SAFETY_NS);return t.length===0?null:s.jsx(q,{icon:s.jsx(At,{className:"size-6"}),title:r("result.safetyChecklist"),titleSize:"sm",children:s.jsx("div",{className:"space-y-4",children:t.map((a,o)=>s.jsxs("label",{className:"label cursor-pointer gap-4 rounded-2xl bg-base-200 p-4",children:[s.jsx("span",{className:"label-text break-keep text-neutral",children:a}),s.jsx("input",{type:"checkbox",className:"checkbox checkbox-sm [--chkbg:theme(colors.neutral)] [--chkfg:theme(colors.neutral-content)]"})]},o))})})}const qt={danger:"result.danger.title",caution:"result.caution.title",safe:"result.safe.title"};function ie({signals:t,variant:r}){const{t:a}=E.useTranslation(R.TRADE_SAFETY_NS);return t.length===0?null:s.jsx(q,{badgeVariant:r,title:a(qt[r]),children:s.jsx("div",{className:"divide-y divide-base-300",children:t.map((o,p)=>s.jsxs("div",{className:"space-y-4 py-4 first:pt-0 last:pb-0",children:[s.jsx(F,{title:o.title,content:o.description}),s.jsx(F,{title:a("result.whatToDo"),content:o.what_to_do})]},p))})})}function Ht({translation:t,nuance:r}){const{t:a}=E.useTranslation(R.TRADE_SAFETY_NS);return s.jsx(q,{subtitle:a("result.translation.subtitle"),title:a("result.translation.title"),children:s.jsxs("div",{className:"space-y-4",children:[t&&s.jsx(F,{title:a("result.translation.label"),content:t}),r&&s.jsx(F,{title:a("result.nuance.label"),content:r})]})})}function Bt({analysis:t}){return s.jsxs("div",{className:"space-y-6",children:[t.ai_summary.length>0&&s.jsx(Mt,{summary:t.ai_summary}),t.risk_signals.length>0&&s.jsx(ie,{signals:t.risk_signals,variant:"danger"}),t.cautions.length>0&&s.jsx(ie,{signals:t.cautions,variant:"caution"}),t.safe_indicators.length>0&&s.jsx(ie,{signals:t.safe_indicators,variant:"safe"}),t.safety_checklist.length>0&&s.jsx(Wt,{items:t.safety_checklist}),(t.translation||t.nuance_explanation)&&s.jsx(Ht,{translation:t.translation,nuance:t.nuance_explanation}),t.price_analysis&&s.jsx(Yt,{data:t.price_analysis})]})}var Be={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Le=N.createContext&&N.createContext(Be),Ut=["attr","size","title"];function Zt(t,r){if(t==null)return{};var a=Kt(t,r),o,p;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(t);for(p=0;p<h.length;p++)o=h[p],!(r.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(a[o]=t[o])}return a}function Kt(t,r){if(t==null)return{};var a={};for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){if(r.indexOf(o)>=0)continue;a[o]=t[o]}return a}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(t[o]=a[o])}return t},X.apply(this,arguments)}function Ie(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);r&&(o=o.filter(function(p){return Object.getOwnPropertyDescriptor(t,p).enumerable})),a.push.apply(a,o)}return a}function G(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?arguments[r]:{};r%2?Ie(Object(a),!0).forEach(function(o){Jt(t,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):Ie(Object(a)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(a,o))})}return t}function Jt(t,r,a){return r=Vt(r),r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}function Vt(t){var r=Xt(t,"string");return typeof r=="symbol"?r:r+""}function Xt(t,r){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var o=a.call(t,r);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function Ue(t){return t&&t.map((r,a)=>N.createElement(r.tag,G({key:a},r.attr),Ue(r.child)))}function Ze(t){return r=>N.createElement(Gt,X({attr:G({},t.attr)},r),Ue(t.child))}function Gt(t){var r=a=>{var{attr:o,size:p,title:h}=t,j=Zt(t,Ut),v=p||a.size||"1em",d;return a.className&&(d=a.className),t.className&&(d=(d?d+" ":"")+t.className),N.createElement("svg",X({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,o,j,{className:d,style:G(G({color:t.color||a.color},a.style),t.style),height:v,width:v,xmlns:"http://www.w3.org/2000/svg"}),h&&N.createElement("title",null,h),t.children)};return Le!==void 0?N.createElement(Le.Consumer,null,a=>r(a)):r(Be)}function Qt(t){return Ze({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:[]}]})(t)}function er(t){return Ze({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:[]}]})(t)}function tr({value:t,onChange:r,onSubmit:a,isLoading:o,error:p}){const{t:h}=E.useTranslation(R.TRADE_SAFETY_NS),j=o?s.jsx("span",{className:"loading loading-spinner loading-sm"}):h("hero.checkSafety"),v=o||!t.trim();return s.jsx("div",{className:"flex w-full flex-col items-center justify-center",children:s.jsxs("div",{className:"w-full lg:max-w-[720px]",children:[s.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:h("hero.title")}),s.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:h("hero.subtitle")}),s.jsxs("div",{className:V("mb-4",!p&&"sm:mb-8 md:mb-12"),children:[s.jsxs("div",{className:"relative hidden lg:block",children:[s.jsx("input",{type:"text",className:"input input-bordered h-[72px] w-full pr-36 text-sm placeholder:text-base-300 focus:outline-none",placeholder:h("hero.placeholder"),"aria-label":h("hero.placeholder"),value:t,onChange:d=>r(d.target.value),disabled:o,onKeyDown:d=>{d.key==="Enter"&&!v&&a()}}),s.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:a,disabled:v,children:j})]}),s.jsx("div",{className:"block lg:hidden",children:s.jsxs("div",{className:"relative h-[400px] w-full overflow-hidden rounded-xl border border-base-300 bg-base-100",children:[!t&&s.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden p-5 pb-24 text-base text-base-300","aria-hidden":"true",children:s.jsxs("div",{className:"whitespace-pre-line leading-relaxed",children:[s.jsx("p",{className:"mb-4 text-base-300",children:h("hero.placeholder")}),h("hero.placeholderExample")]})}),s.jsx("div",{className:"absolute inset-0 overflow-hidden pb-24",children:s.jsx("textarea",{className:"textarea size-full resize-none overflow-auto bg-transparent p-4 leading-6 text-base-content focus:outline-none",value:t,"aria-label":h("hero.placeholder"),onChange:d=>r(d.target.value),disabled:o,placeholder:""})}),s.jsx("div",{className:"absolute inset-x-4 bottom-4 z-10",children:s.jsx("button",{className:"btn btn-neutral h-16 w-full text-base font-medium text-neutral-content",onClick:a,disabled:v,children:j})})]})})]}),p&&s.jsx("div",{className:"alert alert-error mb-6 flex items-center gap-2 text-sm",children:s.jsx("span",{children:p})}),s.jsx("p",{className:"mb-4 text-left text-xs text-base-content/60 sm:mb-8 sm:text-center md:mb-12",children:h("hero.disclaimer")}),s.jsxs("div",{className:"flex items-center justify-start gap-6 sm:justify-center",children:[s.jsx("a",{href:"https://x.com",target:"_blank",rel:"noopener noreferrer","aria-label":"X",children:s.jsx(er,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})}),s.jsx("a",{href:"https://reddit.com",target:"_blank",rel:"noopener noreferrer","aria-label":"Reddit",children:s.jsx(Qt,{className:"size-6 text-base-content transition-colors hover:text-base-content/70"})})]})]})})}var le={exports:{}},W={},Me;function rr(){if(Me)return W;Me=1;var t=N,r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,p=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function j(v,d,z){var x,w={},T=null,H=null;z!==void 0&&(T=""+z),d.key!==void 0&&(T=""+d.key),d.ref!==void 0&&(H=d.ref);for(x in d)o.call(d,x)&&!h.hasOwnProperty(x)&&(w[x]=d[x]);if(v&&v.defaultProps)for(x in d=v.defaultProps,d)w[x]===void 0&&(w[x]=d[x]);return{$$typeof:r,type:v,key:T,ref:H,props:w,_owner:p.current}}return W.Fragment=a,W.jsx=j,W.jsxs=j,W}var J={},Ye;function nr(){return Ye||(Ye=1,process.env.NODE_ENV!=="production"&&(function(){var t=N,r=Symbol.for("react.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),v=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),pe=Symbol.iterator,Ke="@@iterator";function Je(e){if(e===null||typeof e!="object")return null;var n=pe&&e[pe]||e[Ke];return typeof n=="function"?n:null}var $=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var n=arguments.length,i=new Array(n>1?n-1:0),l=1;l<n;l++)i[l-1]=arguments[l];Ve("error",e,i)}}function Ve(e,n,i){{var l=$.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(n+="%s",i=i.concat([m]));var y=i.map(function(f){return String(f)});y.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,y)}}var Xe=!1,Ge=!1,Qe=!1,et=!1,tt=!1,de;de=Symbol.for("react.module.reference");function rt(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===h||tt||e===p||e===z||e===x||et||e===H||Xe||Ge||Qe||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===w||e.$$typeof===j||e.$$typeof===v||e.$$typeof===d||e.$$typeof===de||e.getModuleId!==void 0))}function nt(e,n,i){var l=e.displayName;if(l)return l;var m=n.displayName||n.name||"";return m!==""?i+"("+m+")":i}function me(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case a:return"Portal";case h:return"Profiler";case p:return"StrictMode";case z:return"Suspense";case x:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case v:var n=e;return me(n)+".Consumer";case j:var i=e;return me(i._context)+".Provider";case d:return nt(e,e.render,"ForwardRef");case w:var l=e.displayName||null;return l!==null?l:P(e.type)||"Memo";case T:{var m=e,y=m._payload,f=m._init;try{return P(f(y))}catch{return null}}}return null}var A=Object.assign,M=0,ye,he,be,ge,ve,xe,je;function _e(){}_e.__reactDisabledLog=!0;function at(){{if(M===0){ye=console.log,he=console.info,be=console.warn,ge=console.error,ve=console.group,xe=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function st(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:ye}),info:A({},e,{value:he}),warn:A({},e,{value:be}),error:A({},e,{value:ge}),group:A({},e,{value:ve}),groupCollapsed:A({},e,{value:xe}),groupEnd:A({},e,{value:je})})}M<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=$.ReactCurrentDispatcher,ee;function B(e,n,i){{if(ee===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);ee=l&&l[1]||""}return`
|
|
2
|
+
`+ee+e}}var te=!1,U;{var ot=typeof WeakMap=="function"?WeakMap:Map;U=new ot}function Se(e,n){if(!e||te)return"";{var i=U.get(e);if(i!==void 0)return i}var l;te=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var y;y=Q.current,Q.current=null,at();try{if(n){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(k){l=k}Reflect.construct(e,[],f)}else{try{f.call()}catch(k){l=k}e.call(f.prototype)}}else{try{throw Error()}catch(k){l=k}e()}}catch(k){if(k&&l&&typeof k.stack=="string"){for(var u=k.stack.split(`
|
|
3
|
+
`),S=l.stack.split(`
|
|
4
|
+
`),b=u.length-1,g=S.length-1;b>=1&&g>=0&&u[b]!==S[g];)g--;for(;b>=1&&g>=0;b--,g--)if(u[b]!==S[g]){if(b!==1||g!==1)do if(b--,g--,g<0||u[b]!==S[g]){var O=`
|
|
5
|
+
`+u[b].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,O),O}while(b>=1&&g>=0);break}}}finally{te=!1,Q.current=y,st(),Error.prepareStackTrace=m}var I=e?e.displayName||e.name:"",C=I?B(I):"";return typeof e=="function"&&U.set(e,C),C}function it(e,n,i){return Se(e,!1)}function lt(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function Z(e,n,i){if(e==null)return"";if(typeof e=="function")return Se(e,lt(e));if(typeof e=="string")return B(e);switch(e){case z:return B("Suspense");case x:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return it(e.render);case w:return Z(e.type,n,i);case T:{var l=e,m=l._payload,y=l._init;try{return Z(y(m),n,i)}catch{}}}return""}var Y=Object.prototype.hasOwnProperty,we={},ke=$.ReactDebugCurrentFrame;function K(e){if(e){var n=e._owner,i=Z(e.type,e._source,n?n.type:null);ke.setExtraStackFrame(i)}else ke.setExtraStackFrame(null)}function ct(e,n,i,l,m){{var y=Function.call.bind(Y);for(var f in e)if(y(e,f)){var u=void 0;try{if(typeof e[f]!="function"){var S=Error((l||"React class")+": "+i+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}u=e[f](n,f,l,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(b){u=b}u&&!(u instanceof Error)&&(K(m),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",l||"React class",i,f,typeof u),K(null)),u instanceof Error&&!(u.message in we)&&(we[u.message]=!0,K(m),_("Failed %s type: %s",i,u.message),K(null))}}}var ut=Array.isArray;function re(e){return ut(e)}function ft(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,i=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function pt(e){try{return Ne(e),!1}catch{return!0}}function Ne(e){return""+e}function Oe(e){if(pt(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ft(e)),Ne(e)}var Ee=$.ReactCurrentOwner,dt={key:!0,ref:!0,__self:!0,__source:!0},Re,Te;function mt(e){if(Y.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function yt(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function ht(e,n){typeof e.ref=="string"&&Ee.current}function bt(e,n){{var i=function(){Re||(Re=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function gt(e,n){{var i=function(){Te||(Te=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var vt=function(e,n,i,l,m,y,f){var u={$$typeof:r,type:e,key:n,ref:i,props:f,_owner:y};return u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:m}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function xt(e,n,i,l,m){{var y,f={},u=null,S=null;i!==void 0&&(Oe(i),u=""+i),yt(n)&&(Oe(n.key),u=""+n.key),mt(n)&&(S=n.ref,ht(n));for(y in n)Y.call(n,y)&&!dt.hasOwnProperty(y)&&(f[y]=n[y]);if(e&&e.defaultProps){var b=e.defaultProps;for(y in b)f[y]===void 0&&(f[y]=b[y])}if(u||S){var g=typeof e=="function"?e.displayName||e.name||"Unknown":e;u&&bt(f,g),S&>(f,g)}return vt(e,u,S,m,l,Ee.current,f)}}var ne=$.ReactCurrentOwner,ze=$.ReactDebugCurrentFrame;function L(e){if(e){var n=e._owner,i=Z(e.type,e._source,n?n.type:null);ze.setExtraStackFrame(i)}else ze.setExtraStackFrame(null)}var ae;ae=!1;function se(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Pe(){{if(ne.current){var e=P(ne.current.type);if(e)return`
|
|
6
|
+
|
|
7
|
+
Check the render method of \``+e+"`."}return""}}function jt(e){return""}var De={};function _t(e){{var n=Pe();if(!n){var i=typeof e=="string"?e:e.displayName||e.name;i&&(n=`
|
|
8
|
+
|
|
9
|
+
Check the top-level render call using <`+i+">.")}return n}}function Ae(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=_t(n);if(De[i])return;De[i]=!0;var l="";e&&e._owner&&e._owner!==ne.current&&(l=" It was passed a child from "+P(e._owner.type)+"."),L(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,l),L(null)}}function Ce(e,n){{if(typeof e!="object")return;if(re(e))for(var i=0;i<e.length;i++){var l=e[i];se(l)&&Ae(l,n)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var m=Je(e);if(typeof m=="function"&&m!==e.entries)for(var y=m.call(e),f;!(f=y.next()).done;)se(f.value)&&Ae(f.value,n)}}}function St(e){{var n=e.type;if(n==null||typeof n=="string")return;var i;if(typeof n=="function")i=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===d||n.$$typeof===w))i=n.propTypes;else return;if(i){var l=P(n);ct(i,e.props,"prop",l,e)}else if(n.PropTypes!==void 0&&!ae){ae=!0;var m=P(n);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wt(e){{for(var n=Object.keys(e.props),i=0;i<n.length;i++){var l=n[i];if(l!=="children"&&l!=="key"){L(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),L(null);break}}e.ref!==null&&(L(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),L(null))}}var Fe={};function $e(e,n,i,l,m,y){{var f=rt(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S=jt();S?u+=S:u+=Pe();var b;e===null?b="null":re(e)?b="array":e!==void 0&&e.$$typeof===r?(b="<"+(P(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):b=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",b,u)}var g=xt(e,n,i,m,y);if(g==null)return g;if(f){var O=n.children;if(O!==void 0)if(l)if(re(O)){for(var I=0;I<O.length;I++)Ce(O[I],e);Object.freeze&&Object.freeze(O)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ce(O,e)}if(Y.call(n,"key")){var C=P(e),k=Object.keys(n).filter(function(Tt){return Tt!=="key"}),oe=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Fe[C+oe]){var Rt=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";_(`A props object containing a "key" prop is being spread into JSX:
|
|
10
|
+
let props = %s;
|
|
11
|
+
<%s {...props} />
|
|
12
|
+
React keys must be passed directly to JSX without using spread:
|
|
13
|
+
let props = %s;
|
|
14
|
+
<%s key={someKey} {...props} />`,oe,C,Rt,C),Fe[C+oe]=!0}}return e===o?wt(g):St(g),g}}function kt(e,n,i){return $e(e,n,i,!0)}function Nt(e,n,i){return $e(e,n,i,!1)}var Ot=Nt,Et=kt;J.Fragment=o,J.jsx=Ot,J.jsxs=Et})()),J}var We;function ar(){return We||(We=1,process.env.NODE_ENV==="production"?le.exports=rr():le.exports=nr()),le.exports}var qe=ar();function sr({src:t,autoplay:r,loop:a=!0,...o}){const[p,h]=N.useState(!1),[j,v]=N.useState(null),[d,z]=N.useState(!1);return N.useEffect(()=>{let x=!0;return h(!0),Promise.all([Promise.resolve().then(()=>require("./lottie-react.esm-Bv7L41xK.js")),Promise.resolve().then(()=>require("./isChromatic-5i32AXac-BWePUv7P.js"))]).then(([{Player:w},{default:T}])=>{x&&(v(()=>w),z(T()))}).catch(w=>{throw console.error("[LottiePlayer] Failed to load dependencies:",w),w}),()=>{x=!1}},[]),!p||!j?qe.jsx("div",{...o}):qe.jsx(j,{src:t,loop:a,autoplay:r!==void 0?r:!d,...o})}const or={danger:{lottie:"https://fonts.gstatic.com/s/e/notoemoji/latest/1f6a8/lottie.json",webp:"https://fonts.gstatic.com/s/e/notoemoji/latest/1f6a8/512.webp",gif:"https://fonts.gstatic.com/s/e/notoemoji/latest/1f6a8/512.gif",alt:"🚨"},caution:{lottie:"https://fonts.gstatic.com/s/e/notoemoji/latest/26a0_fe0f/lottie.json",webp:"https://fonts.gstatic.com/s/e/notoemoji/latest/26a0_fe0f/512.webp",gif:"https://fonts.gstatic.com/s/e/notoemoji/latest/26a0_fe0f/512.gif",alt:"⚠️"},safe:{lottie:"https://fonts.gstatic.com/s/e/notoemoji/latest/2705/lottie.json",webp:"https://fonts.gstatic.com/s/e/notoemoji/latest/2705/512.webp",gif:"https://fonts.gstatic.com/s/e/notoemoji/latest/2705/512.gif",alt:"✅"}},ce={danger:"font-bold text-error",caution:"font-bold text-warning",safe:"font-bold text-success"};function ir({level:t,score:r}){const{t:a}=E.useTranslation(R.TRADE_SAFETY_NS),o=or[t];return s.jsxs("div",{className:"mb-8 flex flex-col items-center text-center",children:[s.jsx("div",{className:"mb-5 rounded-full bg-neutral/75 px-4 py-1.5",children:s.jsx("span",{className:"text-sm font-medium text-neutral-content",children:a(`result.safetyLevel.${t}.badge`)})}),s.jsx("h1",{className:"mb-9 break-keep text-4xl font-bold leading-tight text-base-content",children:s.jsx(E.Trans,{t:a,i18nKey:`result.safetyLevel.${t}.title`,components:[s.jsx("strong",{className:ce[t]},"0")]})}),s.jsx("div",{className:"mb-9 flex size-32 items-center justify-center",children:s.jsx(sr,{src:o.lottie,autoplay:!0,loop:!0,className:"size-full"})}),s.jsx("p",{className:"max-w-md break-keep text-xl leading-relaxed text-base-content",children:s.jsx(E.Trans,{t:a,i18nKey:`result.safetyLevel.${t}.description`,values:{score:r},components:[s.jsx("strong",{className:ce[t]},"0"),s.jsx("strong",{className:ce[t]},"1")]})})]})}const fe={safe:70,caution:40},lr=t=>t>=fe.safe?"safe":t>=fe.caution?"caution":"danger",ue=c.z.object({category:c.z.enum(["payment","seller","platform","price","content"]),severity:c.z.enum(["high","medium","low"]),title:c.z.string(),description:c.z.string(),what_to_do:c.z.string()}),cr=c.z.object({market_price_range:c.z.string().nullish(),offered_price:c.z.number().nullish(),currency:c.z.string().nullish(),price_assessment:c.z.string(),warnings:c.z.array(c.z.string())}),ur=c.z.object({ai_summary:c.z.array(c.z.string()),translation:c.z.string().nullish(),nuance_explanation:c.z.string().nullish(),risk_signals:c.z.array(ue),cautions:c.z.array(ue),safe_indicators:c.z.array(ue),price_analysis:cr,safety_checklist:c.z.array(c.z.string()),safe_score:c.z.number(),recommendation:c.z.string(),emotional_support:c.z.string()}),fr=c.z.object({id:c.z.string(),user_id:c.z.string().nullish(),input_text:c.z.string(),llm_analysis:ur,safe_score:c.z.number(),expert_advice:c.z.string().nullish(),expert_reviewed:c.z.boolean(),expert_reviewed_at:c.z.string().nullish(),expert_reviewed_by:c.z.string().nullish(),created_at:c.z.string(),updated_at:c.z.string()}),pr=c.z.enum(["twitter"]),dr=c.z.object({platform:pr,author:c.z.string(),created_at:c.z.string().nullish(),text:c.z.string(),text_preview:c.z.string(),images:c.z.array(c.z.string())}),mr=c.z.object({data:dr});class yr extends zt.BaseCrudRepository{constructor(){super(...arguments),this.resource="trade-safety"}getDataSchema(){return fr}async fetchPreview(r,a){const o=`${this.apiService.buildUrl(this.resource)}/preview`,p=await this.apiService.request(o,{...a,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:r})});return this.validateResponse(p,mr).data}}exports.TRADE_SAFETY_NS=R.TRADE_SAFETY_NS;exports.tradeSafetyTranslations=R.tradeSafetyTranslations;exports.DetailedResult=Bt;exports.HomeHeroSection=tr;exports.PageHeader=ir;exports.SAFETY_SCORE_THRESHOLDS=fe;exports.TradeSafetyRepository=yr;exports.getSafetyLevel=lr;
|
|
2
15
|
//# sourceMappingURL=index.js.map
|