@blotoutio/providers-shop-gpt-sdk 1.13.0 → 1.14.0

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