tanya-chatbot 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tanya-chatbot.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect as
|
|
1
|
+
import { useEffect as M, useState as z, useRef as It } from "react";
|
|
2
2
|
import { jsx as a, jsxs as u, Fragment as re } from "react/jsx-runtime";
|
|
3
3
|
import { createHttpLink as sr, ApolloClient as lr, InMemoryCache as cr, ApolloProvider as dr } from "@apollo/client";
|
|
4
4
|
import { Provider as ur, useDispatch as je, useSelector as Ht } from "react-redux";
|
|
@@ -9,10 +9,10 @@ import "tailwind-merge";
|
|
|
9
9
|
import T from "axios";
|
|
10
10
|
import "crypto-js";
|
|
11
11
|
import { Icon as ge } from "@iconify/react";
|
|
12
|
-
import { toast as
|
|
12
|
+
import { toast as H } from "react-toastify";
|
|
13
13
|
const fr = '*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-full{top:100%}.z-40{z-index:40}.z-50{z-index:50}.m-1{margin:.25rem}.m-3{margin:.75rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-20{margin-bottom:5rem}.mb-24{margin-bottom:6rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-12{height:3rem}.h-28{height:7rem}.h-3{height:.75rem}.h-6{height:1.5rem}.h-\\[120px\\]{height:120px}.h-\\[200px\\]{height:200px}.h-\\[60px\\]{height:60px}.h-\\[90vh\\]{height:90vh}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.w-28{width:7rem}.w-3{width:.75rem}.w-5\\/6{width:83.333333%}.w-6{width:1.5rem}.w-72{width:18rem}.w-\\[100vw\\]{width:100vw}.w-\\[120px\\]{width:120px}.w-\\[150px\\]{width:150px}.w-\\[60px\\]{width:60px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.max-w-\\[200px\\]{max-width:200px}.max-w-\\[75\\%\\]{max-width:75%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[20px\\]{border-radius:20px}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.rounded-l-\\[20px\\]{border-top-left-radius:20px;border-bottom-left-radius:20px}.rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-xl{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-bl-2xl{border-bottom-left-radius:1rem}.rounded-br-xl{border-bottom-right-radius:.75rem}.rounded-tr-\\[20px\\]{border-top-right-radius:20px}.rounded-tr-\\[5px\\]{border-top-right-radius:5px}.border{border-width:1px}.border-0{border-width:0px}.border-b-2{border-bottom-width:2px}.border-l-2{border-left-width:2px}.border-t-2{border-top-width:2px}.border-none{border-style:none}.border-\\[\\#C9C2DE\\]{--tw-border-opacity: 1;border-color:rgb(201 194 222 / var(--tw-border-opacity, 1))}.border-\\[\\#E5E5E5\\]{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.bg-\\[\\#553D94\\]{--tw-bg-opacity: 1;background-color:rgb(85 61 148 / var(--tw-bg-opacity, 1))}.bg-\\[\\#6851C6\\]{--tw-bg-opacity: 1;background-color:rgb(104 81 198 / var(--tw-bg-opacity, 1))}.bg-\\[\\#804C9E0D\\]{background-color:#804c9e0d}.bg-\\[\\#A21CAF\\]{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity, 1))}.bg-\\[\\#AB192D\\]{--tw-bg-opacity: 1;background-color:rgb(171 25 45 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E2DBFF\\]{--tw-bg-opacity: 1;background-color:rgb(226 219 255 / var(--tw-bg-opacity, 1))}.bg-\\[\\#E3DEEF\\]{--tw-bg-opacity: 1;background-color:rgb(227 222 239 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F3F3F3\\]{--tw-bg-opacity: 1;background-color:rgb(243 243 243 / var(--tw-bg-opacity, 1))}.bg-\\[\\#FFFFFF\\],.bg-\\[\\#ffffff\\]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-black\\/30{background-color:#0000004d}.bg-indigo-300{--tw-bg-opacity: 1;background-color:rgb(165 180 252 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-\\[1px\\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-7{padding-left:1.75rem;padding-right:1.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pr-5{padding-right:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-nunitoSans{font-family:Nunito Sans}.text-\\[12px\\]{font-size:12px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-\\[\\#000000\\]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-\\[\\#14121F\\]{--tw-text-opacity: 1;color:rgb(20 18 31 / var(--tw-text-opacity, 1))}.text-\\[\\#18181B\\]{--tw-text-opacity: 1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.text-\\[\\#232323\\]{--tw-text-opacity: 1;color:rgb(35 35 35 / var(--tw-text-opacity, 1))}.text-\\[\\#323135\\]{--tw-text-opacity: 1;color:rgb(50 49 53 / var(--tw-text-opacity, 1))}.text-\\[\\#494949\\]{--tw-text-opacity: 1;color:rgb(73 73 73 / var(--tw-text-opacity, 1))}.text-\\[\\#555555\\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\\[\\#5B5B5B\\]{--tw-text-opacity: 1;color:rgb(91 91 91 / var(--tw-text-opacity, 1))}.text-\\[\\#68656E\\]{--tw-text-opacity: 1;color:rgb(104 101 110 / var(--tw-text-opacity, 1))}.text-\\[\\#959595\\]{--tw-text-opacity: 1;color:rgb(149 149 149 / var(--tw-text-opacity, 1))}.text-\\[\\#EC5050\\]{--tw-text-opacity: 1;color:rgb(236 80 80 / var(--tw-text-opacity, 1))}.text-\\[\\#FBFBFC\\]{--tw-text-opacity: 1;color:rgb(251 251 252 / var(--tw-text-opacity, 1))}.text-\\[\\#FFFFFF\\]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-80{opacity:.8}.shadow-\\[0px_2px_2px_0px_\\#9292BC40\\]{--tw-shadow: 0px 2px 2px 0px #9292BC40;--tw-shadow-colored: 0px 2px 2px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0px_4px_10px_0px_\\#5F499840\\]{--tw-shadow: 0px 4px 10px 0px #5F499840;--tw-shadow-colored: 0px 4px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}html,body,#root{margin:0;padding:0}:root{line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;padding:0}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.hover\\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:text-\\[\\#6952C7\\]:hover{--tw-text-opacity: 1;color:rgb(105 82 199 / var(--tw-text-opacity, 1))}.hover\\:opacity-90:hover{opacity:.9}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}@media(min-width:640px){.sm\\:w-\\[80vw\\]{width:80vw}}@media(min-width:768px){.md\\:h-\\[100vh\\]{height:100vh}.md\\:w-1\\/2{width:50%}.md\\:w-\\[770px\\]{width:770px}.md\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:flex-row{flex-direction:row}}@media(min-width:1024px){.lg\\:h-\\[100vh\\]{height:100vh}.lg\\:w-1\\/2{width:50%}.lg\\:w-2\\/3{width:66.666667%}.lg\\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\\:flex-row{flex-direction:row}.lg\\:rounded-l-xl{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.lg\\:rounded-bl-xl{border-bottom-left-radius:.75rem}}';
|
|
14
14
|
function vo() {
|
|
15
|
-
return
|
|
15
|
+
return M(() => {
|
|
16
16
|
if (typeof document < "u") {
|
|
17
17
|
const t = document.createElement("style");
|
|
18
18
|
return t.textContent = fr, document.head.appendChild(t), () => {
|
|
@@ -97,11 +97,11 @@ function vr({
|
|
|
97
97
|
}) {
|
|
98
98
|
return /* @__PURE__ */ a(Le.Trigger, { "data-slot": "popover-trigger", ...t });
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const kt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream", xAPIKey: "BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi", serverUrl: "https://tanya-sfcc-server.vercel.app/", basePath: "sc-api" }), qe = async () => {
|
|
101
101
|
const t = "https://tanya-sfcc-server.vercel.app/";
|
|
102
102
|
try {
|
|
103
103
|
const e = await T.post(
|
|
104
|
-
`${t}api/auth/token-bm-grant?baseUrl=${
|
|
104
|
+
`${t}api/auth/token-bm-grant?baseUrl=${Z()}&siteId=${K()}`
|
|
105
105
|
);
|
|
106
106
|
return e.status === 200 && e.data.access_token ? e.data.access_token : (console.error("Failed to fetch token:", e.data), null);
|
|
107
107
|
} catch (e) {
|
|
@@ -111,7 +111,7 @@ const vt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
111
111
|
const e = "https://tanya-sfcc-server.vercel.app/";
|
|
112
112
|
try {
|
|
113
113
|
const r = JSON.parse(sessionStorage.getItem("customerData") || "{}").dwsid, o = await T.post(
|
|
114
|
-
`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${
|
|
114
|
+
`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Z()}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
115
115
|
{},
|
|
116
116
|
{
|
|
117
117
|
headers: {
|
|
@@ -125,23 +125,23 @@ const vt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
125
125
|
return T.isAxiosError(r) ? console.error("Error creating basket:", r.response || r.message) : console.error("Unexpected error:", r), null;
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
async function
|
|
128
|
+
async function Ot() {
|
|
129
129
|
var c;
|
|
130
|
-
const t =
|
|
130
|
+
const t = K(), e = "access_token_" + t, r = "expires_in_" + t, o = localStorage.getItem(r), n = localStorage.getItem(e);
|
|
131
131
|
return console.log(n), (c = JSON.parse(sessionStorage.getItem("customerData") || "{}")) != null && c.isGuest, console.log("access token found in local storage"), { access_token: n, expires_in: o };
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const Z = () => sessionStorage.getItem("Host"), K = () => sessionStorage.getItem("SiteId"), it = () => sessionStorage.getItem("pubCfg"), st = () => sessionStorage.getItem("envRef"), lt = () => sessionStorage.getItem("orgRef"), be = async (t) => {
|
|
134
134
|
console.log("fetching results");
|
|
135
|
-
const { serverUrl: e, basePath: r } =
|
|
135
|
+
const { serverUrl: e, basePath: r } = kt();
|
|
136
136
|
let o = "";
|
|
137
137
|
{
|
|
138
|
-
const n = await
|
|
138
|
+
const n = await Ot();
|
|
139
139
|
console.log("the token from getSearchResults", n), o = n.access_token;
|
|
140
140
|
}
|
|
141
141
|
try {
|
|
142
|
-
const n =
|
|
142
|
+
const n = Z();
|
|
143
143
|
return (await T.get(
|
|
144
|
-
`${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${
|
|
144
|
+
`${e}${r}/search-sfcc?baseUrl=${n}&query=${t}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
145
145
|
{
|
|
146
146
|
headers: {
|
|
147
147
|
"Content-Type": "application/json",
|
|
@@ -154,11 +154,11 @@ const Q = () => sessionStorage.getItem("Host"), Y = () => sessionStorage.getItem
|
|
|
154
154
|
}
|
|
155
155
|
}, He = async (t) => {
|
|
156
156
|
if (!t) throw new Error("Product ID is required");
|
|
157
|
-
const { serverUrl: e, basePath: r } =
|
|
157
|
+
const { serverUrl: e, basePath: r } = kt(), o = Z();
|
|
158
158
|
console.log("calling access");
|
|
159
|
-
const { access_token: n } = await
|
|
159
|
+
const { access_token: n } = await Ot();
|
|
160
160
|
return console.log(n), (await T.get(
|
|
161
|
-
`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${
|
|
161
|
+
`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
162
162
|
{
|
|
163
163
|
headers: {
|
|
164
164
|
"Content-Type": "application/json",
|
|
@@ -170,13 +170,13 @@ const Q = () => sessionStorage.getItem("Host"), Y = () => sessionStorage.getItem
|
|
|
170
170
|
if (!t) throw new Error("customerId is required");
|
|
171
171
|
const e = await qe(), { customer_token: r } = await Me(
|
|
172
172
|
e
|
|
173
|
-
), { serverUrl: o, basePath: n } =
|
|
173
|
+
), { serverUrl: o, basePath: n } = kt(), l = (await Ot()).access_token;
|
|
174
174
|
return (await T.get(
|
|
175
|
-
`${o}${n}/get-interest?baseUrl=${
|
|
175
|
+
`${o}${n}/get-interest?baseUrl=${Z()}&customerId=${t}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
176
176
|
{
|
|
177
177
|
headers: {
|
|
178
178
|
"Content-Type": "application/json",
|
|
179
|
-
Authorization: `Bearer ${
|
|
179
|
+
Authorization: `Bearer ${l}`
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
)).data;
|
|
@@ -198,31 +198,31 @@ const Q = () => sessionStorage.getItem("Host"), Y = () => sessionStorage.getItem
|
|
|
198
198
|
}).join("");
|
|
199
199
|
function Cr() {
|
|
200
200
|
const t = () => window.innerWidth < 425 ? 1 : window.innerWidth < 768 ? 2 : 4, [e, r] = z(t);
|
|
201
|
-
return
|
|
201
|
+
return M(() => {
|
|
202
202
|
const o = () => r(t());
|
|
203
203
|
return window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
|
|
204
204
|
}, []), e;
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const Ir = ({
|
|
207
207
|
product: t
|
|
208
208
|
}) => {
|
|
209
209
|
const e = je(), r = Cr(), [o, n] = z(0), c = () => {
|
|
210
210
|
n(
|
|
211
|
-
(
|
|
211
|
+
(s) => s + r >= t.length ? 0 : s + r
|
|
212
212
|
);
|
|
213
|
-
},
|
|
213
|
+
}, l = () => {
|
|
214
214
|
n(
|
|
215
|
-
(
|
|
215
|
+
(s) => s - r < 0 ? t.length - (t.length % r || r) : s - r
|
|
216
216
|
);
|
|
217
|
-
}, d = async (
|
|
218
|
-
const
|
|
219
|
-
e(oe(
|
|
217
|
+
}, d = async (s) => {
|
|
218
|
+
const v = await He(s);
|
|
219
|
+
e(oe(v));
|
|
220
220
|
};
|
|
221
221
|
return /* @__PURE__ */ a("div", { className: "mt-2 overflow-x-hidden", children: /* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-4 relative", children: [
|
|
222
222
|
(t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
|
|
223
223
|
"button",
|
|
224
224
|
{
|
|
225
|
-
onClick:
|
|
225
|
+
onClick: l,
|
|
226
226
|
className: "absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",
|
|
227
227
|
style: {
|
|
228
228
|
height: "30px",
|
|
@@ -232,22 +232,22 @@ const Fr = ({
|
|
|
232
232
|
children: "<"
|
|
233
233
|
}
|
|
234
234
|
),
|
|
235
|
-
/* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((
|
|
236
|
-
var
|
|
235
|
+
/* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: t.slice(o, o + r).map((s) => {
|
|
236
|
+
var v, g, S, C;
|
|
237
237
|
return /* @__PURE__ */ u(
|
|
238
238
|
"div",
|
|
239
239
|
{
|
|
240
240
|
className: "flex-shrink-0 flex flex-col w-[150px] h-[200px] p-2 items-center justify-between cursor-pointer bg-[#FFFFFF] rounded-[10px] shadow-[0px_2px_2px_0px_#9292BC40]",
|
|
241
241
|
onClick: () => {
|
|
242
|
-
d(
|
|
242
|
+
d(s.product_id ?? s.productId);
|
|
243
243
|
},
|
|
244
244
|
children: [
|
|
245
245
|
/* @__PURE__ */ a("div", { className: "w-full p-2 flex items-center justify-center bg-white", children: /* @__PURE__ */ a(
|
|
246
246
|
"img",
|
|
247
247
|
{
|
|
248
|
-
src: ((
|
|
248
|
+
src: ((v = ye(s)[0]) == null ? void 0 : v.link) || ye(s)[0] || // fallback if it's a string
|
|
249
249
|
"https://via.placeholder.com/120",
|
|
250
|
-
alt:
|
|
250
|
+
alt: s != null && s.productName ? s.productName : "Product",
|
|
251
251
|
className: "w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"
|
|
252
252
|
}
|
|
253
253
|
) }),
|
|
@@ -257,8 +257,8 @@ const Fr = ({
|
|
|
257
257
|
className: "text-white w-full p-2 text-[12px] text-center h-[60px]",
|
|
258
258
|
children: [
|
|
259
259
|
/* @__PURE__ */ u("div", { className: "relative inline-block group", children: [
|
|
260
|
-
/* @__PURE__ */ a("div", { className: "w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans", children:
|
|
261
|
-
xe((g =
|
|
260
|
+
/* @__PURE__ */ a("div", { className: "w-full line-clamp-1 overflow-hidden text-ellipsis text-[#000000] font-medium font-nunitoSans", children: s != null && s.productName ? s.productName : s != null && s.product_name ? s.product_name : ke(
|
|
261
|
+
xe((g = s == null ? void 0 : s.name) == null ? void 0 : g["en-US"]),
|
|
262
262
|
60
|
|
263
263
|
) || "Product" }),
|
|
264
264
|
/* @__PURE__ */ a(
|
|
@@ -272,8 +272,8 @@ const Fr = ({
|
|
|
272
272
|
marginBottom: "5px",
|
|
273
273
|
zIndex: 50
|
|
274
274
|
},
|
|
275
|
-
children:
|
|
276
|
-
xe((
|
|
275
|
+
children: s != null && s.productName ? s.productName : s != null && s.product_name ? s.product_name : ke(
|
|
276
|
+
xe((S = s == null ? void 0 : s.name) == null ? void 0 : S["en-US"]),
|
|
277
277
|
60
|
|
278
278
|
) || "Product"
|
|
279
279
|
}
|
|
@@ -281,12 +281,12 @@ const Fr = ({
|
|
|
281
281
|
] }),
|
|
282
282
|
/* @__PURE__ */ u("div", { className: " flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1", children: [
|
|
283
283
|
/* @__PURE__ */ a("p", { children: Sr(
|
|
284
|
-
|
|
285
|
-
(C = ve(
|
|
284
|
+
s != null && s.price ? Number(s == null ? void 0 : s.price) : ve(s).centAmount || 0,
|
|
285
|
+
(C = ve(s)) == null ? void 0 : C.currencyCode
|
|
286
286
|
) }),
|
|
287
287
|
/* @__PURE__ */ u("p", { className: "text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate", children: [
|
|
288
288
|
"$",
|
|
289
|
-
Number(
|
|
289
|
+
Number(s == null ? void 0 : s.price).toFixed(2) ?? 5
|
|
290
290
|
] })
|
|
291
291
|
] })
|
|
292
292
|
]
|
|
@@ -294,7 +294,7 @@ const Fr = ({
|
|
|
294
294
|
)
|
|
295
295
|
]
|
|
296
296
|
},
|
|
297
|
-
|
|
297
|
+
s.productId
|
|
298
298
|
);
|
|
299
299
|
}) }),
|
|
300
300
|
(t == null ? void 0 : t.length) > r && /* @__PURE__ */ a(
|
|
@@ -311,7 +311,7 @@ const Fr = ({
|
|
|
311
311
|
}
|
|
312
312
|
)
|
|
313
313
|
] }) });
|
|
314
|
-
},
|
|
314
|
+
}, Fr = ({ chat: t, storeDetails: e }) => /* @__PURE__ */ a("div", { className: "bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full", children: t.map((r, o) => /* @__PURE__ */ u(
|
|
315
315
|
"div",
|
|
316
316
|
{
|
|
317
317
|
className: "mb-4 p-3 rounded-xl",
|
|
@@ -328,7 +328,7 @@ const Fr = ({
|
|
|
328
328
|
}
|
|
329
329
|
),
|
|
330
330
|
/* @__PURE__ */ a(
|
|
331
|
-
|
|
331
|
+
Ir,
|
|
332
332
|
{
|
|
333
333
|
product: r.items,
|
|
334
334
|
storeDetails: e
|
|
@@ -338,13 +338,13 @@ const Fr = ({
|
|
|
338
338
|
},
|
|
339
339
|
o
|
|
340
340
|
)) }), Ve = async (t, e) => {
|
|
341
|
-
var c,
|
|
342
|
-
const { serverUrl: r, basePath: o } =
|
|
341
|
+
var c, l;
|
|
342
|
+
const { serverUrl: r, basePath: o } = kt(), n = `${r}`;
|
|
343
343
|
console.log(`customer_token
|
|
344
344
|
`, t);
|
|
345
345
|
try {
|
|
346
346
|
const d = await T.post(
|
|
347
|
-
`${n}${o}/basket/create?baseUrl=${
|
|
347
|
+
`${n}${o}/basket/create?baseUrl=${Z()}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
348
348
|
e,
|
|
349
349
|
{
|
|
350
350
|
headers: {
|
|
@@ -356,7 +356,7 @@ const Fr = ({
|
|
|
356
356
|
return window.postMessage(
|
|
357
357
|
{
|
|
358
358
|
type: "WIDGET_CREATED_BASKET",
|
|
359
|
-
basketId: ((c = d.data) == null ? void 0 : c.basket_id) || ((
|
|
359
|
+
basketId: ((c = d.data) == null ? void 0 : c.basket_id) || ((l = d.data) == null ? void 0 : l.basketId)
|
|
360
360
|
},
|
|
361
361
|
"*"
|
|
362
362
|
), d.data;
|
|
@@ -364,10 +364,10 @@ const Fr = ({
|
|
|
364
364
|
return T.isAxiosError(d) ? console.error("Error creating basket:", d.response || d.message) : console.error("Unexpected error:", d), null;
|
|
365
365
|
}
|
|
366
366
|
}, Rt = async (t, e, r) => {
|
|
367
|
-
const { serverUrl: o, basePath: n } =
|
|
367
|
+
const { serverUrl: o, basePath: n } = kt(), c = `${o}`;
|
|
368
368
|
try {
|
|
369
|
-
const
|
|
370
|
-
`${c}${n}/basket/add-product/${t}?baseUrl=${
|
|
369
|
+
const l = await T.post(
|
|
370
|
+
`${c}${n}/basket/add-product/${t}?baseUrl=${Z()}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
371
371
|
e,
|
|
372
372
|
{
|
|
373
373
|
headers: {
|
|
@@ -376,22 +376,22 @@ const Fr = ({
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
);
|
|
379
|
-
return
|
|
380
|
-
} catch (
|
|
381
|
-
return T.isAxiosError(
|
|
379
|
+
return l.status === 200 && l.data ? l.data : null;
|
|
380
|
+
} catch (l) {
|
|
381
|
+
return T.isAxiosError(l) ? console.error(
|
|
382
382
|
"Error adding products to basket:",
|
|
383
|
-
|
|
384
|
-
) : console.error("Unexpected error:",
|
|
383
|
+
l.response || l.message
|
|
384
|
+
) : console.error("Unexpected error:", l), null;
|
|
385
385
|
}
|
|
386
386
|
}, Re = async ({
|
|
387
387
|
basketId: t,
|
|
388
388
|
customer_token: e
|
|
389
389
|
}) => {
|
|
390
390
|
var c;
|
|
391
|
-
const { serverUrl: r, basePath: o } =
|
|
391
|
+
const { serverUrl: r, basePath: o } = kt(), n = `${r}`;
|
|
392
392
|
try {
|
|
393
|
-
const
|
|
394
|
-
`${n}${o}/basket/${t}?baseUrl=${
|
|
393
|
+
const l = await T.get(
|
|
394
|
+
`${n}${o}/basket/${t}?baseUrl=${Z()}&siteId=${K()}&pubCfg=${it()}&envRef=${st()}&orgRef=${lt()}`,
|
|
395
395
|
{
|
|
396
396
|
headers: {
|
|
397
397
|
"Content-Type": "application/json",
|
|
@@ -399,12 +399,12 @@ const Fr = ({
|
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
);
|
|
402
|
-
return { status:
|
|
403
|
-
} catch (
|
|
404
|
-
return T.isAxiosError(
|
|
402
|
+
return { status: l.status, data: l.data };
|
|
403
|
+
} catch (l) {
|
|
404
|
+
return T.isAxiosError(l) ? { status: (c = l.response) == null ? void 0 : c.status, data: null } : { status: null, data: null };
|
|
405
405
|
}
|
|
406
|
-
}, Yt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Nr = 300 * 1e3,
|
|
407
|
-
const
|
|
406
|
+
}, Yt = "sfcc_basket_id", Se = "sfcc_customer_token", Tt = "sfcc_token_expiry", Nr = 300 * 1e3, Ft = "1.0.0";
|
|
407
|
+
const at = (t) => {
|
|
408
408
|
try {
|
|
409
409
|
t ? localStorage.setItem(Yt, t) : localStorage.removeItem(Yt);
|
|
410
410
|
} catch (e) {
|
|
@@ -422,69 +422,69 @@ const nt = (t) => {
|
|
|
422
422
|
console.error("Error storing token:", e);
|
|
423
423
|
}
|
|
424
424
|
}, _e = 300, Er = () => {
|
|
425
|
-
var d,
|
|
426
|
-
const t = je(), e = Ht((
|
|
427
|
-
if (
|
|
425
|
+
var d, s, v, g, S, C;
|
|
426
|
+
const t = je(), e = Ht((I) => I.product.product), r = Ht((I) => I.store.store), [o, n] = z(!!e);
|
|
427
|
+
if (M(() => {
|
|
428
428
|
n(!!e);
|
|
429
429
|
}, [e]), !e) return null;
|
|
430
430
|
const c = async () => {
|
|
431
|
-
var
|
|
431
|
+
var I, j, J, ct, V, dt, St, Pt, tt, _t, Ct, ut, $t, zt, et, O;
|
|
432
432
|
console.log(e, "the prod");
|
|
433
433
|
try {
|
|
434
|
-
if (!((j = (
|
|
435
|
-
|
|
434
|
+
if (!((j = (I = e == null ? void 0 : e.variants) == null ? void 0 : I[0]) != null && j.product_id) && !(e.type.item || e.type.bundle) && !((ct = (J = e == null ? void 0 : e.variants) == null ? void 0 : J[0]) != null && ct.productId)) {
|
|
435
|
+
H.error("Variants not available", {
|
|
436
436
|
position: "bottom-right",
|
|
437
437
|
autoClose: 1e3
|
|
438
438
|
}), console.error("No product variant found");
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
441
|
+
const _ = [
|
|
442
442
|
{
|
|
443
|
-
product_id: ((
|
|
443
|
+
product_id: ((V = e.variants) == null ? void 0 : V[0].product_id) || ((dt = e.variants) == null ? void 0 : dt[0].productId) || (e == null ? void 0 : e.id),
|
|
444
444
|
quantity: 1
|
|
445
445
|
}
|
|
446
446
|
];
|
|
447
|
-
console.log(
|
|
447
|
+
console.log(_, "the product data");
|
|
448
448
|
const k = JSON.parse(
|
|
449
449
|
sessionStorage.getItem("customerData") || "{}"
|
|
450
|
-
),
|
|
450
|
+
), rt = (k == null ? void 0 : k.basketId) || localStorage.getItem(Yt), Wt = !1, At = localStorage.getItem(Tt), jt = Date.now();
|
|
451
451
|
if (!Wt || !At || jt >= parseInt(At)) {
|
|
452
452
|
let $ = "";
|
|
453
453
|
{
|
|
454
|
-
const
|
|
455
|
-
console.log("token from auth data"), $ = "Bearer " +
|
|
454
|
+
const ft = await Ot();
|
|
455
|
+
console.log("token from auth data"), $ = "Bearer " + ft.access_token;
|
|
456
456
|
}
|
|
457
457
|
if (!$) {
|
|
458
458
|
console.error("Failed to get customer_token");
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
|
-
const
|
|
462
|
-
if (Kt($), localStorage.setItem(Tt,
|
|
463
|
-
const
|
|
464
|
-
basketId:
|
|
461
|
+
const pt = jt + 300 * 1e3;
|
|
462
|
+
if (Kt($), localStorage.setItem(Tt, pt.toString()), rt) {
|
|
463
|
+
const ft = await Re({
|
|
464
|
+
basketId: rt,
|
|
465
465
|
customer_token: $
|
|
466
466
|
});
|
|
467
|
-
if (console.log(
|
|
467
|
+
if (console.log(rt, "basket id from customer"), ft.status === 200 && ft) {
|
|
468
468
|
const D = await Rt(
|
|
469
|
-
|
|
470
|
-
|
|
469
|
+
rt,
|
|
470
|
+
_,
|
|
471
471
|
$
|
|
472
472
|
);
|
|
473
|
-
(((
|
|
473
|
+
(((St = D == null ? void 0 : D.product_items) == null ? void 0 : St.length) > 0 || ((Pt = D == null ? void 0 : D.productItems) == null ? void 0 : Pt.length) > 0) && (H.success("Added to cart", {
|
|
474
474
|
position: "bottom-right",
|
|
475
475
|
autoClose: 3e3,
|
|
476
476
|
hideProgressBar: !1,
|
|
477
477
|
closeOnClick: !0,
|
|
478
478
|
pauseOnHover: !0,
|
|
479
479
|
draggable: !0
|
|
480
|
-
}), Vt(
|
|
480
|
+
}), Vt(rt));
|
|
481
481
|
return;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
const Dt = {
|
|
485
485
|
productItems: [
|
|
486
486
|
{
|
|
487
|
-
productId: ((
|
|
487
|
+
productId: ((tt = e.variants) == null ? void 0 : tt[0].product_id) || ((_t = e.variants) == null ? void 0 : _t[0].productId) || (e == null ? void 0 : e.id),
|
|
488
488
|
quantity: 1
|
|
489
489
|
}
|
|
490
490
|
]
|
|
@@ -503,15 +503,15 @@ const nt = (t) => {
|
|
|
503
503
|
console.log(
|
|
504
504
|
"setting stored id",
|
|
505
505
|
(h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId)
|
|
506
|
-
),
|
|
506
|
+
), at(
|
|
507
507
|
(h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId)
|
|
508
508
|
), console.log("adding product to basket");
|
|
509
|
-
const
|
|
509
|
+
const W = await Rt(
|
|
510
510
|
(h == null ? void 0 : h.basket_id) || (h == null ? void 0 : h.basketId),
|
|
511
|
-
|
|
511
|
+
_,
|
|
512
512
|
$
|
|
513
513
|
);
|
|
514
|
-
console.log("object added to basket"), (((
|
|
514
|
+
console.log("object added to basket"), (((Ct = W == null ? void 0 : W.product_items) == null ? void 0 : Ct.length) > 0 || ((ut = W == null ? void 0 : W.productItems) == null ? void 0 : ut.length) > 0) && H.success("Added to cart", {
|
|
515
515
|
position: "bottom-right",
|
|
516
516
|
autoClose: 3e3,
|
|
517
517
|
hideProgressBar: !1,
|
|
@@ -520,17 +520,17 @@ const nt = (t) => {
|
|
|
520
520
|
draggable: !0
|
|
521
521
|
}), Vt(h.basket_id || (h == null ? void 0 : h.basketId));
|
|
522
522
|
}
|
|
523
|
-
} catch (
|
|
524
|
-
console.error("Error adding to cart:",
|
|
523
|
+
} catch (_) {
|
|
524
|
+
console.error("Error adding to cart:", _), H.error("Failed to add product to cart", {
|
|
525
525
|
position: "bottom-right",
|
|
526
526
|
autoClose: 3e3
|
|
527
|
-
}), (($t =
|
|
528
|
-
((zt =
|
|
527
|
+
}), (($t = _ == null ? void 0 : _.response) == null ? void 0 : $t.status) === 404 || // Basket not found
|
|
528
|
+
((zt = _ == null ? void 0 : _.response) == null ? void 0 : zt.status) === 401 ? (((et = _ == null ? void 0 : _.response) == null ? void 0 : et.status) === 404 && at(null), ((O = _ == null ? void 0 : _.response) == null ? void 0 : O.status) === 401 && (at(null), Kt(null))) : (console.error("Failed to add product to basket:", _.message), H.error("Failed to add product to cart", {
|
|
529
529
|
position: "bottom-right",
|
|
530
530
|
autoClose: 3e3
|
|
531
531
|
}));
|
|
532
532
|
}
|
|
533
|
-
},
|
|
533
|
+
}, l = () => {
|
|
534
534
|
e && (window.location.href = e.c_pdpUrl);
|
|
535
535
|
};
|
|
536
536
|
return console.log(e, "the prod"), /* @__PURE__ */ u(re, { children: [
|
|
@@ -552,7 +552,7 @@ const nt = (t) => {
|
|
|
552
552
|
${o ? "translate-y-0 md:translate-y-0 md:translate-x-0 opacity-100" : "translate-y-full md:translate-y-0 md:translate-x-full opacity-0 pointer-events-none"}
|
|
553
553
|
`,
|
|
554
554
|
style: { willChange: "transform, opacity" },
|
|
555
|
-
onClick: (
|
|
555
|
+
onClick: (I) => I.stopPropagation(),
|
|
556
556
|
children: [
|
|
557
557
|
/* @__PURE__ */ u("div", { className: "mt-3 flex flex-row justify-between w-full ", children: [
|
|
558
558
|
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-[#000000] font-bold font-nunitoSans", children: e.name }) }),
|
|
@@ -574,13 +574,13 @@ const nt = (t) => {
|
|
|
574
574
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
|
|
575
575
|
"img",
|
|
576
576
|
{
|
|
577
|
-
src: (g = (
|
|
577
|
+
src: (g = (v = (s = (d = e.imageGroups) == null ? void 0 : d[0]) == null ? void 0 : s.images) == null ? void 0 : v[0]) == null ? void 0 : g.link,
|
|
578
578
|
alt: e.name,
|
|
579
579
|
className: "rounded-[10px]"
|
|
580
580
|
}
|
|
581
581
|
) }),
|
|
582
582
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2", children: e.imageGroups.slice(1, 2).map(
|
|
583
|
-
(
|
|
583
|
+
(I) => I.images.slice(1, 2).map((j) => /* @__PURE__ */ a(
|
|
584
584
|
"img",
|
|
585
585
|
{
|
|
586
586
|
src: j.link,
|
|
@@ -623,7 +623,7 @@ const nt = (t) => {
|
|
|
623
623
|
/* @__PURE__ */ u("div", { className: "mt-4 flex flex-col gap-2 w-full p-2", children: [
|
|
624
624
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center gap-2", children: /* @__PURE__ */ u("div", { className: "flex items-center gap-2 text-left font-nunitoSans", children: [
|
|
625
625
|
/* @__PURE__ */ u("div", { className: "text-[#323135] font-bold", children: [
|
|
626
|
-
((
|
|
626
|
+
((S = e == null ? void 0 : e.rating) == null ? void 0 : S.rate) || 0,
|
|
627
627
|
" /",
|
|
628
628
|
" ",
|
|
629
629
|
/* @__PURE__ */ a("span", { className: "text-[#68656E]", children: "5" })
|
|
@@ -634,8 +634,8 @@ const nt = (t) => {
|
|
|
634
634
|
" ratings"
|
|
635
635
|
] })
|
|
636
636
|
] }) }),
|
|
637
|
-
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((
|
|
638
|
-
var
|
|
637
|
+
/* @__PURE__ */ a("div", { className: "mt-2 flex flex-row items-center gap-2", children: Array.from({ length: 5 }).map((I, j) => {
|
|
638
|
+
var J;
|
|
639
639
|
return /* @__PURE__ */ a(
|
|
640
640
|
ge,
|
|
641
641
|
{
|
|
@@ -643,7 +643,7 @@ const nt = (t) => {
|
|
|
643
643
|
width: "20",
|
|
644
644
|
height: "20",
|
|
645
645
|
className: `text-yellow-500
|
|
646
|
-
${((
|
|
646
|
+
${((J = e == null ? void 0 : e.rating) == null ? void 0 : J.rate) > j ? "text-yellow-500" : "text-gray-300"}
|
|
647
647
|
`
|
|
648
648
|
},
|
|
649
649
|
j
|
|
@@ -670,7 +670,7 @@ const nt = (t) => {
|
|
|
670
670
|
{
|
|
671
671
|
className: "rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",
|
|
672
672
|
style: { backgroundColor: r.tanyaThemeColor },
|
|
673
|
-
onClick:
|
|
673
|
+
onClick: l,
|
|
674
674
|
children: "View more"
|
|
675
675
|
}
|
|
676
676
|
)
|
|
@@ -699,122 +699,149 @@ const nt = (t) => {
|
|
|
699
699
|
"Niece/Nephew": "his/her niece/nephew",
|
|
700
700
|
"My Friends": "his/her friends",
|
|
701
701
|
Others: "others"
|
|
702
|
-
}, n =
|
|
703
|
-
id:
|
|
704
|
-
title:
|
|
705
|
-
image:
|
|
706
|
-
price:
|
|
707
|
-
}), [
|
|
708
|
-
|
|
702
|
+
}, n = It(null), c = It(null), l = It(null), d = It(null), [s, v] = z(null), [g, S] = z(!1), [C, I] = z(!1), [j, J] = z(!1), [ct, V] = z(!1), [dt, St] = z(!1), [Pt, tt] = z(!1), [_t, Ct] = z(""), [ut, $t] = z(""), zt = (i) => ({
|
|
703
|
+
id: i.id,
|
|
704
|
+
title: i.name,
|
|
705
|
+
image: i.image ?? "",
|
|
706
|
+
price: i.price ?? 0
|
|
707
|
+
}), [et, O] = z([]), _ = It(null), k = Ht((i) => i.store.store), rt = Ht((i) => i.product.product);
|
|
708
|
+
M(() => {
|
|
709
|
+
const i = localStorage.getItem(
|
|
710
|
+
`access_token_${t.siteId}`
|
|
711
|
+
), b = localStorage.getItem(
|
|
712
|
+
`chat-token-${t.siteId}`
|
|
713
|
+
);
|
|
714
|
+
if (i && b === i) {
|
|
715
|
+
const m = localStorage.getItem("chatHistory");
|
|
716
|
+
m && O(JSON.parse(m));
|
|
717
|
+
} else
|
|
718
|
+
localStorage.setItem("chatHistory", JSON.stringify([])), localStorage.setItem(
|
|
719
|
+
`chat-token-${t.siteId}`,
|
|
720
|
+
i || ""
|
|
721
|
+
);
|
|
722
|
+
}, []), M(() => {
|
|
723
|
+
localStorage.setItem("chatHistory", JSON.stringify(et));
|
|
724
|
+
const i = localStorage.getItem(
|
|
725
|
+
`access_token_${t.siteId}`
|
|
726
|
+
);
|
|
727
|
+
i && localStorage.setItem(`chat-token-${t.siteId}`, i);
|
|
728
|
+
}, [et]);
|
|
729
|
+
const Wt = () => {
|
|
730
|
+
J(!0), setTimeout(() => I(!0), 10);
|
|
709
731
|
}, At = () => {
|
|
710
|
-
|
|
732
|
+
I(!1), setTimeout(() => J(!1), 300);
|
|
711
733
|
};
|
|
712
|
-
|
|
734
|
+
M(() => {
|
|
713
735
|
g ? Wt() : At();
|
|
714
736
|
}, [g]);
|
|
715
|
-
const jt = (
|
|
716
|
-
$t(o[
|
|
737
|
+
const jt = (i) => {
|
|
738
|
+
$t(o[i]);
|
|
717
739
|
};
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}, [
|
|
721
|
-
let $ = null,
|
|
740
|
+
M(() => {
|
|
741
|
+
_.current && (_.current.scrollTop += 150);
|
|
742
|
+
}, [et]);
|
|
743
|
+
let $ = null, pt = null;
|
|
722
744
|
const Dt = async () => {
|
|
723
|
-
if ($ &&
|
|
745
|
+
if ($ && pt && Date.now() < pt)
|
|
724
746
|
return $;
|
|
725
747
|
try {
|
|
726
|
-
const
|
|
748
|
+
const i = "https://us-east-1lsr29ln3u.auth.us-east-1.amazoncognito.com/oauth2/token", b = new URLSearchParams({
|
|
727
749
|
grant_type: "client_credentials",
|
|
728
750
|
client_id: "4i8rd70sgt961tc4dhskgf08c",
|
|
729
751
|
client_secret: "bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",
|
|
730
752
|
scope: "default-m2m-resource-server-8xzfzo/read"
|
|
731
|
-
}), m = await fetch(
|
|
753
|
+
}), m = await fetch(i, {
|
|
732
754
|
method: "POST",
|
|
733
755
|
headers: {
|
|
734
756
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
735
757
|
},
|
|
736
|
-
body:
|
|
758
|
+
body: b
|
|
737
759
|
});
|
|
738
760
|
if (!m.ok)
|
|
739
761
|
throw new Error(
|
|
740
762
|
`Token request failed! status: ${m.status}`
|
|
741
763
|
);
|
|
742
|
-
const
|
|
743
|
-
$ =
|
|
744
|
-
const p =
|
|
745
|
-
return
|
|
746
|
-
} catch (
|
|
747
|
-
return console.error("Error obtaining JWT token:",
|
|
764
|
+
const x = await m.json();
|
|
765
|
+
$ = x.access_token;
|
|
766
|
+
const p = x.expires_in || 3600;
|
|
767
|
+
return pt = Date.now() + (p - 60) * 1e3, $;
|
|
768
|
+
} catch (i) {
|
|
769
|
+
return console.error("Error obtaining JWT token:", i), $ = null, pt = null, null;
|
|
748
770
|
}
|
|
749
771
|
}, h = async () => {
|
|
750
|
-
const
|
|
751
|
-
|
|
772
|
+
const i = await Ot();
|
|
773
|
+
i != null && v(i);
|
|
752
774
|
};
|
|
753
|
-
|
|
775
|
+
M(() => {
|
|
754
776
|
if (t != null && t.siteId) {
|
|
755
|
-
const { clientID:
|
|
756
|
-
sessionStorage.setItem("Host",
|
|
777
|
+
const { clientID: i, host: b, organizationID: m, shortCode: x, siteId: p } = t;
|
|
778
|
+
sessionStorage.setItem("Host", b), sessionStorage.setItem("SiteId", p), sessionStorage.setItem("pubCfg", btoa(i)), sessionStorage.setItem("envRef", x), sessionStorage.setItem("orgRef", m);
|
|
757
779
|
}
|
|
758
780
|
h(), console.log("scapi environment v1");
|
|
759
|
-
}, []),
|
|
760
|
-
e && (console.log("setting the basket id", e),
|
|
761
|
-
}, [e])
|
|
762
|
-
|
|
763
|
-
|
|
781
|
+
}, []), M(() => {
|
|
782
|
+
e && (console.log("setting the basket id", e), at(e));
|
|
783
|
+
}, [e]), M(() => {
|
|
784
|
+
const i = async () => {
|
|
785
|
+
S(!1);
|
|
786
|
+
};
|
|
787
|
+
return window.addEventListener("reactCartUpdated", i), () => window.removeEventListener("reactCartUpdated", i);
|
|
788
|
+
}, []);
|
|
789
|
+
const W = async () => {
|
|
790
|
+
const i = JSON.parse(
|
|
764
791
|
sessionStorage.getItem("customerData") || "{}"
|
|
765
792
|
).customerId;
|
|
766
|
-
return (await kr(
|
|
767
|
-
},
|
|
768
|
-
console.log("in secondary flow",
|
|
769
|
-
const m = await
|
|
770
|
-
if (console.log(m, "interests of customer",
|
|
793
|
+
return (await kr(i || "")).c_interests;
|
|
794
|
+
}, ft = async (i, b) => {
|
|
795
|
+
console.log("in secondary flow", Ft);
|
|
796
|
+
const m = await W();
|
|
797
|
+
if (console.log(m, "interests of customer", Ft), !!m)
|
|
771
798
|
try {
|
|
772
799
|
O(
|
|
773
800
|
(U) => U.map(
|
|
774
|
-
(
|
|
801
|
+
(R, Y) => Y === U.length - 1 ? { ...R, secondaryLoading: !0 } : R
|
|
775
802
|
)
|
|
776
803
|
);
|
|
777
|
-
const
|
|
778
|
-
if (!
|
|
779
|
-
const p = localStorage.getItem("customerNumber"), w = localStorage.getItem("isLoggedIn"),
|
|
804
|
+
const x = await Dt();
|
|
805
|
+
if (!x) throw new Error("Failed to fetch token");
|
|
806
|
+
const p = localStorage.getItem("customerNumber"), w = localStorage.getItem("isLoggedIn"), ht = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
|
|
780
807
|
registered: String(w || !1),
|
|
781
808
|
userId: String(p || (/* @__PURE__ */ new Date()).getTime())
|
|
782
|
-
}).toString()}`,
|
|
809
|
+
}).toString()}`, mt = JSON.stringify({
|
|
783
810
|
flowId: "Q166PR519W",
|
|
784
811
|
flowAliasId: "HKFUVLWVH2",
|
|
785
812
|
input: {
|
|
786
813
|
loyaltyPoints: "",
|
|
787
|
-
productName:
|
|
788
|
-
productPoints: String(
|
|
814
|
+
productName: i,
|
|
815
|
+
productPoints: String(b || 0),
|
|
789
816
|
interests: m
|
|
790
817
|
}
|
|
791
|
-
}), L = await fetch(
|
|
818
|
+
}), L = await fetch(ht, {
|
|
792
819
|
signal: AbortSignal.timeout(3e4),
|
|
793
820
|
method: "POST",
|
|
794
821
|
headers: {
|
|
795
822
|
"Content-Type": "application/json",
|
|
796
|
-
Authorization: `Bearer ${
|
|
823
|
+
Authorization: `Bearer ${x}`
|
|
797
824
|
},
|
|
798
|
-
body:
|
|
825
|
+
body: mt
|
|
799
826
|
});
|
|
800
827
|
if (!L.body) throw new Error("Readable stream not supported");
|
|
801
|
-
const
|
|
828
|
+
const wt = L.body.getReader(), gt = new TextDecoder();
|
|
802
829
|
let B = "";
|
|
803
830
|
for (; ; ) {
|
|
804
|
-
const { done: U, value:
|
|
831
|
+
const { done: U, value: R } = await wt.read();
|
|
805
832
|
if (U) break;
|
|
806
|
-
B +=
|
|
807
|
-
const
|
|
833
|
+
B += gt.decode(R, { stream: !0 });
|
|
834
|
+
const Y = B.split(`
|
|
808
835
|
`);
|
|
809
|
-
B =
|
|
810
|
-
for (const
|
|
811
|
-
if (
|
|
812
|
-
const f =
|
|
836
|
+
B = Y.pop() || "";
|
|
837
|
+
for (const G of Y)
|
|
838
|
+
if (G.startsWith("data:")) {
|
|
839
|
+
const f = G.slice(5).trim();
|
|
813
840
|
try {
|
|
814
841
|
const q = JSON.parse(f);
|
|
815
842
|
q.index === 0 && O(
|
|
816
|
-
(
|
|
817
|
-
(P,
|
|
843
|
+
(F) => F.map(
|
|
844
|
+
(P, X) => X === F.length - 1 ? {
|
|
818
845
|
...P,
|
|
819
846
|
secondaryResponse: q.data,
|
|
820
847
|
secondaryLoading: !1
|
|
@@ -823,23 +850,23 @@ const nt = (t) => {
|
|
|
823
850
|
);
|
|
824
851
|
} catch (q) {
|
|
825
852
|
O(
|
|
826
|
-
(
|
|
827
|
-
(P,
|
|
853
|
+
(F) => F.map(
|
|
854
|
+
(P, X) => X === F.length - 1 ? { ...P, secondaryLoading: !1 } : P
|
|
828
855
|
)
|
|
829
856
|
), console.error("Secondary flow JSON parse error:", q);
|
|
830
857
|
}
|
|
831
858
|
}
|
|
832
859
|
}
|
|
833
|
-
} catch (
|
|
834
|
-
console.error("Secondary flow error:",
|
|
860
|
+
} catch (x) {
|
|
861
|
+
console.error("Secondary flow error:", x);
|
|
835
862
|
}
|
|
836
|
-
}, D = async (
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
839
|
-
|
|
863
|
+
}, D = async (i) => {
|
|
864
|
+
const b = i || _t.trim();
|
|
865
|
+
if (b) {
|
|
866
|
+
St(!0), Ct(""), n.current = null, c.current = null, l.current = null, d.current = null, O((m) => [
|
|
840
867
|
...m,
|
|
841
868
|
{
|
|
842
|
-
query:
|
|
869
|
+
query: b,
|
|
843
870
|
response: "Thinking for what suits you best...",
|
|
844
871
|
potentialQuestions: "",
|
|
845
872
|
products: [],
|
|
@@ -847,56 +874,56 @@ const nt = (t) => {
|
|
|
847
874
|
}
|
|
848
875
|
]);
|
|
849
876
|
try {
|
|
850
|
-
const m =
|
|
877
|
+
const m = ut, x = localStorage.getItem("customerNumber"), p = localStorage.getItem("isLoggedIn"), w = await Dt();
|
|
851
878
|
if (!w)
|
|
852
879
|
throw new Error("Failed to obtain access token");
|
|
853
|
-
const
|
|
880
|
+
const ht = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
|
|
854
881
|
registered: String(p || !1),
|
|
855
|
-
userId: String(
|
|
856
|
-
}).toString()}`,
|
|
882
|
+
userId: String(x || (/* @__PURE__ */ new Date()).getTime())
|
|
883
|
+
}).toString()}`, mt = JSON.stringify({
|
|
857
884
|
flowId: "MMHQKYI1NE",
|
|
858
885
|
flowAliasId: "SZF9ZK1ATE",
|
|
859
886
|
input: {
|
|
860
|
-
userPrompt:
|
|
887
|
+
userPrompt: b,
|
|
861
888
|
whom: m
|
|
862
889
|
}
|
|
863
|
-
}), L = await fetch(
|
|
890
|
+
}), L = await fetch(ht, {
|
|
864
891
|
signal: AbortSignal.timeout(3e4),
|
|
865
892
|
method: "POST",
|
|
866
893
|
headers: {
|
|
867
894
|
"Content-Type": "application/json",
|
|
868
895
|
Authorization: `Bearer ${w}`
|
|
869
896
|
},
|
|
870
|
-
body:
|
|
897
|
+
body: mt
|
|
871
898
|
});
|
|
872
899
|
if (!L.ok)
|
|
873
900
|
throw new Error(`HTTP error! status: ${L.status}`);
|
|
874
901
|
if (!L.body) throw new Error("Readable stream not supported");
|
|
875
|
-
const
|
|
902
|
+
const wt = L.body.getReader(), gt = new TextDecoder();
|
|
876
903
|
let B = "", U = "";
|
|
877
904
|
for (; ; ) {
|
|
878
|
-
|
|
879
|
-
const { done:
|
|
880
|
-
if (
|
|
881
|
-
B +=
|
|
882
|
-
const
|
|
905
|
+
tt(!0);
|
|
906
|
+
const { done: R, value: Y } = await wt.read();
|
|
907
|
+
if (R) break;
|
|
908
|
+
B += gt.decode(Y, { stream: !0 });
|
|
909
|
+
const G = B.split(`
|
|
883
910
|
`);
|
|
884
|
-
B =
|
|
885
|
-
for (const f of
|
|
911
|
+
B = G.pop() || "";
|
|
912
|
+
for (const f of G)
|
|
886
913
|
if (f.startsWith("data:")) {
|
|
887
914
|
const q = f.slice(5).trim();
|
|
888
915
|
try {
|
|
889
|
-
const
|
|
890
|
-
|
|
916
|
+
const F = JSON.parse(q);
|
|
917
|
+
F.index == 1 && (U = F.data), O(
|
|
891
918
|
(P) => P.map(
|
|
892
|
-
(
|
|
893
|
-
...
|
|
894
|
-
[
|
|
895
|
-
} :
|
|
919
|
+
(X, Lt) => Lt === P.length - 1 ? {
|
|
920
|
+
...X,
|
|
921
|
+
[F.index == 0 ? "response" : F.index == 1 ? "keywords" : F.index == 2 ? "potentialQuestions" : "end"]: F.data
|
|
922
|
+
} : X
|
|
896
923
|
)
|
|
897
924
|
);
|
|
898
|
-
} catch (
|
|
899
|
-
console.error("Error parsing JSON:",
|
|
925
|
+
} catch (F) {
|
|
926
|
+
console.error("Error parsing JSON:", F);
|
|
900
927
|
}
|
|
901
928
|
}
|
|
902
929
|
}
|
|
@@ -904,47 +931,47 @@ const nt = (t) => {
|
|
|
904
931
|
} catch (m) {
|
|
905
932
|
console.error("Error sending message to Tanya:", m);
|
|
906
933
|
} finally {
|
|
907
|
-
|
|
934
|
+
St(!1);
|
|
908
935
|
}
|
|
909
936
|
}
|
|
910
|
-
}, er = (
|
|
911
|
-
const
|
|
937
|
+
}, er = (i) => {
|
|
938
|
+
const b = i.match(
|
|
912
939
|
/top five relevant product or category names are: (.*)/i
|
|
913
|
-
), p = (
|
|
940
|
+
), p = (b ? b[1] : i).split(", ").map((A) => A.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi, "").trim());
|
|
914
941
|
return [...new Set(p)].filter(Boolean).join(",");
|
|
915
|
-
}, rr = async (
|
|
916
|
-
if (typeof
|
|
917
|
-
console.log(
|
|
918
|
-
const
|
|
919
|
-
for (const m of
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
942
|
+
}, rr = async (i) => {
|
|
943
|
+
if (typeof i == "string") {
|
|
944
|
+
console.log(i, "keywords");
|
|
945
|
+
const b = i.split(",");
|
|
946
|
+
for (const m of b) {
|
|
947
|
+
const x = await be(m);
|
|
948
|
+
if (tt(!1), (x == null ? void 0 : x.length) > 0 && (O(
|
|
922
949
|
(p) => p.map(
|
|
923
950
|
(w, A) => A === p.length - 1 ? {
|
|
924
951
|
...w,
|
|
925
952
|
products: [
|
|
926
953
|
...w.products || [],
|
|
927
|
-
{ keyword: m, items:
|
|
954
|
+
{ keyword: m, items: x, loading: !1 }
|
|
928
955
|
]
|
|
929
956
|
} : w
|
|
930
957
|
)
|
|
931
958
|
), !n.current || c.current == null)) {
|
|
932
|
-
const p =
|
|
933
|
-
n.current = String((p == null ? void 0 : p.product_name) ?? ""),
|
|
959
|
+
const p = x[0];
|
|
960
|
+
n.current = String((p == null ? void 0 : p.product_name) ?? ""), l.current = p.image.link, c.current = p.product_id;
|
|
934
961
|
const w = typeof (p == null ? void 0 : p.price) == "number" ? p.price : void 0;
|
|
935
962
|
d.current = typeof w == "number" && Number.isFinite(w) ? w : null;
|
|
936
963
|
}
|
|
937
964
|
}
|
|
938
965
|
} else
|
|
939
|
-
for (const
|
|
940
|
-
const m = await be(
|
|
941
|
-
|
|
942
|
-
(
|
|
943
|
-
(p, w) => w ===
|
|
966
|
+
for (const b of i) {
|
|
967
|
+
const m = await be(b);
|
|
968
|
+
tt(!1), (m == null ? void 0 : m.length) > 0 && O(
|
|
969
|
+
(x) => x.map(
|
|
970
|
+
(p, w) => w === x.length - 1 ? {
|
|
944
971
|
...p,
|
|
945
972
|
products: [
|
|
946
973
|
...p.products || [],
|
|
947
|
-
{ keyword:
|
|
974
|
+
{ keyword: b, items: m, loading: !1 }
|
|
948
975
|
]
|
|
949
976
|
} : p
|
|
950
977
|
)
|
|
@@ -953,32 +980,32 @@ const nt = (t) => {
|
|
|
953
980
|
if (n.current) {
|
|
954
981
|
O(
|
|
955
982
|
(m) => m.map(
|
|
956
|
-
(
|
|
957
|
-
...
|
|
983
|
+
(x, p) => p === m.length - 1 ? {
|
|
984
|
+
...x,
|
|
958
985
|
productSnapshot: {
|
|
959
986
|
id: c.current,
|
|
960
987
|
name: n.current,
|
|
961
|
-
image:
|
|
988
|
+
image: l.current,
|
|
962
989
|
price: d.current ?? null,
|
|
963
990
|
points: 0,
|
|
964
991
|
quantity: 1
|
|
965
992
|
}
|
|
966
|
-
} :
|
|
993
|
+
} : x
|
|
967
994
|
)
|
|
968
995
|
);
|
|
969
|
-
const
|
|
996
|
+
const b = JSON.parse(
|
|
970
997
|
sessionStorage.getItem("customerData") || "{}"
|
|
971
998
|
);
|
|
972
|
-
(
|
|
999
|
+
(b == null ? void 0 : b.isGuest) == !1 ? (console.log("running secondary flow", Ft), ft(n.current, 0)) : console.log("not running secondary flow", Ft);
|
|
973
1000
|
}
|
|
974
|
-
|
|
975
|
-
}, or = async (
|
|
976
|
-
var m,
|
|
977
|
-
|
|
1001
|
+
tt(!1);
|
|
1002
|
+
}, or = async (i, b) => {
|
|
1003
|
+
var m, x, p, w, A, ht, mt, L, wt, gt, B, U, R, Y, G;
|
|
1004
|
+
V(!0);
|
|
978
1005
|
try {
|
|
979
|
-
const f = await He(
|
|
980
|
-
if (!((
|
|
981
|
-
|
|
1006
|
+
const f = await He(i.id);
|
|
1007
|
+
if (!((x = (m = f == null ? void 0 : f.variants) == null ? void 0 : m[0]) != null && x.product_id || (w = (p = f == null ? void 0 : f.variants) == null ? void 0 : p[0]) != null && w.productId) && !(f.type.item || f.type.bundle)) {
|
|
1008
|
+
V(!1), H.error("Variants not found", {
|
|
982
1009
|
position: "bottom-right",
|
|
983
1010
|
autoClose: 1e3
|
|
984
1011
|
}), console.error("No product variant found");
|
|
@@ -986,97 +1013,97 @@ const nt = (t) => {
|
|
|
986
1013
|
}
|
|
987
1014
|
const q = [
|
|
988
1015
|
{
|
|
989
|
-
product_id: ((A = f.variants) == null ? void 0 : A[0].product_id) || ((
|
|
990
|
-
quantity:
|
|
1016
|
+
product_id: ((A = f.variants) == null ? void 0 : A[0].product_id) || ((ht = f.variants) == null ? void 0 : ht[0].productId) || (f == null ? void 0 : f.id),
|
|
1017
|
+
quantity: b
|
|
991
1018
|
}
|
|
992
1019
|
];
|
|
993
|
-
console.log(q, "product data", "app version",
|
|
994
|
-
const
|
|
1020
|
+
console.log(q, "product data", "app version", Ft);
|
|
1021
|
+
const F = JSON.parse(
|
|
995
1022
|
sessionStorage.getItem("customerData") || "{}"
|
|
996
|
-
), P = (
|
|
997
|
-
if (!
|
|
1023
|
+
), P = (F == null ? void 0 : F.basketId) || localStorage.getItem(Yt), X = !1, Lt = localStorage.getItem(Tt), me = Date.now();
|
|
1024
|
+
if (!X || !Lt || me >= parseInt(Lt)) {
|
|
998
1025
|
const nr = await qe();
|
|
999
|
-
let { customer_token:
|
|
1026
|
+
let { customer_token: ot } = await Me(
|
|
1000
1027
|
nr
|
|
1001
1028
|
);
|
|
1002
|
-
if (
|
|
1029
|
+
if (ot = "Bearer " + s.access_token, !ot) {
|
|
1003
1030
|
console.error("Failed to get customer_token");
|
|
1004
1031
|
return;
|
|
1005
1032
|
}
|
|
1006
1033
|
const ar = me + 300 * 1e3;
|
|
1007
|
-
if (Kt(
|
|
1034
|
+
if (Kt(ot), localStorage.setItem(Tt, ar.toString()), console.log(P, "basketIdFromCustomer"), P) {
|
|
1008
1035
|
const we = await Re({
|
|
1009
1036
|
basketId: P,
|
|
1010
|
-
customer_token:
|
|
1037
|
+
customer_token: ot
|
|
1011
1038
|
});
|
|
1012
1039
|
if (we.status === 200 && we) {
|
|
1013
1040
|
const Gt = await Rt(
|
|
1014
1041
|
P,
|
|
1015
1042
|
q,
|
|
1016
|
-
|
|
1043
|
+
ot
|
|
1017
1044
|
);
|
|
1018
|
-
((
|
|
1045
|
+
((mt = Gt == null ? void 0 : Gt.product_items) == null ? void 0 : mt.length) > 0 && (H.success("Added to cart", {
|
|
1019
1046
|
position: "bottom-right",
|
|
1020
1047
|
autoClose: 3e3,
|
|
1021
1048
|
hideProgressBar: !1,
|
|
1022
1049
|
closeOnClick: !0,
|
|
1023
1050
|
pauseOnHover: !0,
|
|
1024
1051
|
draggable: !0
|
|
1025
|
-
}), Vt(P),
|
|
1052
|
+
}), Vt(P), V(!1));
|
|
1026
1053
|
return;
|
|
1027
1054
|
}
|
|
1028
1055
|
}
|
|
1029
1056
|
const ir = {
|
|
1030
1057
|
productItems: [
|
|
1031
1058
|
{
|
|
1032
|
-
productId: ((L = f.variants) == null ? void 0 : L[0].product_id) || ((
|
|
1059
|
+
productId: ((L = f.variants) == null ? void 0 : L[0].product_id) || ((wt = f.variants) == null ? void 0 : wt[0].productId) || (f == null ? void 0 : f.id),
|
|
1033
1060
|
quantity: 1
|
|
1034
1061
|
}
|
|
1035
1062
|
]
|
|
1036
|
-
},
|
|
1063
|
+
}, y = await Ve(ot, ir);
|
|
1037
1064
|
if (console.log(
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1065
|
+
y,
|
|
1066
|
+
y == null ? void 0 : y.basket_id,
|
|
1067
|
+
y == null ? void 0 : y.basketId,
|
|
1041
1068
|
"the basket response"
|
|
1042
|
-
), !(
|
|
1043
|
-
|
|
1069
|
+
), !(y != null && y.basket_id || !(y != null && y.basketId))) {
|
|
1070
|
+
V(!1), console.error("Failed to create basket");
|
|
1044
1071
|
return;
|
|
1045
1072
|
}
|
|
1046
|
-
|
|
1047
|
-
(
|
|
1073
|
+
at(
|
|
1074
|
+
(y == null ? void 0 : y.basket_id) || (y == null ? void 0 : y.basketId)
|
|
1048
1075
|
);
|
|
1049
|
-
const
|
|
1050
|
-
(
|
|
1076
|
+
const bt = await Rt(
|
|
1077
|
+
(y == null ? void 0 : y.basket_id) || (y == null ? void 0 : y.basketId),
|
|
1051
1078
|
q,
|
|
1052
|
-
|
|
1079
|
+
ot
|
|
1053
1080
|
);
|
|
1054
|
-
(((
|
|
1081
|
+
(((gt = bt == null ? void 0 : bt.product_items) == null ? void 0 : gt.length) > 0 || ((B = bt == null ? void 0 : bt.productItems) == null ? void 0 : B.length) > 0) && H.success("Added to cart", {
|
|
1055
1082
|
position: "bottom-right",
|
|
1056
1083
|
autoClose: 3e3,
|
|
1057
1084
|
hideProgressBar: !1,
|
|
1058
1085
|
closeOnClick: !0,
|
|
1059
1086
|
pauseOnHover: !0,
|
|
1060
1087
|
draggable: !0
|
|
1061
|
-
}), Vt(
|
|
1088
|
+
}), Vt(y.basket_id || (y == null ? void 0 : y.basketId));
|
|
1062
1089
|
}
|
|
1063
1090
|
} catch (f) {
|
|
1064
|
-
|
|
1091
|
+
V(!1), console.error("Error adding to cart:", f), H.error("Failed to add product to cart", {
|
|
1065
1092
|
position: "bottom-right",
|
|
1066
1093
|
autoClose: 3e3
|
|
1067
1094
|
}), ((U = f == null ? void 0 : f.response) == null ? void 0 : U.status) === 404 || // Basket not found
|
|
1068
|
-
((
|
|
1095
|
+
((R = f == null ? void 0 : f.response) == null ? void 0 : R.status) === 401 ? (((Y = f == null ? void 0 : f.response) == null ? void 0 : Y.status) === 404 && at(null), ((G = f == null ? void 0 : f.response) == null ? void 0 : G.status) === 401 && (at(null), Kt(null))) : (console.error("Failed to add product to basket:", f.message), H.error("Failed to add product to cart", {
|
|
1069
1096
|
position: "bottom-right",
|
|
1070
1097
|
autoClose: 3e3
|
|
1071
1098
|
}));
|
|
1072
1099
|
}
|
|
1073
|
-
|
|
1100
|
+
V(!1);
|
|
1074
1101
|
};
|
|
1075
|
-
return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(yr, { open: g, onOpenChange:
|
|
1102
|
+
return /* @__PURE__ */ a("div", { className: "relative flex justify-center", children: /* @__PURE__ */ u(yr, { open: g, onOpenChange: S, children: [
|
|
1076
1103
|
/* @__PURE__ */ a(
|
|
1077
1104
|
vr,
|
|
1078
1105
|
{
|
|
1079
|
-
onClick: () =>
|
|
1106
|
+
onClick: () => S(!0),
|
|
1080
1107
|
style: {
|
|
1081
1108
|
// background: storeDetails.tanyaThemeColor,
|
|
1082
1109
|
},
|
|
@@ -1141,7 +1168,7 @@ const nt = (t) => {
|
|
|
1141
1168
|
"div",
|
|
1142
1169
|
{
|
|
1143
1170
|
className: "fixed inset-0 z-40 bg-black/30",
|
|
1144
|
-
onClick: () =>
|
|
1171
|
+
onClick: () => S(!1)
|
|
1145
1172
|
}
|
|
1146
1173
|
),
|
|
1147
1174
|
/* @__PURE__ */ u(
|
|
@@ -1232,7 +1259,7 @@ const nt = (t) => {
|
|
|
1232
1259
|
gap: "1.25rem",
|
|
1233
1260
|
margin: "0.75rem"
|
|
1234
1261
|
},
|
|
1235
|
-
children: /* @__PURE__ */ a("button", { onClick: () =>
|
|
1262
|
+
children: /* @__PURE__ */ a("button", { onClick: () => S(!1), children: /* @__PURE__ */ u(
|
|
1236
1263
|
"svg",
|
|
1237
1264
|
{
|
|
1238
1265
|
width: "24",
|
|
@@ -1284,12 +1311,12 @@ const nt = (t) => {
|
|
|
1284
1311
|
/* @__PURE__ */ u(
|
|
1285
1312
|
"div",
|
|
1286
1313
|
{
|
|
1287
|
-
className: `flex flex-col h-full ${
|
|
1314
|
+
className: `flex flex-col h-full ${rt ? "lg:w-2/3 w-full" : "w-full"}`,
|
|
1288
1315
|
children: [
|
|
1289
1316
|
/* @__PURE__ */ u(
|
|
1290
1317
|
"div",
|
|
1291
1318
|
{
|
|
1292
|
-
ref:
|
|
1319
|
+
ref: _,
|
|
1293
1320
|
className: "overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",
|
|
1294
1321
|
children: [
|
|
1295
1322
|
(k == null ? void 0 : k.whomRequired) && /* @__PURE__ */ u(
|
|
@@ -1298,32 +1325,32 @@ const nt = (t) => {
|
|
|
1298
1325
|
className: "mx-3 p-3 rounded-2xl bg-[#FFFFFF]",
|
|
1299
1326
|
children: [
|
|
1300
1327
|
/* @__PURE__ */ a("div", { className: "flex gap-2 bg-[#FFFFFF]", children: /* @__PURE__ */ a("p", { className: "font-bold font-nunitoSans text-[#494949]", children: "Is this for you or someone else?" }) }),
|
|
1301
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: r.map((
|
|
1328
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: r.map((i) => /* @__PURE__ */ a(
|
|
1302
1329
|
"button",
|
|
1303
1330
|
{
|
|
1304
|
-
onClick: () => jt(
|
|
1331
|
+
onClick: () => jt(i),
|
|
1305
1332
|
className: "px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",
|
|
1306
1333
|
style: {
|
|
1307
|
-
backgroundColor:
|
|
1308
|
-
borderColor:
|
|
1334
|
+
backgroundColor: ut === o[i] ? "#FFFFFF" : "#F3F3F3",
|
|
1335
|
+
borderColor: ut === o[i] ? "#BBB3DD" : ""
|
|
1309
1336
|
},
|
|
1310
|
-
children:
|
|
1337
|
+
children: i
|
|
1311
1338
|
},
|
|
1312
|
-
|
|
1339
|
+
i
|
|
1313
1340
|
)) })
|
|
1314
1341
|
]
|
|
1315
1342
|
}
|
|
1316
1343
|
),
|
|
1317
|
-
|
|
1318
|
-
var m,
|
|
1344
|
+
et.map((i, b) => {
|
|
1345
|
+
var m, x;
|
|
1319
1346
|
return /* @__PURE__ */ u("div", { children: [
|
|
1320
|
-
/* @__PURE__ */ a("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children:
|
|
1321
|
-
|
|
1347
|
+
/* @__PURE__ */ a("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "text-sm font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: i.query }) }),
|
|
1348
|
+
i.response && i.response.includes("Thinking") ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
1322
1349
|
"div",
|
|
1323
1350
|
{
|
|
1324
1351
|
className: "font-nunitoSans animate-pulse font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",
|
|
1325
1352
|
dangerouslySetInnerHTML: {
|
|
1326
|
-
__html: Xt(
|
|
1353
|
+
__html: Xt(i.response)
|
|
1327
1354
|
}
|
|
1328
1355
|
}
|
|
1329
1356
|
) }) : /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
@@ -1331,19 +1358,19 @@ const nt = (t) => {
|
|
|
1331
1358
|
{
|
|
1332
1359
|
className: "font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",
|
|
1333
1360
|
dangerouslySetInnerHTML: {
|
|
1334
|
-
__html: Xt(
|
|
1361
|
+
__html: Xt(i.response)
|
|
1335
1362
|
}
|
|
1336
1363
|
}
|
|
1337
1364
|
) }),
|
|
1338
|
-
|
|
1339
|
-
(
|
|
1340
|
-
|
|
1365
|
+
Pt && !i.response.includes("Thinking") && ((m = i.products) == null ? void 0 : m.length) == 0 && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("p", { className: "text-sm animate-pulse font-nunitoSans font-bold text-[#000000] bg-[#E2DBFF] border border-[#C9C2DE] rounded-l-xl p-2 m-3 mb-4 rounded-br-xl max-w-[75%]", children: "Finding best products for you" }) }),
|
|
1366
|
+
(i == null ? void 0 : i.products) && ((x = i == null ? void 0 : i.products) == null ? void 0 : x.length) > 0 && /* @__PURE__ */ a(
|
|
1367
|
+
Fr,
|
|
1341
1368
|
{
|
|
1342
|
-
chat:
|
|
1369
|
+
chat: i.products,
|
|
1343
1370
|
storeDetails: k
|
|
1344
1371
|
}
|
|
1345
1372
|
),
|
|
1346
|
-
|
|
1373
|
+
i.potentialQuestions.length > 0 && /* @__PURE__ */ u("div", { className: "my-2 px-4 text-sm text-gray-700", children: [
|
|
1347
1374
|
/* @__PURE__ */ a(
|
|
1348
1375
|
"p",
|
|
1349
1376
|
{
|
|
@@ -1352,7 +1379,7 @@ const nt = (t) => {
|
|
|
1352
1379
|
children: "Why not explore these inquiries..."
|
|
1353
1380
|
}
|
|
1354
1381
|
),
|
|
1355
|
-
|
|
1382
|
+
i.potentialQuestions.split(",").map((p, w) => /* @__PURE__ */ a(
|
|
1356
1383
|
"button",
|
|
1357
1384
|
{
|
|
1358
1385
|
className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${k.themeDarkColor} m-1 rounded-xl px-2 py-1`,
|
|
@@ -1365,7 +1392,7 @@ const nt = (t) => {
|
|
|
1365
1392
|
w
|
|
1366
1393
|
))
|
|
1367
1394
|
] }),
|
|
1368
|
-
|
|
1395
|
+
i.secondaryLoading && /* @__PURE__ */ a("div", { className: "mt-3 mb-4 px-4", children: /* @__PURE__ */ u(
|
|
1369
1396
|
"div",
|
|
1370
1397
|
{
|
|
1371
1398
|
className: "tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",
|
|
@@ -1398,7 +1425,7 @@ const nt = (t) => {
|
|
|
1398
1425
|
]
|
|
1399
1426
|
}
|
|
1400
1427
|
) }),
|
|
1401
|
-
|
|
1428
|
+
i.secondaryResponse && /* @__PURE__ */ a(re, { children: /* @__PURE__ */ u("div", { className: "mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]", children: [
|
|
1402
1429
|
/* @__PURE__ */ a(
|
|
1403
1430
|
"div",
|
|
1404
1431
|
{
|
|
@@ -1408,12 +1435,12 @@ const nt = (t) => {
|
|
|
1408
1435
|
},
|
|
1409
1436
|
dangerouslySetInnerHTML: {
|
|
1410
1437
|
__html: Xt(
|
|
1411
|
-
|
|
1438
|
+
i.secondaryResponse
|
|
1412
1439
|
)
|
|
1413
1440
|
}
|
|
1414
1441
|
}
|
|
1415
1442
|
),
|
|
1416
|
-
|
|
1443
|
+
i.productSnapshot && // chat.productSnapshot.points > 0 &&
|
|
1417
1444
|
/* @__PURE__ */ a("div", { className: "mt-4 w-full", children: /* @__PURE__ */ u(
|
|
1418
1445
|
"div",
|
|
1419
1446
|
{
|
|
@@ -1431,11 +1458,11 @@ const nt = (t) => {
|
|
|
1431
1458
|
height: 112,
|
|
1432
1459
|
borderColor: "#eee"
|
|
1433
1460
|
},
|
|
1434
|
-
children:
|
|
1461
|
+
children: i.productSnapshot.image ? /* @__PURE__ */ a(
|
|
1435
1462
|
"img",
|
|
1436
1463
|
{
|
|
1437
|
-
src:
|
|
1438
|
-
alt:
|
|
1464
|
+
src: i.productSnapshot.image,
|
|
1465
|
+
alt: i.productSnapshot.name,
|
|
1439
1466
|
className: "w-full h-full object-cover"
|
|
1440
1467
|
}
|
|
1441
1468
|
) : /* @__PURE__ */ a("div", { className: "w-full h-full flex items-center justify-center text-xs text-gray-500", children: "No Image" })
|
|
@@ -1443,18 +1470,18 @@ const nt = (t) => {
|
|
|
1443
1470
|
),
|
|
1444
1471
|
/* @__PURE__ */ u("div", { className: "flex flex-col flex-1 justify-between", children: [
|
|
1445
1472
|
/* @__PURE__ */ u("div", { children: [
|
|
1446
|
-
/* @__PURE__ */ a("p", { className: "font-semibold text-[15px] leading-snug", children:
|
|
1447
|
-
/* @__PURE__ */ a("p", { className: "mt-1 text-[14px] font-medium", children:
|
|
1473
|
+
/* @__PURE__ */ a("p", { className: "font-semibold text-[15px] leading-snug", children: i.productSnapshot.name }),
|
|
1474
|
+
/* @__PURE__ */ a("p", { className: "mt-1 text-[14px] font-medium", children: i.productSnapshot.price != null ? new Intl.NumberFormat(void 0, {
|
|
1448
1475
|
style: "currency",
|
|
1449
1476
|
currency: (k == null ? void 0 : k.currency) || "USD"
|
|
1450
1477
|
}).format(
|
|
1451
|
-
|
|
1478
|
+
i.productSnapshot.price
|
|
1452
1479
|
) : "" }),
|
|
1453
|
-
|
|
1480
|
+
i.productSnapshot.points > 0 && /* @__PURE__ */ u("p", { className: "mt-1 text-xs opacity-80", children: [
|
|
1454
1481
|
"You will earn",
|
|
1455
1482
|
" ",
|
|
1456
1483
|
/* @__PURE__ */ u("strong", { children: [
|
|
1457
|
-
|
|
1484
|
+
i.productSnapshot.points,
|
|
1458
1485
|
" ",
|
|
1459
1486
|
"points"
|
|
1460
1487
|
] })
|
|
@@ -1468,7 +1495,7 @@ const nt = (t) => {
|
|
|
1468
1495
|
className: "px-3 py-1 text-sm",
|
|
1469
1496
|
onClick: () => O(
|
|
1470
1497
|
(p) => p.map(
|
|
1471
|
-
(w, A) => A ===
|
|
1498
|
+
(w, A) => A === b && w.productSnapshot ? {
|
|
1472
1499
|
...w,
|
|
1473
1500
|
productSnapshot: {
|
|
1474
1501
|
...w.productSnapshot,
|
|
@@ -1487,14 +1514,14 @@ const nt = (t) => {
|
|
|
1487
1514
|
children: "−"
|
|
1488
1515
|
}
|
|
1489
1516
|
),
|
|
1490
|
-
/* @__PURE__ */ a("div", { className: "px-3 py-1 text-sm select-none", children:
|
|
1517
|
+
/* @__PURE__ */ a("div", { className: "px-3 py-1 text-sm select-none", children: i.productSnapshot.quantity }),
|
|
1491
1518
|
/* @__PURE__ */ a(
|
|
1492
1519
|
"button",
|
|
1493
1520
|
{
|
|
1494
1521
|
className: "px-3 py-1 text-sm",
|
|
1495
1522
|
onClick: () => O(
|
|
1496
1523
|
(p) => p.map(
|
|
1497
|
-
(w, A) => A ===
|
|
1524
|
+
(w, A) => A === b && w.productSnapshot ? {
|
|
1498
1525
|
...w,
|
|
1499
1526
|
productSnapshot: {
|
|
1500
1527
|
...w.productSnapshot,
|
|
@@ -1517,19 +1544,19 @@ const nt = (t) => {
|
|
|
1517
1544
|
onClick: () => {
|
|
1518
1545
|
or(
|
|
1519
1546
|
zt(
|
|
1520
|
-
|
|
1547
|
+
i.productSnapshot
|
|
1521
1548
|
),
|
|
1522
|
-
|
|
1549
|
+
i.productSnapshot.quantity
|
|
1523
1550
|
);
|
|
1524
1551
|
},
|
|
1525
|
-
disabled:
|
|
1552
|
+
disabled: ct,
|
|
1526
1553
|
className: "px-4 py-2 rounded-full font-medium",
|
|
1527
1554
|
style: {
|
|
1528
1555
|
background: k.tanyaThemeColor,
|
|
1529
1556
|
color: (k == null ? void 0 : k.tanyaThemeContrastColor) || "#fff",
|
|
1530
|
-
opacity:
|
|
1557
|
+
opacity: ct ? 0.8 : 1
|
|
1531
1558
|
},
|
|
1532
|
-
children:
|
|
1559
|
+
children: ct ? "Adding..." : "Add to cart"
|
|
1533
1560
|
}
|
|
1534
1561
|
)
|
|
1535
1562
|
] })
|
|
@@ -1539,7 +1566,7 @@ const nt = (t) => {
|
|
|
1539
1566
|
) })
|
|
1540
1567
|
] }) }),
|
|
1541
1568
|
/* @__PURE__ */ a("div", { className: "mb-20" })
|
|
1542
|
-
] },
|
|
1569
|
+
] }, b);
|
|
1543
1570
|
})
|
|
1544
1571
|
]
|
|
1545
1572
|
}
|
|
@@ -1557,11 +1584,11 @@ const nt = (t) => {
|
|
|
1557
1584
|
{
|
|
1558
1585
|
className: "flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",
|
|
1559
1586
|
placeholder: "How can I help you...",
|
|
1560
|
-
value:
|
|
1587
|
+
value: _t,
|
|
1561
1588
|
autoFocus: !0,
|
|
1562
|
-
onChange: (
|
|
1563
|
-
onKeyDown: (
|
|
1564
|
-
|
|
1589
|
+
onChange: (i) => Ct(i.target.value),
|
|
1590
|
+
onKeyDown: (i) => {
|
|
1591
|
+
i.key === "Enter" && !dt && D();
|
|
1565
1592
|
}
|
|
1566
1593
|
}
|
|
1567
1594
|
),
|
|
@@ -1569,10 +1596,10 @@ const nt = (t) => {
|
|
|
1569
1596
|
"button",
|
|
1570
1597
|
{
|
|
1571
1598
|
type: "submit",
|
|
1572
|
-
disabled:
|
|
1599
|
+
disabled: dt,
|
|
1573
1600
|
className: "p-3",
|
|
1574
1601
|
onClick: () => D(),
|
|
1575
|
-
children:
|
|
1602
|
+
children: dt ? /* @__PURE__ */ a(
|
|
1576
1603
|
"div",
|
|
1577
1604
|
{
|
|
1578
1605
|
className: "p-3 animate-spin rounded-full h-3 w-3 border-b-2",
|
|
@@ -1621,7 +1648,7 @@ var ne = function(t, e) {
|
|
|
1621
1648
|
for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && (r[n] = o[n]);
|
|
1622
1649
|
}, ne(t, e);
|
|
1623
1650
|
};
|
|
1624
|
-
function
|
|
1651
|
+
function Or(t, e) {
|
|
1625
1652
|
if (typeof e != "function" && e !== null)
|
|
1626
1653
|
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
1627
1654
|
ne(t, e);
|
|
@@ -1630,16 +1657,16 @@ function Pr(t, e) {
|
|
|
1630
1657
|
}
|
|
1631
1658
|
t.prototype = e === null ? Object.create(e) : (r.prototype = e.prototype, new r());
|
|
1632
1659
|
}
|
|
1633
|
-
var
|
|
1634
|
-
return
|
|
1660
|
+
var Q = function() {
|
|
1661
|
+
return Q = Object.assign || function(e) {
|
|
1635
1662
|
for (var r, o = 1, n = arguments.length; o < n; o++) {
|
|
1636
1663
|
r = arguments[o];
|
|
1637
1664
|
for (var c in r) Object.prototype.hasOwnProperty.call(r, c) && (e[c] = r[c]);
|
|
1638
1665
|
}
|
|
1639
1666
|
return e;
|
|
1640
|
-
},
|
|
1667
|
+
}, Q.apply(this, arguments);
|
|
1641
1668
|
};
|
|
1642
|
-
function
|
|
1669
|
+
function Pr(t, e) {
|
|
1643
1670
|
var r = {};
|
|
1644
1671
|
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && e.indexOf(o) < 0 && (r[o] = t[o]);
|
|
1645
1672
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -1652,7 +1679,7 @@ var Qt = "Invariant Violation", Ce = Object.setPrototypeOf, $r = Ce === void 0 ?
|
|
|
1652
1679
|
} : Ce, Ye = (
|
|
1653
1680
|
/** @class */
|
|
1654
1681
|
(function(t) {
|
|
1655
|
-
|
|
1682
|
+
Or(e, t);
|
|
1656
1683
|
function e(r) {
|
|
1657
1684
|
r === void 0 && (r = Qt);
|
|
1658
1685
|
var o = t.call(this, typeof r == "number" ? Qt + ": " + r + " (see https://github.com/apollographql/invariant-packages)" : r) || this;
|
|
@@ -1661,7 +1688,7 @@ var Qt = "Invariant Violation", Ce = Object.setPrototypeOf, $r = Ce === void 0 ?
|
|
|
1661
1688
|
return e;
|
|
1662
1689
|
})(Error)
|
|
1663
1690
|
);
|
|
1664
|
-
function
|
|
1691
|
+
function nt(t, e) {
|
|
1665
1692
|
if (!t)
|
|
1666
1693
|
throw new Ye(e);
|
|
1667
1694
|
}
|
|
@@ -1676,21 +1703,21 @@ function Bt(t) {
|
|
|
1676
1703
|
}
|
|
1677
1704
|
(function(t) {
|
|
1678
1705
|
t.debug = Bt("debug"), t.log = Bt("log"), t.warn = Bt("warn"), t.error = Bt("error");
|
|
1679
|
-
})(
|
|
1706
|
+
})(nt || (nt = {}));
|
|
1680
1707
|
var Je = "3.14.0";
|
|
1681
|
-
function
|
|
1708
|
+
function xt(t) {
|
|
1682
1709
|
try {
|
|
1683
1710
|
return t();
|
|
1684
1711
|
} catch {
|
|
1685
1712
|
}
|
|
1686
1713
|
}
|
|
1687
|
-
const ae =
|
|
1714
|
+
const ae = xt(function() {
|
|
1688
1715
|
return globalThis;
|
|
1689
|
-
}) ||
|
|
1716
|
+
}) || xt(function() {
|
|
1690
1717
|
return window;
|
|
1691
|
-
}) ||
|
|
1718
|
+
}) || xt(function() {
|
|
1692
1719
|
return self;
|
|
1693
|
-
}) ||
|
|
1720
|
+
}) || xt(function() {
|
|
1694
1721
|
return global;
|
|
1695
1722
|
}) || // We don't expect the Function constructor ever to be invoked at runtime, as
|
|
1696
1723
|
// long as at least one of globalThis, window, self, or global is defined, so
|
|
@@ -1698,13 +1725,13 @@ const ae = bt(function() {
|
|
|
1698
1725
|
// detect syntactic usage of the Function constructor. If you think you can
|
|
1699
1726
|
// improve your static analysis to detect this obfuscation, think again. This
|
|
1700
1727
|
// is an arms race you cannot win, at least not in JavaScript.
|
|
1701
|
-
|
|
1702
|
-
return
|
|
1728
|
+
xt(function() {
|
|
1729
|
+
return xt.constructor("return this")();
|
|
1703
1730
|
});
|
|
1704
|
-
var
|
|
1731
|
+
var Ie = /* @__PURE__ */ new Map();
|
|
1705
1732
|
function Ar(t) {
|
|
1706
|
-
var e =
|
|
1707
|
-
return
|
|
1733
|
+
var e = Ie.get(t) || 1;
|
|
1734
|
+
return Ie.set(t, e + 1), "".concat(t, ":").concat(e, ":").concat(Math.random().toString(36).slice(2));
|
|
1708
1735
|
}
|
|
1709
1736
|
function jr(t, e) {
|
|
1710
1737
|
var r = Ar("stringifyForDisplay");
|
|
@@ -1726,19 +1753,19 @@ function Ut(t) {
|
|
|
1726
1753
|
var Zt = Object.assign(function(e, r) {
|
|
1727
1754
|
for (var o = [], n = 2; n < arguments.length; n++)
|
|
1728
1755
|
o[n - 2] = arguments[n];
|
|
1729
|
-
e ||
|
|
1756
|
+
e || nt(e, le(r, o) || ce(r, o));
|
|
1730
1757
|
}, {
|
|
1731
|
-
debug: Ut(
|
|
1732
|
-
log: Ut(
|
|
1733
|
-
warn: Ut(
|
|
1734
|
-
error: Ut(
|
|
1758
|
+
debug: Ut(nt.debug),
|
|
1759
|
+
log: Ut(nt.log),
|
|
1760
|
+
warn: Ut(nt.warn),
|
|
1761
|
+
error: Ut(nt.error)
|
|
1735
1762
|
});
|
|
1736
1763
|
function We(t) {
|
|
1737
1764
|
for (var e = [], r = 1; r < arguments.length; r++)
|
|
1738
1765
|
e[r - 1] = arguments[r];
|
|
1739
1766
|
return new Ye(le(t, e) || ce(t, e));
|
|
1740
1767
|
}
|
|
1741
|
-
var
|
|
1768
|
+
var Fe = Symbol.for("ApolloErrorMessageHandler_" + Je);
|
|
1742
1769
|
function Ge(t) {
|
|
1743
1770
|
if (typeof t == "string")
|
|
1744
1771
|
return t;
|
|
@@ -1750,7 +1777,7 @@ function Ge(t) {
|
|
|
1750
1777
|
}
|
|
1751
1778
|
function le(t, e) {
|
|
1752
1779
|
if (e === void 0 && (e = []), !!t)
|
|
1753
|
-
return ae[
|
|
1780
|
+
return ae[Fe] && ae[Fe](t, e.map(Ge));
|
|
1754
1781
|
}
|
|
1755
1782
|
function ce(t, e) {
|
|
1756
1783
|
if (e === void 0 && (e = []), !!t)
|
|
@@ -1797,12 +1824,12 @@ const Br = () => class {
|
|
|
1797
1824
|
const c = {
|
|
1798
1825
|
__proto__: null,
|
|
1799
1826
|
[this.id]: e
|
|
1800
|
-
},
|
|
1801
|
-
N = { parent:
|
|
1827
|
+
}, l = N;
|
|
1828
|
+
N = { parent: l, slots: c };
|
|
1802
1829
|
try {
|
|
1803
1830
|
return r.apply(n, o);
|
|
1804
1831
|
} finally {
|
|
1805
|
-
N =
|
|
1832
|
+
N = l;
|
|
1806
1833
|
}
|
|
1807
1834
|
}
|
|
1808
1835
|
// Capture the current context and wrap a callback function so that it
|
|
@@ -1883,26 +1910,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1883
1910
|
}
|
|
1884
1911
|
function Mr(t, e) {
|
|
1885
1912
|
if (t) {
|
|
1886
|
-
if (typeof t == "string") return
|
|
1913
|
+
if (typeof t == "string") return Oe(t, e);
|
|
1887
1914
|
var r = Object.prototype.toString.call(t).slice(8, -1);
|
|
1888
1915
|
if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set") return Array.from(t);
|
|
1889
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
1916
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return Oe(t, e);
|
|
1890
1917
|
}
|
|
1891
1918
|
}
|
|
1892
|
-
function
|
|
1919
|
+
function Oe(t, e) {
|
|
1893
1920
|
(e == null || e > t.length) && (e = t.length);
|
|
1894
1921
|
for (var r = 0, o = new Array(e); r < e; r++)
|
|
1895
1922
|
o[r] = t[r];
|
|
1896
1923
|
return o;
|
|
1897
1924
|
}
|
|
1898
|
-
function
|
|
1925
|
+
function Pe(t, e) {
|
|
1899
1926
|
for (var r = 0; r < e.length; r++) {
|
|
1900
1927
|
var o = e[r];
|
|
1901
1928
|
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(t, o.key, o);
|
|
1902
1929
|
}
|
|
1903
1930
|
}
|
|
1904
1931
|
function ue(t, e, r) {
|
|
1905
|
-
return e &&
|
|
1932
|
+
return e && Pe(t.prototype, e), r && Pe(t, r), Object.defineProperty(t, "prototype", { writable: !1 }), t;
|
|
1906
1933
|
}
|
|
1907
1934
|
var pe = function() {
|
|
1908
1935
|
return typeof Symbol == "function";
|
|
@@ -1927,8 +1954,8 @@ function Nt(t) {
|
|
|
1927
1954
|
function Vr(t) {
|
|
1928
1955
|
return t instanceof E;
|
|
1929
1956
|
}
|
|
1930
|
-
function
|
|
1931
|
-
|
|
1957
|
+
function vt(t) {
|
|
1958
|
+
vt.log ? vt.log(t) : setTimeout(function() {
|
|
1932
1959
|
throw t;
|
|
1933
1960
|
});
|
|
1934
1961
|
}
|
|
@@ -1937,7 +1964,7 @@ function Mt(t) {
|
|
|
1937
1964
|
try {
|
|
1938
1965
|
t();
|
|
1939
1966
|
} catch (e) {
|
|
1940
|
-
|
|
1967
|
+
vt(e);
|
|
1941
1968
|
}
|
|
1942
1969
|
});
|
|
1943
1970
|
}
|
|
@@ -1952,7 +1979,7 @@ function Qe(t) {
|
|
|
1952
1979
|
r && r.call(e);
|
|
1953
1980
|
}
|
|
1954
1981
|
} catch (o) {
|
|
1955
|
-
|
|
1982
|
+
vt(o);
|
|
1956
1983
|
}
|
|
1957
1984
|
}
|
|
1958
1985
|
function se(t) {
|
|
@@ -1984,7 +2011,7 @@ function Ze(t, e, r) {
|
|
|
1984
2011
|
break;
|
|
1985
2012
|
}
|
|
1986
2013
|
} catch (c) {
|
|
1987
|
-
|
|
2014
|
+
vt(c);
|
|
1988
2015
|
}
|
|
1989
2016
|
t._state === "closed" ? Qe(t) : t._state === "running" && (t._state = "ready");
|
|
1990
2017
|
}
|
|
@@ -2061,23 +2088,23 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2061
2088
|
}), new Yr(o, this._subscriber);
|
|
2062
2089
|
}, e.forEach = function(o) {
|
|
2063
2090
|
var n = this;
|
|
2064
|
-
return new Promise(function(c,
|
|
2091
|
+
return new Promise(function(c, l) {
|
|
2065
2092
|
if (typeof o != "function") {
|
|
2066
|
-
|
|
2093
|
+
l(new TypeError(o + " is not a function"));
|
|
2067
2094
|
return;
|
|
2068
2095
|
}
|
|
2069
2096
|
function d() {
|
|
2070
|
-
|
|
2097
|
+
s.unsubscribe(), c();
|
|
2071
2098
|
}
|
|
2072
|
-
var
|
|
2073
|
-
next: function(
|
|
2099
|
+
var s = n.subscribe({
|
|
2100
|
+
next: function(v) {
|
|
2074
2101
|
try {
|
|
2075
|
-
o(
|
|
2102
|
+
o(v, d);
|
|
2076
2103
|
} catch (g) {
|
|
2077
|
-
|
|
2104
|
+
l(g), s.unsubscribe();
|
|
2078
2105
|
}
|
|
2079
2106
|
},
|
|
2080
|
-
error:
|
|
2107
|
+
error: l,
|
|
2081
2108
|
complete: c
|
|
2082
2109
|
});
|
|
2083
2110
|
});
|
|
@@ -2085,21 +2112,21 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2085
2112
|
var n = this;
|
|
2086
2113
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2087
2114
|
var c = Nt(this);
|
|
2088
|
-
return new c(function(
|
|
2115
|
+
return new c(function(l) {
|
|
2089
2116
|
return n.subscribe({
|
|
2090
2117
|
next: function(d) {
|
|
2091
2118
|
try {
|
|
2092
2119
|
d = o(d);
|
|
2093
|
-
} catch (
|
|
2094
|
-
return
|
|
2120
|
+
} catch (s) {
|
|
2121
|
+
return l.error(s);
|
|
2095
2122
|
}
|
|
2096
|
-
|
|
2123
|
+
l.next(d);
|
|
2097
2124
|
},
|
|
2098
2125
|
error: function(d) {
|
|
2099
|
-
|
|
2126
|
+
l.error(d);
|
|
2100
2127
|
},
|
|
2101
2128
|
complete: function() {
|
|
2102
|
-
|
|
2129
|
+
l.complete();
|
|
2103
2130
|
}
|
|
2104
2131
|
});
|
|
2105
2132
|
});
|
|
@@ -2107,114 +2134,114 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2107
2134
|
var n = this;
|
|
2108
2135
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2109
2136
|
var c = Nt(this);
|
|
2110
|
-
return new c(function(
|
|
2137
|
+
return new c(function(l) {
|
|
2111
2138
|
return n.subscribe({
|
|
2112
2139
|
next: function(d) {
|
|
2113
2140
|
try {
|
|
2114
2141
|
if (!o(d)) return;
|
|
2115
|
-
} catch (
|
|
2116
|
-
return
|
|
2142
|
+
} catch (s) {
|
|
2143
|
+
return l.error(s);
|
|
2117
2144
|
}
|
|
2118
|
-
|
|
2145
|
+
l.next(d);
|
|
2119
2146
|
},
|
|
2120
2147
|
error: function(d) {
|
|
2121
|
-
|
|
2148
|
+
l.error(d);
|
|
2122
2149
|
},
|
|
2123
2150
|
complete: function() {
|
|
2124
|
-
|
|
2151
|
+
l.complete();
|
|
2125
2152
|
}
|
|
2126
2153
|
});
|
|
2127
2154
|
});
|
|
2128
2155
|
}, e.reduce = function(o) {
|
|
2129
2156
|
var n = this;
|
|
2130
2157
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2131
|
-
var c = Nt(this),
|
|
2158
|
+
var c = Nt(this), l = arguments.length > 1, d = !1, s = arguments[1], v = s;
|
|
2132
2159
|
return new c(function(g) {
|
|
2133
2160
|
return n.subscribe({
|
|
2134
|
-
next: function(
|
|
2161
|
+
next: function(S) {
|
|
2135
2162
|
var C = !d;
|
|
2136
|
-
if (d = !0, !C ||
|
|
2163
|
+
if (d = !0, !C || l)
|
|
2137
2164
|
try {
|
|
2138
|
-
|
|
2139
|
-
} catch (
|
|
2140
|
-
return g.error(
|
|
2165
|
+
v = o(v, S);
|
|
2166
|
+
} catch (I) {
|
|
2167
|
+
return g.error(I);
|
|
2141
2168
|
}
|
|
2142
2169
|
else
|
|
2143
|
-
|
|
2170
|
+
v = S;
|
|
2144
2171
|
},
|
|
2145
|
-
error: function(
|
|
2146
|
-
g.error(
|
|
2172
|
+
error: function(S) {
|
|
2173
|
+
g.error(S);
|
|
2147
2174
|
},
|
|
2148
2175
|
complete: function() {
|
|
2149
|
-
if (!d && !
|
|
2150
|
-
g.next(
|
|
2176
|
+
if (!d && !l) return g.error(new TypeError("Cannot reduce an empty sequence"));
|
|
2177
|
+
g.next(v), g.complete();
|
|
2151
2178
|
}
|
|
2152
2179
|
});
|
|
2153
2180
|
});
|
|
2154
2181
|
}, e.concat = function() {
|
|
2155
|
-
for (var o = this, n = arguments.length, c = new Array(n),
|
|
2156
|
-
c[
|
|
2182
|
+
for (var o = this, n = arguments.length, c = new Array(n), l = 0; l < n; l++)
|
|
2183
|
+
c[l] = arguments[l];
|
|
2157
2184
|
var d = Nt(this);
|
|
2158
|
-
return new d(function(
|
|
2159
|
-
var
|
|
2160
|
-
function
|
|
2161
|
-
|
|
2162
|
-
next: function(
|
|
2163
|
-
|
|
2185
|
+
return new d(function(s) {
|
|
2186
|
+
var v, g = 0;
|
|
2187
|
+
function S(C) {
|
|
2188
|
+
v = C.subscribe({
|
|
2189
|
+
next: function(I) {
|
|
2190
|
+
s.next(I);
|
|
2164
2191
|
},
|
|
2165
|
-
error: function(
|
|
2166
|
-
|
|
2192
|
+
error: function(I) {
|
|
2193
|
+
s.error(I);
|
|
2167
2194
|
},
|
|
2168
2195
|
complete: function() {
|
|
2169
|
-
g === c.length ? (
|
|
2196
|
+
g === c.length ? (v = void 0, s.complete()) : S(d.from(c[g++]));
|
|
2170
2197
|
}
|
|
2171
2198
|
});
|
|
2172
2199
|
}
|
|
2173
|
-
return
|
|
2174
|
-
|
|
2200
|
+
return S(o), function() {
|
|
2201
|
+
v && (v.unsubscribe(), v = void 0);
|
|
2175
2202
|
};
|
|
2176
2203
|
});
|
|
2177
2204
|
}, e.flatMap = function(o) {
|
|
2178
2205
|
var n = this;
|
|
2179
2206
|
if (typeof o != "function") throw new TypeError(o + " is not a function");
|
|
2180
2207
|
var c = Nt(this);
|
|
2181
|
-
return new c(function(
|
|
2182
|
-
var d = [],
|
|
2208
|
+
return new c(function(l) {
|
|
2209
|
+
var d = [], s = n.subscribe({
|
|
2183
2210
|
next: function(g) {
|
|
2184
2211
|
if (o)
|
|
2185
2212
|
try {
|
|
2186
2213
|
g = o(g);
|
|
2187
2214
|
} catch (C) {
|
|
2188
|
-
return
|
|
2215
|
+
return l.error(C);
|
|
2189
2216
|
}
|
|
2190
|
-
var
|
|
2217
|
+
var S = c.from(g).subscribe({
|
|
2191
2218
|
next: function(C) {
|
|
2192
|
-
|
|
2219
|
+
l.next(C);
|
|
2193
2220
|
},
|
|
2194
2221
|
error: function(C) {
|
|
2195
|
-
|
|
2222
|
+
l.error(C);
|
|
2196
2223
|
},
|
|
2197
2224
|
complete: function() {
|
|
2198
|
-
var C = d.indexOf(
|
|
2199
|
-
C >= 0 && d.splice(C, 1),
|
|
2225
|
+
var C = d.indexOf(S);
|
|
2226
|
+
C >= 0 && d.splice(C, 1), v();
|
|
2200
2227
|
}
|
|
2201
2228
|
});
|
|
2202
|
-
d.push(
|
|
2229
|
+
d.push(S);
|
|
2203
2230
|
},
|
|
2204
2231
|
error: function(g) {
|
|
2205
|
-
|
|
2232
|
+
l.error(g);
|
|
2206
2233
|
},
|
|
2207
2234
|
complete: function() {
|
|
2208
|
-
|
|
2235
|
+
v();
|
|
2209
2236
|
}
|
|
2210
2237
|
});
|
|
2211
|
-
function
|
|
2212
|
-
|
|
2238
|
+
function v() {
|
|
2239
|
+
s.closed && d.length === 0 && l.complete();
|
|
2213
2240
|
}
|
|
2214
2241
|
return function() {
|
|
2215
2242
|
d.forEach(function(g) {
|
|
2216
2243
|
return g.unsubscribe();
|
|
2217
|
-
}),
|
|
2244
|
+
}), s.unsubscribe();
|
|
2218
2245
|
};
|
|
2219
2246
|
});
|
|
2220
2247
|
}, e[ie] = function() {
|
|
@@ -2224,18 +2251,18 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2224
2251
|
if (o == null) throw new TypeError(o + " is not an object");
|
|
2225
2252
|
var c = Jt(o, ie);
|
|
2226
2253
|
if (c) {
|
|
2227
|
-
var
|
|
2228
|
-
if (Object(
|
|
2229
|
-
return Vr(
|
|
2230
|
-
return
|
|
2254
|
+
var l = c.call(o);
|
|
2255
|
+
if (Object(l) !== l) throw new TypeError(l + " is not an object");
|
|
2256
|
+
return Vr(l) && l.constructor === n ? l : new n(function(d) {
|
|
2257
|
+
return l.subscribe(d);
|
|
2231
2258
|
});
|
|
2232
2259
|
}
|
|
2233
2260
|
if (fe("iterator") && (c = Jt(o, Hr), c))
|
|
2234
2261
|
return new n(function(d) {
|
|
2235
2262
|
Mt(function() {
|
|
2236
2263
|
if (!d.closed) {
|
|
2237
|
-
for (var
|
|
2238
|
-
var g =
|
|
2264
|
+
for (var s = qr(c.call(o)), v; !(v = s()).done; ) {
|
|
2265
|
+
var g = v.value;
|
|
2239
2266
|
if (d.next(g), d.closed) return;
|
|
2240
2267
|
}
|
|
2241
2268
|
d.complete();
|
|
@@ -2246,8 +2273,8 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2246
2273
|
return new n(function(d) {
|
|
2247
2274
|
Mt(function() {
|
|
2248
2275
|
if (!d.closed) {
|
|
2249
|
-
for (var
|
|
2250
|
-
if (d.next(o[
|
|
2276
|
+
for (var s = 0; s < o.length; ++s)
|
|
2277
|
+
if (d.next(o[s]), d.closed) return;
|
|
2251
2278
|
d.complete();
|
|
2252
2279
|
}
|
|
2253
2280
|
});
|
|
@@ -2256,12 +2283,12 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2256
2283
|
}, t.of = function() {
|
|
2257
2284
|
for (var o = arguments.length, n = new Array(o), c = 0; c < o; c++)
|
|
2258
2285
|
n[c] = arguments[c];
|
|
2259
|
-
var
|
|
2260
|
-
return new
|
|
2286
|
+
var l = typeof this == "function" ? this : t;
|
|
2287
|
+
return new l(function(d) {
|
|
2261
2288
|
Mt(function() {
|
|
2262
2289
|
if (!d.closed) {
|
|
2263
|
-
for (var
|
|
2264
|
-
if (d.next(n[
|
|
2290
|
+
for (var s = 0; s < n.length; ++s)
|
|
2291
|
+
if (d.next(n[s]), d.closed) return;
|
|
2265
2292
|
d.complete();
|
|
2266
2293
|
}
|
|
2267
2294
|
});
|
|
@@ -2276,7 +2303,7 @@ var Yr = /* @__PURE__ */ (function() {
|
|
|
2276
2303
|
pe() && Object.defineProperty(E, Symbol("extensions"), {
|
|
2277
2304
|
value: {
|
|
2278
2305
|
symbol: ie,
|
|
2279
|
-
hostReportError:
|
|
2306
|
+
hostReportError: vt
|
|
2280
2307
|
},
|
|
2281
2308
|
configurable: !0
|
|
2282
2309
|
});
|
|
@@ -2296,9 +2323,9 @@ function Jr(t) {
|
|
|
2296
2323
|
e = "@@observable";
|
|
2297
2324
|
return e;
|
|
2298
2325
|
}
|
|
2299
|
-
var
|
|
2300
|
-
typeof self < "u" ?
|
|
2301
|
-
Jr(
|
|
2326
|
+
var yt;
|
|
2327
|
+
typeof self < "u" ? yt = self : typeof window < "u" ? yt = window : typeof global < "u" ? yt = global : typeof module < "u" ? yt = module : yt = Function("return this")();
|
|
2328
|
+
Jr(yt);
|
|
2302
2329
|
var $e = E.prototype, ze = "@@observable";
|
|
2303
2330
|
$e[ze] || ($e[ze] = function() {
|
|
2304
2331
|
return this;
|
|
@@ -2318,10 +2345,10 @@ function Wr(t) {
|
|
|
2318
2345
|
return t;
|
|
2319
2346
|
}
|
|
2320
2347
|
function Gr(t, e) {
|
|
2321
|
-
var r =
|
|
2322
|
-
typeof c == "function" ? r =
|
|
2348
|
+
var r = Q({}, t), o = function(c) {
|
|
2349
|
+
typeof c == "function" ? r = Q(Q({}, r), c(r)) : r = Q(Q({}, r), c);
|
|
2323
2350
|
}, n = function() {
|
|
2324
|
-
return
|
|
2351
|
+
return Q({}, r);
|
|
2325
2352
|
};
|
|
2326
2353
|
return Object.defineProperty(e, "setContext", {
|
|
2327
2354
|
enumerable: !1,
|
|
@@ -2371,12 +2398,12 @@ var tr = (
|
|
|
2371
2398
|
return r.concat(o);
|
|
2372
2399
|
});
|
|
2373
2400
|
}, t.split = function(e, r, o) {
|
|
2374
|
-
var n = Et(r), c = Et(o || new t(Ae)),
|
|
2375
|
-
return qt(n) && qt(c) ?
|
|
2401
|
+
var n = Et(r), c = Et(o || new t(Ae)), l;
|
|
2402
|
+
return qt(n) && qt(c) ? l = new t(function(d) {
|
|
2376
2403
|
return e(d) ? n.request(d) || E.of() : c.request(d) || E.of();
|
|
2377
|
-
}) :
|
|
2378
|
-
return e(d) ? n.request(d,
|
|
2379
|
-
}), Object.assign(
|
|
2404
|
+
}) : l = new t(function(d, s) {
|
|
2405
|
+
return e(d) ? n.request(d, s) || E.of() : c.request(d, s) || E.of();
|
|
2406
|
+
}), Object.assign(l, { left: n, right: c });
|
|
2380
2407
|
}, t.execute = function(e, r) {
|
|
2381
2408
|
return e.request(Gr(r.context, Xr(Wr(r)))) || E.of();
|
|
2382
2409
|
}, t.concat = function(e, r) {
|
|
@@ -2384,13 +2411,13 @@ var tr = (
|
|
|
2384
2411
|
if (qt(o))
|
|
2385
2412
|
return globalThis.__DEV__ !== !1 && Zt.warn(47, o), o;
|
|
2386
2413
|
var n = Et(r), c;
|
|
2387
|
-
return qt(n) ? c = new t(function(
|
|
2388
|
-
return o.request(
|
|
2414
|
+
return qt(n) ? c = new t(function(l) {
|
|
2415
|
+
return o.request(l, function(d) {
|
|
2389
2416
|
return n.request(d) || E.of();
|
|
2390
2417
|
}) || E.of();
|
|
2391
|
-
}) : c = new t(function(
|
|
2392
|
-
return o.request(
|
|
2393
|
-
return n.request(
|
|
2418
|
+
}) : c = new t(function(l, d) {
|
|
2419
|
+
return o.request(l, function(s) {
|
|
2420
|
+
return n.request(s, d) || E.of();
|
|
2394
2421
|
}) || E.of();
|
|
2395
2422
|
}), Object.assign(c, { left: o, right: n });
|
|
2396
2423
|
}, t.prototype.split = function(e, r, o) {
|
|
@@ -2412,19 +2439,19 @@ var tr = (
|
|
|
2412
2439
|
);
|
|
2413
2440
|
function oo(t) {
|
|
2414
2441
|
return new tr(function(e, r) {
|
|
2415
|
-
var o =
|
|
2442
|
+
var o = Pr(e, []);
|
|
2416
2443
|
return new E(function(n) {
|
|
2417
|
-
var c,
|
|
2444
|
+
var c, l = !1;
|
|
2418
2445
|
return Promise.resolve(o).then(function(d) {
|
|
2419
2446
|
return t(d, e.getContext());
|
|
2420
2447
|
}).then(e.setContext).then(function() {
|
|
2421
|
-
|
|
2448
|
+
l || (c = r(e).subscribe({
|
|
2422
2449
|
next: n.next.bind(n),
|
|
2423
2450
|
error: n.error.bind(n),
|
|
2424
2451
|
complete: n.complete.bind(n)
|
|
2425
2452
|
}));
|
|
2426
2453
|
}).catch(n.error.bind(n)), function() {
|
|
2427
|
-
|
|
2454
|
+
l = !0, c && c.unsubscribe();
|
|
2428
2455
|
};
|
|
2429
2456
|
});
|
|
2430
2457
|
});
|
|
@@ -2465,12 +2492,12 @@ const no = async () => {
|
|
|
2465
2492
|
fetchPolicy: "cache-and-network"
|
|
2466
2493
|
}
|
|
2467
2494
|
}
|
|
2468
|
-
}),
|
|
2495
|
+
}), Io = (t) => {
|
|
2469
2496
|
const { tanyaConfig: e } = t;
|
|
2470
2497
|
return /* @__PURE__ */ a(dr, { client: lo, children: /* @__PURE__ */ a(xr, { children: /* @__PURE__ */ a(Tr, { tanyaConfig: e }) }) });
|
|
2471
2498
|
};
|
|
2472
2499
|
export {
|
|
2473
|
-
|
|
2500
|
+
Io as TanyaChatbot,
|
|
2474
2501
|
vo as TanyaChatbotProvider
|
|
2475
2502
|
};
|
|
2476
2503
|
//# sourceMappingURL=tanya-chatbot.es.js.map
|