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