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