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