@shop-prompter/react 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +149 -46
- package/dist/index.mjs +149 -46
- package/package.json +1 -1
- package/src/product-card-list.component.jsx +18 -7
- package/src/shop-prompter.component.jsx +130 -77
- 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: "Klicke 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: [
|
|
@@ -1004,7 +1063,7 @@ var styles2 = {
|
|
|
1004
1063
|
},
|
|
1005
1064
|
button: {
|
|
1006
1065
|
padding: "0.625rem 1rem",
|
|
1007
|
-
border: "
|
|
1066
|
+
border: "2px solid #e5e7eb",
|
|
1008
1067
|
borderRadius: "0.75rem",
|
|
1009
1068
|
backgroundColor: "transparent",
|
|
1010
1069
|
transition: "background-color 0.2s, color 0.2s",
|
|
@@ -1047,15 +1106,16 @@ 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%",
|
|
1113
|
+
paddingBottom: "1rem",
|
|
1054
1114
|
textAlign: "center"
|
|
1055
1115
|
},
|
|
1056
1116
|
welcomeDescription: {
|
|
1057
1117
|
color: "#4b5563",
|
|
1058
|
-
maxWidth: "
|
|
1118
|
+
maxWidth: "32rem",
|
|
1059
1119
|
fontFamily: 'var(--font-space-grotesk), "Space Grotesk", sans-serif',
|
|
1060
1120
|
fontWeight: 400,
|
|
1061
1121
|
fontStyle: "Regular",
|
|
@@ -1070,7 +1130,7 @@ var styles2 = {
|
|
|
1070
1130
|
display: "flex",
|
|
1071
1131
|
flexWrap: "wrap",
|
|
1072
1132
|
justifyContent: "center",
|
|
1073
|
-
gap: "
|
|
1133
|
+
gap: "1rem"
|
|
1074
1134
|
},
|
|
1075
1135
|
messageContainerUser: {
|
|
1076
1136
|
display: "flex",
|
|
@@ -1215,6 +1275,13 @@ var styles2 = {
|
|
|
1215
1275
|
textAlign: "center",
|
|
1216
1276
|
marginTop: "0.75rem"
|
|
1217
1277
|
},
|
|
1278
|
+
predefinedPromptDisclaimer: {
|
|
1279
|
+
fontSize: "0.75rem",
|
|
1280
|
+
color: "#6b7280",
|
|
1281
|
+
textAlign: "center",
|
|
1282
|
+
marginTop: "2rem",
|
|
1283
|
+
width: "100%"
|
|
1284
|
+
},
|
|
1218
1285
|
backdrop: {
|
|
1219
1286
|
position: "fixed",
|
|
1220
1287
|
top: 0,
|
|
@@ -1369,14 +1436,6 @@ var ANIMATION_STYLES = `
|
|
|
1369
1436
|
border-color: #d1d5db !important;
|
|
1370
1437
|
}
|
|
1371
1438
|
`;
|
|
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
1439
|
var ICONS = {
|
|
1381
1440
|
chat: "https://cdn.jsdelivr.net/gh/lucide-icons/lucide@latest/icons/message-square.svg",
|
|
1382
1441
|
shopprompter: "https://cdn.jsdelivr.net/gh/lucide-icons/lucide@latest/icons/bot.svg",
|
|
@@ -1399,6 +1458,20 @@ function ShopPrompter(props) {
|
|
|
1399
1458
|
const [backdropAnimationClass, setBackdropAnimationClass] = (0, import_react2.useState)(
|
|
1400
1459
|
() => ""
|
|
1401
1460
|
);
|
|
1461
|
+
function t() {
|
|
1462
|
+
return getTranslations(props.defaultLocale);
|
|
1463
|
+
}
|
|
1464
|
+
function requireClickOnPredefinedPromptVal() {
|
|
1465
|
+
const flag = props.requireClickOnPredefinedPrompt;
|
|
1466
|
+
return typeof flag === "string" ? flag !== "false" : flag != null ? flag : true;
|
|
1467
|
+
}
|
|
1468
|
+
function shouldHideInput() {
|
|
1469
|
+
const requireClick = requireClickOnPredefinedPromptVal();
|
|
1470
|
+
if (!requireClick) return false;
|
|
1471
|
+
if (chatMessages.length > 0) return false;
|
|
1472
|
+
if (prompts().length === 0) return false;
|
|
1473
|
+
return true;
|
|
1474
|
+
}
|
|
1402
1475
|
function hasToken() {
|
|
1403
1476
|
var _a2;
|
|
1404
1477
|
const token = props.shopPrompterToken || ((_a2 = apiConfigObj == null ? void 0 : apiConfigObj()) == null ? void 0 : _a2.shopPrompterToken);
|
|
@@ -1558,7 +1631,13 @@ function ShopPrompter(props) {
|
|
|
1558
1631
|
setIsLoading(loading);
|
|
1559
1632
|
},
|
|
1560
1633
|
onError: (err) => {
|
|
1561
|
-
|
|
1634
|
+
if (err.includes("429")) {
|
|
1635
|
+
setError(t().guestLimitReached);
|
|
1636
|
+
} else if (err.includes("401") || err.includes("403")) {
|
|
1637
|
+
setError(t().sessionExpired);
|
|
1638
|
+
} else {
|
|
1639
|
+
setError(err);
|
|
1640
|
+
}
|
|
1562
1641
|
},
|
|
1563
1642
|
onCartOperation: (ops) => {
|
|
1564
1643
|
if (props.onCartOperation) {
|
|
@@ -1695,6 +1774,10 @@ function ShopPrompter(props) {
|
|
|
1695
1774
|
return;
|
|
1696
1775
|
}
|
|
1697
1776
|
const response = await (service == null ? void 0 : service.getAgentExperience());
|
|
1777
|
+
if (!response) {
|
|
1778
|
+
setError(t().agentExperienceError);
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1698
1781
|
setAgentExperience(response);
|
|
1699
1782
|
})();
|
|
1700
1783
|
}
|
|
@@ -1718,7 +1801,7 @@ function ShopPrompter(props) {
|
|
|
1718
1801
|
setError(null);
|
|
1719
1802
|
service == null ? void 0 : service.sendFeedback(messageId, messageContent, targetFeedback).catch((err) => {
|
|
1720
1803
|
setChatMessages(oldMessages);
|
|
1721
|
-
setError((err == null ? void 0 : err.message) ||
|
|
1804
|
+
setError((err == null ? void 0 : err.message) || t().feedbackError);
|
|
1722
1805
|
});
|
|
1723
1806
|
}
|
|
1724
1807
|
function canShowFeedback(message) {
|
|
@@ -1856,7 +1939,7 @@ function ShopPrompter(props) {
|
|
|
1856
1939
|
) : null,
|
|
1857
1940
|
(agentExperience == null ? void 0 : agentExperience.agentName) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: styles2.headerText, children: agentExperience.agentName }) : null
|
|
1858
1941
|
] }) : /* @__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:
|
|
1942
|
+
!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
1943
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles2.subHeaderContainer, children: [
|
|
1861
1944
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1862
1945
|
"button",
|
|
@@ -1864,7 +1947,7 @@ function ShopPrompter(props) {
|
|
|
1864
1947
|
className: "sh-header-btn",
|
|
1865
1948
|
onClick: (e) => handleNewChat(),
|
|
1866
1949
|
style: styles2.headerButton,
|
|
1867
|
-
children:
|
|
1950
|
+
children: t().newChat
|
|
1868
1951
|
}
|
|
1869
1952
|
),
|
|
1870
1953
|
props.chatPosition === "classic-chatbot" || props.chatPosition === "right-panel" || props.chatPosition === "dialog" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1907,7 +1990,7 @@ function ShopPrompter(props) {
|
|
|
1907
1990
|
...styles2.insufficientConfigTitle,
|
|
1908
1991
|
fontFamily: themeObj().fontFamily || void 0
|
|
1909
1992
|
},
|
|
1910
|
-
children:
|
|
1993
|
+
children: t().configErrorTitle
|
|
1911
1994
|
}
|
|
1912
1995
|
),
|
|
1913
1996
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1917,7 +2000,7 @@ function ShopPrompter(props) {
|
|
|
1917
2000
|
...styles2.insufficientConfigMessage,
|
|
1918
2001
|
fontFamily: themeObj().fontFamily || void 0
|
|
1919
2002
|
},
|
|
1920
|
-
children:
|
|
2003
|
+
children: t().configErrorMessage
|
|
1921
2004
|
}
|
|
1922
2005
|
),
|
|
1923
2006
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -1935,7 +2018,7 @@ function ShopPrompter(props) {
|
|
|
1935
2018
|
fontWeight: 600,
|
|
1936
2019
|
marginBottom: "0.25rem"
|
|
1937
2020
|
},
|
|
1938
|
-
children:
|
|
2021
|
+
children: t().configMissingParams
|
|
1939
2022
|
}
|
|
1940
2023
|
),
|
|
1941
2024
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -1955,7 +2038,7 @@ function ShopPrompter(props) {
|
|
|
1955
2038
|
style: {
|
|
1956
2039
|
color: "#ef4444"
|
|
1957
2040
|
},
|
|
1958
|
-
children:
|
|
2041
|
+
children: t().configMissingToken
|
|
1959
2042
|
}
|
|
1960
2043
|
),
|
|
1961
2044
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -1964,7 +2047,7 @@ function ShopPrompter(props) {
|
|
|
1964
2047
|
style: {
|
|
1965
2048
|
color: "#ef4444"
|
|
1966
2049
|
},
|
|
1967
|
-
children:
|
|
2050
|
+
children: t().configMissingApiKey
|
|
1968
2051
|
}
|
|
1969
2052
|
)
|
|
1970
2053
|
]
|
|
@@ -2000,8 +2083,8 @@ function ShopPrompter(props) {
|
|
|
2000
2083
|
alt: "ShopPrompter",
|
|
2001
2084
|
src: (agentExperience == null ? void 0 : agentExperience.agentLogoUrl) ? agentExperience.agentLogoUrl : ICONS.shopprompter,
|
|
2002
2085
|
style: {
|
|
2003
|
-
width: "
|
|
2004
|
-
height: "
|
|
2086
|
+
width: "96px",
|
|
2087
|
+
height: "96px",
|
|
2005
2088
|
marginBottom: "24px",
|
|
2006
2089
|
borderRadius: "12px",
|
|
2007
2090
|
objectFit: "cover"
|
|
@@ -2015,7 +2098,9 @@ function ShopPrompter(props) {
|
|
|
2015
2098
|
...styles2.welcomeTitle,
|
|
2016
2099
|
fontFamily: themeObj().fontFamily || styles2.welcomeTitle.fontFamily
|
|
2017
2100
|
},
|
|
2018
|
-
|
|
2101
|
+
dangerouslySetInnerHTML: {
|
|
2102
|
+
__html: ((_b = agentExperience == null ? void 0 : agentExperience.greeting) == null ? void 0 : _b.title) || t().welcomeToShopPrompter
|
|
2103
|
+
}
|
|
2019
2104
|
}
|
|
2020
2105
|
),
|
|
2021
2106
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2025,13 +2110,19 @@ function ShopPrompter(props) {
|
|
|
2025
2110
|
...styles2.welcomeDescription,
|
|
2026
2111
|
fontFamily: themeObj().fontFamily || styles2.welcomeDescription.fontFamily
|
|
2027
2112
|
},
|
|
2028
|
-
|
|
2113
|
+
dangerouslySetInnerHTML: {
|
|
2114
|
+
__html: ((_c = agentExperience == null ? void 0 : agentExperience.greeting) == null ? void 0 : _c.message) || t().welcomeDescription
|
|
2115
|
+
}
|
|
2029
2116
|
}
|
|
2030
2117
|
),
|
|
2031
2118
|
/* @__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
2119
|
"button",
|
|
2033
2120
|
{
|
|
2034
|
-
style:
|
|
2121
|
+
style: {
|
|
2122
|
+
...styles2.button,
|
|
2123
|
+
borderColor: themeObj().actionColor || "#e5e7eb",
|
|
2124
|
+
outlineColor: themeObj().actionColor || void 0
|
|
2125
|
+
},
|
|
2035
2126
|
onClick: (event) => {
|
|
2036
2127
|
setInput(item.prompt);
|
|
2037
2128
|
handleSend(item.prompt);
|
|
@@ -2039,7 +2130,17 @@ function ShopPrompter(props) {
|
|
|
2039
2130
|
children: item.prompt
|
|
2040
2131
|
},
|
|
2041
2132
|
item.prompt
|
|
2042
|
-
)) })
|
|
2133
|
+
)) }),
|
|
2134
|
+
requireClickOnPredefinedPromptVal() && prompts().length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2135
|
+
"div",
|
|
2136
|
+
{
|
|
2137
|
+
style: {
|
|
2138
|
+
...styles2.predefinedPromptDisclaimer,
|
|
2139
|
+
fontFamily: themeObj().fontFamily || void 0
|
|
2140
|
+
},
|
|
2141
|
+
children: t().predefinedPromptDisclaimer
|
|
2142
|
+
}
|
|
2143
|
+
) : null
|
|
2043
2144
|
] }) : null,
|
|
2044
2145
|
!showWelcome() ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2045
2146
|
"div",
|
|
@@ -2165,7 +2266,7 @@ function ShopPrompter(props) {
|
|
|
2165
2266
|
product_card_list_component_default,
|
|
2166
2267
|
{
|
|
2167
2268
|
skus: message.productSkus,
|
|
2168
|
-
defaultLocale: props.defaultLocale,
|
|
2269
|
+
defaultLocale: props.defaultLocale || DEFAULT_LOCALE,
|
|
2169
2270
|
showPriceIfEmpty: showPriceIfEmptyVal(),
|
|
2170
2271
|
visibleFields: visibleFieldsList()
|
|
2171
2272
|
}
|
|
@@ -2174,19 +2275,20 @@ function ShopPrompter(props) {
|
|
|
2174
2275
|
] }, message.id))
|
|
2175
2276
|
}
|
|
2176
2277
|
) : null,
|
|
2177
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime4.
|
|
2178
|
-
"Error: ",
|
|
2179
|
-
error
|
|
2180
|
-
] }) : null
|
|
2278
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: styles2.errorContainer, children: error }) : null
|
|
2181
2279
|
]
|
|
2182
2280
|
}
|
|
2183
2281
|
),
|
|
2184
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2282
|
+
!shouldHideInput() ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2185
2283
|
"div",
|
|
2186
2284
|
{
|
|
2187
2285
|
style: {
|
|
2188
2286
|
...styles2.inputSection,
|
|
2189
|
-
backgroundColor: themeObj().mainBackgroundColor || styles2.inputSection.backgroundColor
|
|
2287
|
+
backgroundColor: themeObj().mainBackgroundColor || styles2.inputSection.backgroundColor,
|
|
2288
|
+
...error ? {
|
|
2289
|
+
opacity: "0.5",
|
|
2290
|
+
pointerEvents: "none"
|
|
2291
|
+
} : {}
|
|
2190
2292
|
},
|
|
2191
2293
|
children: [
|
|
2192
2294
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: styles2.inputWrapper, children: [
|
|
@@ -2196,10 +2298,11 @@ function ShopPrompter(props) {
|
|
|
2196
2298
|
id: "shop-prompter-input",
|
|
2197
2299
|
type: "text",
|
|
2198
2300
|
style: styles2.input,
|
|
2199
|
-
placeholder: (agentExperience == null ? void 0 : agentExperience.hintText) ||
|
|
2301
|
+
placeholder: (agentExperience == null ? void 0 : agentExperience.hintText) || t().askMeAnything,
|
|
2200
2302
|
value: input,
|
|
2201
2303
|
onInput: (e) => onInputChange(e),
|
|
2202
|
-
onKeyDown: (e) => onInputKeyDown(e)
|
|
2304
|
+
onKeyDown: (e) => onInputKeyDown(e),
|
|
2305
|
+
disabled: !!error
|
|
2203
2306
|
}
|
|
2204
2307
|
),
|
|
2205
2308
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -2224,10 +2327,10 @@ function ShopPrompter(props) {
|
|
|
2224
2327
|
}
|
|
2225
2328
|
)
|
|
2226
2329
|
] }),
|
|
2227
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles2.disclaimer, children:
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: styles2.disclaimer, children: t().disclaimer })
|
|
2228
2331
|
]
|
|
2229
2332
|
}
|
|
2230
|
-
)
|
|
2333
|
+
) : null
|
|
2231
2334
|
]
|
|
2232
2335
|
}
|
|
2233
2336
|
) : null
|