@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.mjs
CHANGED
@@ -423,6 +423,7 @@ const uiActions = new Set([
|
|
423
423
|
'showThreads',
|
424
424
|
'queryInteractions',
|
425
425
|
'promptClicked',
|
426
|
+
'customPromptClicked',
|
426
427
|
'productRecommendationClicked',
|
427
428
|
'blotoutLinkClicked',
|
428
429
|
]);
|
@@ -827,7 +828,7 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
|
|
827
828
|
const data = (await response.json());
|
828
829
|
return data.customPrompts;
|
829
830
|
};
|
830
|
-
const sendEvent = (action, currency, actionData, clickData) => {
|
831
|
+
const sendEvent = (action, currency, actionData, clickData, beacon) => {
|
831
832
|
var _a;
|
832
833
|
const storageData = (_a = getProductActions(baseURL, sessionId)) !== null && _a !== void 0 ? _a : {};
|
833
834
|
const userType = getUserType(baseURL, sessionId);
|
@@ -857,6 +858,10 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
|
|
857
858
|
}
|
858
859
|
})
|
859
860
|
.catch(logger.error);
|
861
|
+
const options = { destination: baseURL };
|
862
|
+
if (beacon) {
|
863
|
+
options.method = 'beacon';
|
864
|
+
}
|
860
865
|
sendTag({
|
861
866
|
eventId: crypto.randomUUID(),
|
862
867
|
eventName: action,
|
@@ -871,6 +876,7 @@ const createShopGPTAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, st
|
|
871
876
|
providers: {
|
872
877
|
shopGPT: true,
|
873
878
|
},
|
879
|
+
options,
|
874
880
|
});
|
875
881
|
};
|
876
882
|
return {
|
@@ -1111,7 +1117,7 @@ const e$4=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"
|
|
1111
1117
|
|
1112
1118
|
const scrollBarStyles = i$4 `
|
1113
1119
|
::-webkit-scrollbar {
|
1114
|
-
width:
|
1120
|
+
width: 15px;
|
1115
1121
|
}
|
1116
1122
|
|
1117
1123
|
::-webkit-scrollbar-track {
|
@@ -1161,15 +1167,15 @@ const shopGPTStyles = i$4 `
|
|
1161
1167
|
}
|
1162
1168
|
|
1163
1169
|
#shop-gpt-modal {
|
1164
|
-
right:
|
1165
|
-
bottom:
|
1166
|
-
height:
|
1170
|
+
right: 20px;
|
1171
|
+
bottom: 91px;
|
1172
|
+
height: calc(90% - 91px);
|
1167
1173
|
width: 35%;
|
1168
1174
|
min-width: 475px;
|
1169
|
-
|
1175
|
+
box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1),
|
1176
|
+
0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
1177
|
+
border-radius: 24px;
|
1170
1178
|
overflow: hidden;
|
1171
|
-
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
1172
|
-
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
1173
1179
|
position: fixed;
|
1174
1180
|
z-index: 2000;
|
1175
1181
|
background: var(--shopgpt-white);
|
@@ -1177,10 +1183,11 @@ const shopGPTStyles = i$4 `
|
|
1177
1183
|
@media screen and (max-width: 768px) {
|
1178
1184
|
min-height: unset;
|
1179
1185
|
min-width: unset;
|
1180
|
-
width:
|
1181
|
-
height:
|
1182
|
-
bottom:
|
1183
|
-
right:
|
1186
|
+
width: 100vw;
|
1187
|
+
height: 100vh;
|
1188
|
+
bottom: 0;
|
1189
|
+
right: 0;
|
1190
|
+
border-radius: 0;
|
1184
1191
|
}
|
1185
1192
|
}
|
1186
1193
|
|
@@ -1191,17 +1198,9 @@ const shopGPTStyles = i$4 `
|
|
1191
1198
|
z-index: 1000;
|
1192
1199
|
|
1193
1200
|
button {
|
1194
|
-
|
1195
|
-
border:
|
1196
|
-
|
1197
|
-
width: 56px;
|
1198
|
-
height: 56px;
|
1199
|
-
background-color: var(--shopgpt-primary);
|
1200
|
-
border-radius: 50%;
|
1201
|
-
display: flex;
|
1202
|
-
justify-content: center;
|
1203
|
-
align-items: center;
|
1204
|
-
box-shadow: 0 0 4px 1px var(--shopgpt-white);
|
1201
|
+
background: unset;
|
1202
|
+
border: unset;
|
1203
|
+
padding: 0;
|
1205
1204
|
}
|
1206
1205
|
|
1207
1206
|
.chatbot-hover-text {
|
@@ -1219,9 +1218,7 @@ const shopGPTStyles = i$4 `
|
|
1219
1218
|
right: calc(100% + 5px);
|
1220
1219
|
|
1221
1220
|
border-radius: 5px 5px 0px;
|
1222
|
-
background:
|
1223
|
-
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
1224
|
-
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
1221
|
+
background: white;
|
1225
1222
|
|
1226
1223
|
font-weight: 400;
|
1227
1224
|
line-height: 150%;
|
@@ -1343,9 +1340,8 @@ const sendFilledIcon = b `
|
|
1343
1340
|
const trashIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
1344
1341
|
<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"/>
|
1345
1342
|
</svg>`;
|
1346
|
-
const
|
1347
|
-
|
1348
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="18" viewBox="0 0 12 18" fill="none">
|
1343
|
+
const botIcon = (width, height) => b `
|
1344
|
+
<svg xmlns="http://www.w3.org/2000/svg" width=${width || '12'} height=${height || '18'} viewBox="0 0 12 18" fill="none">
|
1349
1345
|
<g clip-path="url(#clip0_12438_1597)">
|
1350
1346
|
<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"/>
|
1351
1347
|
</g>
|
@@ -1362,10 +1358,10 @@ const cursorBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="56" height="
|
|
1362
1358
|
const closeBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="36" height="37" viewBox="0 0 36 37" fill="none">
|
1363
1359
|
<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"/>
|
1364
1360
|
</svg>`;
|
1365
|
-
const leftBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1361
|
+
const leftBtn$1 = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1366
1362
|
<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"/>
|
1367
1363
|
</svg>`;
|
1368
|
-
const rightBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
1364
|
+
const rightBtn$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="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"/>
|
1370
1366
|
</svg>`;
|
1371
1367
|
const searchIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none">
|
@@ -1398,6 +1394,46 @@ const shopGPTIcon = b `<svg xmlns="http://www.w3.org/2000/svg" width="105" heigh
|
|
1398
1394
|
<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"/>
|
1399
1395
|
<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"/>
|
1400
1396
|
</svg>`;
|
1397
|
+
const thumbsUpBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
1398
|
+
<g clip-path="url(#clip0_158_630)">
|
1399
|
+
<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"/>
|
1400
|
+
</g>
|
1401
|
+
<defs>
|
1402
|
+
<clipPath id="clip0_158_630">
|
1403
|
+
<rect width="14" height="14" fill="white"/>
|
1404
|
+
</clipPath>
|
1405
|
+
</defs>
|
1406
|
+
</svg>`;
|
1407
|
+
const thumbsUpFilledBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="#18181B" xmlns="http://www.w3.org/2000/svg">
|
1408
|
+
<g clip-path="url(#clip0_158_630_1)">
|
1409
|
+
<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"/>
|
1410
|
+
</g>
|
1411
|
+
<defs>
|
1412
|
+
<clipPath id="clip0_158_630_1">
|
1413
|
+
<rect width="14" height="14" fill="white"/>
|
1414
|
+
</clipPath>
|
1415
|
+
</defs>
|
1416
|
+
</svg>`;
|
1417
|
+
const thumbsDownBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
1418
|
+
<g clip-path="url(#clip0_158_651)">
|
1419
|
+
<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"/>
|
1420
|
+
</g>
|
1421
|
+
<defs>
|
1422
|
+
<clipPath id="clip0_158_651">
|
1423
|
+
<rect width="14" height="14" fill="white"/>
|
1424
|
+
</clipPath>
|
1425
|
+
</defs>
|
1426
|
+
</svg>`;
|
1427
|
+
const thumbsDownFilledBtn = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="#18181B" xmlns="http://www.w3.org/2000/svg">
|
1428
|
+
<g clip-path="url(#clip0_158_651_1)">
|
1429
|
+
<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"/>
|
1430
|
+
</g>
|
1431
|
+
<defs>
|
1432
|
+
<clipPath id="clip0_158_651_1">
|
1433
|
+
<rect width="14" height="14" fill="white"/>
|
1434
|
+
</clipPath>
|
1435
|
+
</defs>
|
1436
|
+
</svg>`;
|
1401
1437
|
|
1402
1438
|
const chatThreadsStyles = i$4 `
|
1403
1439
|
:host {
|
@@ -1867,7 +1903,6 @@ const productItemStyles = i$4 `
|
|
1867
1903
|
}
|
1868
1904
|
|
1869
1905
|
button {
|
1870
|
-
border-style: none;
|
1871
1906
|
cursor: pointer;
|
1872
1907
|
}
|
1873
1908
|
}
|
@@ -1877,19 +1912,28 @@ const productItemStyles = i$4 `
|
|
1877
1912
|
gap: 16px;
|
1878
1913
|
cursor: pointer;
|
1879
1914
|
text-decoration: none;
|
1880
|
-
height: 100%;
|
1881
1915
|
|
1882
1916
|
img {
|
1883
|
-
width:
|
1884
|
-
height:
|
1917
|
+
width: 160px;
|
1918
|
+
height: 160px;
|
1885
1919
|
object-position: center;
|
1886
1920
|
object-fit: contain;
|
1921
|
+
border-radius: 8px;
|
1887
1922
|
}
|
1888
1923
|
}
|
1889
1924
|
|
1925
|
+
.product.modal {
|
1926
|
+
padding: 8px;
|
1927
|
+
gap: 6px;
|
1928
|
+
border-radius: 10px;
|
1929
|
+
background-color: #fff;
|
1930
|
+
box-sizing: border-box;
|
1931
|
+
border: 0.5px solid #cbd5e1;
|
1932
|
+
}
|
1933
|
+
|
1890
1934
|
.content {
|
1891
1935
|
display: flex;
|
1892
|
-
gap:
|
1936
|
+
gap: 10px;
|
1893
1937
|
flex-direction: column;
|
1894
1938
|
|
1895
1939
|
*:last-child {
|
@@ -1899,29 +1943,42 @@ const productItemStyles = i$4 `
|
|
1899
1943
|
|
1900
1944
|
.product-name {
|
1901
1945
|
display: -webkit-box;
|
1902
|
-
color: #
|
1903
|
-
line-height: 150%;
|
1946
|
+
color: #1e293b;
|
1904
1947
|
max-width: 100%;
|
1905
|
-
-webkit-line-clamp:
|
1948
|
+
-webkit-line-clamp: 1;
|
1906
1949
|
-webkit-box-orient: vertical;
|
1907
1950
|
overflow: hidden;
|
1908
1951
|
text-overflow: ellipsis;
|
1909
1952
|
word-break: break-word;
|
1910
1953
|
white-space: normal;
|
1954
|
+
|
1955
|
+
opacity: 0.7;
|
1956
|
+
font-weight: 400;
|
1957
|
+
font-size: 12px;
|
1958
|
+
line-height: 16px;
|
1911
1959
|
}
|
1912
1960
|
|
1913
1961
|
.product-variation-details {
|
1914
|
-
color: #
|
1915
|
-
font-weight:
|
1916
|
-
|
1962
|
+
color: #000000;
|
1963
|
+
font-weight: 600;
|
1964
|
+
font-size: 12px;
|
1965
|
+
line-height: 22px;
|
1966
|
+
display: -webkit-box;
|
1967
|
+
-webkit-line-clamp: 1;
|
1968
|
+
-webkit-box-orient: vertical;
|
1969
|
+
overflow: hidden;
|
1970
|
+
text-overflow: ellipsis;
|
1971
|
+
word-break: break-word;
|
1972
|
+
white-space: normal;
|
1917
1973
|
}
|
1918
1974
|
|
1919
1975
|
.prices {
|
1920
1976
|
display: flex;
|
1921
1977
|
gap: 0 8px;
|
1922
|
-
font-weight:
|
1923
|
-
|
1924
|
-
|
1978
|
+
font-weight: 600;
|
1979
|
+
font-size: 12px;
|
1980
|
+
line-height: 16px;
|
1981
|
+
color: #020617;
|
1925
1982
|
|
1926
1983
|
.price-compared {
|
1927
1984
|
color: #a1a1aa;
|
@@ -1929,26 +1986,44 @@ const productItemStyles = i$4 `
|
|
1929
1986
|
}
|
1930
1987
|
}
|
1931
1988
|
|
1932
|
-
.
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1989
|
+
.product-description {
|
1990
|
+
display: -webkit-box;
|
1991
|
+
-webkit-box-orient: vertical;
|
1992
|
+
-webkit-line-clamp: 2;
|
1993
|
+
overflow: hidden;
|
1994
|
+
text-overflow: ellipsis;
|
1995
|
+
word-break: break-word;
|
1996
|
+
white-space: normal;
|
1997
|
+
max-height: 48px;
|
1998
|
+
margin: 4px 0 6px;
|
1939
1999
|
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
2000
|
+
font-weight: 400;
|
2001
|
+
line-height: 16px;
|
2002
|
+
font-size: 12px;
|
2003
|
+
color: #475569;
|
2004
|
+
}
|
2005
|
+
|
2006
|
+
.btn-quick-view {
|
2007
|
+
color: #fafafa;
|
2008
|
+
font-weight: 500;
|
2009
|
+
font-size: 12px;
|
2010
|
+
text-transform: uppercase;
|
2011
|
+
max-width: 160px;
|
2012
|
+
padding: 8px 12px;
|
2013
|
+
text-align: center;
|
2014
|
+
background: #18181b;
|
2015
|
+
border-radius: 6px;
|
2016
|
+
display: flex;
|
2017
|
+
align-items: center;
|
2018
|
+
gap: 8px;
|
1944
2019
|
|
1945
2020
|
&:hover {
|
1946
|
-
|
2021
|
+
opacity: 0.7;
|
1947
2022
|
}
|
1948
2023
|
}
|
1949
2024
|
|
1950
|
-
@container productContainer (max-width:
|
1951
|
-
.btn-view
|
2025
|
+
@container productContainer (max-width: 216px) {
|
2026
|
+
.btn-quick-view {
|
1952
2027
|
display: none;
|
1953
2028
|
}
|
1954
2029
|
|
@@ -1961,18 +2036,33 @@ const productItemStyles = i$4 `
|
|
1961
2036
|
gap: 0;
|
1962
2037
|
}
|
1963
2038
|
|
1964
|
-
.product-
|
1965
|
-
max-width: 150px;
|
2039
|
+
.product-variation-details {
|
1966
2040
|
font-size: 14px;
|
1967
2041
|
}
|
1968
2042
|
|
1969
|
-
.product
|
1970
|
-
|
2043
|
+
.product.modal {
|
2044
|
+
height: 100%;
|
2045
|
+
|
2046
|
+
.btn-quick-view {
|
2047
|
+
display: flex;
|
2048
|
+
text-transform: capitalize;
|
2049
|
+
max-width: 123px;
|
2050
|
+
}
|
2051
|
+
|
2052
|
+
.content {
|
2053
|
+
gap: 0px;
|
2054
|
+
}
|
2055
|
+
|
2056
|
+
.product-name,
|
2057
|
+
.product-variation-details {
|
2058
|
+
font-size: 12px;
|
2059
|
+
max-width: 160px;
|
2060
|
+
}
|
1971
2061
|
}
|
1972
2062
|
}
|
1973
2063
|
|
1974
2064
|
@container productContainer (max-height: 124px) {
|
1975
|
-
.btn-view
|
2065
|
+
.btn-quick-view {
|
1976
2066
|
display: none;
|
1977
2067
|
}
|
1978
2068
|
|
@@ -1997,9 +2087,54 @@ const productItemStyles = i$4 `
|
|
1997
2087
|
.product-variation-details {
|
1998
2088
|
color: #172a41;
|
1999
2089
|
}
|
2090
|
+
|
2091
|
+
.product-description {
|
2092
|
+
display: none;
|
2093
|
+
}
|
2000
2094
|
}
|
2001
2095
|
`;
|
2002
2096
|
|
2097
|
+
const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2098
|
+
<path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
|
2099
|
+
</svg>`;
|
2100
|
+
const historyBtn = b `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2101
|
+
<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"/>
|
2102
|
+
</svg>`;
|
2103
|
+
const crossBtn = b `<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2104
|
+
<path d="M22.5 7.5L7.5 22.5M7.5 7.5L22.5 22.5" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
2105
|
+
</svg>`;
|
2106
|
+
const sendBtn = b `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2107
|
+
<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"/>
|
2108
|
+
</svg>`;
|
2109
|
+
const sparklesSharp = b `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2110
|
+
<g clip-path="url(#clip0_172_31)">
|
2111
|
+
<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"/>
|
2112
|
+
<path d="M13.3333 2.00002V4.66669V2.00002Z" fill="#CBD5E1"/>
|
2113
|
+
<path d="M14.6666 3.33335H11.9999H14.6666Z" fill="#CBD5E1"/>
|
2114
|
+
<path d="M2.66659 11.3334V12.6667V11.3334Z" fill="#CBD5E1"/>
|
2115
|
+
<path d="M3.33325 12H1.99992H3.33325Z" fill="#CBD5E1"/>
|
2116
|
+
<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"/>
|
2117
|
+
</g>
|
2118
|
+
<defs>
|
2119
|
+
<clipPath id="clip0_172_31">
|
2120
|
+
<rect width="16" height="16" fill="white"/>
|
2121
|
+
</clipPath>
|
2122
|
+
</defs>
|
2123
|
+
</svg>
|
2124
|
+
|
2125
|
+
`;
|
2126
|
+
const leftBtn = b `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2127
|
+
<path d="M12 19L5 12M5 12L12 5M5 12H19" stroke="#18181B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
2128
|
+
</svg>
|
2129
|
+
`;
|
2130
|
+
const rightBtn = b `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2131
|
+
<path d="M5 12H19M19 12L12 5M19 12L12 19" stroke="#18181B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
2132
|
+
</svg>
|
2133
|
+
`;
|
2134
|
+
const chevronRight = b `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2135
|
+
<path d="M5.25 10.5L8.75 7L5.25 3.5" stroke="white" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
|
2136
|
+
</svg>`;
|
2137
|
+
|
2003
2138
|
class ProductItem extends i$1 {
|
2004
2139
|
getLocalPrice(price) {
|
2005
2140
|
if (!this.siteCurrency) {
|
@@ -2033,7 +2168,12 @@ class ProductItem extends i$1 {
|
|
2033
2168
|
return E;
|
2034
2169
|
}
|
2035
2170
|
return this.product.variants[0].selectedOptions.map((option) => x `
|
2036
|
-
<p
|
2171
|
+
<p
|
2172
|
+
class="product-variation-details"
|
2173
|
+
title=${`${option.name}: ${option.value}`}
|
2174
|
+
>
|
2175
|
+
${option.name}: ${option.value}
|
2176
|
+
</p>
|
2037
2177
|
`);
|
2038
2178
|
}
|
2039
2179
|
productClicked(product) {
|
@@ -2058,21 +2198,28 @@ class ProductItem extends i$1 {
|
|
2058
2198
|
render() {
|
2059
2199
|
return x `
|
2060
2200
|
<a
|
2061
|
-
class
|
2201
|
+
class=${e$1({ product: true, modal: this.viewType === 'modal' })}
|
2062
2202
|
href=${this.getProductUrl(this.product.url)}
|
2063
2203
|
@click=${() => this.productClicked(this.product)}
|
2064
2204
|
>
|
2065
2205
|
<img src=${this.product.image.url} alt=${this.product.image.alt} />
|
2066
2206
|
<div class="content">
|
2067
|
-
<
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2207
|
+
<div>
|
2208
|
+
<p class="product-name" title=${this.product.title}>
|
2209
|
+
${this.product.title}
|
2210
|
+
</p>
|
2211
|
+
${this.renderVariantTitles()}
|
2212
|
+
</div>
|
2071
2213
|
<div class="prices">
|
2214
|
+
<p>From</p>
|
2072
2215
|
${this.getComparedAtPrice(this.product.variants[0].comparedAtPrice, this.product.variants[0].price)}
|
2073
2216
|
<p>${this.getLocalPrice(this.product.variants[0].price)}</p>
|
2074
2217
|
</div>
|
2075
|
-
<
|
2218
|
+
<div class="product-description">${this.product.description}</div>
|
2219
|
+
<button class="btn-quick-view">
|
2220
|
+
<span> View Product </span>
|
2221
|
+
${chevronRight}
|
2222
|
+
</button>
|
2076
2223
|
</div>
|
2077
2224
|
</a>
|
2078
2225
|
`;
|
@@ -2103,6 +2250,10 @@ __decorate([
|
|
2103
2250
|
n({ type: String }),
|
2104
2251
|
__metadata("design:type", String)
|
2105
2252
|
], ProductItem.prototype, "userId", void 0);
|
2253
|
+
__decorate([
|
2254
|
+
n({ type: String }),
|
2255
|
+
__metadata("design:type", String)
|
2256
|
+
], ProductItem.prototype, "viewType", void 0);
|
2106
2257
|
if (!customElements.get('product-item')) {
|
2107
2258
|
customElements.define('product-item', ProductItem);
|
2108
2259
|
}
|
@@ -2113,28 +2264,17 @@ const productsListStyles = i$4 `
|
|
2113
2264
|
}
|
2114
2265
|
|
2115
2266
|
.product-container {
|
2116
|
-
flex: 0 0
|
2267
|
+
flex: 0 0 176px;
|
2117
2268
|
container-type: inline-size;
|
2118
2269
|
container-name: productContainer;
|
2119
2270
|
}
|
2120
2271
|
|
2121
|
-
.product-container.modal {
|
2122
|
-
padding: 8px;
|
2123
|
-
margin-bottom: 4px;
|
2124
|
-
border-radius: 10px;
|
2125
|
-
background: #fff;
|
2126
|
-
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
2127
|
-
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
2128
|
-
}
|
2129
|
-
|
2130
2272
|
.products {
|
2131
2273
|
flex: 1;
|
2132
2274
|
display: flex;
|
2133
|
-
gap:
|
2275
|
+
gap: 12px;
|
2134
2276
|
overflow-x: auto;
|
2135
2277
|
scrollbar-width: none;
|
2136
|
-
margin-left: -10px;
|
2137
|
-
padding-left: 10px;
|
2138
2278
|
}
|
2139
2279
|
|
2140
2280
|
.scroll-btns {
|
@@ -2160,12 +2300,31 @@ const productsListStyles = i$4 `
|
|
2160
2300
|
|
2161
2301
|
.disabled {
|
2162
2302
|
opacity: 0.5;
|
2303
|
+
cursor: not-allowed;
|
2304
|
+
}
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
.scroll-btns.modal {
|
2308
|
+
flex-direction: row;
|
2309
|
+
align-items: center;
|
2310
|
+
position: absolute;
|
2311
|
+
bottom: -33px;
|
2312
|
+
right: 0;
|
2313
|
+
height: unset;
|
2314
|
+
gap: 10px;
|
2315
|
+
|
2316
|
+
div {
|
2317
|
+
padding: 5px;
|
2318
|
+
background: #f8fafc;
|
2319
|
+
border: unset;
|
2320
|
+
border-radius: 12.5px;
|
2163
2321
|
}
|
2164
2322
|
}
|
2165
2323
|
|
2166
2324
|
.products-wrapper {
|
2167
2325
|
display: flex;
|
2168
2326
|
gap: 24px;
|
2327
|
+
position: relative;
|
2169
2328
|
}
|
2170
2329
|
`;
|
2171
2330
|
|
@@ -2190,18 +2349,12 @@ class ProductsList extends i$1 {
|
|
2190
2349
|
}
|
2191
2350
|
connectedCallback() {
|
2192
2351
|
super.connectedCallback();
|
2193
|
-
this.updateButtonsState();
|
2194
|
-
window.addEventListener('resize', this.updateButtonsState);
|
2352
|
+
this.resizeObserver = new ResizeObserver(() => this.updateButtonsState());
|
2195
2353
|
}
|
2196
2354
|
disconnectedCallback() {
|
2197
|
-
|
2355
|
+
this.resizeObserver.disconnect();
|
2198
2356
|
super.disconnectedCallback();
|
2199
2357
|
}
|
2200
|
-
updated(_changedProperties) {
|
2201
|
-
if (_changedProperties.has('products')) {
|
2202
|
-
this.updateButtonsState();
|
2203
|
-
}
|
2204
|
-
}
|
2205
2358
|
scrollToLeft(e) {
|
2206
2359
|
var _a;
|
2207
2360
|
e.preventDefault();
|
@@ -2212,20 +2365,27 @@ class ProductsList extends i$1 {
|
|
2212
2365
|
e.preventDefault();
|
2213
2366
|
(_a = this.productsEle) === null || _a === void 0 ? void 0 : _a.scrollBy({ left: 186, behavior: 'smooth' });
|
2214
2367
|
}
|
2368
|
+
firstUpdated(changedProperties) {
|
2369
|
+
super.firstUpdated(changedProperties);
|
2370
|
+
if (!this.productsEle) {
|
2371
|
+
return;
|
2372
|
+
}
|
2373
|
+
this.resizeObserver.observe(this.productsEle);
|
2374
|
+
Array.from(this.productsEle.children).forEach((child) => {
|
2375
|
+
this.resizeObserver.observe(child);
|
2376
|
+
});
|
2377
|
+
this.updateButtonsState();
|
2378
|
+
}
|
2215
2379
|
render() {
|
2216
2380
|
if (!this.products.length) {
|
2217
2381
|
return E;
|
2218
2382
|
}
|
2383
|
+
const isPopupView = this.viewType === 'modal';
|
2219
2384
|
return x `
|
2220
2385
|
<div class="products-wrapper">
|
2221
2386
|
<div class="products" @scroll=${this.updateButtonsState}>
|
2222
2387
|
${o$1(this.products, (product, index) => x `
|
2223
|
-
<div
|
2224
|
-
class=${e$1({
|
2225
|
-
'product-container': true,
|
2226
|
-
modal: this.viewType === 'modal',
|
2227
|
-
})}
|
2228
|
-
>
|
2388
|
+
<div class=${'product-container'}>
|
2229
2389
|
<product-item
|
2230
2390
|
.query=${this.query}
|
2231
2391
|
.response=${this.response}
|
@@ -2233,17 +2393,24 @@ class ProductsList extends i$1 {
|
|
2233
2393
|
.siteCurrency=${this.siteCurrency}
|
2234
2394
|
.rank=${index + 1}
|
2235
2395
|
.userId=${this.userId}
|
2396
|
+
.viewType=${this.viewType}
|
2236
2397
|
></product-item>
|
2237
2398
|
</div>
|
2238
2399
|
`)}
|
2239
2400
|
</div>
|
2240
2401
|
${this.showButtons
|
2241
|
-
? x
|
2402
|
+
? x `<div
|
2403
|
+
class="scroll-btns"
|
2404
|
+
class=${e$1({
|
2405
|
+
'scroll-btns': true,
|
2406
|
+
modal: isPopupView,
|
2407
|
+
})}
|
2408
|
+
>
|
2242
2409
|
<div class="left-btn disabled" @click=${this.scrollToLeft}>
|
2243
|
-
${leftBtn}
|
2410
|
+
${isPopupView ? leftBtn : leftBtn$1}
|
2244
2411
|
</div>
|
2245
2412
|
<div class="right-btn" @click=${this.scrollToRight}>
|
2246
|
-
${rightBtn}
|
2413
|
+
${isPopupView ? rightBtn : rightBtn$1}
|
2247
2414
|
</div>
|
2248
2415
|
</div>`
|
2249
2416
|
: E}
|
@@ -2286,7 +2453,7 @@ __decorate([
|
|
2286
2453
|
], ProductsList.prototype, "rightBtnEle", void 0);
|
2287
2454
|
__decorate([
|
2288
2455
|
e$3('.products'),
|
2289
|
-
__metadata("design:type",
|
2456
|
+
__metadata("design:type", HTMLDivElement)
|
2290
2457
|
], ProductsList.prototype, "productsEle", void 0);
|
2291
2458
|
if (!customElements.get('products-list')) {
|
2292
2459
|
customElements.define('products-list', ProductsList);
|
@@ -2407,7 +2574,7 @@ if (!customElements.get('products-section')) {
|
|
2407
2574
|
customElements.define('products-section', ProductsSection);
|
2408
2575
|
}
|
2409
2576
|
|
2410
|
-
const chatSectionStyles = i$4 `
|
2577
|
+
const chatSectionStyles$1 = i$4 `
|
2411
2578
|
:host {
|
2412
2579
|
font-family: 'Inter', sans-serif;
|
2413
2580
|
font-size: 16px;
|
@@ -2484,33 +2651,6 @@ const chatSectionStyles = i$4 `
|
|
2484
2651
|
align-items: center;
|
2485
2652
|
justify-content: center;
|
2486
2653
|
}
|
2487
|
-
|
2488
|
-
.threads-btn.active {
|
2489
|
-
background: #2b65cf;
|
2490
|
-
opacity: 1;
|
2491
|
-
}
|
2492
|
-
|
2493
|
-
.close-btn:hover {
|
2494
|
-
background: #dc3545;
|
2495
|
-
}
|
2496
|
-
|
2497
|
-
.threads-btn:hover,
|
2498
|
-
.new-search-btn:hover {
|
2499
|
-
background: #2b65cf;
|
2500
|
-
opacity: 0.8;
|
2501
|
-
}
|
2502
|
-
|
2503
|
-
.threads-btn:active,
|
2504
|
-
.new-search-btn:active {
|
2505
|
-
background: #2b65cf;
|
2506
|
-
opacity: 1;
|
2507
|
-
}
|
2508
|
-
|
2509
|
-
.new-search-btn:disabled {
|
2510
|
-
background: #808080;
|
2511
|
-
cursor: not-allowed;
|
2512
|
-
opacity: 0.5;
|
2513
|
-
}
|
2514
2654
|
}
|
2515
2655
|
}
|
2516
2656
|
|
@@ -2524,12 +2664,6 @@ const chatSectionStyles = i$4 `
|
|
2524
2664
|
gap: 25px;
|
2525
2665
|
}
|
2526
2666
|
|
2527
|
-
.chatbot-section.modal-view {
|
2528
|
-
height: calc(100% - 93px);
|
2529
|
-
padding: 0px 16px 16px;
|
2530
|
-
gap: 16px;
|
2531
|
-
}
|
2532
|
-
|
2533
2667
|
.chat-form {
|
2534
2668
|
display: flex;
|
2535
2669
|
align-items: center;
|
@@ -2578,10 +2712,6 @@ const chatSectionStyles = i$4 `
|
|
2578
2712
|
cursor: unset;
|
2579
2713
|
}
|
2580
2714
|
}
|
2581
|
-
|
2582
|
-
button.modal {
|
2583
|
-
right: 26px;
|
2584
|
-
}
|
2585
2715
|
}
|
2586
2716
|
|
2587
2717
|
.messages {
|
@@ -2761,46 +2891,6 @@ const chatSectionStyles = i$4 `
|
|
2761
2891
|
gap: 24px;
|
2762
2892
|
}
|
2763
2893
|
|
2764
|
-
.typing-dots {
|
2765
|
-
display: flex;
|
2766
|
-
align-items: center;
|
2767
|
-
justify-content: center;
|
2768
|
-
gap: 8px;
|
2769
|
-
}
|
2770
|
-
|
2771
|
-
.dot {
|
2772
|
-
width: 6px;
|
2773
|
-
height: 6px;
|
2774
|
-
background-color: #b6b6b6;
|
2775
|
-
border-radius: 50%;
|
2776
|
-
animation: bounce 1.2s infinite ease-in-out;
|
2777
|
-
}
|
2778
|
-
|
2779
|
-
.dot:nth-child(1) {
|
2780
|
-
animation-delay: 0s;
|
2781
|
-
}
|
2782
|
-
|
2783
|
-
.dot:nth-child(2) {
|
2784
|
-
animation-delay: 0.2s;
|
2785
|
-
}
|
2786
|
-
|
2787
|
-
.dot:nth-child(3) {
|
2788
|
-
animation-delay: 0.4s;
|
2789
|
-
}
|
2790
|
-
|
2791
|
-
@keyframes bounce {
|
2792
|
-
0%,
|
2793
|
-
80%,
|
2794
|
-
100% {
|
2795
|
-
transform: translateY(0);
|
2796
|
-
background-color: #b6b6b6;
|
2797
|
-
}
|
2798
|
-
40% {
|
2799
|
-
transform: translateY(-4px);
|
2800
|
-
background-color: #8b8b8b;
|
2801
|
-
}
|
2802
|
-
}
|
2803
|
-
|
2804
2894
|
.prompts {
|
2805
2895
|
display: flex;
|
2806
2896
|
justify-content: center;
|
@@ -2828,170 +2918,45 @@ const chatSectionStyles = i$4 `
|
|
2828
2918
|
}
|
2829
2919
|
}
|
2830
2920
|
|
2831
|
-
|
2832
|
-
|
2833
|
-
position: absolute;
|
2834
|
-
overflow: hidden;
|
2835
|
-
z-index: 1;
|
2836
|
-
top: 78px;
|
2837
|
-
height: 30%;
|
2838
|
-
width: 100%;
|
2839
|
-
background: #fff;
|
2840
|
-
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
2841
|
-
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
2842
|
-
border-radius: 0px 0px 10px 10px;
|
2921
|
+
${scrollBarStyles}
|
2922
|
+
`;
|
2843
2923
|
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2924
|
+
const capitalizeEachWord = (str) => {
|
2925
|
+
return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
|
2926
|
+
};
|
2927
|
+
const adParams = new Set([
|
2928
|
+
'fbclid',
|
2929
|
+
'gclid',
|
2930
|
+
'sccid',
|
2931
|
+
'ttclid',
|
2932
|
+
'epik',
|
2933
|
+
'li_fat_id',
|
2934
|
+
'twclid',
|
2935
|
+
'rdt_cid',
|
2936
|
+
'aleid',
|
2937
|
+
'tabclid',
|
2938
|
+
'msclkid',
|
2939
|
+
'dclid',
|
2940
|
+
'wbraid',
|
2941
|
+
]);
|
2942
|
+
const isFromAd = (params) => [...params.keys()].some((key) => adParams.has(key.toLowerCase()));
|
2850
2943
|
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2856
|
-
}
|
2857
|
-
}
|
2944
|
+
const personalizeDialogStyles = i$4 `
|
2945
|
+
:host {
|
2946
|
+
font-family: 'Inter', sans-serif;
|
2947
|
+
font-size: 16px;
|
2948
|
+
font-weight: 400;
|
2858
2949
|
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
2862
|
-
|
2950
|
+
h2,
|
2951
|
+
p {
|
2952
|
+
margin: 0;
|
2953
|
+
}
|
2863
2954
|
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
cursor: pointer;
|
2870
|
-
|
2871
|
-
p {
|
2872
|
-
font-size: 14px;
|
2873
|
-
font-weight: 400;
|
2874
|
-
line-height: 20px;
|
2875
|
-
}
|
2876
|
-
|
2877
|
-
.trash-icon {
|
2878
|
-
display: none;
|
2879
|
-
}
|
2880
|
-
|
2881
|
-
&:hover {
|
2882
|
-
background: #f1f4f8;
|
2883
|
-
|
2884
|
-
.trash-icon {
|
2885
|
-
display: flex;
|
2886
|
-
}
|
2887
|
-
}
|
2888
|
-
}
|
2889
|
-
|
2890
|
-
.thread-title.disabled {
|
2891
|
-
cursor: not-allowed;
|
2892
|
-
}
|
2893
|
-
}
|
2894
|
-
|
2895
|
-
.trash-icon {
|
2896
|
-
display: flex;
|
2897
|
-
justify-content: center;
|
2898
|
-
align-items: center;
|
2899
|
-
padding: 2px;
|
2900
|
-
cursor: pointer;
|
2901
|
-
|
2902
|
-
&:hover {
|
2903
|
-
border-radius: 5px;
|
2904
|
-
background: #dc3545;
|
2905
|
-
|
2906
|
-
path {
|
2907
|
-
fill: white;
|
2908
|
-
}
|
2909
|
-
}
|
2910
|
-
}
|
2911
|
-
|
2912
|
-
.chat-threads-background {
|
2913
|
-
position: absolute;
|
2914
|
-
top: 78px;
|
2915
|
-
height: 100%;
|
2916
|
-
width: 100%;
|
2917
|
-
opacity: 0.5;
|
2918
|
-
background: #000;
|
2919
|
-
z-index: 0;
|
2920
|
-
}
|
2921
|
-
}
|
2922
|
-
|
2923
|
-
footer {
|
2924
|
-
text-align: center;
|
2925
|
-
font-size: 10px;
|
2926
|
-
color: #4e647f;
|
2927
|
-
font-weight: 500;
|
2928
|
-
|
2929
|
-
a {
|
2930
|
-
text-decoration: none;
|
2931
|
-
}
|
2932
|
-
}
|
2933
|
-
|
2934
|
-
${scrollBarStyles}
|
2935
|
-
`;
|
2936
|
-
|
2937
|
-
const capitalizeEachWord = (str) => {
|
2938
|
-
return str === null || str === void 0 ? void 0 : str.replace(/^\w/, (char) => char.toUpperCase());
|
2939
|
-
};
|
2940
|
-
const adParams = new Set([
|
2941
|
-
'fbclid',
|
2942
|
-
'gclid',
|
2943
|
-
'sccid',
|
2944
|
-
'ttclid',
|
2945
|
-
'epik',
|
2946
|
-
'li_fat_id',
|
2947
|
-
'twclid',
|
2948
|
-
'rdt_cid',
|
2949
|
-
'aleid',
|
2950
|
-
'tabclid',
|
2951
|
-
'msclkid',
|
2952
|
-
'dclid',
|
2953
|
-
'wbraid',
|
2954
|
-
]);
|
2955
|
-
const isFromAd = (params) => [...params.keys()].some((key) => adParams.has(key.toLowerCase()));
|
2956
|
-
|
2957
|
-
const plusBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2958
|
-
<path d="M12.75 11.25V6H11.25V11.25H6V12.75H11.25V18H12.75V12.75H18V11.25H12.75Z" fill="white"/>
|
2959
|
-
</svg>`;
|
2960
|
-
const timerBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2961
|
-
<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"/>
|
2962
|
-
</svg>`;
|
2963
|
-
const crossBtn = b `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
2964
|
-
<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"/>
|
2965
|
-
</svg>`;
|
2966
|
-
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">
|
2967
|
-
<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>
|
2968
|
-
</svg>`;
|
2969
|
-
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">
|
2970
|
-
<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>
|
2971
|
-
</svg>`;
|
2972
|
-
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">
|
2973
|
-
<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>
|
2974
|
-
</svg>`;
|
2975
|
-
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">
|
2976
|
-
<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>
|
2977
|
-
</svg>`;
|
2978
|
-
|
2979
|
-
const personalizeDialogStyles = i$4 `
|
2980
|
-
:host {
|
2981
|
-
font-family: 'Inter', sans-serif;
|
2982
|
-
font-size: 16px;
|
2983
|
-
font-weight: 400;
|
2984
|
-
|
2985
|
-
h2,
|
2986
|
-
p {
|
2987
|
-
margin: 0;
|
2988
|
-
}
|
2989
|
-
|
2990
|
-
button {
|
2991
|
-
border-style: none;
|
2992
|
-
cursor: pointer;
|
2993
|
-
}
|
2994
|
-
}
|
2955
|
+
button {
|
2956
|
+
border-style: none;
|
2957
|
+
cursor: pointer;
|
2958
|
+
}
|
2959
|
+
}
|
2995
2960
|
|
2996
2961
|
dialog::backdrop {
|
2997
2962
|
background: rgba(0, 0, 0, 0.5);
|
@@ -3627,7 +3592,7 @@ class MarkdownRenderer extends i$1 {
|
|
3627
3592
|
MarkdownRenderer.styles = i$4 `
|
3628
3593
|
:host {
|
3629
3594
|
font-family: 'Inter', sans-serif;
|
3630
|
-
font-size:
|
3595
|
+
font-size: 14px;
|
3631
3596
|
font-weight: 400;
|
3632
3597
|
|
3633
3598
|
p {
|
@@ -3643,131 +3608,11 @@ if (!customElements.get('markdown-renderer')) {
|
|
3643
3608
|
customElements.define('markdown-renderer', MarkdownRenderer);
|
3644
3609
|
}
|
3645
3610
|
|
3646
|
-
|
3647
|
-
constructor() {
|
3648
|
-
super(...arguments);
|
3649
|
-
this.position = 'bottom-left';
|
3650
|
-
this.text = '';
|
3651
|
-
}
|
3652
|
-
render() {
|
3653
|
-
return x `
|
3654
|
-
<slot></slot>
|
3655
|
-
<div class="tooltip ${this.position}">${this.text}</div>
|
3656
|
-
`;
|
3657
|
-
}
|
3658
|
-
}
|
3659
|
-
TooltipComponent.styles = [
|
3660
|
-
i$4 `
|
3661
|
-
:host {
|
3662
|
-
position: relative;
|
3663
|
-
display: inline-block;
|
3664
|
-
}
|
3665
|
-
|
3666
|
-
.tooltip {
|
3667
|
-
position: absolute;
|
3668
|
-
color: #172a41;
|
3669
|
-
padding: 4px 8px;
|
3670
|
-
white-space: nowrap;
|
3671
|
-
font-size: 12px;
|
3672
|
-
opacity: 0;
|
3673
|
-
transition: opacity 0.2s;
|
3674
|
-
pointer-events: none;
|
3675
|
-
|
3676
|
-
border-radius: 5px;
|
3677
|
-
background: #ffcc81;
|
3678
|
-
box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1),
|
3679
|
-
0px 2px 4px -1px rgba(0, 0, 0, 0.06);
|
3680
|
-
|
3681
|
-
font-style: normal;
|
3682
|
-
font-weight: 400;
|
3683
|
-
line-height: 150%;
|
3684
|
-
}
|
3685
|
-
|
3686
|
-
:host(:hover) .tooltip {
|
3687
|
-
opacity: 1;
|
3688
|
-
}
|
3689
|
-
|
3690
|
-
.top-center {
|
3691
|
-
bottom: calc(100% + 2px);
|
3692
|
-
left: 50%;
|
3693
|
-
transform: translateX(-50%);
|
3694
|
-
}
|
3695
|
-
|
3696
|
-
.top-left {
|
3697
|
-
bottom: calc(100% + 2px);
|
3698
|
-
left: 0;
|
3699
|
-
}
|
3700
|
-
|
3701
|
-
.top-right {
|
3702
|
-
bottom: calc(100% + 2px);
|
3703
|
-
right: 0;
|
3704
|
-
}
|
3705
|
-
|
3706
|
-
.bottom-center {
|
3707
|
-
top: calc(100% + 2px);
|
3708
|
-
left: 50%;
|
3709
|
-
transform: translateX(-50%);
|
3710
|
-
}
|
3711
|
-
|
3712
|
-
.bottom-left {
|
3713
|
-
top: calc(100% + 2px);
|
3714
|
-
left: 0;
|
3715
|
-
}
|
3716
|
-
|
3717
|
-
.bottom-right {
|
3718
|
-
top: calc(100% + 2px);
|
3719
|
-
right: 0;
|
3720
|
-
}
|
3721
|
-
|
3722
|
-
.left-center {
|
3723
|
-
right: calc(100% + 2px);
|
3724
|
-
top: 50%;
|
3725
|
-
transform: translateY(-50%);
|
3726
|
-
}
|
3727
|
-
|
3728
|
-
.left-top {
|
3729
|
-
right: calc(100% + 2px);
|
3730
|
-
top: 0;
|
3731
|
-
}
|
3732
|
-
|
3733
|
-
.left-bottom {
|
3734
|
-
right: calc(100% + 2px);
|
3735
|
-
bottom: 0;
|
3736
|
-
}
|
3737
|
-
|
3738
|
-
.right-center {
|
3739
|
-
left: calc(100% + 2px);
|
3740
|
-
top: 50%;
|
3741
|
-
transform: translateY(-50%);
|
3742
|
-
}
|
3743
|
-
|
3744
|
-
.right-top {
|
3745
|
-
left: calc(100% + 2px);
|
3746
|
-
top: 0;
|
3747
|
-
}
|
3748
|
-
|
3749
|
-
.right-bottom {
|
3750
|
-
left: calc(100% + 2px);
|
3751
|
-
bottom: 0;
|
3752
|
-
}
|
3753
|
-
`,
|
3754
|
-
];
|
3755
|
-
__decorate([
|
3756
|
-
n({ type: String }),
|
3757
|
-
__metadata("design:type", String)
|
3758
|
-
], TooltipComponent.prototype, "position", void 0);
|
3759
|
-
__decorate([
|
3760
|
-
n({ type: String }),
|
3761
|
-
__metadata("design:type", Object)
|
3762
|
-
], TooltipComponent.prototype, "text", void 0);
|
3763
|
-
if (!customElements.get('tooltip-component')) {
|
3764
|
-
customElements.define('tooltip-component', TooltipComponent);
|
3765
|
-
}
|
3766
|
-
|
3767
|
-
const confirmDialogStyles = i$4 `
|
3611
|
+
const feedbackDialogStyles = i$4 `
|
3768
3612
|
:host {
|
3769
3613
|
font-family: 'Inter', sans-serif;
|
3770
3614
|
font-size: 16px;
|
3615
|
+
line-height: 24px;
|
3771
3616
|
font-weight: 400;
|
3772
3617
|
|
3773
3618
|
display: flex;
|
@@ -3781,141 +3626,22 @@ const confirmDialogStyles = i$4 `
|
|
3781
3626
|
|
3782
3627
|
.modal {
|
3783
3628
|
width: 75%;
|
3784
|
-
max-width:
|
3629
|
+
max-width: 400px;
|
3785
3630
|
background: #fff;
|
3786
|
-
padding:
|
3631
|
+
padding: 24px;
|
3787
3632
|
margin: auto;
|
3788
3633
|
|
3789
|
-
border-radius:
|
3790
|
-
box-shadow:
|
3791
|
-
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
3634
|
+
border-radius: 8px;
|
3635
|
+
box-shadow: rgba(47, 43, 61, 0.28) 0px 8px 23px 0px;
|
3792
3636
|
|
3793
3637
|
z-index: 2000;
|
3794
3638
|
}
|
3795
3639
|
|
3796
|
-
|
3797
|
-
|
3798
|
-
|
3799
|
-
|
3800
|
-
|
3801
|
-
line-height: 150%;
|
3802
|
-
}
|
3803
|
-
|
3804
|
-
::slotted([slot='content']) {
|
3805
|
-
color: #4e647f;
|
3806
|
-
line-height: 150%;
|
3807
|
-
}
|
3808
|
-
|
3809
|
-
.button-wrapper {
|
3810
|
-
margin-top: 12px;
|
3811
|
-
display: flex;
|
3812
|
-
gap: 12px;
|
3813
|
-
|
3814
|
-
.btn {
|
3815
|
-
justify-self: stretch;
|
3816
|
-
padding: 10px;
|
3817
|
-
cursor: pointer;
|
3818
|
-
text-align: center;
|
3819
|
-
width: 100%;
|
3820
|
-
border: 0;
|
3821
|
-
color: #fff;
|
3822
|
-
line-height: 150%;
|
3823
|
-
text-transform: capitalize;
|
3824
|
-
}
|
3825
|
-
|
3826
|
-
.accept-btn {
|
3827
|
-
border-radius: 5px;
|
3828
|
-
background: #dc3545;
|
3829
|
-
|
3830
|
-
&:hover {
|
3831
|
-
background: rgb(176, 62, 25);
|
3832
|
-
}
|
3833
|
-
}
|
3834
|
-
|
3835
|
-
.decline-btn {
|
3836
|
-
border-radius: 5px;
|
3837
|
-
background: #4e647f;
|
3838
|
-
|
3839
|
-
&:hover {
|
3840
|
-
background: rgb(57, 77, 102);
|
3841
|
-
}
|
3842
|
-
}
|
3843
|
-
}
|
3844
|
-
`;
|
3845
|
-
|
3846
|
-
class ConfirmDialog extends i$1 {
|
3847
|
-
onAcceptClick(e) {
|
3848
|
-
e.preventDefault();
|
3849
|
-
this.dispatchEvent(new CustomEvent('accept', {
|
3850
|
-
composed: true,
|
3851
|
-
}));
|
3852
|
-
}
|
3853
|
-
onCancelClick(e) {
|
3854
|
-
e.preventDefault();
|
3855
|
-
this.dispatchEvent(new CustomEvent('decline', {
|
3856
|
-
composed: true,
|
3857
|
-
}));
|
3858
|
-
}
|
3859
|
-
render() {
|
3860
|
-
return x `
|
3861
|
-
<div class="modal">
|
3862
|
-
<slot name="title"></slot>
|
3863
|
-
<slot name="content"></slot>
|
3864
|
-
<div class="button-wrapper">
|
3865
|
-
<slot name="accept-btn">
|
3866
|
-
<button class="btn accept-btn" @click=${this.onAcceptClick}>
|
3867
|
-
Delete
|
3868
|
-
</button>
|
3869
|
-
</slot>
|
3870
|
-
<slot name="decline-btn">
|
3871
|
-
<button class="btn decline-btn" @click=${this.onCancelClick}>
|
3872
|
-
Cancel
|
3873
|
-
</button>
|
3874
|
-
</slot>
|
3875
|
-
</div>
|
3876
|
-
</div>
|
3877
|
-
`;
|
3878
|
-
}
|
3879
|
-
}
|
3880
|
-
ConfirmDialog.styles = [confirmDialogStyles];
|
3881
|
-
if (!customElements.get('confirm-dialog')) {
|
3882
|
-
customElements.define('confirm-dialog', ConfirmDialog);
|
3883
|
-
}
|
3884
|
-
|
3885
|
-
const feedbackDialogStyles = i$4 `
|
3886
|
-
:host {
|
3887
|
-
font-family: 'Inter', sans-serif;
|
3888
|
-
font-size: 16px;
|
3889
|
-
line-height: 24px;
|
3890
|
-
font-weight: 400;
|
3891
|
-
|
3892
|
-
display: flex;
|
3893
|
-
position: absolute;
|
3894
|
-
top: 0;
|
3895
|
-
left: 0;
|
3896
|
-
width: 100%;
|
3897
|
-
height: 100%;
|
3898
|
-
background: #00000050;
|
3899
|
-
}
|
3900
|
-
|
3901
|
-
.modal {
|
3902
|
-
width: 75%;
|
3903
|
-
max-width: 400px;
|
3904
|
-
background: #fff;
|
3905
|
-
padding: 24px;
|
3906
|
-
margin: auto;
|
3907
|
-
|
3908
|
-
border-radius: 8px;
|
3909
|
-
box-shadow: rgba(47, 43, 61, 0.28) 0px 8px 23px 0px;
|
3910
|
-
|
3911
|
-
z-index: 2000;
|
3912
|
-
}
|
3913
|
-
|
3914
|
-
.header {
|
3915
|
-
display: flex;
|
3916
|
-
justify-content: space-between;
|
3917
|
-
align-items: center;
|
3918
|
-
margin-bottom: 16px;
|
3640
|
+
.header {
|
3641
|
+
display: flex;
|
3642
|
+
justify-content: space-between;
|
3643
|
+
align-items: center;
|
3644
|
+
margin-bottom: 16px;
|
3919
3645
|
}
|
3920
3646
|
|
3921
3647
|
.close {
|
@@ -4098,11 +3824,80 @@ if (!customElements.get('feedback-dialog')) {
|
|
4098
3824
|
customElements.define('feedback-dialog', FeedbackDialog);
|
4099
3825
|
}
|
4100
3826
|
|
3827
|
+
class TypingIndicator extends i$1 {
|
3828
|
+
constructor() {
|
3829
|
+
super(...arguments);
|
3830
|
+
this.position = 'bottom-left';
|
3831
|
+
this.text = '';
|
3832
|
+
}
|
3833
|
+
render() {
|
3834
|
+
return x `
|
3835
|
+
<div class="typing-dots">
|
3836
|
+
<div class="dot"></div>
|
3837
|
+
<div class="dot"></div>
|
3838
|
+
<div class="dot"></div>
|
3839
|
+
</div>
|
3840
|
+
`;
|
3841
|
+
}
|
3842
|
+
}
|
3843
|
+
TypingIndicator.styles = [
|
3844
|
+
i$4 `
|
3845
|
+
.typing-dots {
|
3846
|
+
display: flex;
|
3847
|
+
align-items: center;
|
3848
|
+
justify-content: center;
|
3849
|
+
gap: 8px;
|
3850
|
+
}
|
3851
|
+
|
3852
|
+
.dot {
|
3853
|
+
width: 6px;
|
3854
|
+
height: 6px;
|
3855
|
+
background-color: #b6b6b6;
|
3856
|
+
border-radius: 50%;
|
3857
|
+
animation: bounce 1.2s infinite ease-in-out;
|
3858
|
+
}
|
3859
|
+
|
3860
|
+
.dot:nth-child(1) {
|
3861
|
+
animation-delay: 0s;
|
3862
|
+
}
|
3863
|
+
|
3864
|
+
.dot:nth-child(2) {
|
3865
|
+
animation-delay: 0.2s;
|
3866
|
+
}
|
3867
|
+
|
3868
|
+
.dot:nth-child(3) {
|
3869
|
+
animation-delay: 0.4s;
|
3870
|
+
}
|
3871
|
+
|
3872
|
+
@keyframes bounce {
|
3873
|
+
0%,
|
3874
|
+
80%,
|
3875
|
+
100% {
|
3876
|
+
transform: translateY(0);
|
3877
|
+
background-color: #b6b6b6;
|
3878
|
+
}
|
3879
|
+
40% {
|
3880
|
+
transform: translateY(-4px);
|
3881
|
+
background-color: #8b8b8b;
|
3882
|
+
}
|
3883
|
+
}
|
3884
|
+
`,
|
3885
|
+
];
|
3886
|
+
__decorate([
|
3887
|
+
n({ type: String }),
|
3888
|
+
__metadata("design:type", String)
|
3889
|
+
], TypingIndicator.prototype, "position", void 0);
|
3890
|
+
__decorate([
|
3891
|
+
n({ type: String }),
|
3892
|
+
__metadata("design:type", Object)
|
3893
|
+
], TypingIndicator.prototype, "text", void 0);
|
3894
|
+
if (!customElements.get('typing-indicator')) {
|
3895
|
+
customElements.define('typing-indicator', TypingIndicator);
|
3896
|
+
}
|
3897
|
+
|
4101
3898
|
class ChatSection extends i$1 {
|
4102
3899
|
constructor() {
|
4103
3900
|
super(...arguments);
|
4104
|
-
this.showChatThreads = false;
|
4105
|
-
this.deleteAllThreads = false;
|
4106
3901
|
this.userQuery = '';
|
4107
3902
|
this.isStylesheetInjected = false;
|
4108
3903
|
}
|
@@ -4143,25 +3938,6 @@ class ChatSection extends i$1 {
|
|
4143
3938
|
this.userQuery = '';
|
4144
3939
|
await this.processMessage(e, message, false);
|
4145
3940
|
}
|
4146
|
-
handleThreadDelete() {
|
4147
|
-
if (this.deleteAllThreads) {
|
4148
|
-
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
4149
|
-
composed: true,
|
4150
|
-
bubbles: true,
|
4151
|
-
}));
|
4152
|
-
this.deleteAllThreads = false;
|
4153
|
-
return;
|
4154
|
-
}
|
4155
|
-
if (!this.deleteThreadId) {
|
4156
|
-
return;
|
4157
|
-
}
|
4158
|
-
this.dispatchEvent(new CustomEvent('delete-thread', {
|
4159
|
-
detail: { threadId: this.deleteThreadId },
|
4160
|
-
composed: true,
|
4161
|
-
bubbles: true,
|
4162
|
-
}));
|
4163
|
-
this.deleteThreadId = '';
|
4164
|
-
}
|
4165
3941
|
handleFeedback(rating, messageId, queryMessageId, comment, query, response) {
|
4166
3942
|
var _a, _b, _c, _d;
|
4167
3943
|
if (rating === 'bad') {
|
@@ -4203,13 +3979,6 @@ class ChatSection extends i$1 {
|
|
4203
3979
|
bubbles: true,
|
4204
3980
|
}));
|
4205
3981
|
}
|
4206
|
-
typingIndicator() {
|
4207
|
-
return x ` <div class="typing-dots">
|
4208
|
-
<div class="dot"></div>
|
4209
|
-
<div class="dot"></div>
|
4210
|
-
<div class="dot"></div>
|
4211
|
-
</div>`;
|
4212
|
-
}
|
4213
3982
|
botMessage(message, index) {
|
4214
3983
|
var _a, _b, _c, _d, _e;
|
4215
3984
|
const queryMessage = this.messages[index + 1];
|
@@ -4223,7 +3992,7 @@ class ChatSection extends i$1 {
|
|
4223
3992
|
.content=${message.message}
|
4224
3993
|
></markdown-renderer>`
|
4225
3994
|
: E}
|
4226
|
-
${
|
3995
|
+
${((_a = message.products) === null || _a === void 0 ? void 0 : _a[0])
|
4227
3996
|
? x `
|
4228
3997
|
<span class="line"></span>
|
4229
3998
|
<div class="product-container">
|
@@ -4240,16 +4009,6 @@ class ChatSection extends i$1 {
|
|
4240
4009
|
: E}
|
4241
4010
|
</div>
|
4242
4011
|
</div>
|
4243
|
-
${this.viewType === 'modal' && message.products
|
4244
|
-
? x ` <products-list
|
4245
|
-
.query=${queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.message}
|
4246
|
-
.response=${message.message}
|
4247
|
-
.products=${message.products}
|
4248
|
-
.siteCurrency=${this.siteCurrency}
|
4249
|
-
.viewType=${this.viewType}
|
4250
|
-
.userId=${this.userId}
|
4251
|
-
></products-list>`
|
4252
|
-
: E}
|
4253
4012
|
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
4254
4013
|
? x ` <div class="bot-response-actions">
|
4255
4014
|
<button
|
@@ -4279,7 +4038,7 @@ class ChatSection extends i$1 {
|
|
4279
4038
|
<img src=${this.botIconUrl} width="30" height="30" />
|
4280
4039
|
</div>`;
|
4281
4040
|
}
|
4282
|
-
return x ` <div class="bot-icon">${botIcon}</div> `;
|
4041
|
+
return x ` <div class="bot-icon">${botIcon()}</div> `;
|
4283
4042
|
}
|
4284
4043
|
chatWindow() {
|
4285
4044
|
if (this.isLoadingHistory || this.isLoadingThreads) {
|
@@ -4292,7 +4051,7 @@ class ChatSection extends i$1 {
|
|
4292
4051
|
${this.isTyping
|
4293
4052
|
? x ` <div class="message bot">
|
4294
4053
|
<div>${this.renderBotIcon()}</div>
|
4295
|
-
|
4054
|
+
<typing-indicator></typing-indicator>
|
4296
4055
|
</div>`
|
4297
4056
|
: ''}
|
4298
4057
|
${this.isFailed
|
@@ -4314,33 +4073,1236 @@ class ChatSection extends i$1 {
|
|
4314
4073
|
}
|
4315
4074
|
return x ` <div class="message user">${message.message}</div> `;
|
4316
4075
|
})}
|
4317
|
-
${!this.
|
4318
|
-
? x `
|
4319
|
-
<div class="message bot">
|
4320
|
-
<div>${this.renderBotIcon()}</div>
|
4321
|
-
<div>
|
4322
|
-
<p>
|
4323
|
-
Hi,
|
4324
|
-
${this.brandName
|
4325
|
-
? x `Welcome to ${this.brandName}.`
|
4326
|
-
: E}
|
4327
|
-
I'm here to help you find the perfect product. Pick a suggested
|
4328
|
-
prompt from below, or enter your own query.
|
4329
|
-
</p>
|
4330
|
-
</div>
|
4331
|
-
</div>
|
4332
|
-
</div>`
|
4333
|
-
: E}
|
4076
|
+
${!this.welcomeFlowTriggered || !this.thread
|
4077
|
+
? x `
|
4078
|
+
<div class="message bot">
|
4079
|
+
<div>${this.renderBotIcon()}</div>
|
4080
|
+
<div>
|
4081
|
+
<p>
|
4082
|
+
Hi,
|
4083
|
+
${this.brandName
|
4084
|
+
? x `Welcome to ${this.brandName}.`
|
4085
|
+
: E}
|
4086
|
+
I'm here to help you find the perfect product. Pick a suggested
|
4087
|
+
prompt from below, or enter your own query.
|
4088
|
+
</p>
|
4089
|
+
</div>
|
4090
|
+
</div>
|
4091
|
+
</div>`
|
4092
|
+
: E}
|
4093
|
+
</div>
|
4094
|
+
`;
|
4095
|
+
}
|
4096
|
+
renderPrompts() {
|
4097
|
+
var _a;
|
4098
|
+
if (this.isLoadingHistory || this.isStreaming || this.isLoadingThreads) {
|
4099
|
+
return E;
|
4100
|
+
}
|
4101
|
+
const latestMessage = this.messages[0];
|
4102
|
+
const isWelcomeMessage = this.messages.length === 1 && (latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.sender) === 'bot';
|
4103
|
+
const isLLMPrompt = !!((_a = latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.prompts) === null || _a === void 0 ? void 0 : _a.length);
|
4104
|
+
const prompts = this.messages.length
|
4105
|
+
? this.messages[0].prompts
|
4106
|
+
: this.prompts
|
4107
|
+
? this.prompts.split(',').map((prompt) => prompt.trim())
|
4108
|
+
: ['Best Sellers'];
|
4109
|
+
const customPrompts = !this.messages.length || isWelcomeMessage ? this.customPrompts : undefined;
|
4110
|
+
if (!prompts && !customPrompts) {
|
4111
|
+
return E;
|
4112
|
+
}
|
4113
|
+
return x `
|
4114
|
+
<div class="prompts btn">
|
4115
|
+
${o$1(prompts, (prompt) => {
|
4116
|
+
return x `
|
4117
|
+
<div
|
4118
|
+
class="prompt"
|
4119
|
+
@click=${(e) => {
|
4120
|
+
this.processMessage(e, prompt, true);
|
4121
|
+
const eventName = isLLMPrompt
|
4122
|
+
? 'customPromptClicked'
|
4123
|
+
: 'promptClicked';
|
4124
|
+
this.sendEvent(eventName, undefined, {
|
4125
|
+
promptName: prompt,
|
4126
|
+
});
|
4127
|
+
}}
|
4128
|
+
>
|
4129
|
+
${prompt}
|
4130
|
+
</div>
|
4131
|
+
`;
|
4132
|
+
})}
|
4133
|
+
${o$1(customPrompts, ({ prompt, link }) => {
|
4134
|
+
return x `
|
4135
|
+
<a
|
4136
|
+
class="prompt"
|
4137
|
+
href=${link}
|
4138
|
+
target="_blank"
|
4139
|
+
rel="noopener"
|
4140
|
+
@click=${() => this.sendEvent('promptClicked', undefined, {
|
4141
|
+
promptName: prompt,
|
4142
|
+
})}
|
4143
|
+
>
|
4144
|
+
${prompt}
|
4145
|
+
</a>
|
4146
|
+
`;
|
4147
|
+
})}
|
4148
|
+
</div>
|
4149
|
+
`;
|
4150
|
+
}
|
4151
|
+
showContext() {
|
4152
|
+
var _a;
|
4153
|
+
if (!((_a = this.thread) === null || _a === void 0 ? void 0 : _a.devContext)) {
|
4154
|
+
return x `
|
4155
|
+
<div class="context-container">
|
4156
|
+
<div class="context-title">
|
4157
|
+
<p>Context</p>
|
4158
|
+
<div
|
4159
|
+
class="btn"
|
4160
|
+
@click=${() => {
|
4161
|
+
if (!this.contextContainerElement) {
|
4162
|
+
return;
|
4163
|
+
}
|
4164
|
+
this.contextContainerElement.classList.remove('show');
|
4165
|
+
}}
|
4166
|
+
>
|
4167
|
+
${closeBtn}
|
4168
|
+
</div>
|
4169
|
+
</div>
|
4170
|
+
<p>
|
4171
|
+
This search thread has no pre-defined context. Start a new search to
|
4172
|
+
personalize.
|
4173
|
+
</p>
|
4174
|
+
</div>
|
4175
|
+
`;
|
4176
|
+
}
|
4177
|
+
const devContext = this.thread.devContext;
|
4178
|
+
const profileType = devContext.email
|
4179
|
+
? 'Pick your profile'
|
4180
|
+
: 'Stay Anonymous';
|
4181
|
+
const userDetails = devContext.email
|
4182
|
+
? `${capitalizeEachWord(devContext.firstName)} / ${capitalizeEachWord(devContext.gender)} / ${devContext.city} / ${devContext.state ? `- ${capitalizeEachWord(devContext.state)}` : ''} - ${devContext.preferences
|
4183
|
+
? `${devContext.preferences.size},${capitalizeEachWord(devContext.preferences.color)},${capitalizeEachWord(devContext.preferences.material)}`
|
4184
|
+
: ''}`
|
4185
|
+
: '';
|
4186
|
+
const visitationType = devContext.productHandle ? 'Via Ad' : 'Direct Visit';
|
4187
|
+
return x `
|
4188
|
+
<div class="context-container">
|
4189
|
+
<div class="context-title">
|
4190
|
+
<p>Context</p>
|
4191
|
+
<div
|
4192
|
+
class="btn"
|
4193
|
+
@click=${() => {
|
4194
|
+
var _a;
|
4195
|
+
(_a = this.contextContainerElement) === null || _a === void 0 ? void 0 : _a.classList.remove('show');
|
4196
|
+
}}
|
4197
|
+
>
|
4198
|
+
${closeBtn}
|
4199
|
+
</div>
|
4200
|
+
</div>
|
4201
|
+
<div>
|
4202
|
+
<div class="context">
|
4203
|
+
<span>Profile Type:</span>${' '}
|
4204
|
+
<span class="context-type-value"> ${profileType} </span>
|
4205
|
+
</div>
|
4206
|
+
${userDetails
|
4207
|
+
? x ` <div class="context user-details">${userDetails}</div>`
|
4208
|
+
: E}
|
4209
|
+
</div>
|
4210
|
+
<div>
|
4211
|
+
<div class="context">
|
4212
|
+
<span>Visitation Context:</span>${' '}
|
4213
|
+
<span class="context-type-value">${visitationType}</span>
|
4214
|
+
</div>
|
4215
|
+
${devContext.productHandle
|
4216
|
+
? x ` <div class="context product-handle">
|
4217
|
+
${devContext.productHandle}
|
4218
|
+
</div>`
|
4219
|
+
: E}
|
4220
|
+
</div>
|
4221
|
+
</div>
|
4222
|
+
`;
|
4223
|
+
}
|
4224
|
+
contextButton() {
|
4225
|
+
var _a, _b, _c, _d;
|
4226
|
+
if (!this.devMode) {
|
4227
|
+
return ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId)
|
4228
|
+
? x `<h2>${((_b = this.thread) === null || _b === void 0 ? void 0 : _b.title) || 'New Search'}</h2>`
|
4229
|
+
: x `<h2>New Search</h2>`;
|
4230
|
+
}
|
4231
|
+
if ((_c = this.thread) === null || _c === void 0 ? void 0 : _c.threadId) {
|
4232
|
+
return x `
|
4233
|
+
<h2>${((_d = this.thread) === null || _d === void 0 ? void 0 : _d.title) || 'New Search'}</h2>
|
4234
|
+
<button
|
4235
|
+
class="btn-context btn"
|
4236
|
+
@click=${() => {
|
4237
|
+
if (!this.contextContainerElement) {
|
4238
|
+
return;
|
4239
|
+
}
|
4240
|
+
this.contextContainerElement.classList.toggle('show');
|
4241
|
+
}}
|
4242
|
+
>
|
4243
|
+
SHOW CONTEXT
|
4244
|
+
</button>
|
4245
|
+
${this.showContext()}
|
4246
|
+
`;
|
4247
|
+
}
|
4248
|
+
return x `
|
4249
|
+
<h2>Click personalize for hyper Contextual</h2>
|
4250
|
+
<button
|
4251
|
+
class="btn-context active btn"
|
4252
|
+
@click=${() => this.personalizeDialogElement.showModal()}
|
4253
|
+
>
|
4254
|
+
Personalize
|
4255
|
+
</button>
|
4256
|
+
`;
|
4257
|
+
}
|
4258
|
+
render() {
|
4259
|
+
if (this.merchantImage) {
|
4260
|
+
// set the merchant image as a css variable
|
4261
|
+
this.style.setProperty('--shopgpt-merchant-img-url', `url('${this.merchantImage}')`);
|
4262
|
+
}
|
4263
|
+
else {
|
4264
|
+
this.style.removeProperty('--shopgpt-merchant-img-url');
|
4265
|
+
}
|
4266
|
+
return x `
|
4267
|
+
<div class="chat-header">${this.contextButton()}</div>
|
4268
|
+
<div class="chatbot-section">
|
4269
|
+
${this.chatWindow()} ${this.renderPrompts()}
|
4270
|
+
<form class="chat-form" @submit=${this.onSubmit}>
|
4271
|
+
<input
|
4272
|
+
type="text"
|
4273
|
+
.value=${this.userQuery}
|
4274
|
+
@input=${(e) => (this.userQuery = e.target.value)}
|
4275
|
+
placeholder="Type your search here..."
|
4276
|
+
/>
|
4277
|
+
<button
|
4278
|
+
class="btn"
|
4279
|
+
type="submit"
|
4280
|
+
?disabled=${this.isStreaming || this.isLoadingHistory}
|
4281
|
+
>
|
4282
|
+
${sendFilledIcon}
|
4283
|
+
</button>
|
4284
|
+
</form>
|
4285
|
+
</div>
|
4286
|
+
<personalize-dialog
|
4287
|
+
.createChatThread=${this.createChatThread.bind(this)}
|
4288
|
+
.defaultProductHandles=${this.productHandles}
|
4289
|
+
.defaultProfiles=${this.profiles}
|
4290
|
+
></personalize-dialog>
|
4291
|
+
${this.feedbackDetails
|
4292
|
+
? x `
|
4293
|
+
<feedback-dialog
|
4294
|
+
.messageId=${this.feedbackDetails.messageId}
|
4295
|
+
.queryMessageId=${this.feedbackDetails.queryMessageId}
|
4296
|
+
.threadId=${this.feedbackDetails.threadId}
|
4297
|
+
.comment=${this.feedbackDetails.comment}
|
4298
|
+
@submit-feedback=${() => {
|
4299
|
+
this.feedbackDetails = undefined;
|
4300
|
+
}}
|
4301
|
+
@close=${(e) => {
|
4302
|
+
e.stopPropagation();
|
4303
|
+
this.feedbackDetails = undefined;
|
4304
|
+
}}
|
4305
|
+
></feedback-dialog>
|
4306
|
+
`
|
4307
|
+
: E}
|
4308
|
+
`;
|
4309
|
+
}
|
4310
|
+
}
|
4311
|
+
ChatSection.styles = [chatSectionStyles$1];
|
4312
|
+
__decorate([
|
4313
|
+
n({ type: String }),
|
4314
|
+
__metadata("design:type", Object)
|
4315
|
+
], ChatSection.prototype, "merchantImage", void 0);
|
4316
|
+
__decorate([
|
4317
|
+
n({ type: String }),
|
4318
|
+
__metadata("design:type", Object)
|
4319
|
+
], ChatSection.prototype, "botIconUrl", void 0);
|
4320
|
+
__decorate([
|
4321
|
+
n({ type: String }),
|
4322
|
+
__metadata("design:type", Object)
|
4323
|
+
], ChatSection.prototype, "brandName", void 0);
|
4324
|
+
__decorate([
|
4325
|
+
n({ type: String }),
|
4326
|
+
__metadata("design:type", Object)
|
4327
|
+
], ChatSection.prototype, "prompts", void 0);
|
4328
|
+
__decorate([
|
4329
|
+
n({ type: Array }),
|
4330
|
+
__metadata("design:type", Object)
|
4331
|
+
], ChatSection.prototype, "customPrompts", void 0);
|
4332
|
+
__decorate([
|
4333
|
+
n({ type: Boolean }),
|
4334
|
+
__metadata("design:type", Boolean)
|
4335
|
+
], ChatSection.prototype, "isLoadingThreads", void 0);
|
4336
|
+
__decorate([
|
4337
|
+
n({ type: Boolean }),
|
4338
|
+
__metadata("design:type", Boolean)
|
4339
|
+
], ChatSection.prototype, "isLoadingHistory", void 0);
|
4340
|
+
__decorate([
|
4341
|
+
n({ type: Boolean }),
|
4342
|
+
__metadata("design:type", Object)
|
4343
|
+
], ChatSection.prototype, "devMode", void 0);
|
4344
|
+
__decorate([
|
4345
|
+
n({ type: Boolean }),
|
4346
|
+
__metadata("design:type", Boolean)
|
4347
|
+
], ChatSection.prototype, "isTyping", void 0);
|
4348
|
+
__decorate([
|
4349
|
+
n({ type: Boolean }),
|
4350
|
+
__metadata("design:type", Boolean)
|
4351
|
+
], ChatSection.prototype, "isStreaming", void 0);
|
4352
|
+
__decorate([
|
4353
|
+
n({ type: Boolean }),
|
4354
|
+
__metadata("design:type", Boolean)
|
4355
|
+
], ChatSection.prototype, "isFailed", void 0);
|
4356
|
+
__decorate([
|
4357
|
+
n({ type: Array }),
|
4358
|
+
__metadata("design:type", Array)
|
4359
|
+
], ChatSection.prototype, "messages", void 0);
|
4360
|
+
__decorate([
|
4361
|
+
n({ type: Array }),
|
4362
|
+
__metadata("design:type", Array)
|
4363
|
+
], ChatSection.prototype, "profiles", void 0);
|
4364
|
+
__decorate([
|
4365
|
+
n({ type: Array }),
|
4366
|
+
__metadata("design:type", Array)
|
4367
|
+
], ChatSection.prototype, "productHandles", void 0);
|
4368
|
+
__decorate([
|
4369
|
+
n({ type: Object }),
|
4370
|
+
__metadata("design:type", Object)
|
4371
|
+
], ChatSection.prototype, "thread", void 0);
|
4372
|
+
__decorate([
|
4373
|
+
n({ type: Object }),
|
4374
|
+
__metadata("design:type", Object)
|
4375
|
+
], ChatSection.prototype, "siteCurrency", void 0);
|
4376
|
+
__decorate([
|
4377
|
+
e$3('.context-container'),
|
4378
|
+
__metadata("design:type", Object)
|
4379
|
+
], ChatSection.prototype, "contextContainerElement", void 0);
|
4380
|
+
__decorate([
|
4381
|
+
e$3('.chat-window'),
|
4382
|
+
__metadata("design:type", Object)
|
4383
|
+
], ChatSection.prototype, "chatWindowElement", void 0);
|
4384
|
+
__decorate([
|
4385
|
+
e$3('personalize-dialog'),
|
4386
|
+
__metadata("design:type", Object)
|
4387
|
+
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
4388
|
+
__decorate([
|
4389
|
+
r(),
|
4390
|
+
__metadata("design:type", Object)
|
4391
|
+
], ChatSection.prototype, "feedbackDetails", void 0);
|
4392
|
+
__decorate([
|
4393
|
+
n({ type: String }),
|
4394
|
+
__metadata("design:type", Object)
|
4395
|
+
], ChatSection.prototype, "userQuery", void 0);
|
4396
|
+
__decorate([
|
4397
|
+
n({ type: String }),
|
4398
|
+
__metadata("design:type", String)
|
4399
|
+
], ChatSection.prototype, "css", void 0);
|
4400
|
+
__decorate([
|
4401
|
+
n({ type: Boolean }),
|
4402
|
+
__metadata("design:type", Boolean)
|
4403
|
+
], ChatSection.prototype, "welcomeFlowTriggered", void 0);
|
4404
|
+
__decorate([
|
4405
|
+
n({ type: String }),
|
4406
|
+
__metadata("design:type", String)
|
4407
|
+
], ChatSection.prototype, "userId", void 0);
|
4408
|
+
if (!customElements.get('chat-section')) {
|
4409
|
+
customElements.define('chat-section', ChatSection);
|
4410
|
+
}
|
4411
|
+
|
4412
|
+
const chatSectionStyles = i$4 `
|
4413
|
+
:host {
|
4414
|
+
font-family: 'Inter', sans-serif;
|
4415
|
+
font-size: 16px;
|
4416
|
+
font-weight: 400;
|
4417
|
+
|
4418
|
+
h2,
|
4419
|
+
p {
|
4420
|
+
margin: 0;
|
4421
|
+
}
|
4422
|
+
|
4423
|
+
button {
|
4424
|
+
border-style: none;
|
4425
|
+
cursor: pointer;
|
4426
|
+
}
|
4427
|
+
}
|
4428
|
+
|
4429
|
+
.btn {
|
4430
|
+
cursor: pointer;
|
4431
|
+
}
|
4432
|
+
|
4433
|
+
.chat-header {
|
4434
|
+
padding: 15px 19px;
|
4435
|
+
display: flex;
|
4436
|
+
justify-content: space-between;
|
4437
|
+
align-items: center;
|
4438
|
+
background: #020617;
|
4439
|
+
gap: 8px;
|
4440
|
+
height: 60px;
|
4441
|
+
box-sizing: border-box;
|
4442
|
+
|
4443
|
+
h2 {
|
4444
|
+
color: #ffffff;
|
4445
|
+
font-size: 16px;
|
4446
|
+
font-weight: 400;
|
4447
|
+
line-height: 24px;
|
4448
|
+
text-transform: capitalize;
|
4449
|
+
white-space: nowrap;
|
4450
|
+
overflow: hidden;
|
4451
|
+
text-overflow: ellipsis;
|
4452
|
+
}
|
4453
|
+
|
4454
|
+
.btns-wrapper {
|
4455
|
+
margin-left: auto;
|
4456
|
+
display: flex;
|
4457
|
+
align-items: center;
|
4458
|
+
gap: 20px;
|
4459
|
+
|
4460
|
+
.btn-icon {
|
4461
|
+
border-radius: 50%;
|
4462
|
+
padding: 0;
|
4463
|
+
background: transparent;
|
4464
|
+
margin: 0;
|
4465
|
+
display: flex;
|
4466
|
+
align-items: center;
|
4467
|
+
justify-content: center;
|
4468
|
+
height: 24px;
|
4469
|
+
width: 24px;
|
4470
|
+
opacity: 1;
|
4471
|
+
|
4472
|
+
&:hover {
|
4473
|
+
opacity: 0.7;
|
4474
|
+
}
|
4475
|
+
|
4476
|
+
&.active {
|
4477
|
+
opacity: 1;
|
4478
|
+
}
|
4479
|
+
|
4480
|
+
&:disabled {
|
4481
|
+
cursor: not-allowed;
|
4482
|
+
opacity: 0.5;
|
4483
|
+
}
|
4484
|
+
}
|
4485
|
+
}
|
4486
|
+
}
|
4487
|
+
|
4488
|
+
.chatbot-section {
|
4489
|
+
display: flex;
|
4490
|
+
flex-direction: column;
|
4491
|
+
background-color: #fff;
|
4492
|
+
height: calc(100% - 73px);
|
4493
|
+
padding: 0px 20px 13px;
|
4494
|
+
gap: 11px;
|
4495
|
+
}
|
4496
|
+
|
4497
|
+
.chat-form {
|
4498
|
+
display: flex;
|
4499
|
+
align-items: center;
|
4500
|
+
margin: 0;
|
4501
|
+
position: relative;
|
4502
|
+
|
4503
|
+
.sparkles-icon {
|
4504
|
+
position: absolute;
|
4505
|
+
left: 15px;
|
4506
|
+
top: 50%;
|
4507
|
+
transform: translateY(-50%);
|
4508
|
+
pointer-events: none;
|
4509
|
+
transition: opacity 0.2s;
|
4510
|
+
}
|
4511
|
+
|
4512
|
+
input {
|
4513
|
+
flex: 1;
|
4514
|
+
padding: 10px 38px 12px 35px;
|
4515
|
+
font-weight: 500;
|
4516
|
+
font-size: 14px;
|
4517
|
+
line-height: 20px;
|
4518
|
+
color: #201d2f;
|
4519
|
+
|
4520
|
+
background: #fff;
|
4521
|
+
border-radius: 6px;
|
4522
|
+
border: 0.5px solid #bbbbce;
|
4523
|
+
box-shadow: 0px 4px 10px 0px #0000000d;
|
4524
|
+
|
4525
|
+
&:focus {
|
4526
|
+
outline-width: 0;
|
4527
|
+
}
|
4528
|
+
|
4529
|
+
&::placeholder {
|
4530
|
+
font-weight: 400;
|
4531
|
+
font-size: 14px;
|
4532
|
+
color: #94a3b8;
|
4533
|
+
}
|
4534
|
+
}
|
4535
|
+
|
4536
|
+
.send-btn {
|
4537
|
+
position: absolute;
|
4538
|
+
padding: 0;
|
4539
|
+
display: flex;
|
4540
|
+
justify-content: center;
|
4541
|
+
align-items: center;
|
4542
|
+
right: 11px;
|
4543
|
+
background-color: unset;
|
4544
|
+
|
4545
|
+
&:disabled {
|
4546
|
+
opacity: 0.3;
|
4547
|
+
cursor: not-allowed;
|
4548
|
+
}
|
4549
|
+
}
|
4550
|
+
}
|
4551
|
+
|
4552
|
+
.chat-welcome {
|
4553
|
+
display: flex;
|
4554
|
+
flex-direction: column;
|
4555
|
+
gap: 24px;
|
4556
|
+
flex: 1;
|
4557
|
+
align-items: center;
|
4558
|
+
justify-content: center;
|
4559
|
+
|
4560
|
+
.bot-icon {
|
4561
|
+
border-radius: 50px;
|
4562
|
+
width: 100px;
|
4563
|
+
height: 100px;
|
4564
|
+
}
|
4565
|
+
|
4566
|
+
.welcome-title {
|
4567
|
+
font-weight: 700;
|
4568
|
+
font-style: normal;
|
4569
|
+
font-size: 36px;
|
4570
|
+
line-height: 100%;
|
4571
|
+
text-align: center;
|
4572
|
+
color: #020617;
|
4573
|
+
margin-bottom: 8px;
|
4574
|
+
}
|
4575
|
+
|
4576
|
+
.welcome-message {
|
4577
|
+
font-style: normal;
|
4578
|
+
font-size: 14px;
|
4579
|
+
font-weight: 500;
|
4580
|
+
line-height: 20px;
|
4581
|
+
text-align: center;
|
4582
|
+
color: #64748b;
|
4583
|
+
margin: 0 32px 8px;
|
4584
|
+
}
|
4585
|
+
}
|
4586
|
+
|
4587
|
+
.messages {
|
4588
|
+
flex: 1;
|
4589
|
+
overflow-y: auto;
|
4590
|
+
display: flex;
|
4591
|
+
flex-direction: column-reverse;
|
4592
|
+
gap: 12px;
|
4593
|
+
padding-bottom: 10px;
|
4594
|
+
margin-bottom: -10px;
|
4595
|
+
margin-right: -10px;
|
4596
|
+
padding-right: 10px;
|
4597
|
+
margin-left: -10px;
|
4598
|
+
padding-left: 10px;
|
4599
|
+
background: linear-gradient(#f7f8fa80, #f7f8fa80),
|
4600
|
+
var(--shopgpt-merchant-img-url);
|
4601
|
+
background-position: center;
|
4602
|
+
background-repeat: no-repeat;
|
4603
|
+
background-size: contain;
|
4604
|
+
|
4605
|
+
&.loading {
|
4606
|
+
justify-content: center;
|
4607
|
+
align-items: center;
|
4608
|
+
}
|
4609
|
+
|
4610
|
+
.message:last-child {
|
4611
|
+
margin-top: 10px;
|
4612
|
+
}
|
4613
|
+
}
|
4614
|
+
|
4615
|
+
.message-wrapper {
|
4616
|
+
display: flex;
|
4617
|
+
flex-direction: column;
|
4618
|
+
gap: 16px;
|
4619
|
+
margin-bottom: 10px;
|
4620
|
+
}
|
4621
|
+
|
4622
|
+
.message {
|
4623
|
+
font-size: 14px;
|
4624
|
+
line-height: 20px;
|
4625
|
+
}
|
4626
|
+
|
4627
|
+
.message.user {
|
4628
|
+
background: #18181b;
|
4629
|
+
color: #fafafa;
|
4630
|
+
max-width: 75%;
|
4631
|
+
align-self: flex-end;
|
4632
|
+
padding: 8px 12px;
|
4633
|
+
border-radius: 6px;
|
4634
|
+
}
|
4635
|
+
|
4636
|
+
.message.bot {
|
4637
|
+
display: flex;
|
4638
|
+
gap: 16px;
|
4639
|
+
color: #000000;
|
4640
|
+
max-width: 80%;
|
4641
|
+
}
|
4642
|
+
|
4643
|
+
.bot-response-actions {
|
4644
|
+
display: flex;
|
4645
|
+
gap: 20px;
|
4646
|
+
margin-top: -2px;
|
4647
|
+
|
4648
|
+
button {
|
4649
|
+
display: flex;
|
4650
|
+
align-items: center;
|
4651
|
+
justify-content: center;
|
4652
|
+
background: none;
|
4653
|
+
padding: 0px;
|
4654
|
+
|
4655
|
+
&:hover {
|
4656
|
+
opacity: 0.7;
|
4657
|
+
}
|
4658
|
+
}
|
4659
|
+
}
|
4660
|
+
|
4661
|
+
.bot-icon {
|
4662
|
+
display: flex;
|
4663
|
+
padding: 8px 11px;
|
4664
|
+
justify-content: center;
|
4665
|
+
align-items: center;
|
4666
|
+
border-radius: 70px;
|
4667
|
+
border: 1px solid #dbe2eb;
|
4668
|
+
background: #fff;
|
4669
|
+
width: 36px;
|
4670
|
+
height: 36px;
|
4671
|
+
box-sizing: border-box;
|
4672
|
+
}
|
4673
|
+
|
4674
|
+
.prompts {
|
4675
|
+
display: flex;
|
4676
|
+
justify-content: center;
|
4677
|
+
gap: 10px;
|
4678
|
+
flex-wrap: wrap;
|
4679
|
+
|
4680
|
+
.prompt {
|
4681
|
+
padding: 8px 12px;
|
4682
|
+
border-radius: 6px;
|
4683
|
+
border: 1px solid #e4e4e7;
|
4684
|
+
text-decoration: none;
|
4685
|
+
white-space: nowrap;
|
4686
|
+
display: inline-flex;
|
4687
|
+
|
4688
|
+
color: #18181b;
|
4689
|
+
font-size: 14px;
|
4690
|
+
font-weight: 500;
|
4691
|
+
line-height: 20px;
|
4692
|
+
|
4693
|
+
&:hover {
|
4694
|
+
opacity: 0.7;
|
4695
|
+
}
|
4696
|
+
|
4697
|
+
&:active {
|
4698
|
+
opacity: 1;
|
4699
|
+
}
|
4700
|
+
}
|
4701
|
+
|
4702
|
+
&.left-align {
|
4703
|
+
justify-content: flex-start;
|
4704
|
+
}
|
4705
|
+
}
|
4706
|
+
|
4707
|
+
#modal-chat-threads {
|
4708
|
+
.chat-threads {
|
4709
|
+
position: absolute;
|
4710
|
+
overflow: hidden;
|
4711
|
+
z-index: 1;
|
4712
|
+
top: 60px;
|
4713
|
+
height: 30%;
|
4714
|
+
width: 100%;
|
4715
|
+
background: #fff;
|
4716
|
+
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
4717
|
+
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
4718
|
+
border-radius: 0px 0px 10px 10px;
|
4719
|
+
|
4720
|
+
.title-wrapper {
|
4721
|
+
display: flex;
|
4722
|
+
justify-content: space-between;
|
4723
|
+
align-items: center;
|
4724
|
+
border-bottom: 1px solid #dbe2eb;
|
4725
|
+
padding: 10px 16px;
|
4726
|
+
|
4727
|
+
h2 {
|
4728
|
+
color: #172a41;
|
4729
|
+
font-size: 16px;
|
4730
|
+
font-weight: 700;
|
4731
|
+
line-height: 20px;
|
4732
|
+
}
|
4733
|
+
}
|
4734
|
+
|
4735
|
+
.thread-titles-wrapper {
|
4736
|
+
overflow-y: auto;
|
4737
|
+
height: calc(100% - 40px);
|
4738
|
+
}
|
4739
|
+
|
4740
|
+
.thread-title {
|
4741
|
+
display: flex;
|
4742
|
+
justify-content: space-between;
|
4743
|
+
padding: 10px 16px;
|
4744
|
+
color: #4e647f;
|
4745
|
+
cursor: pointer;
|
4746
|
+
|
4747
|
+
p {
|
4748
|
+
font-size: 14px;
|
4749
|
+
font-weight: 400;
|
4750
|
+
line-height: 20px;
|
4751
|
+
width: 100%;
|
4752
|
+
}
|
4753
|
+
|
4754
|
+
.trash-icon {
|
4755
|
+
display: none;
|
4756
|
+
}
|
4757
|
+
|
4758
|
+
&:hover {
|
4759
|
+
background: #f1f4f8;
|
4760
|
+
|
4761
|
+
.trash-icon {
|
4762
|
+
display: flex;
|
4763
|
+
}
|
4764
|
+
}
|
4765
|
+
}
|
4766
|
+
|
4767
|
+
.thread-title.disabled {
|
4768
|
+
cursor: not-allowed;
|
4769
|
+
}
|
4770
|
+
}
|
4771
|
+
|
4772
|
+
.trash-icon {
|
4773
|
+
display: flex;
|
4774
|
+
justify-content: center;
|
4775
|
+
align-items: center;
|
4776
|
+
padding: 2px;
|
4777
|
+
cursor: pointer;
|
4778
|
+
|
4779
|
+
&:hover {
|
4780
|
+
border-radius: 5px;
|
4781
|
+
background: #dc3545;
|
4782
|
+
|
4783
|
+
path {
|
4784
|
+
fill: white;
|
4785
|
+
}
|
4786
|
+
}
|
4787
|
+
}
|
4788
|
+
|
4789
|
+
.chat-threads-background {
|
4790
|
+
position: absolute;
|
4791
|
+
top: 78px;
|
4792
|
+
height: 100%;
|
4793
|
+
width: 100%;
|
4794
|
+
opacity: 0.5;
|
4795
|
+
background: #000;
|
4796
|
+
z-index: 0;
|
4797
|
+
}
|
4798
|
+
}
|
4799
|
+
|
4800
|
+
footer {
|
4801
|
+
text-align: center;
|
4802
|
+
font-size: 12px;
|
4803
|
+
line-height: 16px;
|
4804
|
+
color: #64748b;
|
4805
|
+
font-weight: 500;
|
4806
|
+
|
4807
|
+
a {
|
4808
|
+
color: #ef4444;
|
4809
|
+
text-decoration: none;
|
4810
|
+
}
|
4811
|
+
}
|
4812
|
+
|
4813
|
+
${scrollBarStyles}
|
4814
|
+
`;
|
4815
|
+
|
4816
|
+
class TooltipComponent extends i$1 {
|
4817
|
+
constructor() {
|
4818
|
+
super(...arguments);
|
4819
|
+
this.position = 'bottom-left';
|
4820
|
+
this.text = '';
|
4821
|
+
}
|
4822
|
+
render() {
|
4823
|
+
return x `
|
4824
|
+
<slot></slot>
|
4825
|
+
<div class="tooltip ${this.position}">${this.text}</div>
|
4826
|
+
`;
|
4827
|
+
}
|
4828
|
+
}
|
4829
|
+
TooltipComponent.styles = [
|
4830
|
+
i$4 `
|
4831
|
+
:host {
|
4832
|
+
position: relative;
|
4833
|
+
display: inline-block;
|
4834
|
+
}
|
4835
|
+
|
4836
|
+
.tooltip {
|
4837
|
+
position: absolute;
|
4838
|
+
color: #172a41;
|
4839
|
+
padding: 4px 8px;
|
4840
|
+
white-space: nowrap;
|
4841
|
+
font-size: 12px;
|
4842
|
+
opacity: 0;
|
4843
|
+
transition: opacity 0.2s;
|
4844
|
+
pointer-events: none;
|
4845
|
+
|
4846
|
+
border-radius: 5px;
|
4847
|
+
background: #fff;
|
4848
|
+
|
4849
|
+
font-style: normal;
|
4850
|
+
font-weight: 400;
|
4851
|
+
line-height: 150%;
|
4852
|
+
}
|
4853
|
+
|
4854
|
+
:host(:hover) .tooltip {
|
4855
|
+
opacity: 1;
|
4856
|
+
}
|
4857
|
+
|
4858
|
+
.top-center {
|
4859
|
+
bottom: calc(100% + 2px);
|
4860
|
+
left: 50%;
|
4861
|
+
transform: translateX(-50%);
|
4862
|
+
}
|
4863
|
+
|
4864
|
+
.top-left {
|
4865
|
+
bottom: calc(100% + 2px);
|
4866
|
+
left: 0;
|
4867
|
+
}
|
4868
|
+
|
4869
|
+
.top-right {
|
4870
|
+
bottom: calc(100% + 2px);
|
4871
|
+
right: 0;
|
4872
|
+
}
|
4873
|
+
|
4874
|
+
.bottom-center {
|
4875
|
+
top: calc(100% + 2px);
|
4876
|
+
left: 50%;
|
4877
|
+
transform: translateX(-50%);
|
4878
|
+
}
|
4879
|
+
|
4880
|
+
.bottom-left {
|
4881
|
+
top: calc(100% + 2px);
|
4882
|
+
left: 0;
|
4883
|
+
}
|
4884
|
+
|
4885
|
+
.bottom-right {
|
4886
|
+
top: calc(100% + 2px);
|
4887
|
+
right: 0;
|
4888
|
+
}
|
4889
|
+
|
4890
|
+
.left-center {
|
4891
|
+
right: calc(100% + 2px);
|
4892
|
+
top: 50%;
|
4893
|
+
transform: translateY(-50%);
|
4894
|
+
}
|
4895
|
+
|
4896
|
+
.left-top {
|
4897
|
+
right: calc(100% + 2px);
|
4898
|
+
top: 0;
|
4899
|
+
}
|
4900
|
+
|
4901
|
+
.left-bottom {
|
4902
|
+
right: calc(100% + 2px);
|
4903
|
+
bottom: 0;
|
4904
|
+
}
|
4905
|
+
|
4906
|
+
.right-center {
|
4907
|
+
left: calc(100% + 2px);
|
4908
|
+
top: 50%;
|
4909
|
+
transform: translateY(-50%);
|
4910
|
+
}
|
4911
|
+
|
4912
|
+
.right-top {
|
4913
|
+
left: calc(100% + 2px);
|
4914
|
+
top: 0;
|
4915
|
+
}
|
4916
|
+
|
4917
|
+
.right-bottom {
|
4918
|
+
left: calc(100% + 2px);
|
4919
|
+
bottom: 0;
|
4920
|
+
}
|
4921
|
+
`,
|
4922
|
+
];
|
4923
|
+
__decorate([
|
4924
|
+
n({ type: String }),
|
4925
|
+
__metadata("design:type", String)
|
4926
|
+
], TooltipComponent.prototype, "position", void 0);
|
4927
|
+
__decorate([
|
4928
|
+
n({ type: String }),
|
4929
|
+
__metadata("design:type", Object)
|
4930
|
+
], TooltipComponent.prototype, "text", void 0);
|
4931
|
+
if (!customElements.get('tooltip-component')) {
|
4932
|
+
customElements.define('tooltip-component', TooltipComponent);
|
4933
|
+
}
|
4934
|
+
|
4935
|
+
const confirmDialogStyles = i$4 `
|
4936
|
+
:host {
|
4937
|
+
font-family: 'Inter', sans-serif;
|
4938
|
+
font-size: 16px;
|
4939
|
+
font-weight: 400;
|
4940
|
+
|
4941
|
+
display: flex;
|
4942
|
+
position: absolute;
|
4943
|
+
top: 0;
|
4944
|
+
left: 0;
|
4945
|
+
width: 100%;
|
4946
|
+
height: 100%;
|
4947
|
+
background: #00000050;
|
4948
|
+
}
|
4949
|
+
|
4950
|
+
.modal {
|
4951
|
+
width: 75%;
|
4952
|
+
max-width: 350px;
|
4953
|
+
background: #fff;
|
4954
|
+
padding: 16px;
|
4955
|
+
margin: auto;
|
4956
|
+
|
4957
|
+
border-radius: 10px;
|
4958
|
+
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.12),
|
4959
|
+
0px 20px 20px 0px rgba(0, 0, 0, 0.08);
|
4960
|
+
|
4961
|
+
z-index: 2000;
|
4962
|
+
}
|
4963
|
+
|
4964
|
+
::slotted([slot='title']) {
|
4965
|
+
margin-bottom: 8px !important;
|
4966
|
+
color: #172a41;
|
4967
|
+
font-size: 18px;
|
4968
|
+
font-weight: 700;
|
4969
|
+
line-height: 150%;
|
4970
|
+
}
|
4971
|
+
|
4972
|
+
::slotted([slot='content']) {
|
4973
|
+
color: #4e647f;
|
4974
|
+
line-height: 150%;
|
4975
|
+
}
|
4976
|
+
|
4977
|
+
.button-wrapper {
|
4978
|
+
margin-top: 12px;
|
4979
|
+
display: flex;
|
4980
|
+
gap: 12px;
|
4981
|
+
|
4982
|
+
.btn {
|
4983
|
+
justify-self: stretch;
|
4984
|
+
padding: 10px;
|
4985
|
+
cursor: pointer;
|
4986
|
+
text-align: center;
|
4987
|
+
width: 100%;
|
4988
|
+
border: 0;
|
4989
|
+
color: #fff;
|
4990
|
+
line-height: 150%;
|
4991
|
+
text-transform: capitalize;
|
4992
|
+
}
|
4993
|
+
|
4994
|
+
.accept-btn {
|
4995
|
+
border-radius: 5px;
|
4996
|
+
background: #dc3545;
|
4997
|
+
|
4998
|
+
&:hover {
|
4999
|
+
background: rgb(176, 62, 25);
|
5000
|
+
}
|
5001
|
+
}
|
5002
|
+
|
5003
|
+
.decline-btn {
|
5004
|
+
border-radius: 5px;
|
5005
|
+
background: #4e647f;
|
5006
|
+
|
5007
|
+
&:hover {
|
5008
|
+
background: rgb(57, 77, 102);
|
5009
|
+
}
|
5010
|
+
}
|
5011
|
+
}
|
5012
|
+
`;
|
5013
|
+
|
5014
|
+
class ConfirmDialog extends i$1 {
|
5015
|
+
onAcceptClick(e) {
|
5016
|
+
e.preventDefault();
|
5017
|
+
this.dispatchEvent(new CustomEvent('accept', {
|
5018
|
+
composed: true,
|
5019
|
+
}));
|
5020
|
+
}
|
5021
|
+
onCancelClick(e) {
|
5022
|
+
e.preventDefault();
|
5023
|
+
this.dispatchEvent(new CustomEvent('decline', {
|
5024
|
+
composed: true,
|
5025
|
+
}));
|
5026
|
+
}
|
5027
|
+
render() {
|
5028
|
+
return x `
|
5029
|
+
<div class="modal">
|
5030
|
+
<slot name="title"></slot>
|
5031
|
+
<slot name="content"></slot>
|
5032
|
+
<div class="button-wrapper">
|
5033
|
+
<slot name="accept-btn">
|
5034
|
+
<button class="btn accept-btn" @click=${this.onAcceptClick}>
|
5035
|
+
Delete
|
5036
|
+
</button>
|
5037
|
+
</slot>
|
5038
|
+
<slot name="decline-btn">
|
5039
|
+
<button class="btn decline-btn" @click=${this.onCancelClick}>
|
5040
|
+
Cancel
|
5041
|
+
</button>
|
5042
|
+
</slot>
|
5043
|
+
</div>
|
5044
|
+
</div>
|
5045
|
+
`;
|
5046
|
+
}
|
5047
|
+
}
|
5048
|
+
ConfirmDialog.styles = [confirmDialogStyles];
|
5049
|
+
if (!customElements.get('confirm-dialog')) {
|
5050
|
+
customElements.define('confirm-dialog', ConfirmDialog);
|
5051
|
+
}
|
5052
|
+
|
5053
|
+
const chatbotIcon = b `<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
5054
|
+
<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"/>
|
5055
|
+
</svg>`;
|
5056
|
+
class ChatbotIcon extends i$1 {
|
5057
|
+
render() {
|
5058
|
+
return x ` <div class="chatbot-icon">${chatbotIcon}</div> `;
|
5059
|
+
}
|
5060
|
+
}
|
5061
|
+
ChatbotIcon.styles = [
|
5062
|
+
i$4 `
|
5063
|
+
.chatbot-icon {
|
5064
|
+
border: none;
|
5065
|
+
cursor: pointer;
|
5066
|
+
width: 60px;
|
5067
|
+
height: 58px;
|
5068
|
+
background-color: #020617;
|
5069
|
+
border-radius: 50%;
|
5070
|
+
display: flex;
|
5071
|
+
justify-content: center;
|
5072
|
+
align-items: center;
|
5073
|
+
box-shadow: 0px 10px 10px -5px #0000000a;
|
5074
|
+
}
|
5075
|
+
`,
|
5076
|
+
];
|
5077
|
+
if (!customElements.get('chatbot-icon')) {
|
5078
|
+
customElements.define('chatbot-icon', ChatbotIcon);
|
5079
|
+
}
|
5080
|
+
|
5081
|
+
class PopupView extends i$1 {
|
5082
|
+
constructor() {
|
5083
|
+
super(...arguments);
|
5084
|
+
this.showChatThreads = false;
|
5085
|
+
this.deleteAllThreads = false;
|
5086
|
+
this.userQuery = '';
|
5087
|
+
this.isStylesheetInjected = false;
|
5088
|
+
}
|
5089
|
+
connectedCallback() {
|
5090
|
+
super.connectedCallback();
|
5091
|
+
this.injectCustomCSS();
|
5092
|
+
}
|
5093
|
+
injectCustomCSS() {
|
5094
|
+
if (!this.isStylesheetInjected && this.css) {
|
5095
|
+
const sheet = new CSSStyleSheet();
|
5096
|
+
sheet.replaceSync(this.css);
|
5097
|
+
this.shadowRoot.adoptedStyleSheets.push(sheet);
|
5098
|
+
this.isStylesheetInjected = true;
|
5099
|
+
}
|
5100
|
+
}
|
5101
|
+
scrollToBottom() {
|
5102
|
+
var _a;
|
5103
|
+
(_a = this.chatWindowElement) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
5104
|
+
top: this.chatWindowElement.scrollHeight,
|
5105
|
+
behavior: 'smooth',
|
5106
|
+
});
|
5107
|
+
}
|
5108
|
+
async processMessage(e, message, isPrompt = false) {
|
5109
|
+
this.scrollToBottom();
|
5110
|
+
if (!this.thread) {
|
5111
|
+
await this.createChatThread({ title: '' }, false);
|
5112
|
+
}
|
5113
|
+
await this.sendMessageToServer(e, message, isPrompt);
|
5114
|
+
}
|
5115
|
+
sendEvent(action, actionData, clickData) {
|
5116
|
+
this.dispatchEvent(new CustomEvent('send-event', {
|
5117
|
+
detail: { action, actionData, clickData },
|
5118
|
+
composed: true,
|
5119
|
+
bubbles: true,
|
5120
|
+
}));
|
5121
|
+
}
|
5122
|
+
async onSubmit(e) {
|
5123
|
+
var _a;
|
5124
|
+
e.preventDefault();
|
5125
|
+
const message = (_a = this.userQuery) === null || _a === void 0 ? void 0 : _a.trim();
|
5126
|
+
this.userQuery = '';
|
5127
|
+
await this.processMessage(e, message, false);
|
5128
|
+
}
|
5129
|
+
handleThreadDelete() {
|
5130
|
+
if (this.deleteAllThreads) {
|
5131
|
+
this.dispatchEvent(new CustomEvent('delete-all-threads', {
|
5132
|
+
composed: true,
|
5133
|
+
bubbles: true,
|
5134
|
+
}));
|
5135
|
+
this.deleteAllThreads = false;
|
5136
|
+
return;
|
5137
|
+
}
|
5138
|
+
if (!this.deleteThreadId) {
|
5139
|
+
return;
|
5140
|
+
}
|
5141
|
+
this.dispatchEvent(new CustomEvent('delete-thread', {
|
5142
|
+
detail: { threadId: this.deleteThreadId },
|
5143
|
+
composed: true,
|
5144
|
+
bubbles: true,
|
5145
|
+
}));
|
5146
|
+
this.deleteThreadId = '';
|
5147
|
+
}
|
5148
|
+
handleFeedback(rating, messageId, queryMessageId, comment, query, response) {
|
5149
|
+
var _a, _b, _c, _d;
|
5150
|
+
if (rating === 'bad') {
|
5151
|
+
this.sendEvent('thumbsDown', undefined, {
|
5152
|
+
messageId,
|
5153
|
+
threadId: ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) || '',
|
5154
|
+
rating,
|
5155
|
+
comment: comment !== null && comment !== void 0 ? comment : '',
|
5156
|
+
query: query !== null && query !== void 0 ? query : '',
|
5157
|
+
response: response !== null && response !== void 0 ? response : '',
|
5158
|
+
});
|
5159
|
+
this.feedbackDetails = {
|
5160
|
+
messageId,
|
5161
|
+
queryMessageId,
|
5162
|
+
threadId: ((_b = this.thread) === null || _b === void 0 ? void 0 : _b.threadId) || '',
|
5163
|
+
comment,
|
5164
|
+
};
|
5165
|
+
return;
|
5166
|
+
}
|
5167
|
+
this.sendEvent('thumbsUp', undefined, {
|
5168
|
+
messageId,
|
5169
|
+
threadId: ((_c = this.thread) === null || _c === void 0 ? void 0 : _c.threadId) || '',
|
5170
|
+
rating,
|
5171
|
+
comment: comment !== null && comment !== void 0 ? comment : '',
|
5172
|
+
query: query !== null && query !== void 0 ? query : '',
|
5173
|
+
response: response !== null && response !== void 0 ? response : '',
|
5174
|
+
});
|
5175
|
+
this.dispatchEvent(new CustomEvent('submit-feedback', {
|
5176
|
+
detail: {
|
5177
|
+
messageId: messageId,
|
5178
|
+
queryMessageId: queryMessageId,
|
5179
|
+
threadId: (_d = this.thread) === null || _d === void 0 ? void 0 : _d.threadId,
|
5180
|
+
feedback: {
|
5181
|
+
rating,
|
5182
|
+
comment: null,
|
5183
|
+
},
|
5184
|
+
},
|
5185
|
+
composed: true,
|
5186
|
+
bubbles: true,
|
5187
|
+
}));
|
5188
|
+
}
|
5189
|
+
botMessage(message, index) {
|
5190
|
+
var _a, _b, _c, _d;
|
5191
|
+
const queryMessage = this.messages[index + 1];
|
5192
|
+
return x `
|
5193
|
+
<div class="message-wrapper">
|
5194
|
+
<div class="message bot">
|
5195
|
+
<div>
|
5196
|
+
${message.message
|
5197
|
+
? x ` <markdown-renderer
|
5198
|
+
.content=${message.message}
|
5199
|
+
></markdown-renderer>`
|
5200
|
+
: E}
|
5201
|
+
</div>
|
5202
|
+
</div>
|
5203
|
+
${message.products
|
5204
|
+
? x ` <products-list
|
5205
|
+
.query=${queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.message}
|
5206
|
+
.response=${message.message}
|
5207
|
+
.products=${message.products}
|
5208
|
+
.siteCurrency=${this.siteCurrency}
|
5209
|
+
.viewType=${this.viewType}
|
5210
|
+
.userId=${this.userId}
|
5211
|
+
></products-list>`
|
5212
|
+
: E}
|
5213
|
+
${message.messageId && (queryMessage === null || queryMessage === void 0 ? void 0 : queryMessage.messageId)
|
5214
|
+
? x ` <div class="bot-response-actions">
|
5215
|
+
<button
|
5216
|
+
type="button"
|
5217
|
+
@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)}
|
5218
|
+
>
|
5219
|
+
${((_b = message.feedback) === null || _b === void 0 ? void 0 : _b.rating) === 'good'
|
5220
|
+
? thumbsUpFilledBtn
|
5221
|
+
: thumbsUpBtn}
|
5222
|
+
</button>
|
5223
|
+
<button
|
5224
|
+
type="button"
|
5225
|
+
@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)}
|
5226
|
+
>
|
5227
|
+
${((_d = message.feedback) === null || _d === void 0 ? void 0 : _d.rating) === 'bad'
|
5228
|
+
? thumbsDownFilledBtn
|
5229
|
+
: thumbsDownBtn}
|
5230
|
+
</button>
|
5231
|
+
</div>`
|
5232
|
+
: E}
|
5233
|
+
${index === 0 ? this.renderPrompts() : E}
|
5234
|
+
</div>
|
5235
|
+
`;
|
5236
|
+
}
|
5237
|
+
renderBotIcon(width = 30, height = 30) {
|
5238
|
+
if (!this.botIconUrl) {
|
5239
|
+
return E;
|
5240
|
+
}
|
5241
|
+
return x ` <div class="bot-icon">
|
5242
|
+
<img src=${this.botIconUrl} width=${width} height=${height} />
|
5243
|
+
</div>`;
|
5244
|
+
}
|
5245
|
+
chatWindow() {
|
5246
|
+
if (this.isLoadingHistory || this.isLoadingThreads) {
|
5247
|
+
return x ` <div class="messages loading">
|
5248
|
+
<load-spinner></load-spinner>
|
5249
|
+
</div>`;
|
5250
|
+
}
|
5251
|
+
if (this.messages.length === 0) {
|
5252
|
+
return x `
|
5253
|
+
<div class="chat-welcome">
|
5254
|
+
${this.botIconUrl
|
5255
|
+
? this.renderBotIcon(60, 60)
|
5256
|
+
: x `<chatbot-icon></chatbot-icon>`}
|
5257
|
+
<div>
|
5258
|
+
<h2 class="welcome-title">Hello!</h2>
|
5259
|
+
<p class="welcome-message">
|
5260
|
+
I’m your personal AI concierge and I’m here to help you. What are
|
5261
|
+
you looking for today?
|
5262
|
+
</p>
|
5263
|
+
</div>
|
5264
|
+
${this.renderPrompts()}
|
5265
|
+
</div>
|
5266
|
+
`;
|
5267
|
+
}
|
5268
|
+
return x `
|
5269
|
+
<div class="messages">
|
5270
|
+
${this.isTyping
|
5271
|
+
? x ` <div class="message bot">
|
5272
|
+
<typing-indicator></typing-indicator>
|
5273
|
+
</div>`
|
5274
|
+
: ''}
|
5275
|
+
${this.isFailed
|
5276
|
+
? x ` <div class="message bot">
|
5277
|
+
<div>
|
5278
|
+
<p>
|
5279
|
+
Uh-oh! Looks like I tripped over some alpha-stage wires.
|
5280
|
+
Things are still a bit wobbly here, buy hey, that's what
|
5281
|
+
testing is for, Let's try that again; or feel free to throw
|
5282
|
+
another challenge my way!
|
5283
|
+
</p>
|
5284
|
+
</div>
|
5285
|
+
</div>`
|
5286
|
+
: E}
|
5287
|
+
${o$1(this.messages, (message, index) => {
|
5288
|
+
if (message.sender === 'bot') {
|
5289
|
+
return this.botMessage(message, index);
|
5290
|
+
}
|
5291
|
+
return x ` <div class="message user">${message.message}</div> `;
|
5292
|
+
})}
|
4334
5293
|
</div>
|
4335
5294
|
`;
|
4336
5295
|
}
|
4337
5296
|
renderPrompts() {
|
5297
|
+
var _a, _b;
|
4338
5298
|
if (this.isLoadingHistory || this.isStreaming || this.isLoadingThreads) {
|
4339
5299
|
return E;
|
4340
5300
|
}
|
4341
|
-
const
|
4342
|
-
const
|
4343
|
-
|
5301
|
+
const latestMessage = this.messages[0];
|
5302
|
+
const isWelcomeMessage = this.messages.length === 1 && (latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.sender) === 'bot';
|
5303
|
+
const isLLMPrompt = !!((_a = latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.prompts) === null || _a === void 0 ? void 0 : _a.length);
|
5304
|
+
let prompts = this.messages.length
|
5305
|
+
? this.messages[0].prompts
|
4344
5306
|
: this.prompts
|
4345
5307
|
? this.prompts.split(',').map((prompt) => prompt.trim())
|
4346
5308
|
: ['Best Sellers'];
|
@@ -4348,15 +5310,26 @@ class ChatSection extends i$1 {
|
|
4348
5310
|
if (!prompts && !customPrompts) {
|
4349
5311
|
return E;
|
4350
5312
|
}
|
5313
|
+
// limit the prompts to 5
|
5314
|
+
prompts = prompts === null || prompts === void 0 ? void 0 : prompts.slice(0, 5);
|
4351
5315
|
return x `
|
4352
|
-
<div
|
5316
|
+
<div
|
5317
|
+
class=${e$1({
|
5318
|
+
prompts: true,
|
5319
|
+
btn: true,
|
5320
|
+
'left-align': ((_b = this.messages) === null || _b === void 0 ? void 0 : _b.length) > 0,
|
5321
|
+
})}
|
5322
|
+
>
|
4353
5323
|
${o$1(prompts, (prompt) => {
|
4354
5324
|
return x `
|
4355
5325
|
<div
|
4356
5326
|
class="prompt"
|
4357
5327
|
@click=${(e) => {
|
4358
5328
|
this.processMessage(e, prompt, true);
|
4359
|
-
|
5329
|
+
const eventName = isLLMPrompt
|
5330
|
+
? 'customPromptClicked'
|
5331
|
+
: 'promptClicked';
|
5332
|
+
this.sendEvent(eventName, undefined, {
|
4360
5333
|
promptName: prompt,
|
4361
5334
|
});
|
4362
5335
|
}}
|
@@ -4383,93 +5356,20 @@ class ChatSection extends i$1 {
|
|
4383
5356
|
</div>
|
4384
5357
|
`;
|
4385
5358
|
}
|
4386
|
-
|
4387
|
-
var _a;
|
4388
|
-
if (!((_a = this.thread) === null || _a === void 0 ? void 0 : _a.devContext)) {
|
4389
|
-
return x `
|
4390
|
-
<div class="context-container">
|
4391
|
-
<div class="context-title">
|
4392
|
-
<p>Context</p>
|
4393
|
-
<div
|
4394
|
-
class="btn"
|
4395
|
-
@click=${() => {
|
4396
|
-
if (!this.contextContainerElement) {
|
4397
|
-
return;
|
4398
|
-
}
|
4399
|
-
this.contextContainerElement.classList.remove('show');
|
4400
|
-
}}
|
4401
|
-
>
|
4402
|
-
${closeBtn}
|
4403
|
-
</div>
|
4404
|
-
</div>
|
4405
|
-
<p>
|
4406
|
-
This search thread has no pre-defined context. Start a new search to
|
4407
|
-
personalize.
|
4408
|
-
</p>
|
4409
|
-
</div>
|
4410
|
-
`;
|
4411
|
-
}
|
4412
|
-
const devContext = this.thread.devContext;
|
4413
|
-
const profileType = devContext.email
|
4414
|
-
? 'Pick your profile'
|
4415
|
-
: 'Stay Anonymous';
|
4416
|
-
const userDetails = devContext.email
|
4417
|
-
? `${capitalizeEachWord(devContext.firstName)} / ${capitalizeEachWord(devContext.gender)} / ${devContext.city} / ${devContext.state ? `- ${capitalizeEachWord(devContext.state)}` : ''} - ${devContext.preferences
|
4418
|
-
? `${devContext.preferences.size},${capitalizeEachWord(devContext.preferences.color)},${capitalizeEachWord(devContext.preferences.material)}`
|
4419
|
-
: ''}`
|
4420
|
-
: '';
|
4421
|
-
const visitationType = devContext.productHandle ? 'Via Ad' : 'Direct Visit';
|
4422
|
-
return x `
|
4423
|
-
<div class="context-container">
|
4424
|
-
<div class="context-title">
|
4425
|
-
<p>Context</p>
|
4426
|
-
<div
|
4427
|
-
class="btn"
|
4428
|
-
@click=${() => {
|
4429
|
-
var _a;
|
4430
|
-
(_a = this.contextContainerElement) === null || _a === void 0 ? void 0 : _a.classList.remove('show');
|
4431
|
-
}}
|
4432
|
-
>
|
4433
|
-
${closeBtn}
|
4434
|
-
</div>
|
4435
|
-
</div>
|
4436
|
-
<div>
|
4437
|
-
<div class="context">
|
4438
|
-
<span>Profile Type:</span>${' '}
|
4439
|
-
<span class="context-type-value"> ${profileType} </span>
|
4440
|
-
</div>
|
4441
|
-
${userDetails
|
4442
|
-
? x ` <div class="context user-details">${userDetails}</div>`
|
4443
|
-
: E}
|
4444
|
-
</div>
|
4445
|
-
<div>
|
4446
|
-
<div class="context">
|
4447
|
-
<span>Visitation Context:</span>${' '}
|
4448
|
-
<span class="context-type-value">${visitationType}</span>
|
4449
|
-
</div>
|
4450
|
-
${devContext.productHandle
|
4451
|
-
? x ` <div class="context product-handle">
|
4452
|
-
${devContext.productHandle}
|
4453
|
-
</div>`
|
4454
|
-
: E}
|
4455
|
-
</div>
|
4456
|
-
</div>
|
4457
|
-
`;
|
4458
|
-
}
|
4459
|
-
modalViewHeader() {
|
5359
|
+
chatHeader() {
|
4460
5360
|
var _a;
|
4461
5361
|
return x `
|
4462
|
-
<div>
|
4463
|
-
${this.
|
4464
|
-
|
4465
|
-
|
4466
|
-
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
5362
|
+
<div class="chat-header">
|
5363
|
+
${this.renderBotIcon()}
|
5364
|
+
<h2>
|
5365
|
+
${this.brandName && !this.botIconUrl ? this.brandName : E}
|
5366
|
+
${((_a = this.thread) === null || _a === void 0 ? void 0 : _a.title) || 'AI Concierge'}
|
5367
|
+
</h2>
|
5368
|
+
<div class="btns-wrapper">
|
5369
|
+
<tooltip-component .position=${'bottom-right'} .text=${'New Chat'}>
|
5370
|
+
<button
|
5371
|
+
class="btn btn-icon new-search-btn"
|
5372
|
+
@click=${(e) => {
|
4473
5373
|
var _a, _b;
|
4474
5374
|
e.preventDefault();
|
4475
5375
|
if ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId) {
|
@@ -4477,85 +5377,49 @@ class ChatSection extends i$1 {
|
|
4477
5377
|
}
|
4478
5378
|
(_b = this.setSelectedThreadId) === null || _b === void 0 ? void 0 : _b.call(this, '');
|
4479
5379
|
}}
|
4480
|
-
|
5380
|
+
?disabled=${this.isStreaming}
|
5381
|
+
>
|
5382
|
+
${plusBtn}
|
5383
|
+
</button>
|
5384
|
+
</tooltip-component>
|
5385
|
+
<tooltip-component
|
5386
|
+
.position=${'bottom-right'}
|
5387
|
+
.text=${'Search History'}
|
4481
5388
|
>
|
4482
|
-
|
4483
|
-
|
4484
|
-
</tooltip-component>
|
4485
|
-
<tooltip-component
|
4486
|
-
.position=${'bottom-right'}
|
4487
|
-
.text=${'Search History'}
|
4488
|
-
>
|
4489
|
-
<button
|
4490
|
-
class=${e$1({
|
5389
|
+
<button
|
5390
|
+
class=${e$1({
|
4491
5391
|
btn: true,
|
4492
5392
|
'btn-icon': true,
|
4493
5393
|
'threads-btn': true,
|
4494
5394
|
active: this.showChatThreads,
|
4495
5395
|
})}
|
4496
|
-
|
5396
|
+
@click=${(e) => {
|
4497
5397
|
e.preventDefault();
|
4498
5398
|
this.showChatThreads = !this.showChatThreads;
|
4499
5399
|
if (this.showChatThreads) {
|
4500
5400
|
this.sendEvent('showThreads');
|
4501
5401
|
}
|
4502
5402
|
}}
|
4503
|
-
|
4504
|
-
|
4505
|
-
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
|
5403
|
+
>
|
5404
|
+
${historyBtn}
|
5405
|
+
</button>
|
5406
|
+
</tooltip-component>
|
5407
|
+
<tooltip-component .position=${'bottom-right'} .text=${'Close Chat'}>
|
5408
|
+
<button
|
5409
|
+
class="btn btn-icon close-btn"
|
5410
|
+
@click=${(e) => {
|
4511
5411
|
var _a;
|
4512
5412
|
e.preventDefault();
|
4513
5413
|
(_a = this.closeModal) === null || _a === void 0 ? void 0 : _a.call(this);
|
4514
5414
|
}}
|
4515
|
-
|
4516
|
-
|
4517
|
-
|
4518
|
-
|
5415
|
+
>
|
5416
|
+
${crossBtn}
|
5417
|
+
</button>
|
5418
|
+
</tooltip-component>
|
5419
|
+
</div>
|
4519
5420
|
</div>
|
4520
5421
|
`;
|
4521
5422
|
}
|
4522
|
-
contextButton() {
|
4523
|
-
var _a, _b, _c, _d;
|
4524
|
-
if (this.viewType === 'modal') {
|
4525
|
-
return this.modalViewHeader();
|
4526
|
-
}
|
4527
|
-
if (!this.devMode) {
|
4528
|
-
return ((_a = this.thread) === null || _a === void 0 ? void 0 : _a.threadId)
|
4529
|
-
? x `<h2>${((_b = this.thread) === null || _b === void 0 ? void 0 : _b.title) || 'New Search'}</h2>`
|
4530
|
-
: x `<h2>New Search</h2>`;
|
4531
|
-
}
|
4532
|
-
if ((_c = this.thread) === null || _c === void 0 ? void 0 : _c.threadId) {
|
4533
|
-
return x `
|
4534
|
-
<h2>${((_d = this.thread) === null || _d === void 0 ? void 0 : _d.title) || 'New Search'}</h2>
|
4535
|
-
<button
|
4536
|
-
class="btn-context btn"
|
4537
|
-
@click=${() => {
|
4538
|
-
if (!this.contextContainerElement) {
|
4539
|
-
return;
|
4540
|
-
}
|
4541
|
-
this.contextContainerElement.classList.toggle('show');
|
4542
|
-
}}
|
4543
|
-
>
|
4544
|
-
SHOW CONTEXT
|
4545
|
-
</button>
|
4546
|
-
${this.showContext()}
|
4547
|
-
`;
|
4548
|
-
}
|
4549
|
-
return x `
|
4550
|
-
<h2>Click personalize for hyper Contextual</h2>
|
4551
|
-
<button
|
4552
|
-
class="btn-context active btn"
|
4553
|
-
@click=${() => this.personalizeDialogElement.showModal()}
|
4554
|
-
>
|
4555
|
-
Personalize
|
4556
|
-
</button>
|
4557
|
-
`;
|
4558
|
-
}
|
4559
5423
|
renderChatThreads() {
|
4560
5424
|
if (!this.chatThreads || !this.showChatThreads) {
|
4561
5425
|
return E;
|
@@ -4631,52 +5495,38 @@ class ChatSection extends i$1 {
|
|
4631
5495
|
this.style.removeProperty('--shopgpt-merchant-img-url');
|
4632
5496
|
}
|
4633
5497
|
return x `
|
4634
|
-
|
4635
|
-
<div
|
4636
|
-
|
4637
|
-
'chatbot-section': true,
|
4638
|
-
'modal-view': this.viewType === 'modal',
|
4639
|
-
})}
|
4640
|
-
>
|
4641
|
-
${this.chatWindow()} ${this.renderPrompts()}
|
5498
|
+
${this.chatHeader()}
|
5499
|
+
<div class="chatbot-section">
|
5500
|
+
${this.chatWindow()}
|
4642
5501
|
<form class="chat-form" @submit=${this.onSubmit}>
|
5502
|
+
<span class="sparkles-icon"> ${sparklesSharp} </span>
|
4643
5503
|
<input
|
4644
5504
|
type="text"
|
4645
5505
|
.value=${this.userQuery}
|
4646
5506
|
@input=${(e) => (this.userQuery = e.target.value)}
|
4647
|
-
placeholder="
|
5507
|
+
placeholder="What are you looking for?"
|
4648
5508
|
/>
|
4649
5509
|
<button
|
4650
|
-
class
|
4651
|
-
btn: true,
|
4652
|
-
modal: this.viewType === 'modal',
|
4653
|
-
})}
|
5510
|
+
class="btn send-btn"
|
4654
5511
|
type="submit"
|
4655
5512
|
?disabled=${this.isStreaming || this.isLoadingHistory}
|
4656
5513
|
>
|
4657
|
-
${
|
5514
|
+
${sendBtn}
|
4658
5515
|
</button>
|
4659
5516
|
</form>
|
4660
|
-
|
4661
|
-
|
4662
|
-
|
4663
|
-
|
4664
|
-
|
4665
|
-
|
4666
|
-
|
4667
|
-
|
4668
|
-
|
4669
|
-
|
4670
|
-
|
4671
|
-
|
4672
|
-
</footer>`
|
4673
|
-
: E}
|
5517
|
+
<footer>
|
5518
|
+
Powered by
|
5519
|
+
<a
|
5520
|
+
target="_blank"
|
5521
|
+
href="https://shopgpt.edgeagents.ai"
|
5522
|
+
@click=${() => {
|
5523
|
+
this.sendEvent('blotoutLinkClicked');
|
5524
|
+
}}
|
5525
|
+
>
|
5526
|
+
Blotout
|
5527
|
+
</a>
|
5528
|
+
</footer>
|
4674
5529
|
</div>
|
4675
|
-
<personalize-dialog
|
4676
|
-
.createChatThread=${this.createChatThread.bind(this)}
|
4677
|
-
.defaultProductHandles=${this.productHandles}
|
4678
|
-
.defaultProfiles=${this.profiles}
|
4679
|
-
></personalize-dialog>
|
4680
5530
|
${this.renderChatThreads()}
|
4681
5531
|
${this.deleteThreadId || this.deleteAllThreads
|
4682
5532
|
? x `
|
@@ -4724,121 +5574,97 @@ class ChatSection extends i$1 {
|
|
4724
5574
|
`;
|
4725
5575
|
}
|
4726
5576
|
}
|
4727
|
-
|
5577
|
+
PopupView.styles = [chatSectionStyles];
|
4728
5578
|
__decorate([
|
4729
5579
|
n({ type: String }),
|
4730
5580
|
__metadata("design:type", Object)
|
4731
|
-
],
|
5581
|
+
], PopupView.prototype, "merchantImage", void 0);
|
4732
5582
|
__decorate([
|
4733
5583
|
n({ type: String }),
|
4734
5584
|
__metadata("design:type", Object)
|
4735
|
-
],
|
5585
|
+
], PopupView.prototype, "botIconUrl", void 0);
|
4736
5586
|
__decorate([
|
4737
5587
|
n({ type: String }),
|
4738
5588
|
__metadata("design:type", Object)
|
4739
|
-
],
|
5589
|
+
], PopupView.prototype, "brandName", void 0);
|
4740
5590
|
__decorate([
|
4741
5591
|
n({ type: String }),
|
4742
5592
|
__metadata("design:type", Object)
|
4743
|
-
],
|
5593
|
+
], PopupView.prototype, "prompts", void 0);
|
4744
5594
|
__decorate([
|
4745
5595
|
n({ type: Array }),
|
4746
5596
|
__metadata("design:type", Object)
|
4747
|
-
],
|
5597
|
+
], PopupView.prototype, "customPrompts", void 0);
|
4748
5598
|
__decorate([
|
4749
5599
|
n({ type: Boolean }),
|
4750
5600
|
__metadata("design:type", Boolean)
|
4751
|
-
],
|
5601
|
+
], PopupView.prototype, "isLoadingThreads", void 0);
|
4752
5602
|
__decorate([
|
4753
5603
|
n({ type: Object }),
|
4754
5604
|
__metadata("design:type", Map)
|
4755
|
-
],
|
5605
|
+
], PopupView.prototype, "chatThreads", void 0);
|
4756
5606
|
__decorate([
|
4757
5607
|
r(),
|
4758
5608
|
__metadata("design:type", String)
|
4759
|
-
],
|
5609
|
+
], PopupView.prototype, "deleteThreadId", void 0);
|
4760
5610
|
__decorate([
|
4761
5611
|
n({ type: Boolean }),
|
4762
5612
|
__metadata("design:type", Object)
|
4763
|
-
],
|
5613
|
+
], PopupView.prototype, "showChatThreads", void 0);
|
4764
5614
|
__decorate([
|
4765
5615
|
n({ type: Boolean }),
|
4766
5616
|
__metadata("design:type", Boolean)
|
4767
|
-
],
|
4768
|
-
__decorate([
|
4769
|
-
n({ type: Boolean }),
|
4770
|
-
__metadata("design:type", Object)
|
4771
|
-
], ChatSection.prototype, "devMode", void 0);
|
5617
|
+
], PopupView.prototype, "isLoadingHistory", void 0);
|
4772
5618
|
__decorate([
|
4773
5619
|
n({ type: Boolean }),
|
4774
5620
|
__metadata("design:type", Boolean)
|
4775
|
-
],
|
5621
|
+
], PopupView.prototype, "isTyping", void 0);
|
4776
5622
|
__decorate([
|
4777
5623
|
n({ type: Boolean }),
|
4778
5624
|
__metadata("design:type", Boolean)
|
4779
|
-
],
|
5625
|
+
], PopupView.prototype, "isStreaming", void 0);
|
4780
5626
|
__decorate([
|
4781
5627
|
n({ type: Boolean }),
|
4782
5628
|
__metadata("design:type", Boolean)
|
4783
|
-
],
|
5629
|
+
], PopupView.prototype, "isFailed", void 0);
|
4784
5630
|
__decorate([
|
4785
5631
|
n({ type: Array }),
|
4786
5632
|
__metadata("design:type", Array)
|
4787
|
-
],
|
4788
|
-
__decorate([
|
4789
|
-
n({ type: Array }),
|
4790
|
-
__metadata("design:type", Array)
|
4791
|
-
], ChatSection.prototype, "profiles", void 0);
|
4792
|
-
__decorate([
|
4793
|
-
n({ type: Array }),
|
4794
|
-
__metadata("design:type", Array)
|
4795
|
-
], ChatSection.prototype, "productHandles", void 0);
|
5633
|
+
], PopupView.prototype, "messages", void 0);
|
4796
5634
|
__decorate([
|
4797
5635
|
n({ type: Object }),
|
4798
5636
|
__metadata("design:type", Object)
|
4799
|
-
],
|
5637
|
+
], PopupView.prototype, "thread", void 0);
|
4800
5638
|
__decorate([
|
4801
5639
|
n({ type: Object }),
|
4802
5640
|
__metadata("design:type", Object)
|
4803
|
-
],
|
5641
|
+
], PopupView.prototype, "siteCurrency", void 0);
|
4804
5642
|
__decorate([
|
4805
5643
|
r(),
|
4806
5644
|
__metadata("design:type", Object)
|
4807
|
-
],
|
4808
|
-
__decorate([
|
4809
|
-
e$3('.context-container'),
|
4810
|
-
__metadata("design:type", Object)
|
4811
|
-
], ChatSection.prototype, "contextContainerElement", void 0);
|
5645
|
+
], PopupView.prototype, "deleteAllThreads", void 0);
|
4812
5646
|
__decorate([
|
4813
5647
|
e$3('.chat-window'),
|
4814
5648
|
__metadata("design:type", Object)
|
4815
|
-
],
|
4816
|
-
__decorate([
|
4817
|
-
e$3('personalize-dialog'),
|
4818
|
-
__metadata("design:type", Object)
|
4819
|
-
], ChatSection.prototype, "personalizeDialogElement", void 0);
|
5649
|
+
], PopupView.prototype, "chatWindowElement", void 0);
|
4820
5650
|
__decorate([
|
4821
5651
|
r(),
|
4822
5652
|
__metadata("design:type", Object)
|
4823
|
-
],
|
5653
|
+
], PopupView.prototype, "feedbackDetails", void 0);
|
4824
5654
|
__decorate([
|
4825
5655
|
n({ type: String }),
|
4826
5656
|
__metadata("design:type", Object)
|
4827
|
-
],
|
5657
|
+
], PopupView.prototype, "userQuery", void 0);
|
4828
5658
|
__decorate([
|
4829
5659
|
n({ type: String }),
|
4830
5660
|
__metadata("design:type", String)
|
4831
|
-
],
|
4832
|
-
__decorate([
|
4833
|
-
n({ type: Boolean }),
|
4834
|
-
__metadata("design:type", Boolean)
|
4835
|
-
], ChatSection.prototype, "fromAd", void 0);
|
5661
|
+
], PopupView.prototype, "css", void 0);
|
4836
5662
|
__decorate([
|
4837
5663
|
n({ type: String }),
|
4838
5664
|
__metadata("design:type", String)
|
4839
|
-
],
|
4840
|
-
if (!customElements.get('
|
4841
|
-
customElements.define('
|
5665
|
+
], PopupView.prototype, "userId", void 0);
|
5666
|
+
if (!customElements.get('popup-view')) {
|
5667
|
+
customElements.define('popup-view', PopupView);
|
4842
5668
|
}
|
4843
5669
|
|
4844
5670
|
async function* streamToIterable(stream) {
|
@@ -4934,15 +5760,20 @@ class ShopGPT extends i$1 {
|
|
4934
5760
|
this.modalState = 'close';
|
4935
5761
|
(_a = this.shopGPTDialog) === null || _a === void 0 ? void 0 : _a.close();
|
4936
5762
|
};
|
4937
|
-
this.
|
4938
|
-
var _a;
|
5763
|
+
this.isWelcomeFlowRequired = () => {
|
5764
|
+
var _a, _b;
|
4939
5765
|
if (this.devMode) {
|
4940
5766
|
const thread = this.chatThreads.get(this.selectedThreadId);
|
4941
|
-
return
|
5767
|
+
return ((_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.email)
|
5768
|
+
? true
|
5769
|
+
: !!((_b = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _b === void 0 ? void 0 : _b.productHandle);
|
4942
5770
|
}
|
4943
5771
|
const searchParams = new URLSearchParams(window.location.search);
|
4944
|
-
|
4945
|
-
|
5772
|
+
const userType = getUserType(this.destination, this.sessionId);
|
5773
|
+
if (userType === 'known') {
|
5774
|
+
return true;
|
5775
|
+
}
|
5776
|
+
return isFromAd(searchParams) || searchParams.get('shopGPT') === '1';
|
4946
5777
|
};
|
4947
5778
|
this.submitQuery = (message) => {
|
4948
5779
|
if (!message) {
|
@@ -5007,6 +5838,7 @@ class ShopGPT extends i$1 {
|
|
5007
5838
|
// If the url has `utm_source` open the popup when reloaded
|
5008
5839
|
if (hasSource && isDesktop) {
|
5009
5840
|
this.modalState = 'open';
|
5841
|
+
setUserInteracted(this.destination);
|
5010
5842
|
}
|
5011
5843
|
}
|
5012
5844
|
}
|
@@ -5035,15 +5867,17 @@ class ShopGPT extends i$1 {
|
|
5035
5867
|
if (!thread) {
|
5036
5868
|
return;
|
5037
5869
|
}
|
5038
|
-
const
|
5039
|
-
|
5040
|
-
|
5041
|
-
: fromAd
|
5042
|
-
? this.storeAPI.getCurrentProductHandle()
|
5043
|
-
: undefined;
|
5044
|
-
if (!fromAd) {
|
5870
|
+
const welcomeFlow = this.isWelcomeFlowRequired();
|
5871
|
+
let productHandle;
|
5872
|
+
if (!welcomeFlow) {
|
5045
5873
|
return;
|
5046
5874
|
}
|
5875
|
+
if (this.devMode) {
|
5876
|
+
productHandle = (_a = thread === null || thread === void 0 ? void 0 : thread.devContext) === null || _a === void 0 ? void 0 : _a.productHandle;
|
5877
|
+
}
|
5878
|
+
else if (welcomeFlow) {
|
5879
|
+
productHandle = this.storeAPI.getCurrentProductHandle();
|
5880
|
+
}
|
5047
5881
|
try {
|
5048
5882
|
this.isTyping = true;
|
5049
5883
|
this.isStreaming = true;
|
@@ -5083,7 +5917,7 @@ class ShopGPT extends i$1 {
|
|
5083
5917
|
if (latestThread) {
|
5084
5918
|
this.setSelectedThreadId(latestThread.threadId, true);
|
5085
5919
|
}
|
5086
|
-
else if (!this.devMode && this.
|
5920
|
+
else if (!this.devMode && this.isWelcomeFlowRequired()) {
|
5087
5921
|
this.createChatThread({ title: '' }, true);
|
5088
5922
|
}
|
5089
5923
|
}
|
@@ -5111,7 +5945,7 @@ class ShopGPT extends i$1 {
|
|
5111
5945
|
message: message.message,
|
5112
5946
|
sender: message.sender,
|
5113
5947
|
products,
|
5114
|
-
|
5948
|
+
prompts: message.prompts,
|
5115
5949
|
feedback: message.feedback,
|
5116
5950
|
};
|
5117
5951
|
});
|
@@ -5243,7 +6077,7 @@ class ShopGPT extends i$1 {
|
|
5243
6077
|
...latestMessage,
|
5244
6078
|
message: messageData.message || '',
|
5245
6079
|
messageId: messageData.messageId,
|
5246
|
-
|
6080
|
+
prompts: messageData.prompts,
|
5247
6081
|
sender: 'bot',
|
5248
6082
|
isChunk: false,
|
5249
6083
|
},
|
@@ -5366,7 +6200,7 @@ class ShopGPT extends i$1 {
|
|
5366
6200
|
url: e.detail.url,
|
5367
6201
|
title: e.detail.title,
|
5368
6202
|
rank: e.detail.rank,
|
5369
|
-
});
|
6203
|
+
}, true);
|
5370
6204
|
}
|
5371
6205
|
getSiteCurrency() {
|
5372
6206
|
return this.storeAPI.getSiteCurrency();
|
@@ -5425,7 +6259,7 @@ class ShopGPT extends i$1 {
|
|
5425
6259
|
.customPrompts=${this.customPrompts}
|
5426
6260
|
.botIconUrl=${this.botIconUrl}
|
5427
6261
|
.css=${this.css}
|
5428
|
-
.
|
6262
|
+
.welcomeFlowTriggered=${this.isWelcomeFlowRequired()}
|
5429
6263
|
.userId=${this.userId}
|
5430
6264
|
></chat-section>
|
5431
6265
|
</div>
|
@@ -5439,74 +6273,76 @@ class ShopGPT extends i$1 {
|
|
5439
6273
|
this.modalState = 'close';
|
5440
6274
|
this.shopGPTAPI.sendEvent('chatbotClosed');
|
5441
6275
|
};
|
5442
|
-
|
5443
|
-
|
6276
|
+
return x `
|
6277
|
+
${this.modalState === 'open'
|
6278
|
+
? x `<div
|
6279
|
+
id="shop-gpt-modal"
|
6280
|
+
@delete-thread=${this.handleThreadDelete}
|
6281
|
+
@delete-all-threads=${this.handleAllThreadsDelete}
|
6282
|
+
@submit-feedback=${this.submitFeedback}
|
6283
|
+
@click=${this.handleUserInteraction}
|
6284
|
+
@send-event=${this.sendEvent}
|
6285
|
+
@product-clicked=${this.productClicked}
|
6286
|
+
>
|
6287
|
+
<popup-view
|
6288
|
+
.prompts=${this.quickPrompts}
|
6289
|
+
.brandName=${this.brandName}
|
6290
|
+
.isFailed=${this.isFailed}
|
6291
|
+
.isLoadingHistory=${this.isLoadingHistory}
|
6292
|
+
.isTyping=${this.isTyping}
|
6293
|
+
.isStreaming=${this.isStreaming}
|
6294
|
+
.messages=${this.messages}
|
6295
|
+
.siteCurrency=${this.getSiteCurrency()}
|
6296
|
+
.sendMessageToServer=${this.sendMessageToServer.bind(this)}
|
6297
|
+
.thread=${thread}
|
6298
|
+
.createChatThread=${this.createChatThread.bind(this)}
|
6299
|
+
.viewType=${'modal'}
|
6300
|
+
.closeModal=${closeModal}
|
6301
|
+
.setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
|
6302
|
+
.chatThreads=${this.chatThreads}
|
6303
|
+
.isLoadingThreads=${this.isLoadingThreads}
|
6304
|
+
.merchantImage=${this.merchantImage}
|
6305
|
+
.customPrompts=${this.customPrompts}
|
6306
|
+
.botIconUrl=${this.botIconUrl}
|
6307
|
+
.css=${this.css}
|
6308
|
+
.userId=${this.userId}
|
6309
|
+
></popup-view>
|
6310
|
+
</div>`
|
6311
|
+
: E}
|
6312
|
+
<div class="chatbot-widget">
|
5444
6313
|
<button
|
5445
6314
|
@click=${(e) => {
|
5446
|
-
|
6315
|
+
e.preventDefault();
|
6316
|
+
if (this.modalState === 'open') {
|
6317
|
+
closeModal();
|
6318
|
+
}
|
6319
|
+
else {
|
5447
6320
|
this.openModal();
|
5448
|
-
}
|
6321
|
+
}
|
6322
|
+
}}
|
5449
6323
|
>
|
5450
|
-
|
6324
|
+
<chatbot-icon></chatbot-icon>
|
5451
6325
|
</button>
|
5452
6326
|
${((_a = this.nudge) === null || _a === void 0 ? void 0 : _a.show) && this.showNudge
|
5453
|
-
|
6327
|
+
? x ` <div
|
5454
6328
|
class="nudge"
|
5455
6329
|
@click=${(e) => {
|
5456
|
-
|
5457
|
-
|
5458
|
-
|
6330
|
+
e.preventDefault();
|
6331
|
+
this.openModal();
|
6332
|
+
}}
|
5459
6333
|
>
|
5460
6334
|
Hi there! I'm an AI Agent to help you find the perfect product.
|
5461
6335
|
What are you looking for today?
|
5462
6336
|
</div>`
|
5463
|
-
|
6337
|
+
: x ` <div class="chatbot-hover-text">
|
5464
6338
|
What are you looking for today?
|
5465
6339
|
</div>`}
|
5466
|
-
</div>`;
|
5467
|
-
}
|
5468
|
-
return x `
|
5469
|
-
<div
|
5470
|
-
id="shop-gpt-modal"
|
5471
|
-
@delete-thread=${this.handleThreadDelete}
|
5472
|
-
@delete-all-threads=${this.handleAllThreadsDelete}
|
5473
|
-
@submit-feedback=${this.submitFeedback}
|
5474
|
-
@click=${this.handleUserInteraction}
|
5475
|
-
@send-event=${this.sendEvent}
|
5476
|
-
@product-clicked=${this.productClicked}
|
5477
|
-
>
|
5478
|
-
<chat-section
|
5479
|
-
.prompts=${this.quickPrompts}
|
5480
|
-
.brandName=${this.brandName}
|
5481
|
-
.isFailed=${this.isFailed}
|
5482
|
-
.isLoadingHistory=${this.isLoadingHistory}
|
5483
|
-
.isTyping=${this.isTyping}
|
5484
|
-
.isStreaming=${this.isStreaming}
|
5485
|
-
.messages=${this.messages}
|
5486
|
-
.siteCurrency=${this.getSiteCurrency()}
|
5487
|
-
.sendMessageToServer=${this.sendMessageToServer.bind(this)}
|
5488
|
-
.thread=${thread}
|
5489
|
-
.createChatThread=${this.createChatThread.bind(this)}
|
5490
|
-
.devMode=${this.devMode}
|
5491
|
-
.productHandles=${this.productHandles}
|
5492
|
-
.profiles=${this.profiles}
|
5493
|
-
.viewType=${'modal'}
|
5494
|
-
.closeModal=${closeModal}
|
5495
|
-
.setSelectedThreadId=${this.setSelectedThreadId.bind(this)}
|
5496
|
-
.chatThreads=${this.chatThreads}
|
5497
|
-
.isLoadingThreads=${this.isLoadingThreads}
|
5498
|
-
.merchantImage=${this.merchantImage}
|
5499
|
-
.customPrompts=${this.customPrompts}
|
5500
|
-
.botIconUrl=${this.botIconUrl}
|
5501
|
-
.css=${this.css}
|
5502
|
-
.fromAd=${this.isFromAd()}
|
5503
|
-
.userId=${this.userId}
|
5504
|
-
></chat-section>
|
5505
6340
|
</div>
|
5506
6341
|
`;
|
5507
6342
|
}
|
5508
6343
|
openModal() {
|
5509
6344
|
setIsBotOpened(this.destination, this.sessionId, true);
|
6345
|
+
setUserInteracted(this.destination);
|
5510
6346
|
this.shopGPTAPI.sendEvent('chatbotOpened');
|
5511
6347
|
this.modalState = 'open';
|
5512
6348
|
this.handleUserInteraction();
|