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