@blotoutio/providers-shop-gpt-sdk 1.13.0 → 1.15.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/index.cjs.js +1783 -947
- package/index.d.ts +1 -0
- package/index.js +1784 -948
- package/index.mjs +1783 -947
- package/package.json +3 -1
package/index.js
CHANGED
@@ -426,6 +426,7 @@ var ProvidersShopGptSdk = (function () {
|
|
426
426
|
'showThreads',
|
427
427
|
'queryInteractions',
|
428
428
|
'promptClicked',
|
429
|
+
'customPromptClicked',
|
429
430
|
'productRecommendationClicked',
|
430
431
|
'blotoutLinkClicked',
|
431
432
|
]);
|
@@ -830,7 +831,7 @@ var ProvidersShopGptSdk = (function () {
|
|
830
831
|
const data = (await response.json());
|
831
832
|
return data.customPrompts;
|
832
833
|
};
|
833
|
-
const sendEvent = (action, currency, actionData, clickData) => {
|
834
|
+
const sendEvent = (action, currency, actionData, clickData, beacon) => {
|
834
835
|
var _a;
|
835
836
|
const storageData = (_a = getProductActions(baseURL, sessionId)) !== null && _a !== void 0 ? _a : {};
|
836
837
|
const userType = getUserType(baseURL, sessionId);
|
@@ -860,6 +861,10 @@ var ProvidersShopGptSdk = (function () {
|
|
860
861
|
}
|
861
862
|
})
|
862
863
|
.catch(logger.error);
|
864
|
+
const options = { destination: baseURL };
|
865
|
+
if (beacon) {
|
866
|
+
options.method = 'beacon';
|
867
|
+
}
|
863
868
|
sendTag({
|
864
869
|
eventId: crypto.randomUUID(),
|
865
870
|
eventName: action,
|
@@ -874,6 +879,7 @@ var ProvidersShopGptSdk = (function () {
|
|
874
879
|
providers: {
|
875
880
|
shopGPT: true,
|
876
881
|
},
|
882
|
+
options,
|
877
883
|
});
|
878
884
|
};
|
879
885
|
return {
|
@@ -1114,7 +1120,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1114
1120
|
|
1115
1121
|
const scrollBarStyles = i$4 `
|
1116
1122
|
::-webkit-scrollbar {
|
1117
|
-
width:
|
1123
|
+
width: 15px;
|
1118
1124
|
}
|
1119
1125
|
|
1120
1126
|
::-webkit-scrollbar-track {
|
@@ -1164,15 +1170,15 @@ var ProvidersShopGptSdk = (function () {
|
|
1164
1170
|
}
|
1165
1171
|
|
1166
1172
|
#shop-gpt-modal {
|
1167
|
-
right:
|
1168
|
-
bottom:
|
1169
|
-
height:
|
1173
|
+
right: 20px;
|
1174
|
+
bottom: 91px;
|
1175
|
+
height: calc(90% - 91px);
|
1170
1176
|
width: 35%;
|
1171
1177
|
min-width: 475px;
|
1172
|
-
|
1178
|
+
box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1),
|
1179
|
+
0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
1180
|
+
border-radius: 24px;
|
1173
1181
|
overflow: hidden;
|
1174
|
-
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
1175
|
-
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
1176
1182
|
position: fixed;
|
1177
1183
|
z-index: 2000;
|
1178
1184
|
background: var(--shopgpt-white);
|
@@ -1180,10 +1186,11 @@ var ProvidersShopGptSdk = (function () {
|
|
1180
1186
|
@media screen and (max-width: 768px) {
|
1181
1187
|
min-height: unset;
|
1182
1188
|
min-width: unset;
|
1183
|
-
width:
|
1184
|
-
height:
|
1185
|
-
bottom:
|
1186
|
-
right:
|
1189
|
+
width: 100vw;
|
1190
|
+
height: 100vh;
|
1191
|
+
bottom: 0;
|
1192
|
+
right: 0;
|
1193
|
+
border-radius: 0;
|
1187
1194
|
}
|
1188
1195
|
}
|
1189
1196
|
|
@@ -1194,17 +1201,9 @@ var ProvidersShopGptSdk = (function () {
|
|
1194
1201
|
z-index: 1000;
|
1195
1202
|
|
1196
1203
|
button {
|
1197
|
-
|
1198
|
-
border:
|
1199
|
-
|
1200
|
-
width: 56px;
|
1201
|
-
height: 56px;
|
1202
|
-
background-color: var(--shopgpt-primary);
|
1203
|
-
border-radius: 50%;
|
1204
|
-
display: flex;
|
1205
|
-
justify-content: center;
|
1206
|
-
align-items: center;
|
1207
|
-
box-shadow: 0 0 4px 1px var(--shopgpt-white);
|
1204
|
+
background: unset;
|
1205
|
+
border: unset;
|
1206
|
+
padding: 0;
|
1208
1207
|
}
|
1209
1208
|
|
1210
1209
|
.chatbot-hover-text {
|
@@ -1222,9 +1221,7 @@ var ProvidersShopGptSdk = (function () {
|
|
1222
1221
|
right: calc(100% + 5px);
|
1223
1222
|
|
1224
1223
|
border-radius: 5px 5px 0px;
|
1225
|
-
background:
|
1226
|
-
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
1227
|
-
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
1224
|
+
background: white;
|
1228
1225
|
|
1229
1226
|
font-weight: 400;
|
1230
1227
|
line-height: 150%;
|
@@ -1346,9 +1343,8 @@ var ProvidersShopGptSdk = (function () {
|
|
1346
1343
|
const trashIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
1347
1344
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.75 1.125H11.25V2.25H6.75V1.125ZM2.25 3.375V4.5H3.375V15.75C3.375 16.0484 3.49353 16.3345 3.7045 16.5455C3.91548 16.7565 4.20163 16.875 4.5 16.875H13.5C13.7984 16.875 14.0845 16.7565 14.2955 16.5455C14.5065 16.3345 14.625 16.0484 14.625 15.75V4.5H15.75V3.375H2.25ZM4.5 15.75V4.5H13.5V15.75H4.5ZM6.75 6.75H7.875V13.5H6.75V6.75ZM10.125 6.75H11.25V13.5H10.125V6.75Z" fill="#A3B2C6"/>
|
1348
1345
|
</svg>`;
|
1349
|
-
const
|
1350
|
-
|
1351
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="18" viewBox="0 0 12 18" fill="none">
|
1346
|
+
const botIcon = (width, height) => b `
|
1347
|
+
<svg xmlns="http://www.w3.org/2000/svg" width=${width || '12'} height=${height || '18'} viewBox="0 0 12 18" fill="none">
|
1352
1348
|
<g clip-path="url(#clip0_12438_1597)">
|
1353
1349
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.0703335 0.211252C0.0351569 0.281773 0.0351562 0.374089 0.0351562 0.55872V17.2552C0.0351562 17.4398 0.0351569 17.5321 0.0703335 17.6026C0.101276 17.6647 0.150648 17.7151 0.211375 17.7468C0.280413 17.7826 0.37079 17.7826 0.551541 17.7826H1.75313C1.93388 17.7826 2.02425 17.7826 2.09329 17.7468C2.15402 17.7151 2.20339 17.6647 2.23433 17.6026C2.26951 17.5321 2.26951 17.4398 2.26951 17.2552V16.6659C3.28957 17.5011 4.58438 18.0007 5.99343 18.0007C9.2841 18.0007 11.9517 15.2758 11.9517 11.9145C11.9517 8.55319 9.2841 5.82832 5.99343 5.82832C4.58438 5.82832 3.28957 6.32793 2.26951 7.1632V0.55872C2.26951 0.374089 2.26951 0.281773 2.23433 0.211252C2.20339 0.149221 2.15402 0.0987883 2.09329 0.0671818C2.02425 0.03125 1.93388 0.03125 1.75313 0.03125H0.551541C0.37079 0.03125 0.280413 0.03125 0.211375 0.0671818C0.150648 0.0987883 0.101276 0.149221 0.0703335 0.211252ZM2.26951 11.9145C2.26951 14.0154 3.93677 15.7184 5.99343 15.7184C8.05007 15.7184 9.71735 14.0154 9.71735 11.9145C9.71735 9.81372 8.05007 8.11064 5.99343 8.11064C3.93677 8.11064 2.26951 9.81372 2.26951 11.9145Z" fill="#F25C2B"/>
|
1354
1350
|
</g>
|
@@ -1365,10 +1361,10 @@ var ProvidersShopGptSdk = (function () {
|
|
1365
1361
|
const closeBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="36" height="37" viewBox="0 0 36 37" fill="none">
|
1366
1362
|
<path d="M27 11.075L25.425 9.5L18 16.925L10.575 9.5L9 11.075L16.425 18.5L9 25.925L10.575 27.5L18 20.075L25.425 27.5L27 25.925L19.575 18.5L27 11.075Z" fill="#A3B2C6"/>
|
1367
1363
|
</svg>`;
|
1368
|
-
const leftBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1364
|
+
const leftBtn$1 = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1369
1365
|
<path d="M6.64645 2.64645L6.9954 2.2975L7.34889 2.64184L8.06389 3.33834L8.42613 3.69121L8.06918 4.04942L5.12908 7H14H14.5V7.5V8.5V9H14H5.1329L8.06839 11.9328L8.42264 12.2867L8.06818 12.6404L7.35318 13.3539L6.99963 13.7067L6.64645 13.3536L1.64645 8.35355L1.29289 8L1.64645 7.64645L6.64645 2.64645Z" fill="#4E647F" stroke="#4E647F"/>
|
1370
1366
|
</svg>`;
|
1371
|
-
const rightBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1367
|
+
const rightBtn$1 = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1372
1368
|
<path d="M9.35355 2.64645L9.0046 2.2975L8.65111 2.64184L7.93611 3.33834L7.57387 3.69121L7.93082 4.04942L10.8709 7H2H1.5V7.5V8.5V9H2H10.8671L7.93161 11.9328L7.57736 12.2867L7.93182 12.6404L8.64682 13.3539L9.00037 13.7067L9.35355 13.3536L14.3536 8.35355L14.7071 8L14.3536 7.64645L9.35355 2.64645Z" fill="#4E647F" stroke="#4E647F"/>
|
1373
1369
|
</svg>`;
|
1374
1370
|
const searchIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none">
|
@@ -1400,6 +1396,46 @@ var ProvidersShopGptSdk = (function () {
|
|
1400
1396
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M80.8045 32.827C81.748 32.827 82.5129 32.0538 82.5129 31.0999C82.5129 30.1461 81.748 29.3728 80.8045 29.3728C79.8609 29.3728 79.096 30.1461 79.096 31.0999C79.096 32.0538 79.8609 32.827 80.8045 32.827ZM80.8045 33.8633C82.3141 33.8633 83.538 32.6261 83.538 31.0999C83.538 29.5738 82.3141 28.3366 80.8045 28.3366C79.2948 28.3366 78.0709 29.5738 78.0709 31.0999C78.0709 32.6261 79.2948 33.8633 80.8045 33.8633Z" fill="#F25C2B"/>
|
1401
1397
|
<path d="M75.2265 25.6998C75.1436 25.6998 75.1021 25.6998 75.0705 25.7161C75.0426 25.7305 75.02 25.7534 75.0058 25.7815C74.9896 25.8135 74.9896 25.8555 74.9896 25.9393V26.9083H74.6394C74.5593 26.9083 74.5183 26.9086 74.4872 26.9247C74.4593 26.939 74.4367 26.9619 74.4225 26.99C74.4063 27.0221 74.4063 27.064 74.4063 27.1478V27.7051C74.4063 27.7889 74.4063 27.8308 74.4225 27.8628C74.4367 27.891 74.4593 27.9139 74.4872 27.9282C74.5188 27.9446 74.5603 27.9446 74.6432 27.9446H74.9896V32.0994H74.9882C74.9878 32.1063 74.9874 32.1131 74.987 32.12C74.9876 32.1359 74.9885 32.1518 74.9896 32.1676V32.2073L74.9918 32.2072C75.0376 33.0766 75.7476 33.7581 76.6088 33.7595C76.7762 33.7594 76.9423 33.733 77.1013 33.6816C77.1703 33.6593 77.2245 33.5768 77.2243 33.5035L77.2261 32.7371C77.2261 32.7257 77.224 32.7075 77.2211 32.6964C77.2206 32.6945 77.22 32.6924 77.2194 32.6903C77.2148 32.6737 77.2005 32.6492 77.1865 32.6391C77.1828 32.6365 77.1347 32.6088 77.0944 32.6334C77.0512 32.6536 77.0505 32.654 77.0498 32.6543C77.0388 32.6596 77.0016 32.6737 76.9842 32.6839C76.8335 32.7484 76.8109 32.7469 76.7666 32.7532C76.7363 32.7575 76.7058 32.7596 76.6752 32.7596C76.6174 32.7596 76.56 32.752 76.5042 32.7369C76.4485 32.7218 76.3949 32.6993 76.3449 32.6702C76.3181 32.6523 76.2927 32.6326 76.2687 32.6111C76.2546 32.6011 76.241 32.5905 76.2278 32.5793C76.2212 32.5744 76.2146 32.5693 76.2081 32.5641C76.2064 32.5618 76.2047 32.5596 76.203 32.5573C76.0832 32.4441 76.0151 32.2858 76.0147 32.12C76.0151 32.1146 76.0157 32.1092 76.0163 32.1039C76.0157 32.0999 76.0152 32.0959 76.0147 32.092V27.9446H76.9737C77.0566 27.9446 77.0981 27.9446 77.1298 27.9282C77.1576 27.9139 77.1803 27.891 77.1945 27.8628C77.2106 27.8308 77.2106 27.7889 77.2106 27.7051V27.1478C77.2106 27.064 77.2106 27.0221 77.1945 26.99C77.1803 26.9619 77.1576 26.939 77.1298 26.9247C77.0981 26.9083 77.0566 26.9083 76.9737 26.9083H76.0147V25.9393C76.0147 25.8555 76.0147 25.8135 75.9985 25.7815C75.9843 25.7534 75.9617 25.7305 75.9338 25.7161C75.9021 25.6998 75.8607 25.6998 75.7778 25.6998H75.2265Z" fill="#F25C2B"/>
|
1402
1398
|
<path d="M90.323 25.7117C90.2401 25.7117 90.1986 25.7117 90.1669 25.7281C90.1391 25.7424 90.1165 25.7653 90.1022 25.7934C90.0861 25.8255 90.0861 25.8674 90.0861 25.9512V26.9203H89.7359C89.6558 26.9203 89.6148 26.9205 89.5836 26.9366C89.5558 26.9509 89.5331 26.9738 89.5189 27.002C89.5028 27.034 89.5028 27.0759 89.5028 27.1597V27.717C89.5028 27.8008 89.5028 27.8427 89.5189 27.8748C89.5331 27.9029 89.5558 27.9258 89.5836 27.9402C89.6153 27.9565 89.6568 27.9565 89.7397 27.9565H90.0861V32.1113H90.0847C90.0843 32.1182 90.0838 32.1251 90.0835 32.1319C90.0841 32.1478 90.085 32.1637 90.0861 32.1795V32.2192L90.0883 32.2191C90.1341 33.0885 90.844 33.7701 91.7052 33.7715C91.8727 33.7713 92.0388 33.745 92.1978 33.6936C92.2668 33.6713 92.321 33.5887 92.3208 33.5154L92.3225 32.749C92.3226 32.7376 92.3205 32.7194 92.3176 32.7084C92.317 32.7064 92.3165 32.7043 92.3159 32.7022C92.3113 32.6856 92.297 32.6611 92.283 32.651C92.2793 32.6484 92.2311 32.6207 92.1908 32.6453C92.1477 32.6656 92.147 32.6659 92.1463 32.6662C92.1353 32.6715 92.0981 32.6856 92.0807 32.6958C91.9299 32.7603 91.9074 32.7589 91.8631 32.7651C91.8328 32.7694 91.8023 32.7716 91.7716 32.7716C91.7139 32.7716 91.6565 32.7639 91.6007 32.7488C91.5449 32.7337 91.4914 32.7113 91.4414 32.6821C91.4146 32.6643 91.3891 32.6445 91.3652 32.623C91.3511 32.613 91.3375 32.6024 91.3243 32.5912C91.3176 32.5863 91.3111 32.5812 91.3046 32.576C91.3029 32.5738 91.3012 32.5715 91.2995 32.5692C91.1797 32.456 91.1115 32.2977 91.1112 32.1319C91.1116 32.1265 91.1121 32.1212 91.1127 32.1158C91.1122 32.1118 91.1116 32.1079 91.1112 32.1039V27.9565H92.0702C92.1531 27.9565 92.1946 27.9565 92.2262 27.9402C92.2541 27.9258 92.2767 27.9029 92.2909 27.8748C92.3071 27.8427 92.3071 27.8008 92.3071 27.717V27.1597C92.3071 27.0759 92.3071 27.034 92.2909 27.002C92.2767 26.9738 92.2541 26.9509 92.2262 26.9366C92.1946 26.9203 92.1531 26.9203 92.0702 26.9203H91.1112V25.9512C91.1112 25.8674 91.1112 25.8255 91.095 25.7934C91.0808 25.7653 91.0582 25.7424 91.0303 25.7281C90.9986 25.7117 90.9572 25.7117 90.8743 25.7117H90.323Z" fill="#F25C2B"/>
|
1399
|
+
</svg>`;
|
1400
|
+
const thumbsUpBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
1401
|
+
<g clip-path="url(#clip0_158_630)">
|
1402
|
+
<path d="M4.08317 5.83335V12.8334M8.74984 3.43002L8.1665 5.83335H11.5673C11.7485 5.83335 11.9271 5.87552 12.0891 5.95652C12.2511 6.03752 12.392 6.15512 12.5007 6.30002C12.6093 6.44492 12.6828 6.61312 12.7152 6.79132C12.7476 6.96952 12.7381 7.15281 12.6873 7.32669L11.3282 11.9934C11.2575 12.2357 11.1101 12.4486 10.9082 12.6C10.7062 12.7515 10.4606 12.8334 10.2082 12.8334H2.33317C2.02375 12.8334 1.72701 12.7104 1.50821 12.4916C1.28942 12.2729 1.1665 11.9761 1.1665 11.6667V7.00002C1.1665 6.6906 1.28942 6.39385 1.50821 6.17506C1.72701 5.95627 2.02375 5.83335 2.33317 5.83335H3.94317C4.16022 5.83324 4.37293 5.77258 4.55739 5.65819C4.74186 5.5438 4.89075 5.38023 4.98734 5.18585L6.99984 1.16669C7.27492 1.17009 7.54568 1.23562 7.79189 1.35837C8.03809 1.48112 8.25338 1.65792 8.42166 1.87556C8.58993 2.09319 8.70686 2.34605 8.76368 2.61522C8.82051 2.8844 8.81578 3.16293 8.74984 3.43002Z" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round"/>
|
1403
|
+
</g>
|
1404
|
+
<defs>
|
1405
|
+
<clipPath id="clip0_158_630">
|
1406
|
+
<rect width="14" height="14" fill="white"/>
|
1407
|
+
</clipPath>
|
1408
|
+
</defs>
|
1409
|
+
</svg>`;
|
1410
|
+
const thumbsUpFilledBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="#18181B" xmlns="http://www.w3.org/2000/svg">
|
1411
|
+
<g clip-path="url(#clip0_158_630_1)">
|
1412
|
+
<path d="M4.08317 5.83335V12.8334M8.74984 3.43002L8.1665 5.83335H11.5673C11.7485 5.83335 11.9271 5.87552 12.0891 5.95652C12.2511 6.03752 12.392 6.15512 12.5007 6.30002C12.6093 6.44492 12.6828 6.61312 12.7152 6.79132C12.7476 6.96952 12.7381 7.15281 12.6873 7.32669L11.3282 11.9934C11.2575 12.2357 11.1101 12.4486 10.9082 12.6C10.7062 12.7515 10.4606 12.8334 10.2082 12.8334H2.33317C2.02375 12.8334 1.72701 12.7104 1.50821 12.4916C1.28942 12.2729 1.1665 11.9761 1.1665 11.6667V7.00002C1.1665 6.6906 1.28942 6.39385 1.50821 6.17506C1.72701 5.95627 2.02375 5.83335 2.33317 5.83335H3.94317C4.16022 5.83324 4.37293 5.77258 4.55739 5.65819C4.74186 5.5438 4.89075 5.38023 4.98734 5.18585L6.99984 1.16669C7.27492 1.17009 7.54568 1.23562 7.79189 1.35837C8.03809 1.48112 8.25338 1.65792 8.42166 1.87556C8.58993 2.09319 8.70686 2.34605 8.76368 2.61522C8.82051 2.8844 8.81578 3.16293 8.74984 3.43002Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
1413
|
+
</g>
|
1414
|
+
<defs>
|
1415
|
+
<clipPath id="clip0_158_630_1">
|
1416
|
+
<rect width="14" height="14" fill="white"/>
|
1417
|
+
</clipPath>
|
1418
|
+
</defs>
|
1419
|
+
</svg>`;
|
1420
|
+
const thumbsDownBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
1421
|
+
<g clip-path="url(#clip0_158_651)">
|
1422
|
+
<path d="M9.9165 8.16669V1.16669M5.24979 10.57L5.83312 8.16669H2.43229C2.25117 8.16669 2.07254 8.12452 1.91054 8.04352C1.74854 7.96252 1.60763 7.84492 1.49896 7.70002C1.39029 7.55512 1.31684 7.38692 1.28444 7.20872C1.25204 7.03052 1.26158 6.84723 1.31229 6.67335L2.67146 2.00669C2.74214 1.76435 2.88951 1.55148 3.09146 1.40002C3.2934 1.24856 3.53903 1.16669 3.79146 1.16669H11.6665C11.9759 1.16669 12.2726 1.2896 12.4914 1.5084C12.7102 1.72719 12.8331 2.02393 12.8331 2.33335V7.00002C12.8331 7.30944 12.7102 7.60619 12.4914 7.82498C12.2726 8.04377 11.9759 8.16669 11.6665 8.16669H10.0565C9.83941 8.1668 9.6267 8.22746 9.44223 8.34185C9.25777 8.45624 9.10888 8.61981 9.01229 8.81419L6.99979 12.8334C6.7247 12.8299 6.45394 12.7644 6.20774 12.6417C5.96153 12.5189 5.74625 12.3421 5.57797 12.1245C5.40969 11.9068 5.29277 11.654 5.23594 11.3848C5.17912 11.1156 5.18385 10.8371 5.24979 10.57Z" stroke="#18181B" stroke-linecap="round" stroke-linejoin="round"/>
|
1423
|
+
</g>
|
1424
|
+
<defs>
|
1425
|
+
<clipPath id="clip0_158_651">
|
1426
|
+
<rect width="14" height="14" fill="white"/>
|
1427
|
+
</clipPath>
|
1428
|
+
</defs>
|
1429
|
+
</svg>`;
|
1430
|
+
const thumbsDownFilledBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="#18181B" xmlns="http://www.w3.org/2000/svg">
|
1431
|
+
<g clip-path="url(#clip0_158_651_1)">
|
1432
|
+
<path d="M9.9165 8.16669V1.16669M5.24979 10.57L5.83312 8.16669H2.43229C2.25117 8.16669 2.07254 8.12452 1.91054 8.04352C1.74854 7.96252 1.60763 7.84492 1.49896 7.70002C1.39029 7.55512 1.31684 7.38692 1.28444 7.20872C1.25204 7.03052 1.26158 6.84723 1.31229 6.67335L2.67146 2.00669C2.74214 1.76435 2.88951 1.55148 3.09146 1.40002C3.2934 1.24856 3.53903 1.16669 3.79146 1.16669H11.6665C11.9759 1.16669 12.2726 1.2896 12.4914 1.5084C12.7102 1.72719 12.8331 2.02393 12.8331 2.33335V7.00002C12.8331 7.30944 12.7102 7.60619 12.4914 7.82498C12.2726 8.04377 11.9759 8.16669 11.6665 8.16669H10.0565C9.83941 8.1668 9.6267 8.22746 9.44223 8.34185C9.25777 8.45624 9.10888 8.61981 9.01229 8.81419L6.99979 12.8334C6.7247 12.8299 6.45394 12.7644 6.20774 12.6417C5.96153 12.5189 5.74625 12.3421 5.57797 12.1245C5.40969 11.9068 5.29277 11.654 5.23594 11.3848C5.17912 11.1156 5.18385 10.8371 5.24979 10.57Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
1433
|
+
</g>
|
1434
|
+
<defs>
|
1435
|
+
<clipPath id="clip0_158_651_1">
|
1436
|
+
<rect width="14" height="14" fill="white"/>
|
1437
|
+
</clipPath>
|
1438
|
+
</defs>
|
1403
1439
|
</svg>`;
|
1404
1440
|
|
1405
1441
|
const chatThreadsStyles = i$4 `
|
@@ -1870,7 +1906,6 @@ var ProvidersShopGptSdk = (function () {
|
|
1870
1906
|
}
|
1871
1907
|
|
1872
1908
|
button {
|
1873
|
-
border-style: none;
|
1874
1909
|
cursor: pointer;
|
1875
1910
|
}
|
1876
1911
|
}
|
@@ -1880,19 +1915,28 @@ var ProvidersShopGptSdk = (function () {
|
|
1880
1915
|
gap: 16px;
|
1881
1916
|
cursor: pointer;
|
1882
1917
|
text-decoration: none;
|
1883
|
-
height: 100%;
|
1884
1918
|
|
1885
1919
|
img {
|
1886
|
-
width:
|
1887
|
-
height:
|
1920
|
+
width: 160px;
|
1921
|
+
height: 160px;
|
1888
1922
|
object-position: center;
|
1889
1923
|
object-fit: contain;
|
1924
|
+
border-radius: 8px;
|
1890
1925
|
}
|
1891
1926
|
}
|
1892
1927
|
|
1928
|
+
.product.modal {
|
1929
|
+
padding: 8px;
|
1930
|
+
gap: 6px;
|
1931
|
+
border-radius: 10px;
|
1932
|
+
background-color: #fff;
|
1933
|
+
box-sizing: border-box;
|
1934
|
+
border: 0.5px solid #cbd5e1;
|
1935
|
+
}
|
1936
|
+
|
1893
1937
|
.content {
|
1894
1938
|
display: flex;
|
1895
|
-
gap:
|
1939
|
+
gap: 10px;
|
1896
1940
|
flex-direction: column;
|
1897
1941
|
|
1898
1942
|
*:last-child {
|
@@ -1902,29 +1946,42 @@ var ProvidersShopGptSdk = (function () {
|
|
1902
1946
|
|
1903
1947
|
.product-name {
|
1904
1948
|
display: -webkit-box;
|
1905
|
-
color: #
|
1906
|
-
line-height: 150%;
|
1949
|
+
color: #1e293b;
|
1907
1950
|
max-width: 100%;
|
1908
|
-
-webkit-line-clamp:
|
1951
|
+
-webkit-line-clamp: 1;
|
1909
1952
|
-webkit-box-orient: vertical;
|
1910
1953
|
overflow: hidden;
|
1911
1954
|
text-overflow: ellipsis;
|
1912
1955
|
word-break: break-word;
|
1913
1956
|
white-space: normal;
|
1957
|
+
|
1958
|
+
opacity: 0.7;
|
1959
|
+
font-weight: 400;
|
1960
|
+
font-size: 12px;
|
1961
|
+
line-height: 16px;
|
1914
1962
|
}
|
1915
1963
|
|
1916
1964
|
.product-variation-details {
|
1917
|
-
color: #
|
1918
|
-
font-weight:
|
1919
|
-
|
1965
|
+
color: #000000;
|
1966
|
+
font-weight: 600;
|
1967
|
+
font-size: 12px;
|
1968
|
+
line-height: 22px;
|
1969
|
+
display: -webkit-box;
|
1970
|
+
-webkit-line-clamp: 1;
|
1971
|
+
-webkit-box-orient: vertical;
|
1972
|
+
overflow: hidden;
|
1973
|
+
text-overflow: ellipsis;
|
1974
|
+
word-break: break-word;
|
1975
|
+
white-space: normal;
|
1920
1976
|
}
|
1921
1977
|
|
1922
1978
|
.prices {
|
1923
1979
|
display: flex;
|
1924
1980
|
gap: 0 8px;
|
1925
|
-
font-weight:
|
1926
|
-
|
1927
|
-
|
1981
|
+
font-weight: 600;
|
1982
|
+
font-size: 12px;
|
1983
|
+
line-height: 16px;
|
1984
|
+
color: #020617;
|
1928
1985
|
|
1929
1986
|
.price-compared {
|
1930
1987
|
color: #a1a1aa;
|
@@ -1932,26 +1989,44 @@ var ProvidersShopGptSdk = (function () {
|
|
1932
1989
|
}
|
1933
1990
|
}
|
1934
1991
|
|
1935
|
-
.
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1992
|
+
.product-description {
|
1993
|
+
display: -webkit-box;
|
1994
|
+
-webkit-box-orient: vertical;
|
1995
|
+
-webkit-line-clamp: 2;
|
1996
|
+
overflow: hidden;
|
1997
|
+
text-overflow: ellipsis;
|
1998
|
+
word-break: break-word;
|
1999
|
+
white-space: normal;
|
2000
|
+
max-height: 48px;
|
2001
|
+
margin: 4px 0 6px;
|
1942
2002
|
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
2003
|
+
font-weight: 400;
|
2004
|
+
line-height: 16px;
|
2005
|
+
font-size: 12px;
|
2006
|
+
color: #475569;
|
2007
|
+
}
|
2008
|
+
|
2009
|
+
.btn-quick-view {
|
2010
|
+
color: #fafafa;
|
2011
|
+
font-weight: 500;
|
2012
|
+
font-size: 12px;
|
2013
|
+
text-transform: uppercase;
|
2014
|
+
max-width: 160px;
|
2015
|
+
padding: 8px 12px;
|
2016
|
+
text-align: center;
|
2017
|
+
background: #18181b;
|
2018
|
+
border-radius: 6px;
|
2019
|
+
display: flex;
|
2020
|
+
align-items: center;
|
2021
|
+
gap: 8px;
|
1947
2022
|
|
1948
2023
|
&:hover {
|
1949
|
-
|
2024
|
+
opacity: 0.7;
|
1950
2025
|
}
|
1951
2026
|
}
|
1952
2027
|
|
1953
|
-
@container productContainer (max-width:
|
1954
|
-
.btn-view
|
2028
|
+
@container productContainer (max-width: 216px) {
|
2029
|
+
.btn-quick-view {
|
1955
2030
|
display: none;
|
1956
2031
|
}
|
1957
2032
|
|
@@ -1964,18 +2039,33 @@ var ProvidersShopGptSdk = (function () {
|
|
1964
2039
|
gap: 0;
|
1965
2040
|
}
|
1966
2041
|
|
1967
|
-
.product-
|
1968
|
-
max-width: 150px;
|
2042
|
+
.product-variation-details {
|
1969
2043
|
font-size: 14px;
|
1970
2044
|
}
|
1971
2045
|
|
1972
|
-
.product
|
1973
|
-
|
2046
|
+
.product.modal {
|
2047
|
+
height: 100%;
|
2048
|
+
|
2049
|
+
.btn-quick-view {
|
2050
|
+
display: flex;
|
2051
|
+
text-transform: capitalize;
|
2052
|
+
max-width: 123px;
|
2053
|
+
}
|
2054
|
+
|
2055
|
+
.content {
|
2056
|
+
gap: 0px;
|
2057
|
+
}
|
2058
|
+
|
2059
|
+
.product-name,
|
2060
|
+
.product-variation-details {
|
2061
|
+
font-size: 12px;
|
2062
|
+
max-width: 160px;
|
2063
|
+
}
|
1974
2064
|
}
|
1975
2065
|
}
|
1976
2066
|
|
1977
2067
|
@container productContainer (max-height: 124px) {
|
1978
|
-
.btn-view
|
2068
|
+
.btn-quick-view {
|
1979
2069
|
display: none;
|
1980
2070
|
}
|
1981
2071
|
|
@@ -2000,9 +2090,54 @@ var ProvidersShopGptSdk = (function () {
|
|
2000
2090
|
.product-variation-details {
|
2001
2091
|
color: #172a41;
|
2002
2092
|
}
|
2093
|
+
|
2094
|
+
.product-description {
|
2095
|
+
display: none;
|
2096
|
+
}
|
2003
2097
|
}
|
2004
2098
|
`;
|
2005
2099
|
|
2100
|
+
const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2101
|
+
<path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
|
2102
|
+
</svg>`;
|
2103
|
+
const historyBtn = b `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2104
|
+
<path d="M2.25 9C2.25 10.335 2.64588 11.6401 3.38758 12.7501C4.12928 13.8601 5.18349 14.7253 6.41689 15.2362C7.65029 15.7471 9.00749 15.8808 10.3169 15.6203C11.6262 15.3599 12.829 14.717 13.773 13.773C14.717 12.829 15.3599 11.6262 15.6203 10.3169C15.8808 9.00749 15.7471 7.65029 15.2362 6.41689C14.7253 5.18349 13.8601 4.12928 12.7501 3.38758C11.6401 2.64588 10.335 2.25 9 2.25C7.11296 2.2571 5.30173 2.99342 3.945 4.305L2.25 6M2.25 6V2.25M2.25 6H6M9 5.25V9L12 10.5" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
2105
|
+
</svg>`;
|
2106
|
+
const crossBtn = b `<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2107
|
+
<path d="M22.5 7.5L7.5 22.5M7.5 7.5L22.5 22.5" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
2108
|
+
</svg>`;
|
2109
|
+
const sendBtn = b `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2110
|
+
<path d="M4 8L2 2L14.6667 8M4 8L2 14L14.6667 8M4 8H14.6667" stroke="#1E293B" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
|
2111
|
+
</svg>`;
|
2112
|
+
const sparklesSharp = b `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2113
|
+
<g clip-path="url(#clip0_172_31)">
|
2114
|
+
<path d="M6.62455 10.3334C6.56503 10.1026 6.44477 9.89209 6.27629 9.72361C6.10781 9.55513 5.89726 9.43487 5.66655 9.37536L1.57655 8.32069C1.50677 8.30088 1.44535 8.25886 1.40162 8.20099C1.35789 8.14312 1.33423 8.07256 1.33423 8.00002C1.33423 7.92749 1.35789 7.85693 1.40162 7.79906C1.44535 7.74119 1.50677 7.69916 1.57655 7.67936L5.66655 6.62402C5.89718 6.56456 6.10767 6.44441 6.27615 6.27605C6.44462 6.10769 6.56492 5.89728 6.62455 5.66669L7.67921 1.57669C7.69882 1.50664 7.7408 1.44492 7.79876 1.40095C7.85672 1.35699 7.92747 1.33319 8.00021 1.33319C8.07296 1.33319 8.14371 1.35699 8.20166 1.40095C8.25962 1.44492 8.30161 1.50664 8.32121 1.57669L9.37521 5.66669C9.43473 5.8974 9.55499 6.10795 9.72347 6.27644C9.89195 6.44492 10.1025 6.56517 10.3332 6.62469L14.4232 7.67869C14.4935 7.69809 14.5556 7.74003 14.5998 7.79807C14.644 7.85612 14.6679 7.92706 14.6679 8.00002C14.6679 8.07298 14.644 8.14393 14.5998 8.20197C14.5556 8.26002 14.4935 8.30196 14.4232 8.32136L10.3332 9.37536C10.1025 9.43487 9.89195 9.55513 9.72347 9.72361C9.55499 9.89209 9.43473 10.1026 9.37521 10.3334L8.32055 14.4234C8.30094 14.4934 8.25896 14.5551 8.201 14.5991C8.14304 14.6431 8.07229 14.6669 7.99955 14.6669C7.9268 14.6669 7.85605 14.6431 7.79809 14.5991C7.74014 14.5551 7.69815 14.4934 7.67854 14.4234L6.62455 10.3334Z" fill="#CBD5E1"/>
|
2115
|
+
<path d="M13.3333 2.00002V4.66669V2.00002Z" fill="#CBD5E1"/>
|
2116
|
+
<path d="M14.6666 3.33335H11.9999H14.6666Z" fill="#CBD5E1"/>
|
2117
|
+
<path d="M2.66659 11.3334V12.6667V11.3334Z" fill="#CBD5E1"/>
|
2118
|
+
<path d="M3.33325 12H1.99992H3.33325Z" fill="#CBD5E1"/>
|
2119
|
+
<path d="M13.3333 2.00002V4.66669M14.6666 3.33335H11.9999M2.66659 11.3334V12.6667M3.33325 12H1.99992M6.62455 10.3334C6.56503 10.1026 6.44477 9.89209 6.27629 9.72361C6.10781 9.55513 5.89726 9.43487 5.66655 9.37536L1.57655 8.32069C1.50677 8.30088 1.44535 8.25886 1.40162 8.20099C1.35789 8.14312 1.33423 8.07256 1.33423 8.00002C1.33423 7.92749 1.35789 7.85693 1.40162 7.79906C1.44535 7.74119 1.50677 7.69916 1.57655 7.67936L5.66655 6.62402C5.89718 6.56456 6.10767 6.44441 6.27615 6.27605C6.44462 6.10769 6.56492 5.89728 6.62455 5.66669L7.67921 1.57669C7.69882 1.50664 7.7408 1.44492 7.79876 1.40095C7.85672 1.35699 7.92747 1.33319 8.00021 1.33319C8.07296 1.33319 8.14371 1.35699 8.20166 1.40095C8.25962 1.44492 8.30161 1.50664 8.32121 1.57669L9.37521 5.66669C9.43473 5.8974 9.55499 6.10795 9.72347 6.27644C9.89195 6.44492 10.1025 6.56517 10.3332 6.62469L14.4232 7.67869C14.4935 7.69809 14.5556 7.74003 14.5998 7.79807C14.644 7.85612 14.6679 7.92706 14.6679 8.00002C14.6679 8.07298 14.644 8.14393 14.5998 8.20197C14.5556 8.26002 14.4935 8.30196 14.4232 8.32136L10.3332 9.37536C10.1025 9.43487 9.89195 9.55513 9.72347 9.72361C9.55499 9.89209 9.43473 10.1026 9.37521 10.3334L8.32055 14.4234C8.30094 14.4934 8.25896 14.5551 8.201 14.5991C8.14304 14.6431 8.07229 14.6669 7.99955 14.6669C7.9268 14.6669 7.85605 14.6431 7.79809 14.5991C7.74013 14.5551 7.69815 14.4934 7.67855 14.4234L6.62455 10.3334Z" stroke="#CBD5E1" stroke-linecap="round" stroke-linejoin="round"/>
|
2120
|
+
</g>
|
2121
|
+
<defs>
|
2122
|
+
<clipPath id="clip0_172_31">
|
2123
|
+
<rect width="16" height="16" fill="white"/>
|
2124
|
+
</clipPath>
|
2125
|
+
</defs>
|
2126
|
+
</svg>
|
2127
|
+
|
2128
|
+
`;
|
2129
|
+
const leftBtn = b `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2130
|
+
<path d="M12 19L5 12M5 12L12 5M5 12H19" stroke="#18181B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
2131
|
+
</svg>
|
2132
|
+
`;
|
2133
|
+
const rightBtn = b `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2134
|
+
<path d="M5 12H19M19 12L12 5M19 12L12 19" stroke="#18181B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
2135
|
+
</svg>
|
2136
|
+
`;
|
2137
|
+
const chevronRight = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2138
|
+
<path d="M5.25 10.5L8.75 7L5.25 3.5" stroke="white" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
|
2139
|
+
</svg>`;
|
2140
|
+
|
2006
2141
|
class ProductItem extends i$1 {
|
2007
2142
|
getLocalPrice(price) {
|
2008
2143
|
if (!this.siteCurrency) {
|
@@ -2036,7 +2171,12 @@ var ProvidersShopGptSdk = (function () {
|
|
2036
2171
|
return E;
|
2037
2172
|
}
|
2038
2173
|
return this.product.variants[0].selectedOptions.map((option) => x `
|
2039
|
-
<p
|
2174
|
+
<p
|
2175
|
+
class="product-variation-details"
|
2176
|
+
title=${`${option.name}: ${option.value}`}
|
2177
|
+
>
|
2178
|
+
${option.name}: ${option.value}
|
2179
|
+
</p>
|
2040
2180
|
`);
|
2041
2181
|
}
|
2042
2182
|
productClicked(product) {
|
@@ -2061,21 +2201,28 @@ var ProvidersShopGptSdk = (function () {
|
|
2061
2201
|
render() {
|
2062
2202
|
return x `
|
2063
2203
|
<a
|
2064
|
-
class
|
2204
|
+
class=${e$1({ product: true, modal: this.viewType === 'modal' })}
|
2065
2205
|
href=${this.getProductUrl(this.product.url)}
|
2066
2206
|
@click=${() => this.productClicked(this.product)}
|
2067
2207
|
>
|
2068
2208
|
<img src=${this.product.image.url} alt=${this.product.image.alt} />
|
2069
2209
|
<div class="content">
|
2070
|
-
<
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2210
|
+
<div>
|
2211
|
+
<p class="product-name" title=${this.product.title}>
|
2212
|
+
${this.product.title}
|
2213
|
+
</p>
|
2214
|
+
${this.renderVariantTitles()}
|
2215
|
+
</div>
|
2074
2216
|
<div class="prices">
|
2217
|
+
<p>From</p>
|
2075
2218
|
${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
|
2076
2219
|
<p>${this.getLocalPrice(this.product.variants[0].price)}</p>
|
2077
2220
|
</div>
|
2078
|
-
<
|
2221
|
+
<div class="product-description">${this.product.description}</div>
|
2222
|
+
<button class="btn-quick-view">
|
2223
|
+
<span> View Product </span>
|
2224
|
+
${chevronRight}
|
2225
|
+
</button>
|
2079
2226
|
</div>
|
2080
2227
|
</a>
|
2081
2228
|
`;
|
@@ -2106,6 +2253,10 @@ var ProvidersShopGptSdk = (function () {
|
|
2106
2253
|
n({ type: String }),
|
2107
2254
|
__metadata("design:type", String)
|
2108
2255
|
], ProductItem.prototype, "userId", void 0);
|
2256
|
+
__decorate([
|
2257
|
+
n({ type: String }),
|
2258
|
+
__metadata("design:type", String)
|
2259
|
+
], ProductItem.prototype, "viewType", void 0);
|
2109
2260
|
if (!customElements.get('product-item')) {
|
2110
2261
|
customElements.define('product-item', ProductItem);
|
2111
2262
|
}
|
@@ -2116,28 +2267,17 @@ var ProvidersShopGptSdk = (function () {
|
|
2116
2267
|
}
|
2117
2268
|
|
2118
2269
|
.product-container {
|
2119
|
-
flex: 0 0
|
2270
|
+
flex: 0 0 176px;
|
2120
2271
|
container-type: inline-size;
|
2121
2272
|
container-name: productContainer;
|
2122
2273
|
}
|
2123
2274
|
|
2124
|
-
.product-container.modal {
|
2125
|
-
padding: 8px;
|
2126
|
-
margin-bottom: 4px;
|
2127
|
-
border-radius: 10px;
|
2128
|
-
background: #fff;
|
2129
|
-
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
2130
|
-
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
2131
|
-
}
|
2132
|
-
|
2133
2275
|
.products {
|
2134
2276
|
flex: 1;
|
2135
2277
|
display: flex;
|
2136
|
-
gap:
|
2278
|
+
gap: 12px;
|
2137
2279
|
overflow-x: auto;
|
2138
2280
|
scrollbar-width: none;
|
2139
|
-
margin-left: -10px;
|
2140
|
-
padding-left: 10px;
|
2141
2281
|
}
|
2142
2282
|
|
2143
2283
|
.scroll-btns {
|
@@ -2163,12 +2303,31 @@ var ProvidersShopGptSdk = (function () {
|
|
2163
2303
|
|
2164
2304
|
.disabled {
|
2165
2305
|
opacity: 0.5;
|
2306
|
+
cursor: not-allowed;
|
2307
|
+
}
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
.scroll-btns.modal {
|
2311
|
+
flex-direction: row;
|
2312
|
+
align-items: center;
|
2313
|
+
position: absolute;
|
2314
|
+
bottom: -33px;
|
2315
|
+
right: 0;
|
2316
|
+
height: unset;
|
2317
|
+
gap: 10px;
|
2318
|
+
|
2319
|
+
div {
|
2320
|
+
padding: 5px;
|
2321
|
+
background: #f8fafc;
|
2322
|
+
border: unset;
|
2323
|
+
border-radius: 12.5px;
|
2166
2324
|
}
|
2167
2325
|
}
|
2168
2326
|
|
2169
2327
|
.products-wrapper {
|
2170
2328
|
display: flex;
|
2171
2329
|
gap: 24px;
|
2330
|
+
position: relative;
|
2172
2331
|
}
|
2173
2332
|
`;
|
2174
2333
|
|
@@ -2193,18 +2352,12 @@ var ProvidersShopGptSdk = (function () {
|
|
2193
2352
|
}
|
2194
2353
|
connectedCallback() {
|
2195
2354
|
super.connectedCallback();
|
2196
|
-
this.updateButtonsState();
|
2197
|
-
window.addEventListener('resize', this.updateButtonsState);
|
2355
|
+
this.resizeObserver = new ResizeObserver(() => this.updateButtonsState());
|
2198
2356
|
}
|
2199
2357
|
disconnectedCallback() {
|
2200
|
-
|
2358
|
+
this.resizeObserver.disconnect();
|
2201
2359
|
super.disconnectedCallback();
|
2202
2360
|
}
|
2203
|
-
updated(_changedProperties) {
|
2204
|
-
if (_changedProperties.has('products')) {
|
2205
|
-
this.updateButtonsState();
|
2206
|
-
}
|
2207
|
-
}
|
2208
2361
|
scrollToLeft(e) {
|
2209
2362
|
var _a;
|
2210
2363
|
e.preventDefault();
|
@@ -2215,20 +2368,27 @@ var ProvidersShopGptSdk = (function () {
|
|
2215
2368
|
e.preventDefault();
|
2216
2369
|
(_a = this.productsEle) === null || _a === void 0 ? void 0 : _a.scrollBy({ left: 186, behavior: 'smooth' });
|
2217
2370
|
}
|
2371
|
+
firstUpdated(changedProperties) {
|
2372
|
+
super.firstUpdated(changedProperties);
|
2373
|
+
if (!this.productsEle) {
|
2374
|
+
return;
|
2375
|
+
}
|
2376
|
+
this.resizeObserver.observe(this.productsEle);
|
2377
|
+
Array.from(this.productsEle.children).forEach((child) => {
|
2378
|
+
this.resizeObserver.observe(child);
|
2379
|
+
});
|
2380
|
+
this.updateButtonsState();
|
2381
|
+
}
|
2218
2382
|
render() {
|
2219
2383
|
if (!this.products.length) {
|
2220
2384
|
return E;
|
2221
2385
|
}
|
2386
|
+
const isPopupView = this.viewType === 'modal';
|
2222
2387
|
return x `
|
2223
2388
|
<div class="products-wrapper">
|
2224
2389
|
<div class="products" @scroll=${this.updateButtonsState}>
|
2225
2390
|
${o$1(this.products, (product, index) => x `
|
2226
|
-
<div
|
2227
|
-
class=${e$1({
|
2228
|
-
'product-container': true,
|
2229
|
-
modal: this.viewType === 'modal',
|
2230
|
-
})}
|
2231
|
-
>
|
2391
|
+
<div class=${'product-container'}>
|
2232
2392
|
<product-item
|
2233
2393
|
.query=${this.query}
|
2234
2394
|
.response=${this.response}
|
@@ -2236,17 +2396,24 @@ var ProvidersShopGptSdk = (function () {
|
|
2236
2396
|
.siteCurrency=${this.siteCurrency}
|
2237
2397
|
.rank=${index + 1}
|
2238
2398
|
.userId=${this.userId}
|
2399
|
+
.viewType=${this.viewType}
|
2239
2400
|
></product-item>
|
2240
2401
|
</div>
|
2241
2402
|
`)}
|
2242
2403
|
</div>
|
2243
2404
|
${this.showButtons
|
2244
|
-
? x
|
2405
|
+
? x `<div
|
2406
|
+
class="scroll-btns"
|
2407
|
+
class=${e$1({
|
2408
|
+
'scroll-btns': true,
|
2409
|
+
modal: isPopupView,
|
2410
|
+
})}
|
2411
|
+
>
|
2245
2412
|
<div class="left-btn disabled" @click=${this.scrollToLeft}>
|
2246
|
-
${leftBtn}
|
2413
|
+
${isPopupView ? leftBtn : leftBtn$1}
|
2247
2414
|
</div>
|
2248
2415
|
<div class="right-btn" @click=${this.scrollToRight}>
|
2249
|
-
${rightBtn}
|
2416
|
+
${isPopupView ? rightBtn : rightBtn$1}
|
2250
2417
|
</div>
|
2251
2418
|
</div>`
|
2252
2419
|
: E}
|
@@ -2289,7 +2456,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2289
2456
|
], ProductsList.prototype, "rightBtnEle", void 0);
|
2290
2457
|
__decorate([
|
2291
2458
|
e$3('.products'),
|
2292
|
-
__metadata("design:type",
|
2459
|
+
__metadata("design:type", HTMLDivElement)
|
2293
2460
|
], ProductsList.prototype, "productsEle", void 0);
|
2294
2461
|
if (!customElements.get('products-list')) {
|
2295
2462
|
customElements.define('products-list', ProductsList);
|
@@ -2410,7 +2577,7 @@ var ProvidersShopGptSdk = (function () {
|
|
2410
2577
|
customElements.define('products-section', ProductsSection);
|
2411
2578
|
}
|
2412
2579
|
|
2413
|
-
const chatSectionStyles = i$4 `
|
2580
|
+
const chatSectionStyles$1 = i$4 `
|
2414
2581
|
:host {
|
2415
2582
|
font-family: 'Inter', sans-serif;
|
2416
2583
|
font-size: 16px;
|
@@ -2487,33 +2654,6 @@ var ProvidersShopGptSdk = (function () {
|
|
2487
2654
|
align-items: center;
|
2488
2655
|
justify-content: center;
|
2489
2656
|
}
|
2490
|
-
|
2491
|
-
.threads-btn.active {
|
2492
|
-
background: #2b65cf;
|
2493
|
-
opacity: 1;
|
2494
|
-
}
|
2495
|
-
|
2496
|
-
.close-btn:hover {
|
2497
|
-
background: #dc3545;
|
2498
|
-
}
|
2499
|
-
|
2500
|
-
.threads-btn:hover,
|
2501
|
-
.new-search-btn:hover {
|
2502
|
-
background: #2b65cf;
|
2503
|
-
opacity: 0.8;
|
2504
|
-
}
|
2505
|
-
|
2506
|
-
.threads-btn:active,
|
2507
|
-
.new-search-btn:active {
|
2508
|
-
background: #2b65cf;
|
2509
|
-
opacity: 1;
|
2510
|
-
}
|
2511
|
-
|
2512
|
-
.new-search-btn:disabled {
|
2513
|
-
background: #808080;
|
2514
|
-
cursor: not-allowed;
|
2515
|
-
opacity: 0.5;
|
2516
|
-
}
|
2517
2657
|
}
|
2518
2658
|
}
|
2519
2659
|
|
@@ -2527,12 +2667,6 @@ var ProvidersShopGptSdk = (function () {
|
|
2527
2667
|
gap: 25px;
|
2528
2668
|
}
|
2529
2669
|
|
2530
|
-
.chatbot-section.modal-view {
|
2531
|
-
height: calc(100% - 93px);
|
2532
|
-
padding: 0px 16px 16px;
|
2533
|
-
gap: 16px;
|
2534
|
-
}
|
2535
|
-
|
2536
2670
|
.chat-form {
|
2537
2671
|
display: flex;
|
2538
2672
|
align-items: center;
|
@@ -2581,10 +2715,6 @@ var ProvidersShopGptSdk = (function () {
|
|
2581
2715
|
cursor: unset;
|
2582
2716
|
}
|
2583
2717
|
}
|
2584
|
-
|
2585
|
-
button.modal {
|
2586
|
-
right: 26px;
|
2587
|
-
}
|
2588
2718
|
}
|
2589
2719
|
|
2590
2720
|
.messages {
|
@@ -2764,46 +2894,6 @@ var ProvidersShopGptSdk = (function () {
|
|
2764
2894
|
gap: 24px;
|
2765
2895
|
}
|
2766
2896
|
|
2767
|
-
.typing-dots {
|
2768
|
-
display: flex;
|
2769
|
-
align-items: center;
|
2770
|
-
justify-content: center;
|
2771
|
-
gap: 8px;
|
2772
|
-
}
|
2773
|
-
|
2774
|
-
.dot {
|
2775
|
-
width: 6px;
|
2776
|
-
height: 6px;
|
2777
|
-
background-color: #b6b6b6;
|
2778
|
-
border-radius: 50%;
|
2779
|
-
animation: bounce 1.2s infinite ease-in-out;
|
2780
|
-
}
|
2781
|
-
|
2782
|
-
.dot:nth-child(1) {
|
2783
|
-
animation-delay: 0s;
|
2784
|
-
}
|
2785
|
-
|
2786
|
-
.dot:nth-child(2) {
|
2787
|
-
animation-delay: 0.2s;
|
2788
|
-
}
|
2789
|
-
|
2790
|
-
.dot:nth-child(3) {
|
2791
|
-
animation-delay: 0.4s;
|
2792
|
-
}
|
2793
|
-
|
2794
|
-
@keyframes bounce {
|
2795
|
-
0%,
|
2796
|
-
80%,
|
2797
|
-
100% {
|
2798
|
-
transform: translateY(0);
|
2799
|
-
background-color: #b6b6b6;
|
2800
|
-
}
|
2801
|
-
40% {
|
2802
|
-
transform: translateY(-4px);
|
2803
|
-
background-color: #8b8b8b;
|
2804
|
-
}
|
2805
|
-
}
|
2806
|
-
|
2807
2897
|
.prompts {
|
2808
2898
|
display: flex;
|
2809
2899
|
justify-content: center;
|
@@ -2831,170 +2921,45 @@ var ProvidersShopGptSdk = (function () {
|
|
2831
2921
|
}
|
2832
2922
|
}
|
2833
2923
|
|
2834
|
-
|
2835
|
-
|
2836
|
-
position: absolute;
|
2837
|
-
overflow: hidden;
|
2838
|
-
z-index: 1;
|
2839
|
-
top: 78px;
|
2840
|
-
height: 30%;
|
2841
|
-
width: 100%;
|
2842
|
-
background: #fff;
|
2843
|
-
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
2844
|
-
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
2845
|
-
border-radius: 0px 0px 10px 10px;
|
2924
|
+
${scrollBarStyles}
|
2925
|
+
`;
|
2846
2926
|
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2927
|
+
const capitalizeEachWord = (str) => {
|
2928
|
+
return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
|
2929
|
+
};
|
2930
|
+
const adParams = new Set([
|
2931
|
+
'fbclid',
|
2932
|
+
'gclid',
|
2933
|
+
'sccid',
|
2934
|
+
'ttclid',
|
2935
|
+
'epik',
|
2936
|
+
'li_fat_id',
|
2937
|
+
'twclid',
|
2938
|
+
'rdt_cid',
|
2939
|
+
'aleid',
|
2940
|
+
'tabclid',
|
2941
|
+
'msclkid',
|
2942
|
+
'dclid',
|
2943
|
+
'wbraid',
|
2944
|
+
]);
|
2945
|
+
const isFromAd = (params) => [...params.keys()].some((key) => adParams.has(key.toLowerCase()));
|
2853
2946
|
|
2854
|
-
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
}
|
2860
|
-
}
|
2947
|
+
const personalizeDialogStyles = i$4 `
|
2948
|
+
:host {
|
2949
|
+
font-family: 'Inter', sans-serif;
|
2950
|
+
font-size: 16px;
|
2951
|
+
font-weight: 400;
|
2861
2952
|
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2953
|
+
h2,
|
2954
|
+
p {
|
2955
|
+
margin: 0;
|
2956
|
+
}
|
2866
2957
|
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
cursor: pointer;
|
2873
|
-
|
2874
|
-
p {
|
2875
|
-
font-size: 14px;
|
2876
|
-
font-weight: 400;
|
2877
|
-
line-height: 20px;
|
2878
|
-
}
|
2879
|
-
|
2880
|
-
.trash-icon {
|
2881
|
-
display: none;
|
2882
|
-
}
|
2883
|
-
|
2884
|
-
&:hover {
|
2885
|
-
background: #f1f4f8;
|
2886
|
-
|
2887
|
-
.trash-icon {
|
2888
|
-
display: flex;
|
2889
|
-
}
|
2890
|
-
}
|
2891
|
-
}
|
2892
|
-
|
2893
|
-
.thread-title.disabled {
|
2894
|
-
cursor: not-allowed;
|
2895
|
-
}
|
2896
|
-
}
|
2897
|
-
|
2898
|
-
.trash-icon {
|
2899
|
-
display: flex;
|
2900
|
-
justify-content: center;
|
2901
|
-
align-items: center;
|
2902
|
-
padding: 2px;
|
2903
|
-
cursor: pointer;
|
2904
|
-
|
2905
|
-
&:hover {
|
2906
|
-
border-radius: 5px;
|
2907
|
-
background: #dc3545;
|
2908
|
-
|
2909
|
-
path {
|
2910
|
-
fill: white;
|
2911
|
-
}
|
2912
|
-
}
|
2913
|
-
}
|
2914
|
-
|
2915
|
-
.chat-threads-background {
|
2916
|
-
position: absolute;
|
2917
|
-
top: 78px;
|
2918
|
-
height: 100%;
|
2919
|
-
width: 100%;
|
2920
|
-
opacity: 0.5;
|
2921
|
-
background: #000;
|
2922
|
-
z-index: 0;
|
2923
|
-
}
|
2924
|
-
}
|
2925
|
-
|
2926
|
-
footer {
|
2927
|
-
text-align: center;
|
2928
|
-
font-size: 10px;
|
2929
|
-
color: #4e647f;
|
2930
|
-
font-weight: 500;
|
2931
|
-
|
2932
|
-
a {
|
2933
|
-
text-decoration: none;
|
2934
|
-
}
|
2935
|
-
}
|
2936
|
-
|
2937
|
-
${scrollBarStyles}
|
2938
|
-
`;
|
2939
|
-
|
2940
|
-
const capitalizeEachWord = (str) => {
|
2941
|
-
return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
|
2942
|
-
};
|
2943
|
-
const adParams = new Set([
|
2944
|
-
'fbclid',
|
2945
|
-
'gclid',
|
2946
|
-
'sccid',
|
2947
|
-
'ttclid',
|
2948
|
-
'epik',
|
2949
|
-
'li_fat_id',
|
2950
|
-
'twclid',
|
2951
|
-
'rdt_cid',
|
2952
|
-
'aleid',
|
2953
|
-
'tabclid',
|
2954
|
-
'msclkid',
|
2955
|
-
'dclid',
|
2956
|
-
'wbraid',
|
2957
|
-
]);
|
2958
|
-
const isFromAd = (params) => [...params.keys()].some((key) => adParams.has(key.toLowerCase()));
|
2959
|
-
|
2960
|
-
const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2961
|
-
<path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
|
2962
|
-
</svg>`;
|
2963
|
-
const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2964
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.16652 20.7304C7.89323 21.8842 9.9233 22.5 12 22.5C14.7848 22.5 17.4555 21.3938 19.4246 19.4246C21.3938 17.4555 22.5 14.7848 22.5 12C22.5 9.9233 21.8842 7.89323 20.7304 6.16652C19.5767 4.4398 17.9368 3.09399 16.0182 2.29927C14.0996 1.50455 11.9884 1.29661 9.95156 1.70176C7.91476 2.1069 6.04383 3.10693 4.57538 4.57538C3.10693 6.04383 2.1069 7.91476 1.70176 9.95156C1.29661 11.9884 1.50455 14.0996 2.29927 16.0182C3.09399 17.9368 4.4398 19.5767 6.16652 20.7304ZM6.99987 4.51678C8.47992 3.52785 10.22 3 12 3C14.387 3 16.6761 3.94822 18.364 5.63604C20.0518 7.32387 21 9.61306 21 12C21 13.78 20.4722 15.5201 19.4832 17.0001C18.4943 18.4802 17.0887 19.6337 15.4442 20.3149C13.7996 20.9961 11.99 21.1743 10.2442 20.8271C8.49836 20.4798 6.89472 19.6226 5.63604 18.364C4.37737 17.1053 3.5202 15.5016 3.17294 13.7558C2.82567 12.01 3.0039 10.2004 3.68509 8.55585C4.36628 6.91132 5.51983 5.50571 6.99987 4.51678ZM11.25 12.3075L15.4425 16.5L16.5 15.4425L12.75 11.685V5.25H11.25V12.3075Z" fill="white"/>
|
2965
|
-
</svg>`;
|
2966
|
-
const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2967
|
-
<path d="M18 7.05L16.95 6L12 10.95L7.05 6L6 7.05L10.95 12L6 16.95L7.05 18L12 13.05L16.95 18L18 16.95L13.05 12L18 7.05Z" fill="white"/>
|
2968
|
-
</svg>`;
|
2969
|
-
const thumbsUpBtn = b `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--tabler" font-size="1.375rem" width="1em" height="1em" viewBox="0 0 24 24">
|
2970
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 11v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h3a4 4 0 0 0 4-4V6a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1-2 2h-7a3 3 0 0 1-3-3"></path>
|
2971
|
-
</svg>`;
|
2972
|
-
const thumbsUpFilledBtn = b `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--tabler" font-size="1.375rem" width="1em" height="1em" viewBox="0 0 24 24">
|
2973
|
-
<path fill="currentColor" d="M13 3a3 3 0 0 1 2.995 2.824L16 6v4h2a3 3 0 0 1 2.98 2.65l.015.174L21 13l-.02.196l-1.006 5.032c-.381 1.626-1.502 2.796-2.81 2.78L17 21H9a1 1 0 0 1-.993-.883L8 20l.001-9.536a1 1 0 0 1 .5-.865a3 3 0 0 0 1.492-2.397L10 7V6a3 3 0 0 1 3-3m-8 7a1 1 0 0 1 .993.883L6 11v9a1 1 0 0 1-.883.993L5 21H4a2 2 0 0 1-1.995-1.85L2 19v-7a2 2 0 0 1 1.85-1.995L4 10z"></path>
|
2974
|
-
</svg>`;
|
2975
|
-
const thumbsDownBtn = b `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--tabler" font-size="1.375rem" width="1em" height="1em" viewBox="0 0 24 24">
|
2976
|
-
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 13V5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h3a4 4 0 0 1 4 4v1a2 2 0 0 0 4 0v-5h3a2 2 0 0 0 2-2l-1-5a2 3 0 0 0-2-2h-7a3 3 0 0 0-3 3"></path>
|
2977
|
-
</svg>`;
|
2978
|
-
const thumbsDownFilledBtn = b `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--tabler" font-size="1.375rem" width="1em" height="1em" viewBox="0 0 24 24">
|
2979
|
-
<path fill="currentColor" d="M13 21.008a3 3 0 0 0 2.995-2.823l.005-.177v-4h2a3 3 0 0 0 2.98-2.65l.015-.173l.005-.177l-.02-.196l-1.006-5.032c-.381-1.625-1.502-2.796-2.81-2.78L17 3.008H9a1 1 0 0 0-.993.884L8 4.008l.001 9.536a1 1 0 0 0 .5.866a3 3 0 0 1 1.492 2.396l.007.202v1a3 3 0 0 0 3 3m-8-7a1 1 0 0 0 .993-.883L6 13.008v-9a1 1 0 0 0-.883-.993L5 3.008H4A2 2 0 0 0 2.005 4.86L2 5.01v7a2 2 0 0 0 1.85 1.994l.15.005h1z"></path>
|
2980
|
-
</svg>`;
|
2981
|
-
|
2982
|
-
const personalizeDialogStyles = i$4 `
|
2983
|
-
:host {
|
2984
|
-
font-family: 'Inter', sans-serif;
|
2985
|
-
font-size: 16px;
|
2986
|
-
font-weight: 400;
|
2987
|
-
|
2988
|
-
h2,
|
2989
|
-
p {
|
2990
|
-
margin: 0;
|
2991
|
-
}
|
2992
|
-
|
2993
|
-
button {
|
2994
|
-
border-style: none;
|
2995
|
-
cursor: pointer;
|
2996
|
-
}
|
2997
|
-
}
|
2958
|
+
button {
|
2959
|
+
border-style: none;
|
2960
|
+
cursor: pointer;
|
2961
|
+
}
|
2962
|
+
}
|
2998
2963
|
|
2999
2964
|
dialog::backdrop {
|
3000
2965
|
background: rgba(0, 0, 0, 0.5);
|
@@ -3630,7 +3595,7 @@ var ProvidersShopGptSdk = (function () {
|
|
3630
3595
|
MarkdownRenderer.styles = i$4 `
|
3631
3596
|
:host {
|
3632
3597
|
font-family: 'Inter', sans-serif;
|
3633
|
-
font-size:
|
3598
|
+
font-size: 14px;
|
3634
3599
|
font-weight: 400;
|
3635
3600
|
|
3636
3601
|
p {
|
@@ -3646,131 +3611,11 @@ var ProvidersShopGptSdk = (function () {
|
|
3646
3611
|
customElements.define('markdown-renderer', MarkdownRenderer);
|
3647
3612
|
}
|
3648
3613
|
|
3649
|
-
|
3650
|
-
constructor() {
|
3651
|
-
super(...arguments);
|
3652
|
-
this.position = 'bottom-left';
|
3653
|
-
this.text = '';
|
3654
|
-
}
|
3655
|
-
render() {
|
3656
|
-
return x `
|
3657
|
-
<slot></slot>
|
3658
|
-
<div class="tooltip ${this.position}">${this.text}</div>
|
3659
|
-
`;
|
3660
|
-
}
|
3661
|
-
}
|
3662
|
-
TooltipComponent.styles = [
|
3663
|
-
i$4 `
|
3664
|
-
:host {
|
3665
|
-
position: relative;
|
3666
|
-
display: inline-block;
|
3667
|
-
}
|
3668
|
-
|
3669
|
-
.tooltip {
|
3670
|
-
position: absolute;
|
3671
|
-
color: #172a41;
|
3672
|
-
padding: 4px 8px;
|
3673
|
-
white-space: nowrap;
|
3674
|
-
font-size: 12px;
|
3675
|
-
opacity: 0;
|
3676
|
-
transition: opacity 0.2s;
|
3677
|
-
pointer-events: none;
|
3678
|
-
|
3679
|
-
border-radius: 5px;
|
3680
|
-
background: #ffcc81;
|
3681
|
-
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
3682
|
-
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
3683
|
-
|
3684
|
-
font-style: normal;
|
3685
|
-
font-weight: 400;
|
3686
|
-
line-height: 150%;
|
3687
|
-
}
|
3688
|
-
|
3689
|
-
:host(:hover) .tooltip {
|
3690
|
-
opacity: 1;
|
3691
|
-
}
|
3692
|
-
|
3693
|
-
.top-center {
|
3694
|
-
bottom: calc(100% + 2px);
|
3695
|
-
left: 50%;
|
3696
|
-
transform: translateX(-50%);
|
3697
|
-
}
|
3698
|
-
|
3699
|
-
.top-left {
|
3700
|
-
bottom: calc(100% + 2px);
|
3701
|
-
left: 0;
|
3702
|
-
}
|
3703
|
-
|
3704
|
-
.top-right {
|
3705
|
-
bottom: calc(100% + 2px);
|
3706
|
-
right: 0;
|
3707
|
-
}
|
3708
|
-
|
3709
|
-
.bottom-center {
|
3710
|
-
top: calc(100% + 2px);
|
3711
|
-
left: 50%;
|
3712
|
-
transform: translateX(-50%);
|
3713
|
-
}
|
3714
|
-
|
3715
|
-
.bottom-left {
|
3716
|
-
top: calc(100% + 2px);
|
3717
|
-
left: 0;
|
3718
|
-
}
|
3719
|
-
|
3720
|
-
.bottom-right {
|
3721
|
-
top: calc(100% + 2px);
|
3722
|
-
right: 0;
|
3723
|
-
}
|
3724
|
-
|
3725
|
-
.left-center {
|
3726
|
-
right: calc(100% + 2px);
|
3727
|
-
top: 50%;
|
3728
|
-
transform: translateY(-50%);
|
3729
|
-
}
|
3730
|
-
|
3731
|
-
.left-top {
|
3732
|
-
right: calc(100% + 2px);
|
3733
|
-
top: 0;
|
3734
|
-
}
|
3735
|
-
|
3736
|
-
.left-bottom {
|
3737
|
-
right: calc(100% + 2px);
|
3738
|
-
bottom: 0;
|
3739
|
-
}
|
3740
|
-
|
3741
|
-
.right-center {
|
3742
|
-
left: calc(100% + 2px);
|
3743
|
-
top: 50%;
|
3744
|
-
transform: translateY(-50%);
|
3745
|
-
}
|
3746
|
-
|
3747
|
-
.right-top {
|
3748
|
-
left: calc(100% + 2px);
|
3749
|
-
top: 0;
|
3750
|
-
}
|
3751
|
-
|
3752
|
-
.right-bottom {
|
3753
|
-
left: calc(100% + 2px);
|
3754
|
-
bottom: 0;
|
3755
|
-
}
|
3756
|
-
`,
|
3757
|
-
];
|
3758
|
-
__decorate([
|
3759
|
-
n({ type: String }),
|
3760
|
-
__metadata("design:type", String)
|
3761
|
-
], TooltipComponent.prototype, "position", void 0);
|
3762
|
-
__decorate([
|
3763
|
-
n({ type: String }),
|
3764
|
-
__metadata("design:type", Object)
|
3765
|
-
], TooltipComponent.prototype, "text", void 0);
|
3766
|
-
if (!customElements.get('tooltip-component')) {
|
3767
|
-
customElements.define('tooltip-component', TooltipComponent);
|
3768
|
-
}
|
3769
|
-
|
3770
|
-
const confirmDialogStyles = i$4 `
|
3614
|
+
const feedbackDialogStyles = i$4 `
|
3771
3615
|
:host {
|
3772
3616
|
font-family: 'Inter', sans-serif;
|
3773
3617
|
font-size: 16px;
|
3618
|
+
line-height: 24px;
|
3774
3619
|
font-weight: 400;
|
3775
3620
|
|
3776
3621
|
display: flex;
|
@@ -3784,141 +3629,22 @@ var ProvidersShopGptSdk = (function () {
|
|
3784
3629
|
|
3785
3630
|
.modal {
|
3786
3631
|
width: 75%;
|
3787
|
-
max-width:
|
3632
|
+
max-width: 400px;
|
3788
3633
|
background: #fff;
|
3789
|
-
padding:
|
3634
|
+
padding: 24px;
|
3790
3635
|
margin: auto;
|
3791
3636
|
|
3792
|
-
border-radius:
|
3793
|
-
box-shadow:
|
3794
|
-
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
3637
|
+
border-radius: 8px;
|
3638
|
+
box-shadow: rgba(47, 43, 61, 0.28) 0px 8px 23px 0px;
|
3795
3639
|
|
3796
3640
|
z-index: 2000;
|
3797
3641
|
}
|
3798
3642
|
|
3799
|
-
|
3800
|
-
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
line-height: 150%;
|
3805
|
-
}
|
3806
|
-
|
3807
|
-
::slotted([slot='content']) {
|
3808
|
-
color: #4e647f;
|
3809
|
-
line-height: 150%;
|
3810
|
-
}
|
3811
|
-
|
3812
|
-
.button-wrapper {
|
3813
|
-
margin-top: 12px;
|
3814
|
-
display: flex;
|
3815
|
-
gap: 12px;
|
3816
|
-
|
3817
|
-
.btn {
|
3818
|
-
justify-self: stretch;
|
3819
|
-
padding: 10px;
|
3820
|
-
cursor: pointer;
|
3821
|
-
text-align: center;
|
3822
|
-
width: 100%;
|
3823
|
-
border: 0;
|
3824
|
-
color: #fff;
|
3825
|
-
line-height: 150%;
|
3826
|
-
text-transform: capitalize;
|
3827
|
-
}
|
3828
|
-
|
3829
|
-
.accept-btn {
|
3830
|
-
border-radius: 5px;
|
3831
|
-
background: #dc3545;
|
3832
|
-
|
3833
|
-
&:hover {
|
3834
|
-
background: rgb(176, 62, 25);
|
3835
|
-
}
|
3836
|
-
}
|
3837
|
-
|
3838
|
-
.decline-btn {
|
3839
|
-
border-radius: 5px;
|
3840
|
-
background: #4e647f;
|
3841
|
-
|
3842
|
-
&:hover {
|
3843
|
-
background: rgb(57, 77, 102);
|
3844
|
-
}
|
3845
|
-
}
|
3846
|
-
}
|
3847
|
-
`;
|
3848
|
-
|
3849
|
-
class ConfirmDialog extends i$1 {
|
3850
|
-
onAcceptClick(e) {
|
3851
|
-
e.preventDefault();
|
3852
|
-
this.dispatchEvent(new CustomEvent('accept', {
|
3853
|
-
composed: true,
|
3854
|
-
}));
|
3855
|
-
}
|
3856
|
-
onCancelClick(e) {
|
3857
|
-
e.preventDefault();
|
3858
|
-
this.dispatchEvent(new CustomEvent('decline', {
|
3859
|
-
composed: true,
|
3860
|
-
}));
|
3861
|
-
}
|
3862
|
-
render() {
|
3863
|
-
return x `
|
3864
|
-
<div class="modal">
|
3865
|
-
<slot name="title"></slot>
|
3866
|
-
<slot name="content"></slot>
|
3867
|
-
<div class="button-wrapper">
|
3868
|
-
<slot name="accept-btn">
|
3869
|
-
<button class="btn accept-btn" @click=${this.onAcceptClick}>
|
3870
|
-
Delete
|
3871
|
-
</button>
|
3872
|
-
</slot>
|
3873
|
-
<slot name="decline-btn">
|
3874
|
-
<button class="btn decline-btn" @click=${this.onCancelClick}>
|
3875
|
-
Cancel
|
3876
|
-
</button>
|
3877
|
-
</slot>
|
3878
|
-
</div>
|
3879
|
-
</div>
|
3880
|
-
`;
|
3881
|
-
}
|
3882
|
-
}
|
3883
|
-
ConfirmDialog.styles = [confirmDialogStyles];
|
3884
|
-
if (!customElements.get('confirm-dialog')) {
|
3885
|
-
customElements.define('confirm-dialog', ConfirmDialog);
|
3886
|
-
}
|
3887
|
-
|
3888
|
-
const feedbackDialogStyles = i$4 `
|
3889
|
-
:host {
|
3890
|
-
font-family: 'Inter', sans-serif;
|
3891
|
-
font-size: 16px;
|
3892
|
-
line-height: 24px;
|
3893
|
-
font-weight: 400;
|
3894
|
-
|
3895
|
-
display: flex;
|
3896
|
-
position: absolute;
|
3897
|
-
top: 0;
|
3898
|
-
left: 0;
|
3899
|
-
width: 100%;
|
3900
|
-
height: 100%;
|
3901
|
-
background: #00000050;
|
3902
|
-
}
|
3903
|
-
|
3904
|
-
.modal {
|
3905
|
-
width: 75%;
|
3906
|
-
max-width: 400px;
|
3907
|
-
background: #fff;
|
3908
|
-
padding: 24px;
|
3909
|
-
margin: auto;
|
3910
|
-
|
3911
|
-
border-radius: 8px;
|
3912
|
-
box-shadow: rgba(47, 43, 61, 0.28) 0px 8px 23px 0px;
|
3913
|
-
|
3914
|
-
z-index: 2000;
|
3915
|
-
}
|
3916
|
-
|
3917
|
-
.header {
|
3918
|
-
display: flex;
|
3919
|
-
justify-content: space-between;
|
3920
|
-
align-items: center;
|
3921
|
-
margin-bottom: 16px;
|
3643
|
+
.header {
|
3644
|
+
display: flex;
|
3645
|
+
justify-content: space-between;
|
3646
|
+
align-items: center;
|
3647
|
+
margin-bottom: 16px;
|
3922
3648
|
}
|
3923
3649
|
|
3924
3650
|
.close {
|
@@ -4101,11 +3827,80 @@ ${this.comment ? this.comment : E}</textarea
|
|
4101
3827
|
customElements.define('feedback-dialog', FeedbackDialog);
|
4102
3828
|
}
|
4103
3829
|
|
3830
|
+
class TypingIndicator extends i$1 {
|
3831
|
+
constructor() {
|
3832
|
+
super(...arguments);
|
3833
|
+
this.position = 'bottom-left';
|
3834
|
+
this.text = '';
|
3835
|
+
}
|
3836
|
+
render() {
|
3837
|
+
return x `
|
3838
|
+
<div class="typing-dots">
|
3839
|
+
<div class="dot"></div>
|
3840
|
+
<div class="dot"></div>
|
3841
|
+
<div class="dot"></div>
|
3842
|
+
</div>
|
3843
|
+
`;
|
3844
|
+
}
|
3845
|
+
}
|
3846
|
+
TypingIndicator.styles = [
|
3847
|
+
i$4 `
|
3848
|
+
.typing-dots {
|
3849
|
+
display: flex;
|
3850
|
+
align-items: center;
|
3851
|
+
justify-content: center;
|
3852
|
+
gap: 8px;
|
3853
|
+
}
|
3854
|
+
|
3855
|
+
.dot {
|
3856
|
+
width: 6px;
|
3857
|
+
height: 6px;
|
3858
|
+
background-color: #b6b6b6;
|
3859
|
+
border-radius: 50%;
|
3860
|
+
animation: bounce 1.2s infinite ease-in-out;
|
3861
|
+
}
|
3862
|
+
|
3863
|
+
.dot:nth-child(1) {
|
3864
|
+
animation-delay: 0s;
|
3865
|
+
}
|
3866
|
+
|
3867
|
+
.dot:nth-child(2) {
|
3868
|
+
animation-delay: 0.2s;
|
3869
|
+
}
|
3870
|
+
|
3871
|
+
.dot:nth-child(3) {
|
3872
|
+
animation-delay: 0.4s;
|
3873
|
+
}
|
3874
|
+
|
3875
|
+
@keyframes bounce {
|
3876
|
+
0%,
|
3877
|
+
80%,
|
3878
|
+
100% {
|
3879
|
+
transform: translateY(0);
|
3880
|
+
background-color: #b6b6b6;
|
3881
|
+
}
|
3882
|
+
40% {
|
3883
|
+
transform: translateY(-4px);
|
3884
|
+
background-color: #8b8b8b;
|
3885
|
+
}
|
3886
|
+
}
|
3887
|
+
`,
|
3888
|
+
];
|
3889
|
+
__decorate([
|
3890
|
+
n({ type: String }),
|
3891
|
+
__metadata("design:type", String)
|
3892
|
+
], TypingIndicator.prototype, "position", void 0);
|
3893
|
+
__decorate([
|
3894
|
+
n({ type: String }),
|
3895
|
+
__metadata("design:type", Object)
|
3896
|
+
], TypingIndicator.prototype, "text", void 0);
|
3897
|
+
if (!customElements.get('typing-indicator')) {
|
3898
|
+
customElements.define('typing-indicator', TypingIndicator);
|
3899
|
+
}
|
3900
|
+
|
4104
3901
|
class ChatSection extends i$1 {
|
4105
3902
|
constructor() {
|
4106
3903
|
super(...arguments);
|
4107
|
-
this.showChatThreads = false;
|
4108
|
-
this.deleteAllThreads = false;
|
4109
3904
|
this.userQuery = '';
|
4110
3905
|
this.isStylesheetInjected = false;
|
4111
3906
|
}
|
@@ -4146,25 +3941,6 @@ ${this.comment ? this.comment : E}</textarea
|
|
4146
3941
|
this.userQuery = '';
|
4147
3942
|
await this.processMessage(e, message, false);
|
4148
3943
|
}
|
4149
|
-
handleThreadDelete() {
|
4150
|
-
if (this.deleteAllThreads) {
|
4151
|
-
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
4152
|
-
composed: true,
|
4153
|
-
bubbles: true,
|
4154
|
-
}));
|
4155
|
-
this.deleteAllThreads = false;
|
4156
|
-
return;
|
4157
|
-
}
|
4158
|
-
if (!this.deleteThreadId) {
|
4159
|
-
return;
|
4160
|
-
}
|
4161
|
-
this.dispatchEvent(new CustomEvent('delete-thread', {
|
4162
|
-
detail: { threadId: this.deleteThreadId },
|
4163
|
-
composed: true,
|
4164
|
-
bubbles: true,
|
4165
|
-
}));
|
4166
|
-
this.deleteThreadId = '';
|
4167
|
-
}
|
4168
3944
|
handleFeedback(rating, messageId, queryMessageId, comment, query, response) {
|
4169
3945
|
var _a, _b, _c, _d;
|
4170
3946
|
if (rating === 'bad') {
|
@@ -4206,13 +3982,6 @@ ${this.comment ? this.comment : E}</textarea
|
|
4206
3982
|
bubbles: true,
|
4207
3983
|
}));
|
4208
3984
|
}
|
4209
|
-
typingIndicator() {
|
4210
|
-
return x ` <div class="typing-dots">
|
4211
|
-
<div class="dot"></div>
|
4212
|
-
<div class="dot"></div>
|
4213
|
-
<div class="dot"></div>
|
4214
|
-
</div>`;
|
4215
|
-
}
|
4216
3985
|
botMessage(message, index) {
|
4217
3986
|
var _a, _b, _c, _d, _e;
|
4218
3987
|
const queryMessage = this.messages[index + 1];
|
@@ -4226,7 +3995,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
4226
3995
|
.content=${message.message}
|
4227
3996
|
></markdown-renderer>`
|
4228
3997
|
: E}
|
4229
|
-
${
|
3998
|
+
${((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
|
4230
3999
|
? x `
|
4231
4000
|
<span class="line"></span>
|
4232
4001
|
<div class="product-container">
|
@@ -4243,16 +4012,6 @@ ${this.comment ? this.comment : E}</textarea
|
|
4243
4012
|
: E}
|
4244
4013
|
</div>
|
4245
4014
|
</div>
|
4246
|
-
${this.viewType === 'modal' && message.products
|
4247
|
-
? x ` <products-list
|
4248
|
-
.query=${queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.message}
|
4249
|
-
.response=${message.message}
|
4250
|
-
.products=${message.products}
|
4251
|
-
.siteCurrency=${this.siteCurrency}
|
4252
|
-
.viewType=${this.viewType}
|
4253
|
-
.userId=${this.userId}
|
4254
|
-
></products-list>`
|
4255
|
-
: E}
|
4256
4015
|
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
4257
4016
|
? x ` <div class="bot-response-actions">
|
4258
4017
|
<button
|
@@ -4282,7 +4041,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
4282
4041
|
<img src=${this.botIconUrl} width="30" height="30" />
|
4283
4042
|
</div>`;
|
4284
4043
|
}
|
4285
|
-
return x ` <div class="bot-icon">${botIcon}</div> `;
|
4044
|
+
return x ` <div class="bot-icon">${botIcon()}</div> `;
|
4286
4045
|
}
|
4287
4046
|
chatWindow() {
|
4288
4047
|
if (this.isLoadingHistory || this.isLoadingThreads) {
|
@@ -4295,12 +4054,1229 @@ ${this.comment ? this.comment : E}</textarea
|
|
4295
4054
|
${this.isTyping
|
4296
4055
|
? x ` <div class="message bot">
|
4297
4056
|
<div>${this.renderBotIcon()}</div>
|
4298
|
-
|
4057
|
+
<typing-indicator></typing-indicator>
|
4058
|
+
</div>`
|
4059
|
+
: ''}
|
4060
|
+
${this.isFailed
|
4061
|
+
? x ` <div class="message bot">
|
4062
|
+
<div>${this.renderBotIcon()}</div>
|
4063
|
+
<div>
|
4064
|
+
<p>
|
4065
|
+
Uh-oh! Looks like I tripped over some alpha-stage wires.
|
4066
|
+
Things are still a bit wobbly here, buy hey, that's what
|
4067
|
+
testing is for, Let's try that again; or feel free to throw
|
4068
|
+
another challenge my way!
|
4069
|
+
</p>
|
4070
|
+
</div>
|
4071
|
+
</div>`
|
4072
|
+
: E}
|
4073
|
+
${o$1(this.messages, (message, index) => {
|
4074
|
+
if (message.sender === 'bot') {
|
4075
|
+
return this.botMessage(message, index);
|
4076
|
+
}
|
4077
|
+
return x ` <div class="message user">${message.message}</div> `;
|
4078
|
+
})}
|
4079
|
+
${!this.welcomeFlowTriggered || !this.thread
|
4080
|
+
? x `
|
4081
|
+
<div class="message bot">
|
4082
|
+
<div>${this.renderBotIcon()}</div>
|
4083
|
+
<div>
|
4084
|
+
<p>
|
4085
|
+
Hi,
|
4086
|
+
${this.brandName
|
4087
|
+
? x `Welcome to ${this.brandName}.`
|
4088
|
+
: E}
|
4089
|
+
I'm here to help you find the perfect product. Pick a suggested
|
4090
|
+
prompt from below, or enter your own query.
|
4091
|
+
</p>
|
4092
|
+
</div>
|
4093
|
+
</div>
|
4094
|
+
</div>`
|
4095
|
+
: E}
|
4096
|
+
</div>
|
4097
|
+
`;
|
4098
|
+
}
|
4099
|
+
renderPrompts() {
|
4100
|
+
var _a;
|
4101
|
+
if (this.isLoadingHistory || this.isStreaming || this.isLoadingThreads) {
|
4102
|
+
return E;
|
4103
|
+
}
|
4104
|
+
const latestMessage = this.messages[0];
|
4105
|
+
const isWelcomeMessage = this.messages.length === 1 && (latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.sender) === 'bot';
|
4106
|
+
const isLLMPrompt = !!((_a = latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.prompts) === null || _a === void 0 ? void 0 : _a.length);
|
4107
|
+
const prompts = this.messages.length
|
4108
|
+
? this.messages[0].prompts
|
4109
|
+
: this.prompts
|
4110
|
+
? this.prompts.split(',').map((prompt) => prompt.trim())
|
4111
|
+
: ['Best Sellers'];
|
4112
|
+
const customPrompts = !this.messages.length || isWelcomeMessage ? this.customPrompts : undefined;
|
4113
|
+
if (!prompts && !customPrompts) {
|
4114
|
+
return E;
|
4115
|
+
}
|
4116
|
+
return x `
|
4117
|
+
<div class="prompts btn">
|
4118
|
+
${o$1(prompts, (prompt) => {
|
4119
|
+
return x `
|
4120
|
+
<div
|
4121
|
+
class="prompt"
|
4122
|
+
@click=${(e) => {
|
4123
|
+
this.processMessage(e, prompt, true);
|
4124
|
+
const eventName = isLLMPrompt
|
4125
|
+
? 'customPromptClicked'
|
4126
|
+
: 'promptClicked';
|
4127
|
+
this.sendEvent(eventName, undefined, {
|
4128
|
+
promptName: prompt,
|
4129
|
+
});
|
4130
|
+
}}
|
4131
|
+
>
|
4132
|
+
${prompt}
|
4133
|
+
</div>
|
4134
|
+
`;
|
4135
|
+
})}
|
4136
|
+
${o$1(customPrompts, ({ prompt, link }) => {
|
4137
|
+
return x `
|
4138
|
+
<a
|
4139
|
+
class="prompt"
|
4140
|
+
href=${link}
|
4141
|
+
target="_blank"
|
4142
|
+
rel="noopener"
|
4143
|
+
@click=${() => this.sendEvent('promptClicked', undefined, {
|
4144
|
+
promptName: prompt,
|
4145
|
+
})}
|
4146
|
+
>
|
4147
|
+
${prompt}
|
4148
|
+
</a>
|
4149
|
+
`;
|
4150
|
+
})}
|
4151
|
+
</div>
|
4152
|
+
`;
|
4153
|
+
}
|
4154
|
+
showContext() {
|
4155
|
+
var _a;
|
4156
|
+
if (!((_a = this.thread) === null || _a === void 0 ? void 0 : _a.devContext)) {
|
4157
|
+
return x `
|
4158
|
+
<div class="context-container">
|
4159
|
+
<div class="context-title">
|
4160
|
+
<p>Context</p>
|
4161
|
+
<div
|
4162
|
+
class="btn"
|
4163
|
+
@click=${() => {
|
4164
|
+
if (!this.contextContainerElement) {
|
4165
|
+
return;
|
4166
|
+
}
|
4167
|
+
this.contextContainerElement.classList.remove('show');
|
4168
|
+
}}
|
4169
|
+
>
|
4170
|
+
${closeBtn}
|
4171
|
+
</div>
|
4172
|
+
</div>
|
4173
|
+
<p>
|
4174
|
+
This search thread has no pre-defined context. Start a new search to
|
4175
|
+
personalize.
|
4176
|
+
</p>
|
4177
|
+
</div>
|
4178
|
+
`;
|
4179
|
+
}
|
4180
|
+
const devContext = this.thread.devContext;
|
4181
|
+
const profileType = devContext.email
|
4182
|
+
? 'Pick your profile'
|
4183
|
+
: 'Stay Anonymous';
|
4184
|
+
const userDetails = devContext.email
|
4185
|
+
? `${capitalizeEachWord(devContext.firstName)} / ${capitalizeEachWord(devContext.gender)} / ${devContext.city} / ${devContext.state ? `- ${capitalizeEachWord(devContext.state)}` : ''} - ${devContext.preferences
|
4186
|
+
? `${devContext.preferences.size},${capitalizeEachWord(devContext.preferences.color)},${capitalizeEachWord(devContext.preferences.material)}`
|
4187
|
+
: ''}`
|
4188
|
+
: '';
|
4189
|
+
const visitationType = devContext.productHandle ? 'Via Ad' : 'Direct Visit';
|
4190
|
+
return x `
|
4191
|
+
<div class="context-container">
|
4192
|
+
<div class="context-title">
|
4193
|
+
<p>Context</p>
|
4194
|
+
<div
|
4195
|
+
class="btn"
|
4196
|
+
@click=${() => {
|
4197
|
+
var _a;
|
4198
|
+
(_a = this.contextContainerElement) === null || _a === void 0 ? void 0 : _a.classList.remove('show');
|
4199
|
+
}}
|
4200
|
+
>
|
4201
|
+
${closeBtn}
|
4202
|
+
</div>
|
4203
|
+
</div>
|
4204
|
+
<div>
|
4205
|
+
<div class="context">
|
4206
|
+
<span>Profile Type:</span>${' '}
|
4207
|
+
<span class="context-type-value"> ${profileType} </span>
|
4208
|
+
</div>
|
4209
|
+
${userDetails
|
4210
|
+
? x ` <div class="context user-details">${userDetails}</div>`
|
4211
|
+
: E}
|
4212
|
+
</div>
|
4213
|
+
<div>
|
4214
|
+
<div class="context">
|
4215
|
+
<span>Visitation Context:</span>${' '}
|
4216
|
+
<span class="context-type-value">${visitationType}</span>
|
4217
|
+
</div>
|
4218
|
+
${devContext.productHandle
|
4219
|
+
? x ` <div class="context product-handle">
|
4220
|
+
${devContext.productHandle}
|
4221
|
+
</div>`
|
4222
|
+
: E}
|
4223
|
+
</div>
|
4224
|
+
</div>
|
4225
|
+
`;
|
4226
|
+
}
|
4227
|
+
contextButton() {
|
4228
|
+
var _a, _b, _c, _d;
|
4229
|
+
if (!this.devMode) {
|
4230
|
+
return ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId)
|
4231
|
+
? x `<h2>${((_b = this.thread) === null || _b === void 0 ? void 0 : _b.title) || 'New Search'}</h2>`
|
4232
|
+
: x `<h2>New Search</h2>`;
|
4233
|
+
}
|
4234
|
+
if ((_c = this.thread) === null || _c === void 0 ? void 0 : _c.threadId) {
|
4235
|
+
return x `
|
4236
|
+
<h2>${((_d = this.thread) === null || _d === void 0 ? void 0 : _d.title) || 'New Search'}</h2>
|
4237
|
+
<button
|
4238
|
+
class="btn-context btn"
|
4239
|
+
@click=${() => {
|
4240
|
+
if (!this.contextContainerElement) {
|
4241
|
+
return;
|
4242
|
+
}
|
4243
|
+
this.contextContainerElement.classList.toggle('show');
|
4244
|
+
}}
|
4245
|
+
>
|
4246
|
+
SHOW CONTEXT
|
4247
|
+
</button>
|
4248
|
+
${this.showContext()}
|
4249
|
+
`;
|
4250
|
+
}
|
4251
|
+
return x `
|
4252
|
+
<h2>Click personalize for hyper Contextual</h2>
|
4253
|
+
<button
|
4254
|
+
class="btn-context active btn"
|
4255
|
+
@click=${() => this.personalizeDialogElement.showModal()}
|
4256
|
+
>
|
4257
|
+
Personalize
|
4258
|
+
</button>
|
4259
|
+
`;
|
4260
|
+
}
|
4261
|
+
render() {
|
4262
|
+
if (this.merchantImage) {
|
4263
|
+
// set the merchant image as a css variable
|
4264
|
+
this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
|
4265
|
+
}
|
4266
|
+
else {
|
4267
|
+
this.style.removeProperty('--shopgpt-merchant-img-url');
|
4268
|
+
}
|
4269
|
+
return x `
|
4270
|
+
<div class="chat-header">${this.contextButton()}</div>
|
4271
|
+
<div class="chatbot-section">
|
4272
|
+
${this.chatWindow()} ${this.renderPrompts()}
|
4273
|
+
<form class="chat-form" @submit=${this.onSubmit}>
|
4274
|
+
<input
|
4275
|
+
type="text"
|
4276
|
+
.value=${this.userQuery}
|
4277
|
+
@input=${(e) => (this.userQuery = e.target.value)}
|
4278
|
+
placeholder="Type your search here..."
|
4279
|
+
/>
|
4280
|
+
<button
|
4281
|
+
class="btn"
|
4282
|
+
type="submit"
|
4283
|
+
?disabled=${this.isStreaming || this.isLoadingHistory}
|
4284
|
+
>
|
4285
|
+
${sendFilledIcon}
|
4286
|
+
</button>
|
4287
|
+
</form>
|
4288
|
+
</div>
|
4289
|
+
<personalize-dialog
|
4290
|
+
.createChatThread=${this.createChatThread.bind(this)}
|
4291
|
+
.defaultProductHandles=${this.productHandles}
|
4292
|
+
.defaultProfiles=${this.profiles}
|
4293
|
+
></personalize-dialog>
|
4294
|
+
${this.feedbackDetails
|
4295
|
+
? x `
|
4296
|
+
<feedback-dialog
|
4297
|
+
.messageId=${this.feedbackDetails.messageId}
|
4298
|
+
.queryMessageId=${this.feedbackDetails.queryMessageId}
|
4299
|
+
.threadId=${this.feedbackDetails.threadId}
|
4300
|
+
.comment=${this.feedbackDetails.comment}
|
4301
|
+
@submit-feedback=${() => {
|
4302
|
+
this.feedbackDetails = undefined;
|
4303
|
+
}}
|
4304
|
+
@close=${(e) => {
|
4305
|
+
e.stopPropagation();
|
4306
|
+
this.feedbackDetails = undefined;
|
4307
|
+
}}
|
4308
|
+
></feedback-dialog>
|
4309
|
+
`
|
4310
|
+
: E}
|
4311
|
+
`;
|
4312
|
+
}
|
4313
|
+
}
|
4314
|
+
ChatSection.styles = [chatSectionStyles$1];
|
4315
|
+
__decorate([
|
4316
|
+
n({ type: String }),
|
4317
|
+
__metadata("design:type", Object)
|
4318
|
+
], ChatSection.prototype, "merchantImage", void 0);
|
4319
|
+
__decorate([
|
4320
|
+
n({ type: String }),
|
4321
|
+
__metadata("design:type", Object)
|
4322
|
+
], ChatSection.prototype, "botIconUrl", void 0);
|
4323
|
+
__decorate([
|
4324
|
+
n({ type: String }),
|
4325
|
+
__metadata("design:type", Object)
|
4326
|
+
], ChatSection.prototype, "brandName", void 0);
|
4327
|
+
__decorate([
|
4328
|
+
n({ type: String }),
|
4329
|
+
__metadata("design:type", Object)
|
4330
|
+
], ChatSection.prototype, "prompts", void 0);
|
4331
|
+
__decorate([
|
4332
|
+
n({ type: Array }),
|
4333
|
+
__metadata("design:type", Object)
|
4334
|
+
], ChatSection.prototype, "customPrompts", void 0);
|
4335
|
+
__decorate([
|
4336
|
+
n({ type: Boolean }),
|
4337
|
+
__metadata("design:type", Boolean)
|
4338
|
+
], ChatSection.prototype, "isLoadingThreads", void 0);
|
4339
|
+
__decorate([
|
4340
|
+
n({ type: Boolean }),
|
4341
|
+
__metadata("design:type", Boolean)
|
4342
|
+
], ChatSection.prototype, "isLoadingHistory", void 0);
|
4343
|
+
__decorate([
|
4344
|
+
n({ type: Boolean }),
|
4345
|
+
__metadata("design:type", Object)
|
4346
|
+
], ChatSection.prototype, "devMode", void 0);
|
4347
|
+
__decorate([
|
4348
|
+
n({ type: Boolean }),
|
4349
|
+
__metadata("design:type", Boolean)
|
4350
|
+
], ChatSection.prototype, "isTyping", void 0);
|
4351
|
+
__decorate([
|
4352
|
+
n({ type: Boolean }),
|
4353
|
+
__metadata("design:type", Boolean)
|
4354
|
+
], ChatSection.prototype, "isStreaming", void 0);
|
4355
|
+
__decorate([
|
4356
|
+
n({ type: Boolean }),
|
4357
|
+
__metadata("design:type", Boolean)
|
4358
|
+
], ChatSection.prototype, "isFailed", void 0);
|
4359
|
+
__decorate([
|
4360
|
+
n({ type: Array }),
|
4361
|
+
__metadata("design:type", Array)
|
4362
|
+
], ChatSection.prototype, "messages", void 0);
|
4363
|
+
__decorate([
|
4364
|
+
n({ type: Array }),
|
4365
|
+
__metadata("design:type", Array)
|
4366
|
+
], ChatSection.prototype, "profiles", void 0);
|
4367
|
+
__decorate([
|
4368
|
+
n({ type: Array }),
|
4369
|
+
__metadata("design:type", Array)
|
4370
|
+
], ChatSection.prototype, "productHandles", void 0);
|
4371
|
+
__decorate([
|
4372
|
+
n({ type: Object }),
|
4373
|
+
__metadata("design:type", Object)
|
4374
|
+
], ChatSection.prototype, "thread", void 0);
|
4375
|
+
__decorate([
|
4376
|
+
n({ type: Object }),
|
4377
|
+
__metadata("design:type", Object)
|
4378
|
+
], ChatSection.prototype, "siteCurrency", void 0);
|
4379
|
+
__decorate([
|
4380
|
+
e$3('.context-container'),
|
4381
|
+
__metadata("design:type", Object)
|
4382
|
+
], ChatSection.prototype, "contextContainerElement", void 0);
|
4383
|
+
__decorate([
|
4384
|
+
e$3('.chat-window'),
|
4385
|
+
__metadata("design:type", Object)
|
4386
|
+
], ChatSection.prototype, "chatWindowElement", void 0);
|
4387
|
+
__decorate([
|
4388
|
+
e$3('personalize-dialog'),
|
4389
|
+
__metadata("design:type", Object)
|
4390
|
+
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
4391
|
+
__decorate([
|
4392
|
+
r(),
|
4393
|
+
__metadata("design:type", Object)
|
4394
|
+
], ChatSection.prototype, "feedbackDetails", void 0);
|
4395
|
+
__decorate([
|
4396
|
+
n({ type: String }),
|
4397
|
+
__metadata("design:type", Object)
|
4398
|
+
], ChatSection.prototype, "userQuery", void 0);
|
4399
|
+
__decorate([
|
4400
|
+
n({ type: String }),
|
4401
|
+
__metadata("design:type", String)
|
4402
|
+
], ChatSection.prototype, "css", void 0);
|
4403
|
+
__decorate([
|
4404
|
+
n({ type: Boolean }),
|
4405
|
+
__metadata("design:type", Boolean)
|
4406
|
+
], ChatSection.prototype, "welcomeFlowTriggered", void 0);
|
4407
|
+
__decorate([
|
4408
|
+
n({ type: String }),
|
4409
|
+
__metadata("design:type", String)
|
4410
|
+
], ChatSection.prototype, "userId", void 0);
|
4411
|
+
if (!customElements.get('chat-section')) {
|
4412
|
+
customElements.define('chat-section', ChatSection);
|
4413
|
+
}
|
4414
|
+
|
4415
|
+
const chatSectionStyles = i$4 `
|
4416
|
+
:host {
|
4417
|
+
font-family: 'Inter', sans-serif;
|
4418
|
+
font-size: 16px;
|
4419
|
+
font-weight: 400;
|
4420
|
+
|
4421
|
+
h2,
|
4422
|
+
p {
|
4423
|
+
margin: 0;
|
4424
|
+
}
|
4425
|
+
|
4426
|
+
button {
|
4427
|
+
border-style: none;
|
4428
|
+
cursor: pointer;
|
4429
|
+
}
|
4430
|
+
}
|
4431
|
+
|
4432
|
+
.btn {
|
4433
|
+
cursor: pointer;
|
4434
|
+
}
|
4435
|
+
|
4436
|
+
.chat-header {
|
4437
|
+
padding: 15px 19px;
|
4438
|
+
display: flex;
|
4439
|
+
justify-content: space-between;
|
4440
|
+
align-items: center;
|
4441
|
+
background: #020617;
|
4442
|
+
gap: 8px;
|
4443
|
+
height: 60px;
|
4444
|
+
box-sizing: border-box;
|
4445
|
+
|
4446
|
+
h2 {
|
4447
|
+
color: #ffffff;
|
4448
|
+
font-size: 16px;
|
4449
|
+
font-weight: 400;
|
4450
|
+
line-height: 24px;
|
4451
|
+
text-transform: capitalize;
|
4452
|
+
white-space: nowrap;
|
4453
|
+
overflow: hidden;
|
4454
|
+
text-overflow: ellipsis;
|
4455
|
+
}
|
4456
|
+
|
4457
|
+
.btns-wrapper {
|
4458
|
+
margin-left: auto;
|
4459
|
+
display: flex;
|
4460
|
+
align-items: center;
|
4461
|
+
gap: 20px;
|
4462
|
+
|
4463
|
+
.btn-icon {
|
4464
|
+
border-radius: 50%;
|
4465
|
+
padding: 0;
|
4466
|
+
background: transparent;
|
4467
|
+
margin: 0;
|
4468
|
+
display: flex;
|
4469
|
+
align-items: center;
|
4470
|
+
justify-content: center;
|
4471
|
+
height: 24px;
|
4472
|
+
width: 24px;
|
4473
|
+
opacity: 1;
|
4474
|
+
|
4475
|
+
&:hover {
|
4476
|
+
opacity: 0.7;
|
4477
|
+
}
|
4478
|
+
|
4479
|
+
&.active {
|
4480
|
+
opacity: 1;
|
4481
|
+
}
|
4482
|
+
|
4483
|
+
&:disabled {
|
4484
|
+
cursor: not-allowed;
|
4485
|
+
opacity: 0.5;
|
4486
|
+
}
|
4487
|
+
}
|
4488
|
+
}
|
4489
|
+
}
|
4490
|
+
|
4491
|
+
.chatbot-section {
|
4492
|
+
display: flex;
|
4493
|
+
flex-direction: column;
|
4494
|
+
background-color: #fff;
|
4495
|
+
height: calc(100% - 73px);
|
4496
|
+
padding: 0px 20px 13px;
|
4497
|
+
gap: 11px;
|
4498
|
+
}
|
4499
|
+
|
4500
|
+
.chat-form {
|
4501
|
+
display: flex;
|
4502
|
+
align-items: center;
|
4503
|
+
margin: 0;
|
4504
|
+
position: relative;
|
4505
|
+
|
4506
|
+
.sparkles-icon {
|
4507
|
+
position: absolute;
|
4508
|
+
left: 15px;
|
4509
|
+
top: 50%;
|
4510
|
+
transform: translateY(-50%);
|
4511
|
+
pointer-events: none;
|
4512
|
+
transition: opacity 0.2s;
|
4513
|
+
}
|
4514
|
+
|
4515
|
+
input {
|
4516
|
+
flex: 1;
|
4517
|
+
padding: 10px 38px 12px 35px;
|
4518
|
+
font-weight: 500;
|
4519
|
+
font-size: 14px;
|
4520
|
+
line-height: 20px;
|
4521
|
+
color: #201d2f;
|
4522
|
+
|
4523
|
+
background: #fff;
|
4524
|
+
border-radius: 6px;
|
4525
|
+
border: 0.5px solid #bbbbce;
|
4526
|
+
box-shadow: 0px 4px 10px 0px #0000000d;
|
4527
|
+
|
4528
|
+
&:focus {
|
4529
|
+
outline-width: 0;
|
4530
|
+
}
|
4531
|
+
|
4532
|
+
&::placeholder {
|
4533
|
+
font-weight: 400;
|
4534
|
+
font-size: 14px;
|
4535
|
+
color: #94a3b8;
|
4536
|
+
}
|
4537
|
+
}
|
4538
|
+
|
4539
|
+
.send-btn {
|
4540
|
+
position: absolute;
|
4541
|
+
padding: 0;
|
4542
|
+
display: flex;
|
4543
|
+
justify-content: center;
|
4544
|
+
align-items: center;
|
4545
|
+
right: 11px;
|
4546
|
+
background-color: unset;
|
4547
|
+
|
4548
|
+
&:disabled {
|
4549
|
+
opacity: 0.3;
|
4550
|
+
cursor: not-allowed;
|
4551
|
+
}
|
4552
|
+
}
|
4553
|
+
}
|
4554
|
+
|
4555
|
+
.chat-welcome {
|
4556
|
+
display: flex;
|
4557
|
+
flex-direction: column;
|
4558
|
+
gap: 24px;
|
4559
|
+
flex: 1;
|
4560
|
+
align-items: center;
|
4561
|
+
justify-content: center;
|
4562
|
+
|
4563
|
+
.bot-icon {
|
4564
|
+
border-radius: 50px;
|
4565
|
+
width: 100px;
|
4566
|
+
height: 100px;
|
4567
|
+
}
|
4568
|
+
|
4569
|
+
.welcome-title {
|
4570
|
+
font-weight: 700;
|
4571
|
+
font-style: normal;
|
4572
|
+
font-size: 36px;
|
4573
|
+
line-height: 100%;
|
4574
|
+
text-align: center;
|
4575
|
+
color: #020617;
|
4576
|
+
margin-bottom: 8px;
|
4577
|
+
}
|
4578
|
+
|
4579
|
+
.welcome-message {
|
4580
|
+
font-style: normal;
|
4581
|
+
font-size: 14px;
|
4582
|
+
font-weight: 500;
|
4583
|
+
line-height: 20px;
|
4584
|
+
text-align: center;
|
4585
|
+
color: #64748b;
|
4586
|
+
margin: 0 32px 8px;
|
4587
|
+
}
|
4588
|
+
}
|
4589
|
+
|
4590
|
+
.messages {
|
4591
|
+
flex: 1;
|
4592
|
+
overflow-y: auto;
|
4593
|
+
display: flex;
|
4594
|
+
flex-direction: column-reverse;
|
4595
|
+
gap: 12px;
|
4596
|
+
padding-bottom: 10px;
|
4597
|
+
margin-bottom: -10px;
|
4598
|
+
margin-right: -10px;
|
4599
|
+
padding-right: 10px;
|
4600
|
+
margin-left: -10px;
|
4601
|
+
padding-left: 10px;
|
4602
|
+
background: linear-gradient(#f7f8fa80, #f7f8fa80),
|
4603
|
+
var(--shopgpt-merchant-img-url);
|
4604
|
+
background-position: center;
|
4605
|
+
background-repeat: no-repeat;
|
4606
|
+
background-size: contain;
|
4607
|
+
|
4608
|
+
&.loading {
|
4609
|
+
justify-content: center;
|
4610
|
+
align-items: center;
|
4611
|
+
}
|
4612
|
+
|
4613
|
+
.message:last-child {
|
4614
|
+
margin-top: 10px;
|
4615
|
+
}
|
4616
|
+
}
|
4617
|
+
|
4618
|
+
.message-wrapper {
|
4619
|
+
display: flex;
|
4620
|
+
flex-direction: column;
|
4621
|
+
gap: 16px;
|
4622
|
+
margin-bottom: 10px;
|
4623
|
+
}
|
4624
|
+
|
4625
|
+
.message {
|
4626
|
+
font-size: 14px;
|
4627
|
+
line-height: 20px;
|
4628
|
+
}
|
4629
|
+
|
4630
|
+
.message.user {
|
4631
|
+
background: #18181b;
|
4632
|
+
color: #fafafa;
|
4633
|
+
max-width: 75%;
|
4634
|
+
align-self: flex-end;
|
4635
|
+
padding: 8px 12px;
|
4636
|
+
border-radius: 6px;
|
4637
|
+
}
|
4638
|
+
|
4639
|
+
.message.bot {
|
4640
|
+
display: flex;
|
4641
|
+
gap: 16px;
|
4642
|
+
color: #000000;
|
4643
|
+
max-width: 80%;
|
4644
|
+
}
|
4645
|
+
|
4646
|
+
.bot-response-actions {
|
4647
|
+
display: flex;
|
4648
|
+
gap: 20px;
|
4649
|
+
margin-top: -2px;
|
4650
|
+
|
4651
|
+
button {
|
4652
|
+
display: flex;
|
4653
|
+
align-items: center;
|
4654
|
+
justify-content: center;
|
4655
|
+
background: none;
|
4656
|
+
padding: 0px;
|
4657
|
+
|
4658
|
+
&:hover {
|
4659
|
+
opacity: 0.7;
|
4660
|
+
}
|
4661
|
+
}
|
4662
|
+
}
|
4663
|
+
|
4664
|
+
.bot-icon {
|
4665
|
+
display: flex;
|
4666
|
+
padding: 8px 11px;
|
4667
|
+
justify-content: center;
|
4668
|
+
align-items: center;
|
4669
|
+
border-radius: 70px;
|
4670
|
+
border: 1px solid #dbe2eb;
|
4671
|
+
background: #fff;
|
4672
|
+
width: 36px;
|
4673
|
+
height: 36px;
|
4674
|
+
box-sizing: border-box;
|
4675
|
+
}
|
4676
|
+
|
4677
|
+
.prompts {
|
4678
|
+
display: flex;
|
4679
|
+
justify-content: center;
|
4680
|
+
gap: 10px;
|
4681
|
+
flex-wrap: wrap;
|
4682
|
+
|
4683
|
+
.prompt {
|
4684
|
+
padding: 8px 12px;
|
4685
|
+
border-radius: 6px;
|
4686
|
+
border: 1px solid #e4e4e7;
|
4687
|
+
text-decoration: none;
|
4688
|
+
white-space: nowrap;
|
4689
|
+
display: inline-flex;
|
4690
|
+
|
4691
|
+
color: #18181b;
|
4692
|
+
font-size: 14px;
|
4693
|
+
font-weight: 500;
|
4694
|
+
line-height: 20px;
|
4695
|
+
|
4696
|
+
&:hover {
|
4697
|
+
opacity: 0.7;
|
4698
|
+
}
|
4699
|
+
|
4700
|
+
&:active {
|
4701
|
+
opacity: 1;
|
4702
|
+
}
|
4703
|
+
}
|
4704
|
+
|
4705
|
+
&.left-align {
|
4706
|
+
justify-content: flex-start;
|
4707
|
+
}
|
4708
|
+
}
|
4709
|
+
|
4710
|
+
#modal-chat-threads {
|
4711
|
+
.chat-threads {
|
4712
|
+
position: absolute;
|
4713
|
+
overflow: hidden;
|
4714
|
+
z-index: 1;
|
4715
|
+
top: 60px;
|
4716
|
+
height: 30%;
|
4717
|
+
width: 100%;
|
4718
|
+
background: #fff;
|
4719
|
+
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
4720
|
+
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
4721
|
+
border-radius: 0px 0px 10px 10px;
|
4722
|
+
|
4723
|
+
.title-wrapper {
|
4724
|
+
display: flex;
|
4725
|
+
justify-content: space-between;
|
4726
|
+
align-items: center;
|
4727
|
+
border-bottom: 1px solid #dbe2eb;
|
4728
|
+
padding: 10px 16px;
|
4729
|
+
|
4730
|
+
h2 {
|
4731
|
+
color: #172a41;
|
4732
|
+
font-size: 16px;
|
4733
|
+
font-weight: 700;
|
4734
|
+
line-height: 20px;
|
4735
|
+
}
|
4736
|
+
}
|
4737
|
+
|
4738
|
+
.thread-titles-wrapper {
|
4739
|
+
overflow-y: auto;
|
4740
|
+
height: calc(100% - 40px);
|
4741
|
+
}
|
4742
|
+
|
4743
|
+
.thread-title {
|
4744
|
+
display: flex;
|
4745
|
+
justify-content: space-between;
|
4746
|
+
padding: 10px 16px;
|
4747
|
+
color: #4e647f;
|
4748
|
+
cursor: pointer;
|
4749
|
+
|
4750
|
+
p {
|
4751
|
+
font-size: 14px;
|
4752
|
+
font-weight: 400;
|
4753
|
+
line-height: 20px;
|
4754
|
+
width: 100%;
|
4755
|
+
}
|
4756
|
+
|
4757
|
+
.trash-icon {
|
4758
|
+
display: none;
|
4759
|
+
}
|
4760
|
+
|
4761
|
+
&:hover {
|
4762
|
+
background: #f1f4f8;
|
4763
|
+
|
4764
|
+
.trash-icon {
|
4765
|
+
display: flex;
|
4766
|
+
}
|
4767
|
+
}
|
4768
|
+
}
|
4769
|
+
|
4770
|
+
.thread-title.disabled {
|
4771
|
+
cursor: not-allowed;
|
4772
|
+
}
|
4773
|
+
}
|
4774
|
+
|
4775
|
+
.trash-icon {
|
4776
|
+
display: flex;
|
4777
|
+
justify-content: center;
|
4778
|
+
align-items: center;
|
4779
|
+
padding: 2px;
|
4780
|
+
cursor: pointer;
|
4781
|
+
|
4782
|
+
&:hover {
|
4783
|
+
border-radius: 5px;
|
4784
|
+
background: #dc3545;
|
4785
|
+
|
4786
|
+
path {
|
4787
|
+
fill: white;
|
4788
|
+
}
|
4789
|
+
}
|
4790
|
+
}
|
4791
|
+
|
4792
|
+
.chat-threads-background {
|
4793
|
+
position: absolute;
|
4794
|
+
top: 78px;
|
4795
|
+
height: 100%;
|
4796
|
+
width: 100%;
|
4797
|
+
opacity: 0.5;
|
4798
|
+
background: #000;
|
4799
|
+
z-index: 0;
|
4800
|
+
}
|
4801
|
+
}
|
4802
|
+
|
4803
|
+
footer {
|
4804
|
+
text-align: center;
|
4805
|
+
font-size: 12px;
|
4806
|
+
line-height: 16px;
|
4807
|
+
color: #64748b;
|
4808
|
+
font-weight: 500;
|
4809
|
+
|
4810
|
+
a {
|
4811
|
+
color: #ef4444;
|
4812
|
+
text-decoration: none;
|
4813
|
+
}
|
4814
|
+
}
|
4815
|
+
|
4816
|
+
${scrollBarStyles}
|
4817
|
+
`;
|
4818
|
+
|
4819
|
+
class TooltipComponent extends i$1 {
|
4820
|
+
constructor() {
|
4821
|
+
super(...arguments);
|
4822
|
+
this.position = 'bottom-left';
|
4823
|
+
this.text = '';
|
4824
|
+
}
|
4825
|
+
render() {
|
4826
|
+
return x `
|
4827
|
+
<slot></slot>
|
4828
|
+
<div class="tooltip ${this.position}">${this.text}</div>
|
4829
|
+
`;
|
4830
|
+
}
|
4831
|
+
}
|
4832
|
+
TooltipComponent.styles = [
|
4833
|
+
i$4 `
|
4834
|
+
:host {
|
4835
|
+
position: relative;
|
4836
|
+
display: inline-block;
|
4837
|
+
}
|
4838
|
+
|
4839
|
+
.tooltip {
|
4840
|
+
position: absolute;
|
4841
|
+
color: #172a41;
|
4842
|
+
padding: 4px 8px;
|
4843
|
+
white-space: nowrap;
|
4844
|
+
font-size: 12px;
|
4845
|
+
opacity: 0;
|
4846
|
+
transition: opacity 0.2s;
|
4847
|
+
pointer-events: none;
|
4848
|
+
|
4849
|
+
border-radius: 5px;
|
4850
|
+
background: #fff;
|
4851
|
+
|
4852
|
+
font-style: normal;
|
4853
|
+
font-weight: 400;
|
4854
|
+
line-height: 150%;
|
4855
|
+
}
|
4856
|
+
|
4857
|
+
:host(:hover) .tooltip {
|
4858
|
+
opacity: 1;
|
4859
|
+
}
|
4860
|
+
|
4861
|
+
.top-center {
|
4862
|
+
bottom: calc(100% + 2px);
|
4863
|
+
left: 50%;
|
4864
|
+
transform: translateX(-50%);
|
4865
|
+
}
|
4866
|
+
|
4867
|
+
.top-left {
|
4868
|
+
bottom: calc(100% + 2px);
|
4869
|
+
left: 0;
|
4870
|
+
}
|
4871
|
+
|
4872
|
+
.top-right {
|
4873
|
+
bottom: calc(100% + 2px);
|
4874
|
+
right: 0;
|
4875
|
+
}
|
4876
|
+
|
4877
|
+
.bottom-center {
|
4878
|
+
top: calc(100% + 2px);
|
4879
|
+
left: 50%;
|
4880
|
+
transform: translateX(-50%);
|
4881
|
+
}
|
4882
|
+
|
4883
|
+
.bottom-left {
|
4884
|
+
top: calc(100% + 2px);
|
4885
|
+
left: 0;
|
4886
|
+
}
|
4887
|
+
|
4888
|
+
.bottom-right {
|
4889
|
+
top: calc(100% + 2px);
|
4890
|
+
right: 0;
|
4891
|
+
}
|
4892
|
+
|
4893
|
+
.left-center {
|
4894
|
+
right: calc(100% + 2px);
|
4895
|
+
top: 50%;
|
4896
|
+
transform: translateY(-50%);
|
4897
|
+
}
|
4898
|
+
|
4899
|
+
.left-top {
|
4900
|
+
right: calc(100% + 2px);
|
4901
|
+
top: 0;
|
4902
|
+
}
|
4903
|
+
|
4904
|
+
.left-bottom {
|
4905
|
+
right: calc(100% + 2px);
|
4906
|
+
bottom: 0;
|
4907
|
+
}
|
4908
|
+
|
4909
|
+
.right-center {
|
4910
|
+
left: calc(100% + 2px);
|
4911
|
+
top: 50%;
|
4912
|
+
transform: translateY(-50%);
|
4913
|
+
}
|
4914
|
+
|
4915
|
+
.right-top {
|
4916
|
+
left: calc(100% + 2px);
|
4917
|
+
top: 0;
|
4918
|
+
}
|
4919
|
+
|
4920
|
+
.right-bottom {
|
4921
|
+
left: calc(100% + 2px);
|
4922
|
+
bottom: 0;
|
4923
|
+
}
|
4924
|
+
`,
|
4925
|
+
];
|
4926
|
+
__decorate([
|
4927
|
+
n({ type: String }),
|
4928
|
+
__metadata("design:type", String)
|
4929
|
+
], TooltipComponent.prototype, "position", void 0);
|
4930
|
+
__decorate([
|
4931
|
+
n({ type: String }),
|
4932
|
+
__metadata("design:type", Object)
|
4933
|
+
], TooltipComponent.prototype, "text", void 0);
|
4934
|
+
if (!customElements.get('tooltip-component')) {
|
4935
|
+
customElements.define('tooltip-component', TooltipComponent);
|
4936
|
+
}
|
4937
|
+
|
4938
|
+
const confirmDialogStyles = i$4 `
|
4939
|
+
:host {
|
4940
|
+
font-family: 'Inter', sans-serif;
|
4941
|
+
font-size: 16px;
|
4942
|
+
font-weight: 400;
|
4943
|
+
|
4944
|
+
display: flex;
|
4945
|
+
position: absolute;
|
4946
|
+
top: 0;
|
4947
|
+
left: 0;
|
4948
|
+
width: 100%;
|
4949
|
+
height: 100%;
|
4950
|
+
background: #00000050;
|
4951
|
+
}
|
4952
|
+
|
4953
|
+
.modal {
|
4954
|
+
width: 75%;
|
4955
|
+
max-width: 350px;
|
4956
|
+
background: #fff;
|
4957
|
+
padding: 16px;
|
4958
|
+
margin: auto;
|
4959
|
+
|
4960
|
+
border-radius: 10px;
|
4961
|
+
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
4962
|
+
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
4963
|
+
|
4964
|
+
z-index: 2000;
|
4965
|
+
}
|
4966
|
+
|
4967
|
+
::slotted([slot='title']) {
|
4968
|
+
margin-bottom: 8px !important;
|
4969
|
+
color: #172a41;
|
4970
|
+
font-size: 18px;
|
4971
|
+
font-weight: 700;
|
4972
|
+
line-height: 150%;
|
4973
|
+
}
|
4974
|
+
|
4975
|
+
::slotted([slot='content']) {
|
4976
|
+
color: #4e647f;
|
4977
|
+
line-height: 150%;
|
4978
|
+
}
|
4979
|
+
|
4980
|
+
.button-wrapper {
|
4981
|
+
margin-top: 12px;
|
4982
|
+
display: flex;
|
4983
|
+
gap: 12px;
|
4984
|
+
|
4985
|
+
.btn {
|
4986
|
+
justify-self: stretch;
|
4987
|
+
padding: 10px;
|
4988
|
+
cursor: pointer;
|
4989
|
+
text-align: center;
|
4990
|
+
width: 100%;
|
4991
|
+
border: 0;
|
4992
|
+
color: #fff;
|
4993
|
+
line-height: 150%;
|
4994
|
+
text-transform: capitalize;
|
4995
|
+
}
|
4996
|
+
|
4997
|
+
.accept-btn {
|
4998
|
+
border-radius: 5px;
|
4999
|
+
background: #dc3545;
|
5000
|
+
|
5001
|
+
&:hover {
|
5002
|
+
background: rgb(176, 62, 25);
|
5003
|
+
}
|
5004
|
+
}
|
5005
|
+
|
5006
|
+
.decline-btn {
|
5007
|
+
border-radius: 5px;
|
5008
|
+
background: #4e647f;
|
5009
|
+
|
5010
|
+
&:hover {
|
5011
|
+
background: rgb(57, 77, 102);
|
5012
|
+
}
|
5013
|
+
}
|
5014
|
+
}
|
5015
|
+
`;
|
5016
|
+
|
5017
|
+
class ConfirmDialog extends i$1 {
|
5018
|
+
onAcceptClick(e) {
|
5019
|
+
e.preventDefault();
|
5020
|
+
this.dispatchEvent(new CustomEvent('accept', {
|
5021
|
+
composed: true,
|
5022
|
+
}));
|
5023
|
+
}
|
5024
|
+
onCancelClick(e) {
|
5025
|
+
e.preventDefault();
|
5026
|
+
this.dispatchEvent(new CustomEvent('decline', {
|
5027
|
+
composed: true,
|
5028
|
+
}));
|
5029
|
+
}
|
5030
|
+
render() {
|
5031
|
+
return x `
|
5032
|
+
<div class="modal">
|
5033
|
+
<slot name="title"></slot>
|
5034
|
+
<slot name="content"></slot>
|
5035
|
+
<div class="button-wrapper">
|
5036
|
+
<slot name="accept-btn">
|
5037
|
+
<button class="btn accept-btn" @click=${this.onAcceptClick}>
|
5038
|
+
Delete
|
5039
|
+
</button>
|
5040
|
+
</slot>
|
5041
|
+
<slot name="decline-btn">
|
5042
|
+
<button class="btn decline-btn" @click=${this.onCancelClick}>
|
5043
|
+
Cancel
|
5044
|
+
</button>
|
5045
|
+
</slot>
|
5046
|
+
</div>
|
5047
|
+
</div>
|
5048
|
+
`;
|
5049
|
+
}
|
5050
|
+
}
|
5051
|
+
ConfirmDialog.styles = [confirmDialogStyles];
|
5052
|
+
if (!customElements.get('confirm-dialog')) {
|
5053
|
+
customElements.define('confirm-dialog', ConfirmDialog);
|
5054
|
+
}
|
5055
|
+
|
5056
|
+
const chatbotIcon = b `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
5057
|
+
<path d="M13.9999 6.99999V2.33333H9.33325M2.33325 14H4.66659M10.4999 12.8333V15.1667M17.4999 12.8333V15.1667M23.3333 14H25.6666M9.33325 21L4.66659 25.6667V9.33333C4.66659 8.71449 4.91242 8.121 5.35 7.68341C5.78759 7.24583 6.38108 6.99999 6.99992 6.99999H20.9999C21.6188 6.99999 22.2122 7.24583 22.6498 7.68341C23.0874 8.121 23.3333 8.71449 23.3333 9.33333V18.6667C23.3333 19.2855 23.0874 19.879 22.6498 20.3166C22.2122 20.7542 21.6188 21 20.9999 21H9.33325Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
5058
|
+
</svg>`;
|
5059
|
+
class ChatbotIcon extends i$1 {
|
5060
|
+
render() {
|
5061
|
+
return x ` <div class="chatbot-icon">${chatbotIcon}</div> `;
|
5062
|
+
}
|
5063
|
+
}
|
5064
|
+
ChatbotIcon.styles = [
|
5065
|
+
i$4 `
|
5066
|
+
.chatbot-icon {
|
5067
|
+
border: none;
|
5068
|
+
cursor: pointer;
|
5069
|
+
width: 60px;
|
5070
|
+
height: 58px;
|
5071
|
+
background-color: #020617;
|
5072
|
+
border-radius: 50%;
|
5073
|
+
display: flex;
|
5074
|
+
justify-content: center;
|
5075
|
+
align-items: center;
|
5076
|
+
box-shadow: 0px 10px 10px -5px #0000000a;
|
5077
|
+
}
|
5078
|
+
`,
|
5079
|
+
];
|
5080
|
+
if (!customElements.get('chatbot-icon')) {
|
5081
|
+
customElements.define('chatbot-icon', ChatbotIcon);
|
5082
|
+
}
|
5083
|
+
|
5084
|
+
class PopupView extends i$1 {
|
5085
|
+
constructor() {
|
5086
|
+
super(...arguments);
|
5087
|
+
this.showChatThreads = false;
|
5088
|
+
this.deleteAllThreads = false;
|
5089
|
+
this.userQuery = '';
|
5090
|
+
this.isStylesheetInjected = false;
|
5091
|
+
}
|
5092
|
+
connectedCallback() {
|
5093
|
+
super.connectedCallback();
|
5094
|
+
this.injectCustomCSS();
|
5095
|
+
}
|
5096
|
+
injectCustomCSS() {
|
5097
|
+
if (!this.isStylesheetInjected && this.css) {
|
5098
|
+
const sheet = new CSSStyleSheet();
|
5099
|
+
sheet.replaceSync(this.css);
|
5100
|
+
this.shadowRoot.adoptedStyleSheets.push(sheet);
|
5101
|
+
this.isStylesheetInjected = true;
|
5102
|
+
}
|
5103
|
+
}
|
5104
|
+
scrollToBottom() {
|
5105
|
+
var _a;
|
5106
|
+
(_a = this.chatWindowElement) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
5107
|
+
top: this.chatWindowElement.scrollHeight,
|
5108
|
+
behavior: 'smooth',
|
5109
|
+
});
|
5110
|
+
}
|
5111
|
+
async processMessage(e, message, isPrompt = false) {
|
5112
|
+
this.scrollToBottom();
|
5113
|
+
if (!this.thread) {
|
5114
|
+
await this.createChatThread({ title: '' }, false);
|
5115
|
+
}
|
5116
|
+
await this.sendMessageToServer(e, message, isPrompt);
|
5117
|
+
}
|
5118
|
+
sendEvent(action, actionData, clickData) {
|
5119
|
+
this.dispatchEvent(new CustomEvent('send-event', {
|
5120
|
+
detail: { action, actionData, clickData },
|
5121
|
+
composed: true,
|
5122
|
+
bubbles: true,
|
5123
|
+
}));
|
5124
|
+
}
|
5125
|
+
async onSubmit(e) {
|
5126
|
+
var _a;
|
5127
|
+
e.preventDefault();
|
5128
|
+
const message = (_a = this.userQuery) === null || _a === void 0 ? void 0 : _a.trim();
|
5129
|
+
this.userQuery = '';
|
5130
|
+
await this.processMessage(e, message, false);
|
5131
|
+
}
|
5132
|
+
handleThreadDelete() {
|
5133
|
+
if (this.deleteAllThreads) {
|
5134
|
+
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
5135
|
+
composed: true,
|
5136
|
+
bubbles: true,
|
5137
|
+
}));
|
5138
|
+
this.deleteAllThreads = false;
|
5139
|
+
return;
|
5140
|
+
}
|
5141
|
+
if (!this.deleteThreadId) {
|
5142
|
+
return;
|
5143
|
+
}
|
5144
|
+
this.dispatchEvent(new CustomEvent('delete-thread', {
|
5145
|
+
detail: { threadId: this.deleteThreadId },
|
5146
|
+
composed: true,
|
5147
|
+
bubbles: true,
|
5148
|
+
}));
|
5149
|
+
this.deleteThreadId = '';
|
5150
|
+
}
|
5151
|
+
handleFeedback(rating, messageId, queryMessageId, comment, query, response) {
|
5152
|
+
var _a, _b, _c, _d;
|
5153
|
+
if (rating === 'bad') {
|
5154
|
+
this.sendEvent('thumbsDown', undefined, {
|
5155
|
+
messageId,
|
5156
|
+
threadId: ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) || '',
|
5157
|
+
rating,
|
5158
|
+
comment: comment !== null && comment !== void 0 ? comment : '',
|
5159
|
+
query: query !== null && query !== void 0 ? query : '',
|
5160
|
+
response: response !== null && response !== void 0 ? response : '',
|
5161
|
+
});
|
5162
|
+
this.feedbackDetails = {
|
5163
|
+
messageId,
|
5164
|
+
queryMessageId,
|
5165
|
+
threadId: ((_b = this.thread) === null || _b === void 0 ? void 0 : _b.threadId) || '',
|
5166
|
+
comment,
|
5167
|
+
};
|
5168
|
+
return;
|
5169
|
+
}
|
5170
|
+
this.sendEvent('thumbsUp', undefined, {
|
5171
|
+
messageId,
|
5172
|
+
threadId: ((_c = this.thread) === null || _c === void 0 ? void 0 : _c.threadId) || '',
|
5173
|
+
rating,
|
5174
|
+
comment: comment !== null && comment !== void 0 ? comment : '',
|
5175
|
+
query: query !== null && query !== void 0 ? query : '',
|
5176
|
+
response: response !== null && response !== void 0 ? response : '',
|
5177
|
+
});
|
5178
|
+
this.dispatchEvent(new CustomEvent('submit-feedback', {
|
5179
|
+
detail: {
|
5180
|
+
messageId: messageId,
|
5181
|
+
queryMessageId: queryMessageId,
|
5182
|
+
threadId: (_d = this.thread) === null || _d === void 0 ? void 0 : _d.threadId,
|
5183
|
+
feedback: {
|
5184
|
+
rating,
|
5185
|
+
comment: null,
|
5186
|
+
},
|
5187
|
+
},
|
5188
|
+
composed: true,
|
5189
|
+
bubbles: true,
|
5190
|
+
}));
|
5191
|
+
}
|
5192
|
+
botMessage(message, index) {
|
5193
|
+
var _a, _b, _c, _d;
|
5194
|
+
const queryMessage = this.messages[index + 1];
|
5195
|
+
return x `
|
5196
|
+
<div class="message-wrapper">
|
5197
|
+
<div class="message bot">
|
5198
|
+
<div>
|
5199
|
+
${message.message
|
5200
|
+
? x ` <markdown-renderer
|
5201
|
+
.content=${message.message}
|
5202
|
+
></markdown-renderer>`
|
5203
|
+
: E}
|
5204
|
+
</div>
|
5205
|
+
</div>
|
5206
|
+
${message.products
|
5207
|
+
? x ` <products-list
|
5208
|
+
.query=${queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.message}
|
5209
|
+
.response=${message.message}
|
5210
|
+
.products=${message.products}
|
5211
|
+
.siteCurrency=${this.siteCurrency}
|
5212
|
+
.viewType=${this.viewType}
|
5213
|
+
.userId=${this.userId}
|
5214
|
+
></products-list>`
|
5215
|
+
: E}
|
5216
|
+
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
5217
|
+
? x ` <div class="bot-response-actions">
|
5218
|
+
<button
|
5219
|
+
type="button"
|
5220
|
+
@click=${this.handleFeedback.bind(this, 'good', message.messageId, queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId, (_a = message.feedback) === null || _a === void 0 ? void 0 : _a.comment, queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.message, message === null || message === void 0 ? void 0 : message.message)}
|
5221
|
+
>
|
5222
|
+
${((_b = message.feedback) === null || _b === void 0 ? void 0 : _b.rating) === 'good'
|
5223
|
+
? thumbsUpFilledBtn
|
5224
|
+
: thumbsUpBtn}
|
5225
|
+
</button>
|
5226
|
+
<button
|
5227
|
+
type="button"
|
5228
|
+
@click=${this.handleFeedback.bind(this, 'bad', message.messageId, queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId, (_c = message.feedback) === null || _c === void 0 ? void 0 : _c.comment, queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.message, message === null || message === void 0 ? void 0 : message.message)}
|
5229
|
+
>
|
5230
|
+
${((_d = message.feedback) === null || _d === void 0 ? void 0 : _d.rating) === 'bad'
|
5231
|
+
? thumbsDownFilledBtn
|
5232
|
+
: thumbsDownBtn}
|
5233
|
+
</button>
|
5234
|
+
</div>`
|
5235
|
+
: E}
|
5236
|
+
${index === 0 ? this.renderPrompts() : E}
|
5237
|
+
</div>
|
5238
|
+
`;
|
5239
|
+
}
|
5240
|
+
renderBotIcon(width = 30, height = 30) {
|
5241
|
+
if (!this.botIconUrl) {
|
5242
|
+
return E;
|
5243
|
+
}
|
5244
|
+
return x ` <div class="bot-icon">
|
5245
|
+
<img src=${this.botIconUrl} width=${width} height=${height} />
|
5246
|
+
</div>`;
|
5247
|
+
}
|
5248
|
+
chatWindow() {
|
5249
|
+
if (this.isLoadingHistory || this.isLoadingThreads) {
|
5250
|
+
return x ` <div class="messages loading">
|
5251
|
+
<load-spinner></load-spinner>
|
5252
|
+
</div>`;
|
5253
|
+
}
|
5254
|
+
if (this.messages.length === 0) {
|
5255
|
+
return x `
|
5256
|
+
<div class="chat-welcome">
|
5257
|
+
${this.botIconUrl
|
5258
|
+
? this.renderBotIcon(60, 60)
|
5259
|
+
: x `<chatbot-icon></chatbot-icon>`}
|
5260
|
+
<div>
|
5261
|
+
<h2 class="welcome-title">Hello!</h2>
|
5262
|
+
<p class="welcome-message">
|
5263
|
+
I’m your personal AI concierge and I’m here to help you. What are
|
5264
|
+
you looking for today?
|
5265
|
+
</p>
|
5266
|
+
</div>
|
5267
|
+
${this.renderPrompts()}
|
5268
|
+
</div>
|
5269
|
+
`;
|
5270
|
+
}
|
5271
|
+
return x `
|
5272
|
+
<div class="messages">
|
5273
|
+
${this.isTyping
|
5274
|
+
? x ` <div class="message bot">
|
5275
|
+
<typing-indicator></typing-indicator>
|
4299
5276
|
</div>`
|
4300
5277
|
: ''}
|
4301
5278
|
${this.isFailed
|
4302
5279
|
? x ` <div class="message bot">
|
4303
|
-
<div>${this.renderBotIcon()}</div>
|
4304
5280
|
<div>
|
4305
5281
|
<p>
|
4306
5282
|
Uh-oh! Looks like I tripped over some alpha-stage wires.
|
@@ -4317,33 +5293,19 @@ ${this.comment ? this.comment : E}</textarea
|
|
4317
5293
|
}
|
4318
5294
|
return x ` <div class="message user">${message.message}</div> `;
|
4319
5295
|
})}
|
4320
|
-
${!this.fromAd || !this.thread
|
4321
|
-
? x `
|
4322
|
-
<div class="message bot">
|
4323
|
-
<div>${this.renderBotIcon()}</div>
|
4324
|
-
<div>
|
4325
|
-
<p>
|
4326
|
-
Hi,
|
4327
|
-
${this.brandName
|
4328
|
-
? x `Welcome to ${this.brandName}.`
|
4329
|
-
: E}
|
4330
|
-
I'm here to help you find the perfect product. Pick a suggested
|
4331
|
-
prompt from below, or enter your own query.
|
4332
|
-
</p>
|
4333
|
-
</div>
|
4334
|
-
</div>
|
4335
|
-
</div>`
|
4336
|
-
: E}
|
4337
5296
|
</div>
|
4338
5297
|
`;
|
4339
5298
|
}
|
4340
5299
|
renderPrompts() {
|
5300
|
+
var _a, _b;
|
4341
5301
|
if (this.isLoadingHistory || this.isStreaming || this.isLoadingThreads) {
|
4342
5302
|
return E;
|
4343
5303
|
}
|
4344
|
-
const
|
4345
|
-
const
|
4346
|
-
|
5304
|
+
const latestMessage = this.messages[0];
|
5305
|
+
const isWelcomeMessage = this.messages.length === 1 && (latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.sender) === 'bot';
|
5306
|
+
const isLLMPrompt = !!((_a = latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.prompts) === null || _a === void 0 ? void 0 : _a.length);
|
5307
|
+
let prompts = this.messages.length
|
5308
|
+
? this.messages[0].prompts
|
4347
5309
|
: this.prompts
|
4348
5310
|
? this.prompts.split(',').map((prompt) => prompt.trim())
|
4349
5311
|
: ['Best Sellers'];
|
@@ -4351,15 +5313,26 @@ ${this.comment ? this.comment : E}</textarea
|
|
4351
5313
|
if (!prompts && !customPrompts) {
|
4352
5314
|
return E;
|
4353
5315
|
}
|
5316
|
+
// limit the prompts to 5
|
5317
|
+
prompts = prompts === null || prompts === void 0 ? void 0 : prompts.slice(0, 5);
|
4354
5318
|
return x `
|
4355
|
-
<div
|
5319
|
+
<div
|
5320
|
+
class=${e$1({
|
5321
|
+
prompts: true,
|
5322
|
+
btn: true,
|
5323
|
+
'left-align': ((_b = this.messages) === null || _b === void 0 ? void 0 : _b.length) > 0,
|
5324
|
+
})}
|
5325
|
+
>
|
4356
5326
|
${o$1(prompts, (prompt) => {
|
4357
5327
|
return x `
|
4358
5328
|
<div
|
4359
5329
|
class="prompt"
|
4360
5330
|
@click=${(e) => {
|
4361
5331
|
this.processMessage(e, prompt, true);
|
4362
|
-
|
5332
|
+
const eventName = isLLMPrompt
|
5333
|
+
? 'customPromptClicked'
|
5334
|
+
: 'promptClicked';
|
5335
|
+
this.sendEvent(eventName, undefined, {
|
4363
5336
|
promptName: prompt,
|
4364
5337
|
});
|
4365
5338
|
}}
|
@@ -4386,93 +5359,20 @@ ${this.comment ? this.comment : E}</textarea
|
|
4386
5359
|
</div>
|
4387
5360
|
`;
|
4388
5361
|
}
|
4389
|
-
|
4390
|
-
var _a;
|
4391
|
-
if (!((_a = this.thread) === null || _a === void 0 ? void 0 : _a.devContext)) {
|
4392
|
-
return x `
|
4393
|
-
<div class="context-container">
|
4394
|
-
<div class="context-title">
|
4395
|
-
<p>Context</p>
|
4396
|
-
<div
|
4397
|
-
class="btn"
|
4398
|
-
@click=${() => {
|
4399
|
-
if (!this.contextContainerElement) {
|
4400
|
-
return;
|
4401
|
-
}
|
4402
|
-
this.contextContainerElement.classList.remove('show');
|
4403
|
-
}}
|
4404
|
-
>
|
4405
|
-
${closeBtn}
|
4406
|
-
</div>
|
4407
|
-
</div>
|
4408
|
-
<p>
|
4409
|
-
This search thread has no pre-defined context. Start a new search to
|
4410
|
-
personalize.
|
4411
|
-
</p>
|
4412
|
-
</div>
|
4413
|
-
`;
|
4414
|
-
}
|
4415
|
-
const devContext = this.thread.devContext;
|
4416
|
-
const profileType = devContext.email
|
4417
|
-
? 'Pick your profile'
|
4418
|
-
: 'Stay Anonymous';
|
4419
|
-
const userDetails = devContext.email
|
4420
|
-
? `${capitalizeEachWord(devContext.firstName)} / ${capitalizeEachWord(devContext.gender)} / ${devContext.city} / ${devContext.state ? `- ${capitalizeEachWord(devContext.state)}` : ''} - ${devContext.preferences
|
4421
|
-
? `${devContext.preferences.size},${capitalizeEachWord(devContext.preferences.color)},${capitalizeEachWord(devContext.preferences.material)}`
|
4422
|
-
: ''}`
|
4423
|
-
: '';
|
4424
|
-
const visitationType = devContext.productHandle ? 'Via Ad' : 'Direct Visit';
|
4425
|
-
return x `
|
4426
|
-
<div class="context-container">
|
4427
|
-
<div class="context-title">
|
4428
|
-
<p>Context</p>
|
4429
|
-
<div
|
4430
|
-
class="btn"
|
4431
|
-
@click=${() => {
|
4432
|
-
var _a;
|
4433
|
-
(_a = this.contextContainerElement) === null || _a === void 0 ? void 0 : _a.classList.remove('show');
|
4434
|
-
}}
|
4435
|
-
>
|
4436
|
-
${closeBtn}
|
4437
|
-
</div>
|
4438
|
-
</div>
|
4439
|
-
<div>
|
4440
|
-
<div class="context">
|
4441
|
-
<span>Profile Type:</span>${' '}
|
4442
|
-
<span class="context-type-value"> ${profileType} </span>
|
4443
|
-
</div>
|
4444
|
-
${userDetails
|
4445
|
-
? x ` <div class="context user-details">${userDetails}</div>`
|
4446
|
-
: E}
|
4447
|
-
</div>
|
4448
|
-
<div>
|
4449
|
-
<div class="context">
|
4450
|
-
<span>Visitation Context:</span>${' '}
|
4451
|
-
<span class="context-type-value">${visitationType}</span>
|
4452
|
-
</div>
|
4453
|
-
${devContext.productHandle
|
4454
|
-
? x ` <div class="context product-handle">
|
4455
|
-
${devContext.productHandle}
|
4456
|
-
</div>`
|
4457
|
-
: E}
|
4458
|
-
</div>
|
4459
|
-
</div>
|
4460
|
-
`;
|
4461
|
-
}
|
4462
|
-
modalViewHeader() {
|
5362
|
+
chatHeader() {
|
4463
5363
|
var _a;
|
4464
5364
|
return x `
|
4465
|
-
<div>
|
4466
|
-
${this.
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
4473
|
-
|
4474
|
-
|
4475
|
-
|
5365
|
+
<div class="chat-header">
|
5366
|
+
${this.renderBotIcon()}
|
5367
|
+
<h2>
|
5368
|
+
${this.brandName && !this.botIconUrl ? this.brandName : E}
|
5369
|
+
${((_a = this.thread) === null || _a === void 0 ? void 0 : _a.title) || 'AI Concierge'}
|
5370
|
+
</h2>
|
5371
|
+
<div class="btns-wrapper">
|
5372
|
+
<tooltip-component .position=${'bottom-right'} .text=${'New Chat'}>
|
5373
|
+
<button
|
5374
|
+
class="btn btn-icon new-search-btn"
|
5375
|
+
@click=${(e) => {
|
4476
5376
|
var _a, _b;
|
4477
5377
|
e.preventDefault();
|
4478
5378
|
if ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) {
|
@@ -4480,83 +5380,47 @@ ${this.comment ? this.comment : E}</textarea
|
|
4480
5380
|
}
|
4481
5381
|
(_b = this.setSelectedThreadId) === null || _b === void 0 ? void 0 : _b.call(this, '');
|
4482
5382
|
}}
|
4483
|
-
|
5383
|
+
?disabled=${this.isStreaming}
|
5384
|
+
>
|
5385
|
+
${plusBtn}
|
5386
|
+
</button>
|
5387
|
+
</tooltip-component>
|
5388
|
+
<tooltip-component
|
5389
|
+
.position=${'bottom-right'}
|
5390
|
+
.text=${'Search History'}
|
4484
5391
|
>
|
4485
|
-
|
4486
|
-
|
4487
|
-
</tooltip-component>
|
4488
|
-
<tooltip-component
|
4489
|
-
.position=${'bottom-right'}
|
4490
|
-
.text=${'Search History'}
|
4491
|
-
>
|
4492
|
-
<button
|
4493
|
-
class=${e$1({
|
5392
|
+
<button
|
5393
|
+
class=${e$1({
|
4494
5394
|
btn: true,
|
4495
5395
|
'btn-icon': true,
|
4496
5396
|
'threads-btn': true,
|
4497
5397
|
active: this.showChatThreads,
|
4498
5398
|
})}
|
4499
|
-
|
5399
|
+
@click=${(e) => {
|
4500
5400
|
e.preventDefault();
|
4501
5401
|
this.showChatThreads = !this.showChatThreads;
|
4502
5402
|
if (this.showChatThreads) {
|
4503
5403
|
this.sendEvent('showThreads');
|
4504
5404
|
}
|
4505
5405
|
}}
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
4511
|
-
|
4512
|
-
|
4513
|
-
|
5406
|
+
>
|
5407
|
+
${historyBtn}
|
5408
|
+
</button>
|
5409
|
+
</tooltip-component>
|
5410
|
+
<tooltip-component .position=${'bottom-right'} .text=${'Close Chat'}>
|
5411
|
+
<button
|
5412
|
+
class="btn btn-icon close-btn"
|
5413
|
+
@click=${(e) => {
|
4514
5414
|
var _a;
|
4515
5415
|
e.preventDefault();
|
4516
5416
|
(_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this);
|
4517
5417
|
}}
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4521
|
-
|
5418
|
+
>
|
5419
|
+
${crossBtn}
|
5420
|
+
</button>
|
5421
|
+
</tooltip-component>
|
5422
|
+
</div>
|
4522
5423
|
</div>
|
4523
|
-
`;
|
4524
|
-
}
|
4525
|
-
contextButton() {
|
4526
|
-
var _a, _b, _c, _d;
|
4527
|
-
if (this.viewType === 'modal') {
|
4528
|
-
return this.modalViewHeader();
|
4529
|
-
}
|
4530
|
-
if (!this.devMode) {
|
4531
|
-
return ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId)
|
4532
|
-
? x `<h2>${((_b = this.thread) === null || _b === void 0 ? void 0 : _b.title) || 'New Search'}</h2>`
|
4533
|
-
: x `<h2>New Search</h2>`;
|
4534
|
-
}
|
4535
|
-
if ((_c = this.thread) === null || _c === void 0 ? void 0 : _c.threadId) {
|
4536
|
-
return x `
|
4537
|
-
<h2>${((_d = this.thread) === null || _d === void 0 ? void 0 : _d.title) || 'New Search'}</h2>
|
4538
|
-
<button
|
4539
|
-
class="btn-context btn"
|
4540
|
-
@click=${() => {
|
4541
|
-
if (!this.contextContainerElement) {
|
4542
|
-
return;
|
4543
|
-
}
|
4544
|
-
this.contextContainerElement.classList.toggle('show');
|
4545
|
-
}}
|
4546
|
-
>
|
4547
|
-
SHOW CONTEXT
|
4548
|
-
</button>
|
4549
|
-
${this.showContext()}
|
4550
|
-
`;
|
4551
|
-
}
|
4552
|
-
return x `
|
4553
|
-
<h2>Click personalize for hyper Contextual</h2>
|
4554
|
-
<button
|
4555
|
-
class="btn-context active btn"
|
4556
|
-
@click=${() => this.personalizeDialogElement.showModal()}
|
4557
|
-
>
|
4558
|
-
Personalize
|
4559
|
-
</button>
|
4560
5424
|
`;
|
4561
5425
|
}
|
4562
5426
|
renderChatThreads() {
|
@@ -4634,52 +5498,38 @@ ${this.comment ? this.comment : E}</textarea
|
|
4634
5498
|
this.style.removeProperty('--shopgpt-merchant-img-url');
|
4635
5499
|
}
|
4636
5500
|
return x `
|
4637
|
-
|
4638
|
-
<div
|
4639
|
-
|
4640
|
-
'chatbot-section': true,
|
4641
|
-
'modal-view': this.viewType === 'modal',
|
4642
|
-
})}
|
4643
|
-
>
|
4644
|
-
${this.chatWindow()} ${this.renderPrompts()}
|
5501
|
+
${this.chatHeader()}
|
5502
|
+
<div class="chatbot-section">
|
5503
|
+
${this.chatWindow()}
|
4645
5504
|
<form class="chat-form" @submit=${this.onSubmit}>
|
5505
|
+
<span class="sparkles-icon"> ${sparklesSharp} </span>
|
4646
5506
|
<input
|
4647
5507
|
type="text"
|
4648
5508
|
.value=${this.userQuery}
|
4649
5509
|
@input=${(e) => (this.userQuery = e.target.value)}
|
4650
|
-
placeholder="
|
5510
|
+
placeholder="What are you looking for?"
|
4651
5511
|
/>
|
4652
5512
|
<button
|
4653
|
-
class
|
4654
|
-
btn: true,
|
4655
|
-
modal: this.viewType === 'modal',
|
4656
|
-
})}
|
5513
|
+
class="btn send-btn"
|
4657
5514
|
type="submit"
|
4658
5515
|
?disabled=${this.isStreaming || this.isLoadingHistory}
|
4659
5516
|
>
|
4660
|
-
${
|
5517
|
+
${sendBtn}
|
4661
5518
|
</button>
|
4662
5519
|
</form>
|
4663
|
-
|
4664
|
-
|
4665
|
-
|
4666
|
-
|
4667
|
-
|
4668
|
-
|
4669
|
-
|
4670
|
-
|
4671
|
-
|
4672
|
-
|
4673
|
-
|
4674
|
-
|
4675
|
-
</footer>`
|
4676
|
-
: E}
|
5520
|
+
<footer>
|
5521
|
+
Powered by
|
5522
|
+
<a
|
5523
|
+
target="_blank"
|
5524
|
+
href="https://shopgpt.edgeagents.ai"
|
5525
|
+
@click=${() => {
|
5526
|
+
this.sendEvent('blotoutLinkClicked');
|
5527
|
+
}}
|
5528
|
+
>
|
5529
|
+
Blotout
|
5530
|
+
</a>
|
5531
|
+
</footer>
|
4677
5532
|
</div>
|
4678
|
-
<personalize-dialog
|
4679
|
-
.createChatThread=${this.createChatThread.bind(this)}
|
4680
|
-
.defaultProductHandles=${this.productHandles}
|
4681
|
-
.defaultProfiles=${this.profiles}
|
4682
|
-
></personalize-dialog>
|
4683
5533
|
${this.renderChatThreads()}
|
4684
5534
|
${this.deleteThreadId || this.deleteAllThreads
|
4685
5535
|
? x `
|
@@ -4727,121 +5577,97 @@ ${this.comment ? this.comment : E}</textarea
|
|
4727
5577
|
`;
|
4728
5578
|
}
|
4729
5579
|
}
|
4730
|
-
|
5580
|
+
PopupView.styles = [chatSectionStyles];
|
4731
5581
|
__decorate([
|
4732
5582
|
n({ type: String }),
|
4733
5583
|
__metadata("design:type", Object)
|
4734
|
-
],
|
5584
|
+
], PopupView.prototype, "merchantImage", void 0);
|
4735
5585
|
__decorate([
|
4736
5586
|
n({ type: String }),
|
4737
5587
|
__metadata("design:type", Object)
|
4738
|
-
],
|
5588
|
+
], PopupView.prototype, "botIconUrl", void 0);
|
4739
5589
|
__decorate([
|
4740
5590
|
n({ type: String }),
|
4741
5591
|
__metadata("design:type", Object)
|
4742
|
-
],
|
5592
|
+
], PopupView.prototype, "brandName", void 0);
|
4743
5593
|
__decorate([
|
4744
5594
|
n({ type: String }),
|
4745
5595
|
__metadata("design:type", Object)
|
4746
|
-
],
|
5596
|
+
], PopupView.prototype, "prompts", void 0);
|
4747
5597
|
__decorate([
|
4748
5598
|
n({ type: Array }),
|
4749
5599
|
__metadata("design:type", Object)
|
4750
|
-
],
|
5600
|
+
], PopupView.prototype, "customPrompts", void 0);
|
4751
5601
|
__decorate([
|
4752
5602
|
n({ type: Boolean }),
|
4753
5603
|
__metadata("design:type", Boolean)
|
4754
|
-
],
|
5604
|
+
], PopupView.prototype, "isLoadingThreads", void 0);
|
4755
5605
|
__decorate([
|
4756
5606
|
n({ type: Object }),
|
4757
5607
|
__metadata("design:type", Map)
|
4758
|
-
],
|
5608
|
+
], PopupView.prototype, "chatThreads", void 0);
|
4759
5609
|
__decorate([
|
4760
5610
|
r(),
|
4761
5611
|
__metadata("design:type", String)
|
4762
|
-
],
|
5612
|
+
], PopupView.prototype, "deleteThreadId", void 0);
|
4763
5613
|
__decorate([
|
4764
5614
|
n({ type: Boolean }),
|
4765
5615
|
__metadata("design:type", Object)
|
4766
|
-
],
|
5616
|
+
], PopupView.prototype, "showChatThreads", void 0);
|
4767
5617
|
__decorate([
|
4768
5618
|
n({ type: Boolean }),
|
4769
5619
|
__metadata("design:type", Boolean)
|
4770
|
-
],
|
4771
|
-
__decorate([
|
4772
|
-
n({ type: Boolean }),
|
4773
|
-
__metadata("design:type", Object)
|
4774
|
-
], ChatSection.prototype, "devMode", void 0);
|
5620
|
+
], PopupView.prototype, "isLoadingHistory", void 0);
|
4775
5621
|
__decorate([
|
4776
5622
|
n({ type: Boolean }),
|
4777
5623
|
__metadata("design:type", Boolean)
|
4778
|
-
],
|
5624
|
+
], PopupView.prototype, "isTyping", void 0);
|
4779
5625
|
__decorate([
|
4780
5626
|
n({ type: Boolean }),
|
4781
5627
|
__metadata("design:type", Boolean)
|
4782
|
-
],
|
5628
|
+
], PopupView.prototype, "isStreaming", void 0);
|
4783
5629
|
__decorate([
|
4784
5630
|
n({ type: Boolean }),
|
4785
5631
|
__metadata("design:type", Boolean)
|
4786
|
-
],
|
4787
|
-
__decorate([
|
4788
|
-
n({ type: Array }),
|
4789
|
-
__metadata("design:type", Array)
|
4790
|
-
], ChatSection.prototype, "messages", void 0);
|
4791
|
-
__decorate([
|
4792
|
-
n({ type: Array }),
|
4793
|
-
__metadata("design:type", Array)
|
4794
|
-
], ChatSection.prototype, "profiles", void 0);
|
5632
|
+
], PopupView.prototype, "isFailed", void 0);
|
4795
5633
|
__decorate([
|
4796
5634
|
n({ type: Array }),
|
4797
5635
|
__metadata("design:type", Array)
|
4798
|
-
],
|
5636
|
+
], PopupView.prototype, "messages", void 0);
|
4799
5637
|
__decorate([
|
4800
5638
|
n({ type: Object }),
|
4801
5639
|
__metadata("design:type", Object)
|
4802
|
-
],
|
5640
|
+
], PopupView.prototype, "thread", void 0);
|
4803
5641
|
__decorate([
|
4804
5642
|
n({ type: Object }),
|
4805
5643
|
__metadata("design:type", Object)
|
4806
|
-
],
|
5644
|
+
], PopupView.prototype, "siteCurrency", void 0);
|
4807
5645
|
__decorate([
|
4808
5646
|
r(),
|
4809
5647
|
__metadata("design:type", Object)
|
4810
|
-
],
|
4811
|
-
__decorate([
|
4812
|
-
e$3('.context-container'),
|
4813
|
-
__metadata("design:type", Object)
|
4814
|
-
], ChatSection.prototype, "contextContainerElement", void 0);
|
5648
|
+
], PopupView.prototype, "deleteAllThreads", void 0);
|
4815
5649
|
__decorate([
|
4816
5650
|
e$3('.chat-window'),
|
4817
5651
|
__metadata("design:type", Object)
|
4818
|
-
],
|
4819
|
-
__decorate([
|
4820
|
-
e$3('personalize-dialog'),
|
4821
|
-
__metadata("design:type", Object)
|
4822
|
-
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
5652
|
+
], PopupView.prototype, "chatWindowElement", void 0);
|
4823
5653
|
__decorate([
|
4824
5654
|
r(),
|
4825
5655
|
__metadata("design:type", Object)
|
4826
|
-
],
|
5656
|
+
], PopupView.prototype, "feedbackDetails", void 0);
|
4827
5657
|
__decorate([
|
4828
5658
|
n({ type: String }),
|
4829
5659
|
__metadata("design:type", Object)
|
4830
|
-
],
|
5660
|
+
], PopupView.prototype, "userQuery", void 0);
|
4831
5661
|
__decorate([
|
4832
5662
|
n({ type: String }),
|
4833
5663
|
__metadata("design:type", String)
|
4834
|
-
],
|
4835
|
-
__decorate([
|
4836
|
-
n({ type: Boolean }),
|
4837
|
-
__metadata("design:type", Boolean)
|
4838
|
-
], ChatSection.prototype, "fromAd", void 0);
|
5664
|
+
], PopupView.prototype, "css", void 0);
|
4839
5665
|
__decorate([
|
4840
5666
|
n({ type: String }),
|
4841
5667
|
__metadata("design:type", String)
|
4842
|
-
],
|
4843
|
-
if (!customElements.get('
|
4844
|
-
customElements.define('
|
5668
|
+
], PopupView.prototype, "userId", void 0);
|
5669
|
+
if (!customElements.get('popup-view')) {
|
5670
|
+
customElements.define('popup-view', PopupView);
|
4845
5671
|
}
|
4846
5672
|
|
4847
5673
|
async function* streamToIterable(stream) {
|
@@ -4937,15 +5763,20 @@ ${this.comment ? this.comment : E}</textarea
|
|
4937
5763
|
this.modalState = 'close';
|
4938
5764
|
(_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
|
4939
5765
|
};
|
4940
|
-
this.
|
4941
|
-
var _a;
|
5766
|
+
this.isWelcomeFlowRequired = () => {
|
5767
|
+
var _a, _b;
|
4942
5768
|
if (this.devMode) {
|
4943
5769
|
const thread = this.chatThreads.get(this.selectedThreadId);
|
4944
|
-
return
|
5770
|
+
return ((_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.email)
|
5771
|
+
? true
|
5772
|
+
: !!((_b = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _b === void 0 ? void 0 : _b.productHandle);
|
4945
5773
|
}
|
4946
5774
|
const searchParams = new URLSearchParams(window.location.search);
|
4947
|
-
|
4948
|
-
|
5775
|
+
const userType = getUserType(this.destination, this.sessionId);
|
5776
|
+
if (userType === 'known') {
|
5777
|
+
return true;
|
5778
|
+
}
|
5779
|
+
return isFromAd(searchParams) || searchParams.get('shopGPT') === '1';
|
4949
5780
|
};
|
4950
5781
|
this.submitQuery = (message) => {
|
4951
5782
|
if (!message) {
|
@@ -5010,6 +5841,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5010
5841
|
// If the url has `utm_source` open the popup when reloaded
|
5011
5842
|
if (hasSource && isDesktop) {
|
5012
5843
|
this.modalState = 'open';
|
5844
|
+
setUserInteracted(this.destination);
|
5013
5845
|
}
|
5014
5846
|
}
|
5015
5847
|
}
|
@@ -5038,15 +5870,17 @@ ${this.comment ? this.comment : E}</textarea
|
|
5038
5870
|
if (!thread) {
|
5039
5871
|
return;
|
5040
5872
|
}
|
5041
|
-
const
|
5042
|
-
|
5043
|
-
|
5044
|
-
: fromAd
|
5045
|
-
? this.storeAPI.getCurrentProductHandle()
|
5046
|
-
: undefined;
|
5047
|
-
if (!fromAd) {
|
5873
|
+
const welcomeFlow = this.isWelcomeFlowRequired();
|
5874
|
+
let productHandle;
|
5875
|
+
if (!welcomeFlow) {
|
5048
5876
|
return;
|
5049
5877
|
}
|
5878
|
+
if (this.devMode) {
|
5879
|
+
productHandle = (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle;
|
5880
|
+
}
|
5881
|
+
else if (welcomeFlow) {
|
5882
|
+
productHandle = this.storeAPI.getCurrentProductHandle();
|
5883
|
+
}
|
5050
5884
|
try {
|
5051
5885
|
this.isTyping = true;
|
5052
5886
|
this.isStreaming = true;
|
@@ -5086,7 +5920,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5086
5920
|
if (latestThread) {
|
5087
5921
|
this.setSelectedThreadId(latestThread.threadId, true);
|
5088
5922
|
}
|
5089
|
-
else if (!this.devMode && this.
|
5923
|
+
else if (!this.devMode && this.isWelcomeFlowRequired()) {
|
5090
5924
|
this.createChatThread({ title: '' }, true);
|
5091
5925
|
}
|
5092
5926
|
}
|
@@ -5114,7 +5948,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5114
5948
|
message: message.message,
|
5115
5949
|
sender: message.sender,
|
5116
5950
|
products,
|
5117
|
-
|
5951
|
+
prompts: message.prompts,
|
5118
5952
|
feedback: message.feedback,
|
5119
5953
|
};
|
5120
5954
|
});
|
@@ -5246,7 +6080,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5246
6080
|
...latestMessage,
|
5247
6081
|
message: messageData.message || '',
|
5248
6082
|
messageId: messageData.messageId,
|
5249
|
-
|
6083
|
+
prompts: messageData.prompts,
|
5250
6084
|
sender: 'bot',
|
5251
6085
|
isChunk: false,
|
5252
6086
|
},
|
@@ -5369,7 +6203,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5369
6203
|
url: e.detail.url,
|
5370
6204
|
title: e.detail.title,
|
5371
6205
|
rank: e.detail.rank,
|
5372
|
-
});
|
6206
|
+
}, true);
|
5373
6207
|
}
|
5374
6208
|
getSiteCurrency() {
|
5375
6209
|
return this.storeAPI.getSiteCurrency();
|
@@ -5428,7 +6262,7 @@ ${this.comment ? this.comment : E}</textarea
|
|
5428
6262
|
.customPrompts=${this.customPrompts}
|
5429
6263
|
.botIconUrl=${this.botIconUrl}
|
5430
6264
|
.css=${this.css}
|
5431
|
-
.
|
6265
|
+
.welcomeFlowTriggered=${this.isWelcomeFlowRequired()}
|
5432
6266
|
.userId=${this.userId}
|
5433
6267
|
></chat-section>
|
5434
6268
|
</div>
|
@@ -5442,74 +6276,76 @@ ${this.comment ? this.comment : E}</textarea
|
|
5442
6276
|
this.modalState = 'close';
|
5443
6277
|
this.shopGPTAPI.sendEvent('chatbotClosed');
|
5444
6278
|
};
|
5445
|
-
|
5446
|
-
|
6279
|
+
return x `
|
6280
|
+
${this.modalState === 'open'
|
6281
|
+
? x `<div
|
6282
|
+
id="shop-gpt-modal"
|
6283
|
+
@delete-thread=${this.handleThreadDelete}
|
6284
|
+
@delete-all-threads=${this.handleAllThreadsDelete}
|
6285
|
+
@submit-feedback=${this.submitFeedback}
|
6286
|
+
@click=${this.handleUserInteraction}
|
6287
|
+
@send-event=${this.sendEvent}
|
6288
|
+
@product-clicked=${this.productClicked}
|
6289
|
+
>
|
6290
|
+
<popup-view
|
6291
|
+
.prompts=${this.quickPrompts}
|
6292
|
+
.brandName=${this.brandName}
|
6293
|
+
.isFailed=${this.isFailed}
|
6294
|
+
.isLoadingHistory=${this.isLoadingHistory}
|
6295
|
+
.isTyping=${this.isTyping}
|
6296
|
+
.isStreaming=${this.isStreaming}
|
6297
|
+
.messages=${this.messages}
|
6298
|
+
.siteCurrency=${this.getSiteCurrency()}
|
6299
|
+
.sendMessageToServer=${this.sendMessageToServer.bind(this)}
|
6300
|
+
.thread=${thread}
|
6301
|
+
.createChatThread=${this.createChatThread.bind(this)}
|
6302
|
+
.viewType=${'modal'}
|
6303
|
+
.closeModal=${closeModal}
|
6304
|
+
.setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
|
6305
|
+
.chatThreads=${this.chatThreads}
|
6306
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
6307
|
+
.merchantImage=${this.merchantImage}
|
6308
|
+
.customPrompts=${this.customPrompts}
|
6309
|
+
.botIconUrl=${this.botIconUrl}
|
6310
|
+
.css=${this.css}
|
6311
|
+
.userId=${this.userId}
|
6312
|
+
></popup-view>
|
6313
|
+
</div>`
|
6314
|
+
: E}
|
6315
|
+
<div class="chatbot-widget">
|
5447
6316
|
<button
|
5448
6317
|
@click=${(e) => {
|
5449
|
-
|
6318
|
+
e.preventDefault();
|
6319
|
+
if (this.modalState === 'open') {
|
6320
|
+
closeModal();
|
6321
|
+
}
|
6322
|
+
else {
|
5450
6323
|
this.openModal();
|
5451
|
-
}
|
6324
|
+
}
|
6325
|
+
}}
|
5452
6326
|
>
|
5453
|
-
|
6327
|
+
<chatbot-icon></chatbot-icon>
|
5454
6328
|
</button>
|
5455
6329
|
${((_a = this.nudge) === null || _a === void 0 ? void 0 : _a.show) && this.showNudge
|
5456
|
-
|
6330
|
+
? x ` <div
|
5457
6331
|
class="nudge"
|
5458
6332
|
@click=${(e) => {
|
5459
|
-
|
5460
|
-
|
5461
|
-
|
6333
|
+
e.preventDefault();
|
6334
|
+
this.openModal();
|
6335
|
+
}}
|
5462
6336
|
>
|
5463
6337
|
Hi there! I'm an AI Agent to help you find the perfect product.
|
5464
6338
|
What are you looking for today?
|
5465
6339
|
</div>`
|
5466
|
-
|
6340
|
+
: x ` <div class="chatbot-hover-text">
|
5467
6341
|
What are you looking for today?
|
5468
6342
|
</div>`}
|
5469
|
-
</div>`;
|
5470
|
-
}
|
5471
|
-
return x `
|
5472
|
-
<div
|
5473
|
-
id="shop-gpt-modal"
|
5474
|
-
@delete-thread=${this.handleThreadDelete}
|
5475
|
-
@delete-all-threads=${this.handleAllThreadsDelete}
|
5476
|
-
@submit-feedback=${this.submitFeedback}
|
5477
|
-
@click=${this.handleUserInteraction}
|
5478
|
-
@send-event=${this.sendEvent}
|
5479
|
-
@product-clicked=${this.productClicked}
|
5480
|
-
>
|
5481
|
-
<chat-section
|
5482
|
-
.prompts=${this.quickPrompts}
|
5483
|
-
.brandName=${this.brandName}
|
5484
|
-
.isFailed=${this.isFailed}
|
5485
|
-
.isLoadingHistory=${this.isLoadingHistory}
|
5486
|
-
.isTyping=${this.isTyping}
|
5487
|
-
.isStreaming=${this.isStreaming}
|
5488
|
-
.messages=${this.messages}
|
5489
|
-
.siteCurrency=${this.getSiteCurrency()}
|
5490
|
-
.sendMessageToServer=${this.sendMessageToServer.bind(this)}
|
5491
|
-
.thread=${thread}
|
5492
|
-
.createChatThread=${this.createChatThread.bind(this)}
|
5493
|
-
.devMode=${this.devMode}
|
5494
|
-
.productHandles=${this.productHandles}
|
5495
|
-
.profiles=${this.profiles}
|
5496
|
-
.viewType=${'modal'}
|
5497
|
-
.closeModal=${closeModal}
|
5498
|
-
.setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
|
5499
|
-
.chatThreads=${this.chatThreads}
|
5500
|
-
.isLoadingThreads=${this.isLoadingThreads}
|
5501
|
-
.merchantImage=${this.merchantImage}
|
5502
|
-
.customPrompts=${this.customPrompts}
|
5503
|
-
.botIconUrl=${this.botIconUrl}
|
5504
|
-
.css=${this.css}
|
5505
|
-
.fromAd=${this.isFromAd()}
|
5506
|
-
.userId=${this.userId}
|
5507
|
-
></chat-section>
|
5508
6343
|
</div>
|
5509
6344
|
`;
|
5510
6345
|
}
|
5511
6346
|
openModal() {
|
5512
6347
|
setIsBotOpened(this.destination, this.sessionId, true);
|
6348
|
+
setUserInteracted(this.destination);
|
5513
6349
|
this.shopGPTAPI.sendEvent('chatbotOpened');
|
5514
6350
|
this.modalState = 'open';
|
5515
6351
|
this.handleUserInteraction();
|