@shop-prompter/react 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +147 -45
- package/dist/index.mjs +147 -45
- package/package.json +1 -1
- package/src/product-card-list.component.jsx +18 -7
- package/src/shop-prompter.component.jsx +128 -76
- package/src/translations.ts +53 -0
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -686,6 +686,57 @@ var ShopPrompterService = class {
|
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
688
|
|
|
689
|
+
// src/translations.ts
|
|
690
|
+
var DEFAULT_LOCALE = "en";
|
|
691
|
+
var TRANSLATIONS = {
|
|
692
|
+
en: {
|
|
693
|
+
newChat: "New Chat",
|
|
694
|
+
welcomeToShopPrompter: "Welcome",
|
|
695
|
+
welcomeDescription: "I am your personal AI shopping assistant. Ask me what you would like to know!",
|
|
696
|
+
askMeAnything: "Ask me anything...",
|
|
697
|
+
thinking: "Thinking...",
|
|
698
|
+
feedbackError: "We are sorry, but we could not process your feedback. Please try again later.",
|
|
699
|
+
guestLimitReached: "We are sorry, the chat is no longer available for a guest user. Please log in to continue chatting.",
|
|
700
|
+
sessionExpired: "We are sorry. It looks like the session just expired. Please refresh the page to continue chatting.",
|
|
701
|
+
agentExperienceError: "We are sorry. The session seems to be expired, or the connection is wrongly configured. Please reload the page.",
|
|
702
|
+
apiKeyWarning: "API Key is only for development purposes",
|
|
703
|
+
configErrorTitle: "Configuration Error",
|
|
704
|
+
configErrorMessage: "The initialization requires certain parameters to be present\u201A. Please check your setup.",
|
|
705
|
+
configMissingParams: "Missing Parameters:",
|
|
706
|
+
configMissingToken: "- Valid token (not found)",
|
|
707
|
+
configMissingApiKey: "- Valid API Key. (not found)",
|
|
708
|
+
disclaimer: "AI content may be inaccurate.",
|
|
709
|
+
loadingProducts: "Loading products...",
|
|
710
|
+
productFetchError: "We are unable to fetch products.",
|
|
711
|
+
predefinedPromptDisclaimer: "Click on a prompt, to start the conversation"
|
|
712
|
+
},
|
|
713
|
+
de: {
|
|
714
|
+
newChat: "Neuer Chat",
|
|
715
|
+
welcomeToShopPrompter: "Willkommen",
|
|
716
|
+
welcomeDescription: "Ich bin Ihr pers\xF6nlicher KI-Einkaufsassistent. Fragen Sie mich alles \xFCber was Sie wissen m\xF6chten!",
|
|
717
|
+
askMeAnything: "Fragen Sie mich etwas...",
|
|
718
|
+
thinking: "Einen Moment...",
|
|
719
|
+
feedbackError: "Es tut uns leid, aber wir konnten Ihr Feedback nicht verarbeiten. Bitte versuchen Sie es sp\xE4ter erneut.",
|
|
720
|
+
guestLimitReached: "Es tut uns leid, der Chat steht f\xFCr Gastbenutzer nicht mehr zur Verf\xFCgung. Bitte melden Sie sich an, um weiter zu chatten.",
|
|
721
|
+
sessionExpired: "Es tut uns leid. Die Sitzung scheint abgelaufen zu sein. Bitte laden Sie die Seite neu, um weiter zu chatten.",
|
|
722
|
+
agentExperienceError: "Es tut uns leid. Die Sitzung scheint abgelaufen zu sein oder die Verbindung ist falsch konfiguriert. Bitte laden Sie die Seite neu.",
|
|
723
|
+
apiKeyWarning: "API Key ist nur f\xFCr Entwicklungszwecke",
|
|
724
|
+
configErrorTitle: "Konfigurationsfehler",
|
|
725
|
+
configErrorMessage: "Die Initialsierung ben\xF6tigt gewisse Parameter, die nicht vorhanden sind. Bitte \xFCberpr\xFCfen Sie Ihre Einrichtung.",
|
|
726
|
+
configMissingParams: "Fehlende Parameter:",
|
|
727
|
+
configMissingToken: "- G\xFCltiger Token (nicht gefunden)",
|
|
728
|
+
configMissingApiKey: "- API Key (nicht gefunden)",
|
|
729
|
+
disclaimer: "KI-Inhalte k\xF6nnen Fehler beinhalten.",
|
|
730
|
+
loadingProducts: "Produkte werden geladen...",
|
|
731
|
+
productFetchError: "Die Produkte konnten leider nicht geladen werden.",
|
|
732
|
+
predefinedPromptDisclaimer: "Klicken Sie auf einen Text, um die Unterhaltung zu starten"
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
function getTranslations(locale) {
|
|
736
|
+
const resolved = locale || DEFAULT_LOCALE;
|
|
737
|
+
return TRANSLATIONS[resolved] || TRANSLATIONS[DEFAULT_LOCALE];
|
|
738
|
+
}
|
|
739
|
+
|
|
689
740
|
// src/thumbs-up-icon.component.jsx
|
|
690
741
|
var React = __toESM(require("react"));
|
|
691
742
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -833,12 +884,23 @@ var styles = {
|
|
|
833
884
|
maxWidth: "100%",
|
|
834
885
|
boxSizing: "border-box",
|
|
835
886
|
overflow: "hidden"
|
|
887
|
+
},
|
|
888
|
+
errorContainer: {
|
|
889
|
+
padding: "0.75rem",
|
|
890
|
+
backgroundColor: "#fef2f2",
|
|
891
|
+
border: "1px solid #fecaca",
|
|
892
|
+
color: "#dc2626",
|
|
893
|
+
fontSize: "0.75rem",
|
|
894
|
+
borderRadius: "0.5rem"
|
|
836
895
|
}
|
|
837
896
|
};
|
|
838
897
|
function ProductCardList(props) {
|
|
839
898
|
const [products, setProducts] = (0, import_react.useState)(() => []);
|
|
840
899
|
const [loading, setLoading] = (0, import_react.useState)(() => false);
|
|
841
900
|
const [error, setError] = (0, import_react.useState)(() => null);
|
|
901
|
+
function t() {
|
|
902
|
+
return getTranslations(props.defaultLocale);
|
|
903
|
+
}
|
|
842
904
|
function fetchProducts() {
|
|
843
905
|
let skusList = props.skus;
|
|
844
906
|
if (typeof skusList === "string") {
|
|
@@ -862,13 +924,13 @@ function ProductCardList(props) {
|
|
|
862
924
|
setLoading(false);
|
|
863
925
|
}).catch((err) => {
|
|
864
926
|
console.error("Failed to fetch products:", err);
|
|
865
|
-
setError((
|
|
927
|
+
setError(t().productFetchError);
|
|
866
928
|
setLoading(false);
|
|
867
929
|
});
|
|
868
930
|
}
|
|
869
931
|
function getProductName(product) {
|
|
870
932
|
var _a;
|
|
871
|
-
const locale = props.defaultLocale
|
|
933
|
+
const locale = props.defaultLocale;
|
|
872
934
|
const localized = ((_a = product.localization) == null ? void 0 : _a[locale]) || Object.values(product.localization || {})[0];
|
|
873
935
|
return (localized == null ? void 0 : localized.name) || product.sku;
|
|
874
936
|
}
|
|
@@ -892,7 +954,7 @@ function ProductCardList(props) {
|
|
|
892
954
|
}
|
|
893
955
|
function getDynamicField(product, field) {
|
|
894
956
|
var _a;
|
|
895
|
-
const locale = props.defaultLocale
|
|
957
|
+
const locale = props.defaultLocale;
|
|
896
958
|
const localized = ((_a = product.localization) == null ? void 0 : _a[locale]) || Object.values(product.localization || {})[0];
|
|
897
959
|
if (!localized) return void 0;
|
|
898
960
|
const parts = field.split(".");
|
|
@@ -924,11 +986,8 @@ function ProductCardList(props) {
|
|
|
924
986
|
props.skus ? Array.isArray(props.skus) ? props.skus.join(",") : props.skus : ""
|
|
925
987
|
]);
|
|
926
988
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: props.skus && props.skus.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: styles.wrapper, children: [
|
|
927
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles.statusContainer, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children:
|
|
928
|
-
!loading && error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles.
|
|
929
|
-
"Error: ",
|
|
930
|
-
error
|
|
931
|
-
] }) }) : null,
|
|
989
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles.statusContainer, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t().loadingProducts }) }) : null,
|
|
990
|
+
!loading && error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles.errorContainer, children: t().productFetchError }) : null,
|
|
932
991
|
!loading && products && products.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles.productCardsContainer, children: products == null ? void 0 : products.map((product) => {
|
|
933
992
|
var _a;
|
|
934
993
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: styles.productCard, children: [
|
|
@@ -1047,7 +1106,7 @@ var styles2 = {
|
|
|
1047
1106
|
fontFamily: 'var(--font-space-grotesk), "Space Grotesk", sans-serif',
|
|
1048
1107
|
fontWeight: 500,
|
|
1049
1108
|
fontStyle: "Medium",
|
|
1050
|
-
fontSize: "
|
|
1109
|
+
fontSize: "28px",
|
|
1051
1110
|
leadingTrim: "NONE",
|
|
1052
1111
|
lineHeight: "100%",
|
|
1053
1112
|
letterSpacing: "0%",
|
|
@@ -1055,7 +1114,7 @@ var styles2 = {
|
|
|
1055
1114
|
},
|
|
1056
1115
|
welcomeDescription: {
|
|
1057
1116
|
color: "#4b5563",
|
|
1058
|
-
maxWidth: "
|
|
1117
|
+
maxWidth: "32rem",
|
|
1059
1118
|
fontFamily: 'var(--font-space-grotesk), "Space Grotesk", sans-serif',
|
|
1060
1119
|
fontWeight: 400,
|
|
1061
1120
|
fontStyle: "Regular",
|
|
@@ -1070,7 +1129,7 @@ var styles2 = {
|
|
|
1070
1129
|
display: "flex",
|
|
1071
1130
|
flexWrap: "wrap",
|
|
1072
1131
|
justifyContent: "center",
|
|
1073
|
-
gap: "
|
|
1132
|
+
gap: "1rem"
|
|
1074
1133
|
},
|
|
1075
1134
|
messageContainerUser: {
|
|
1076
1135
|
display: "flex",
|
|
@@ -1215,6 +1274,13 @@ var styles2 = {
|
|
|
1215
1274
|
textAlign: "center",
|
|
1216
1275
|
marginTop: "0.75rem"
|
|
1217
1276
|
},
|
|
1277
|
+
predefinedPromptDisclaimer: {
|
|
1278
|
+
fontSize: "0.75rem",
|
|
1279
|
+
color: "#6b7280",
|
|
1280
|
+
textAlign: "center",
|
|
1281
|
+
marginTop: "2rem",
|
|
1282
|
+
width: "100%"
|
|
1283
|
+
},
|
|
1218
1284
|
backdrop: {
|
|
1219
1285
|
position: "fixed",
|
|
1220
1286
|
top: 0,
|
|
@@ -1369,14 +1435,6 @@ var ANIMATION_STYLES = `
|
|
|
1369
1435
|
border-color: #d1d5db !important;
|
|
1370
1436
|
}
|
|
1371
1437
|
`;
|
|
1372
|
-
var TRANSLATIONS = {
|
|
1373
|
-
newChat: "New Chat",
|
|
1374
|
-
welcomeToShopPrompter: "Welcome to ShopPrompter",
|
|
1375
|
-
welcomeDescription: "I am your personal AI shopping assistant. Ask me anything about our products!",
|
|
1376
|
-
askMeAnything: "Ask me anything...",
|
|
1377
|
-
thinking: "Thinking...",
|
|
1378
|
-
feedbackError: "We are sorry, but we could not process your feedback. Please try again later."
|
|
1379
|
-
};
|
|
1380
1438
|
var ICONS = {
|
|
1381
1439
|
chat: "https://cdn.jsdelivr.net/gh/lucide-icons/lucide@latest/icons/message-square.svg",
|
|
1382
1440
|
shopprompter: "https://cdn.jsdelivr.net/gh/lucide-icons/lucide@latest/icons/bot.svg",
|
|
@@ -1399,6 +1457,20 @@ function ShopPrompter(props) {
|
|
|
1399
1457
|
const [backdropAnimationClass, setBackdropAnimationClass] = (0, import_react2.useState)(
|
|
1400
1458
|
() => ""
|
|
1401
1459
|
);
|
|
1460
|
+
function t() {
|
|
1461
|
+
return getTranslations(props.defaultLocale);
|
|
1462
|
+
}
|
|
1463
|
+
function requireClickOnPredefinedPromptVal() {
|
|
1464
|
+
const flag = props.requireClickOnPredefinedPrompt;
|
|
1465
|
+
return typeof flag === "string" ? flag !== "false" : flag != null ? flag : true;
|
|
1466
|
+
}
|
|
1467
|
+
function shouldHideInput() {
|
|
1468
|
+
const requireClick = requireClickOnPredefinedPromptVal();
|
|
1469
|
+
if (!requireClick) return false;
|
|
1470
|
+
if (chatMessages.length > 0) return false;
|
|
1471
|
+
if (prompts().length === 0) return false;
|
|
1472
|
+
return true;
|
|
1473
|
+
}
|
|
1402
1474
|
function hasToken() {
|
|
1403
1475
|
var _a2;
|
|
1404
1476
|
const token = props.shopPrompterToken || ((_a2 = apiConfigObj == null ? void 0 : apiConfigObj()) == null ? void 0 : _a2.shopPrompterToken);
|
|
@@ -1558,7 +1630,13 @@ function ShopPrompter(props) {
|
|
|
1558
1630
|
setIsLoading(loading);
|
|
1559
1631
|
},
|
|
1560
1632
|
onError: (err) => {
|
|
1561
|
-
|
|
1633
|
+
if (err.includes("429")) {
|
|
1634
|
+
setError(t().guestLimitReached);
|
|
1635
|
+
} else if (err.includes("401") || err.includes("403")) {
|
|
1636
|
+
setError(t().sessionExpired);
|
|
1637
|
+
} else {
|
|
1638
|
+
setError(err);
|
|
1639
|
+
}
|
|
1562
1640
|
},
|
|
1563
1641
|
onCartOperation: (ops) => {
|
|
1564
1642
|
if (props.onCartOperation) {
|
|
@@ -1695,6 +1773,10 @@ function ShopPrompter(props) {
|
|
|
1695
1773
|
return;
|
|
1696
1774
|
}
|
|
1697
1775
|
const response = await (service == null ? void 0 : service.getAgentExperience());
|
|
1776
|
+
if (!response) {
|
|
1777
|
+
setError(t().agentExperienceError);
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1698
1780
|
setAgentExperience(response);
|
|
1699
1781
|
})();
|
|
1700
1782
|
}
|
|
@@ -1718,7 +1800,7 @@ function ShopPrompter(props) {
|
|
|
1718
1800
|
setError(null);
|
|
1719
1801
|
service == null ? void 0 : service.sendFeedback(messageId, messageContent, targetFeedback).catch((err) => {
|
|
1720
1802
|
setChatMessages(oldMessages);
|
|
1721
|
-
setError((err == null ? void 0 : err.message) ||
|
|
1803
|
+
setError((err == null ? void 0 : err.message) || t().feedbackError);
|
|
1722
1804
|
});
|
|
1723
1805
|
}
|
|
1724
1806
|
function canShowFeedback(message) {
|
|
@@ -1856,7 +1938,7 @@ function ShopPrompter(props) {
|
|
|
1856
1938
|
) : null,
|
|
1857
1939
|
(agentExperience == null ? void 0 : agentExperience.agentName) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles2.headerText, children: agentExperience.agentName }) : null
|
|
1858
1940
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles2.subHeaderContainer }) }),
|
|
1859
|
-
!hasToken() && ((_a = apiConfigObj == null ? void 0 : apiConfigObj()) == null ? void 0 : _a.apiKey) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles2.warningBanner, children:
|
|
1941
|
+
!hasToken() && ((_a = apiConfigObj == null ? void 0 : apiConfigObj()) == null ? void 0 : _a.apiKey) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles2.warningBanner, children: t().apiKeyWarning }) : null,
|
|
1860
1942
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles2.subHeaderContainer, children: [
|
|
1861
1943
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1862
1944
|
"button",
|
|
@@ -1864,7 +1946,7 @@ function ShopPrompter(props) {
|
|
|
1864
1946
|
className: "sh-header-btn",
|
|
1865
1947
|
onClick: (e) => handleNewChat(),
|
|
1866
1948
|
style: styles2.headerButton,
|
|
1867
|
-
children:
|
|
1949
|
+
children: t().newChat
|
|
1868
1950
|
}
|
|
1869
1951
|
),
|
|
1870
1952
|
props.chatPosition === "classic-chatbot" || props.chatPosition === "right-panel" || props.chatPosition === "dialog" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1907,7 +1989,7 @@ function ShopPrompter(props) {
|
|
|
1907
1989
|
...styles2.insufficientConfigTitle,
|
|
1908
1990
|
fontFamily: themeObj().fontFamily || void 0
|
|
1909
1991
|
},
|
|
1910
|
-
children:
|
|
1992
|
+
children: t().configErrorTitle
|
|
1911
1993
|
}
|
|
1912
1994
|
),
|
|
1913
1995
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1917,7 +1999,7 @@ function ShopPrompter(props) {
|
|
|
1917
1999
|
...styles2.insufficientConfigMessage,
|
|
1918
2000
|
fontFamily: themeObj().fontFamily || void 0
|
|
1919
2001
|
},
|
|
1920
|
-
children:
|
|
2002
|
+
children: t().configErrorMessage
|
|
1921
2003
|
}
|
|
1922
2004
|
),
|
|
1923
2005
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -1935,7 +2017,7 @@ function ShopPrompter(props) {
|
|
|
1935
2017
|
fontWeight: 600,
|
|
1936
2018
|
marginBottom: "0.25rem"
|
|
1937
2019
|
},
|
|
1938
|
-
children:
|
|
2020
|
+
children: t().configMissingParams
|
|
1939
2021
|
}
|
|
1940
2022
|
),
|
|
1941
2023
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -1955,7 +2037,7 @@ function ShopPrompter(props) {
|
|
|
1955
2037
|
style: {
|
|
1956
2038
|
color: "#ef4444"
|
|
1957
2039
|
},
|
|
1958
|
-
children:
|
|
2040
|
+
children: t().configMissingToken
|
|
1959
2041
|
}
|
|
1960
2042
|
),
|
|
1961
2043
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1964,7 +2046,7 @@ function ShopPrompter(props) {
|
|
|
1964
2046
|
style: {
|
|
1965
2047
|
color: "#ef4444"
|
|
1966
2048
|
},
|
|
1967
|
-
children:
|
|
2049
|
+
children: t().configMissingApiKey
|
|
1968
2050
|
}
|
|
1969
2051
|
)
|
|
1970
2052
|
]
|
|
@@ -2000,8 +2082,8 @@ function ShopPrompter(props) {
|
|
|
2000
2082
|
alt: "ShopPrompter",
|
|
2001
2083
|
src: (agentExperience == null ? void 0 : agentExperience.agentLogoUrl) ? agentExperience.agentLogoUrl : ICONS.shopprompter,
|
|
2002
2084
|
style: {
|
|
2003
|
-
width: "
|
|
2004
|
-
height: "
|
|
2085
|
+
width: "96px",
|
|
2086
|
+
height: "96px",
|
|
2005
2087
|
marginBottom: "24px",
|
|
2006
2088
|
borderRadius: "12px",
|
|
2007
2089
|
objectFit: "cover"
|
|
@@ -2015,7 +2097,9 @@ function ShopPrompter(props) {
|
|
|
2015
2097
|
...styles2.welcomeTitle,
|
|
2016
2098
|
fontFamily: themeObj().fontFamily || styles2.welcomeTitle.fontFamily
|
|
2017
2099
|
},
|
|
2018
|
-
|
|
2100
|
+
dangerouslySetInnerHTML: {
|
|
2101
|
+
__html: ((_b = agentExperience == null ? void 0 : agentExperience.greeting) == null ? void 0 : _b.title) || t().welcomeToShopPrompter
|
|
2102
|
+
}
|
|
2019
2103
|
}
|
|
2020
2104
|
),
|
|
2021
2105
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2025,13 +2109,19 @@ function ShopPrompter(props) {
|
|
|
2025
2109
|
...styles2.welcomeDescription,
|
|
2026
2110
|
fontFamily: themeObj().fontFamily || styles2.welcomeDescription.fontFamily
|
|
2027
2111
|
},
|
|
2028
|
-
|
|
2112
|
+
dangerouslySetInnerHTML: {
|
|
2113
|
+
__html: ((_c = agentExperience == null ? void 0 : agentExperience.greeting) == null ? void 0 : _c.message) || t().welcomeDescription
|
|
2114
|
+
}
|
|
2029
2115
|
}
|
|
2030
2116
|
),
|
|
2031
2117
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles2.buttonContainer, children: (_d = prompts()) == null ? void 0 : _d.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2032
2118
|
"button",
|
|
2033
2119
|
{
|
|
2034
|
-
style:
|
|
2120
|
+
style: {
|
|
2121
|
+
...styles2.button,
|
|
2122
|
+
borderColor: themeObj().actionColor || "#e5e7eb",
|
|
2123
|
+
outlineColor: themeObj().actionColor || void 0
|
|
2124
|
+
},
|
|
2035
2125
|
onClick: (event) => {
|
|
2036
2126
|
setInput(item.prompt);
|
|
2037
2127
|
handleSend(item.prompt);
|
|
@@ -2039,7 +2129,17 @@ function ShopPrompter(props) {
|
|
|
2039
2129
|
children: item.prompt
|
|
2040
2130
|
},
|
|
2041
2131
|
item.prompt
|
|
2042
|
-
)) })
|
|
2132
|
+
)) }),
|
|
2133
|
+
requireClickOnPredefinedPromptVal() && prompts().length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2134
|
+
"div",
|
|
2135
|
+
{
|
|
2136
|
+
style: {
|
|
2137
|
+
...styles2.predefinedPromptDisclaimer,
|
|
2138
|
+
fontFamily: themeObj().fontFamily || void 0
|
|
2139
|
+
},
|
|
2140
|
+
children: t().predefinedPromptDisclaimer
|
|
2141
|
+
}
|
|
2142
|
+
) : null
|
|
2043
2143
|
] }) : null,
|
|
2044
2144
|
!showWelcome() ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2045
2145
|
"div",
|
|
@@ -2165,7 +2265,7 @@ function ShopPrompter(props) {
|
|
|
2165
2265
|
product_card_list_component_default,
|
|
2166
2266
|
{
|
|
2167
2267
|
skus: message.productSkus,
|
|
2168
|
-
defaultLocale: props.defaultLocale,
|
|
2268
|
+
defaultLocale: props.defaultLocale || DEFAULT_LOCALE,
|
|
2169
2269
|
showPriceIfEmpty: showPriceIfEmptyVal(),
|
|
2170
2270
|
visibleFields: visibleFieldsList()
|
|
2171
2271
|
}
|
|
@@ -2174,19 +2274,20 @@ function ShopPrompter(props) {
|
|
|
2174
2274
|
] }, message.id))
|
|
2175
2275
|
}
|
|
2176
2276
|
) : null,
|
|
2177
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime4.
|
|
2178
|
-
"Error: ",
|
|
2179
|
-
error
|
|
2180
|
-
] }) : null
|
|
2277
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles2.errorContainer, children: error }) : null
|
|
2181
2278
|
]
|
|
2182
2279
|
}
|
|
2183
2280
|
),
|
|
2184
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2281
|
+
!shouldHideInput() ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2185
2282
|
"div",
|
|
2186
2283
|
{
|
|
2187
2284
|
style: {
|
|
2188
2285
|
...styles2.inputSection,
|
|
2189
|
-
backgroundColor: themeObj().mainBackgroundColor || styles2.inputSection.backgroundColor
|
|
2286
|
+
backgroundColor: themeObj().mainBackgroundColor || styles2.inputSection.backgroundColor,
|
|
2287
|
+
...error ? {
|
|
2288
|
+
opacity: "0.5",
|
|
2289
|
+
pointerEvents: "none"
|
|
2290
|
+
} : {}
|
|
2190
2291
|
},
|
|
2191
2292
|
children: [
|
|
2192
2293
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles2.inputWrapper, children: [
|
|
@@ -2196,10 +2297,11 @@ function ShopPrompter(props) {
|
|
|
2196
2297
|
id: "shop-prompter-input",
|
|
2197
2298
|
type: "text",
|
|
2198
2299
|
style: styles2.input,
|
|
2199
|
-
placeholder: (agentExperience == null ? void 0 : agentExperience.hintText) ||
|
|
2300
|
+
placeholder: (agentExperience == null ? void 0 : agentExperience.hintText) || t().askMeAnything,
|
|
2200
2301
|
value: input,
|
|
2201
2302
|
onInput: (e) => onInputChange(e),
|
|
2202
|
-
onKeyDown: (e) => onInputKeyDown(e)
|
|
2303
|
+
onKeyDown: (e) => onInputKeyDown(e),
|
|
2304
|
+
disabled: !!error
|
|
2203
2305
|
}
|
|
2204
2306
|
),
|
|
2205
2307
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2224,10 +2326,10 @@ function ShopPrompter(props) {
|
|
|
2224
2326
|
}
|
|
2225
2327
|
)
|
|
2226
2328
|
] }),
|
|
2227
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles2.disclaimer, children:
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles2.disclaimer, children: t().disclaimer })
|
|
2228
2330
|
]
|
|
2229
2331
|
}
|
|
2230
|
-
)
|
|
2332
|
+
) : null
|
|
2231
2333
|
]
|
|
2232
2334
|
}
|
|
2233
2335
|
) : null
|