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

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