tanya-chatbot 0.4.2 → 0.4.3
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),n=require("react/jsx-runtime"),Bt=require("@apollo/client"),tt=require("react-redux"),ae=require("@reduxjs/toolkit"),er=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const E=require("axios");require("crypto-js");const he=require("@iconify/react"),U=require("react-toastify");function rr(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const Pe=rr(er),or='*,: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}}';function nr(){return S.useEffect(()=>{if(typeof document<"u"){const t=document.createElement("style");return t.textContent=or,document.head.appendChild(t),()=>{document.head.removeChild(t)}}},[]),null}const ar={store:{storeCode:"",storeName:"",storeDescription:"",activeCatalogId:0,isDefault:!1,logoDarkBg:"",logoLightBg:"",logoTransparent:"",catalogs:[],themeColor:"",themeContrastColor:"",tanyaThemeColor:"",tanyaThemeColorLight:"",favicon:"",websiteTitle:"",flowId:"",aliasId:"",searchConfigs:{endpoint:"",accessKey:"",secretKey:""},homePageCategories:[],carouselImages:{web:[],mobile:[]},otherImages:{web:[],mobile:[]}}},$e=ae.createSlice({name:"store",initialState:ar,reducers:{setStore:(t,e)=>{t.store=e.payload}}}),{setStore:eo}=$e.actions,sr=$e.reducer,ir={product:null},ze=ae.createSlice({name:"product",initialState:ir,reducers:{setProduct:(t,e)=>{t.product=e.payload}}}),{setProduct:te}=ze.actions,lr=ze.reducer,cr=ae.configureStore({reducer:{store:sr,product:lr}}),dr=({children:t})=>n.jsx(tt.Provider,{store:cr,children:t}),Ut=t=>{const e=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:t}});window.dispatchEvent(e)};function ur({...t}){return n.jsx(Pe.Root,{"data-slot":"popover",...t})}function fr({...t}){return n.jsx(Pe.Trigger,{"data-slot":"popover-trigger",...t})}const bt=()=>({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"}),De=async()=>{const t="https://tanya-sfcc-server.vercel.app/";try{const e=await E.post(`${t}api/auth/token-bm-grant?baseUrl=${et()}&siteId=${R()}`);return e.status===200&&e.data.access_token?e.data.access_token:(console.error("Failed to fetch token:",e.data),null)}catch(e){return E.isAxiosError(e)?console.error("Error fetching token:",e.response||e.message):console.error("Unexpected error:",e),null}},Ae=async t=>{const e="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await E.post(`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${et()}&siteId=${R()}&pubCfg=${rt()}&envRef=${ot()}&orgRef=${nt()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return o.status===200&&o.data?o.data:null}catch(r){return E.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function It(){var g;const t=R(),e="access_token_"+t,r="expires_in_"+t,o=localStorage.getItem(r),a=localStorage.getItem(e);console.log(a);const l=((g=JSON.parse(sessionStorage.getItem("customerData")||"{}"))==null?void 0:g.isGuest)||!0;if(o&&a&&new Date().getTime()<parseInt(o))return console.log("access token found in local storage"),{access_token:a,expires_in:o};const{serverUrl:c}=bt(),d=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,s=JSON.parse(sessionStorage.getItem("customerData")||"{}").usrRef;try{const h=l?"unregister-auth":"register-auth",k=await E.get(`${c}sc-api/${h}?dwsid=${d}&email=${s}&pubCfg=${rt()}&envRef=${ot()}&orgRef=${nt()}&siteId=${R()}&token=true`,{withCredentials:!0});return localStorage.setItem(e,k.data.access_token),localStorage.setItem(r,String(new Date().getTime()+k.data.expires_in*1e3)),localStorage.setItem("isGuest",l?"true":"false"),k.data}catch(h){console.log(h)}}const et=()=>sessionStorage.getItem("Host"),R=()=>sessionStorage.getItem("SiteId"),rt=()=>sessionStorage.getItem("pubCfg"),ot=()=>sessionStorage.getItem("envRef"),nt=()=>sessionStorage.getItem("orgRef"),me=async t=>{console.log("fetching results");const{serverUrl:e,basePath:r}=bt();let o="";{const a=await It();console.log("the token from getSearchResults",a),o=a.access_token}try{const a=et();return(await E.get(`${e}${r}/search-sfcc?baseUrl=${a}&query=${t}&siteId=${R()}&pubCfg=${rt()}&envRef=${ot()}&orgRef=${nt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(a){throw console.error("Error fetching search results:",a),a}},qe=async t=>{if(!t)throw new Error("Product ID is required");const{serverUrl:e,basePath:r}=bt(),o=et();console.log("calling access");const{access_token:a}=await It();return console.log(a),(await E.get(`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${R()}&pubCfg=${rt()}&envRef=${ot()}&orgRef=${nt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})).data},pr=async t=>{if(!t)throw new Error("customerId is required");const e=await De(),{customer_token:r}=await Ae(e),{serverUrl:o,basePath:a}=bt(),c=(await It()).access_token;return(await E.get(`${o}${a}/get-interest?baseUrl=${et()}&customerId=${t}&siteId=${R()}&pubCfg=${rt()}&envRef=${ot()}&orgRef=${nt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`}})).data},we=t=>String(typeof t=="string"?t:t["en-US"]||t),ge=t=>t!=null&&t.image?[t.image]:"variants"in t?t.variants[0].images:t.masterVariant.images.map(e=>e.url),hr=(t,e)=>t.toLocaleString("en-US",{style:"currency",currency:e||"USD"}),xe=t=>{var e,r,o;return"variants"in t?{centAmount:(e=t.variants[0])==null?void 0:e.prices.EUR.max,currencyCode:"DOL"}:{centAmount:(r=t.masterVariant)==null?void 0:r.prices[0].value.centAmount,currencyCode:(o=t.masterVariant)==null?void 0:o.prices[0].value.currencyCode}},mr=t=>t.charAt(0).toUpperCase()+t.slice(1),be=(t,e)=>t.length<e?t:t.slice(0,e)+"...",Wt=t=>t.split("\\n").map((e,r)=>{const o=e.match(/^(\d+)\.\s(.+)/);return o?`<p key=${r} class="mb-2"><strong>${o[1]}.</strong> ${o[2]}</p>`:e.trim()?`<p key=${r} class="mb-2">${e}</p>`:"<br/>"}).join("");function wr(){const t=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[e,r]=S.useState(t);return S.useEffect(()=>{const o=()=>r(t());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e}const gr=({product:t})=>{const e=tt.useDispatch(),r=wr(),[o,a]=S.useState(0),l=()=>{a(s=>s+r>=t.length?0:s+r)},c=()=>{a(s=>s-r<0?t.length-(t.length%r||r):s-r)},d=async s=>{const g=await qe(s);e(te(g))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:c,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:t.slice(o,o+r).map(s=>{var g,h,k,_;return n.jsxs("div",{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]",onClick:()=>{d(s.product_id??s.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((g=ge(s)[0])==null?void 0:g.link)||ge(s)[0]||"https://via.placeholder.com/120",alt:s!=null&&s.productName?s.productName:"Product",className:"w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"})}),n.jsxs("div",{className:"text-white w-full p-2 text-[12px] text-center h-[60px]",children:[n.jsxs("div",{className:"relative inline-block group",children:[n.jsx("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:be(we((h=s==null?void 0:s.name)==null?void 0:h["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:s!=null&&s.productName?s.productName:s!=null&&s.product_name?s.product_name:be(we((k=s==null?void 0:s.name)==null?void 0:k["en-US"]),60)||"Product"})]}),n.jsxs("div",{className:" flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1",children:[n.jsx("p",{children:hr(s!=null&&s.price?Number(s==null?void 0:s.price):xe(s).centAmount||0,(_=xe(s))==null?void 0:_.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(s==null?void 0:s.price).toFixed(2)??5]})]})]})]},s.productId)})}),(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:l,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},xr=({chat:t,storeDetails:e})=>n.jsx("div",{className:"bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",children:t.map((r,o)=>n.jsxs("div",{className:"mb-4 p-3 rounded-xl",style:{background:"linear-gradient(109.52deg, #F0EEF5 36.91%, #F4F3EE 100.34%"},children:[n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",children:mr(r.keyword)||"No keyword"}),n.jsx(gr,{product:r.items,storeDetails:e})]},o))}),Le=async(t,e)=>{const{serverUrl:r,basePath:o}=bt(),a=`${r}`;console.log(`customer_token
|
|
2
|
-
`,t);try{
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),n=require("react/jsx-runtime"),Ut=require("@apollo/client"),st=require("react-redux"),ae=require("@reduxjs/toolkit"),or=require("@radix-ui/react-popover");require("clsx");require("tailwind-merge");const E=require("axios");require("crypto-js");const me=require("@iconify/react"),U=require("react-toastify");function nr(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const $e=nr(or),ar='*,: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}}';function sr(){return S.useEffect(()=>{if(typeof document<"u"){const t=document.createElement("style");return t.textContent=ar,document.head.appendChild(t),()=>{document.head.removeChild(t)}}},[]),null}const ir={store:{storeCode:"",storeName:"",storeDescription:"",activeCatalogId:0,isDefault:!1,logoDarkBg:"",logoLightBg:"",logoTransparent:"",catalogs:[],themeColor:"",themeContrastColor:"",tanyaThemeColor:"",tanyaThemeColorLight:"",favicon:"",websiteTitle:"",flowId:"",aliasId:"",searchConfigs:{endpoint:"",accessKey:"",secretKey:""},homePageCategories:[],carouselImages:{web:[],mobile:[]},otherImages:{web:[],mobile:[]}}},ze=ae.createSlice({name:"store",initialState:ir,reducers:{setStore:(t,e)=>{t.store=e.payload}}}),{setStore:oo}=ze.actions,lr=ze.reducer,cr={product:null},De=ae.createSlice({name:"product",initialState:cr,reducers:{setProduct:(t,e)=>{t.product=e.payload}}}),{setProduct:te}=De.actions,dr=De.reducer,ur=ae.configureStore({reducer:{store:lr,product:dr}}),fr=({children:t})=>n.jsx(st.Provider,{store:ur,children:t}),Mt=t=>{const e=new CustomEvent("reactCartUpdated",{detail:{cartUpdated:!0,basketId:t}});window.dispatchEvent(e)};function pr({...t}){return n.jsx($e.Root,{"data-slot":"popover",...t})}function hr({...t}){return n.jsx($e.Trigger,{"data-slot":"popover-trigger",...t})}const it=()=>({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"}),Ae=async()=>{const t="https://tanya-sfcc-server.vercel.app/";try{const e=await E.post(`${t}api/auth/token-bm-grant?baseUrl=${X()}&siteId=${M()}`);return e.status===200&&e.data.access_token?e.data.access_token:(console.error("Failed to fetch token:",e.data),null)}catch(e){return E.isAxiosError(e)?console.error("Error fetching token:",e.response||e.message):console.error("Unexpected error:",e),null}},qe=async t=>{const e="https://tanya-sfcc-server.vercel.app/";try{const r=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,o=await E.post(`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${X()}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});return o.status===200&&o.data?o.data:null}catch(r){return E.isAxiosError(r)?console.error("Error creating basket:",r.response||r.message):console.error("Unexpected error:",r),null}};async function Nt(){var g;const t=M(),e="access_token_"+t,r="expires_in_"+t,o=localStorage.getItem(r),a=localStorage.getItem(e);console.log(a);const d=((g=JSON.parse(sessionStorage.getItem("customerData")||"{}"))==null?void 0:g.isGuest)||!0;if(o&&a&&new Date().getTime()<parseInt(o))return console.log("access token found in local storage"),{access_token:a,expires_in:o};const{serverUrl:i}=it(),l=JSON.parse(sessionStorage.getItem("customerData")||"{}").dwsid,s=JSON.parse(sessionStorage.getItem("customerData")||"{}").usrRef;try{const h=d?"unregister-auth":"register-auth",k=await E.get(`${i}sc-api/${h}?dwsid=${l}&email=${s}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}&siteId=${M()}&token=true`,{withCredentials:!0});return localStorage.setItem(e,k.data.access_token),localStorage.setItem(r,String(new Date().getTime()+k.data.expires_in*1e3)),localStorage.setItem("isGuest",d?"true":"false"),k.data}catch(h){console.log(h)}}const X=()=>sessionStorage.getItem("Host"),M=()=>sessionStorage.getItem("SiteId"),Q=()=>sessionStorage.getItem("pubCfg"),Z=()=>sessionStorage.getItem("envRef"),tt=()=>sessionStorage.getItem("orgRef"),we=async t=>{console.log("fetching results");const{serverUrl:e,basePath:r}=it();let o="";{const a=await Nt();console.log("the token from getSearchResults",a),o=a.access_token}try{const a=X();return(await E.get(`${e}${r}/search-sfcc?baseUrl=${a}&query=${t}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})).data.hits}catch(a){throw console.error("Error fetching search results:",a),a}},Le=async t=>{if(!t)throw new Error("Product ID is required");const{serverUrl:e,basePath:r}=it(),o=X();console.log("calling access");const{access_token:a}=await Nt();return console.log(a),(await E.get(`${e}${r}/product-sfcc/${t}?baseUrl=${o}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}})).data},mr=async t=>{if(!t)throw new Error("customerId is required");const e=await Ae(),{customer_token:r}=await qe(e),{serverUrl:o,basePath:a}=it(),i=(await Nt()).access_token;return(await E.get(`${o}${a}/get-interest?baseUrl=${X()}&customerId=${t}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})).data},ge=t=>String(typeof t=="string"?t:t["en-US"]||t),xe=t=>t!=null&&t.image?[t.image]:"variants"in t?t.variants[0].images:t.masterVariant.images.map(e=>e.url),wr=(t,e)=>t.toLocaleString("en-US",{style:"currency",currency:e||"USD"}),be=t=>{var e,r,o;return"variants"in t?{centAmount:(e=t.variants[0])==null?void 0:e.prices.EUR.max,currencyCode:"DOL"}:{centAmount:(r=t.masterVariant)==null?void 0:r.prices[0].value.centAmount,currencyCode:(o=t.masterVariant)==null?void 0:o.prices[0].value.currencyCode}},gr=t=>t.charAt(0).toUpperCase()+t.slice(1),ye=(t,e)=>t.length<e?t:t.slice(0,e)+"...",Wt=t=>t.split("\\n").map((e,r)=>{const o=e.match(/^(\d+)\.\s(.+)/);return o?`<p key=${r} class="mb-2"><strong>${o[1]}.</strong> ${o[2]}</p>`:e.trim()?`<p key=${r} class="mb-2">${e}</p>`:"<br/>"}).join("");function xr(){const t=()=>window.innerWidth<425?1:window.innerWidth<768?2:4,[e,r]=S.useState(t);return S.useEffect(()=>{const o=()=>r(t());return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e}const br=({product:t})=>{const e=st.useDispatch(),r=xr(),[o,a]=S.useState(0),d=()=>{a(s=>s+r>=t.length?0:s+r)},i=()=>{a(s=>s-r<0?t.length-(t.length%r||r):s-r)},l=async s=>{const g=await Le(s);e(te(g))};return n.jsx("div",{className:"mt-2 overflow-x-hidden",children:n.jsxs("div",{className:"flex items-center justify-center gap-4 relative",children:[(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:i,className:"absolute z-50 left-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:"<"}),n.jsx("div",{className:"flex gap-5 justify-center flex-1 overflow-hidden",children:t.slice(o,o+r).map(s=>{var g,h,k,_;return n.jsxs("div",{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]",onClick:()=>{l(s.product_id??s.productId)},children:[n.jsx("div",{className:"w-full p-2 flex items-center justify-center bg-white",children:n.jsx("img",{src:((g=xe(s)[0])==null?void 0:g.link)||xe(s)[0]||"https://via.placeholder.com/120",alt:s!=null&&s.productName?s.productName:"Product",className:"w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"})}),n.jsxs("div",{className:"text-white w-full p-2 text-[12px] text-center h-[60px]",children:[n.jsxs("div",{className:"relative inline-block group",children:[n.jsx("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:ye(ge((h=s==null?void 0:s.name)==null?void 0:h["en-US"]),60)||"Product"}),n.jsx("div",{className:"absolute left-0 top-full mt-1 w-max max-w-[200px] p-2 bg-white shadow-lg text-black text-xs rounded opacity-0 transition-opacity duration-300 group-hover:opacity-100 z-50 pointer-events-auto",style:{position:"absolute",top:"-100%",left:"0",marginBottom:"5px",zIndex:50},children:s!=null&&s.productName?s.productName:s!=null&&s.product_name?s.product_name:ye(ge((k=s==null?void 0:s.name)==null?void 0:k["en-US"]),60)||"Product"})]}),n.jsxs("div",{className:" flex text-center items-center gap-2 text-[14px] text-[#14121F] font-bold font-nunitoSans text-base mb-1",children:[n.jsx("p",{children:wr(s!=null&&s.price?Number(s==null?void 0:s.price):be(s).centAmount||0,(_=be(s))==null?void 0:_.currencyCode)}),n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans truncate",children:["$",Number(s==null?void 0:s.price).toFixed(2)??5]})]})]})]},s.productId)})}),(t==null?void 0:t.length)>r&&n.jsx("button",{onClick:d,className:"absolute z-50 right-0 text-[#000000] bg-[#ffffff] rounded-full p-2 flex items-center h-fit",style:{height:"30px",width:"30px",boxShadow:"0 4px 10px rgba(0, 0, 0, 0.25)"},children:">"})]})})},yr=({chat:t,storeDetails:e})=>n.jsx("div",{className:"bg-[#FFFFFF] px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",children:t.map((r,o)=>n.jsxs("div",{className:"mb-4 p-3 rounded-xl",style:{background:"linear-gradient(109.52deg, #F0EEF5 36.91%, #F4F3EE 100.34%"},children:[n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] p-2 w-fit rounded-[20px]",children:gr(r.keyword)||"No keyword"}),n.jsx(br,{product:r.items,storeDetails:e})]},o))}),Be=async(t,e)=>{var d,i;const{serverUrl:r,basePath:o}=it(),a=`${r}`;console.log(`customer_token
|
|
2
|
+
`,t);try{const l=await E.post(`${a}${o}/basket/create?baseUrl=${X()}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,e,{headers:{"Content-Type":"application/json",Authorization:t}});return window.postMessage({type:"WIDGET_CREATED_BASKET",basketId:((d=l.data)==null?void 0:d.basket_id)||((i=l.data)==null?void 0:i.basketId)},"*"),l.data}catch(l){return E.isAxiosError(l)?console.error("Error creating basket:",l.response||l.message):console.error("Unexpected error:",l),null}},Rt=async(t,e,r)=>{const{serverUrl:o,basePath:a}=it(),d=`${o}`;try{const i=await E.post(`${d}${a}/basket/add-product/${t}?baseUrl=${X()}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,e,{headers:{"Content-Type":"application/json",Authorization:r}});return i.status===200&&i.data?i.data:null}catch(i){return E.isAxiosError(i)?console.error("Error adding products to basket:",i.response||i.message):console.error("Unexpected error:",i),null}},Ue=async({basketId:t,customer_token:e})=>{var d;const{serverUrl:r,basePath:o}=it(),a=`${r}`;try{const i=await E.get(`${a}${o}/basket/${t}?baseUrl=${X()}&siteId=${M()}&pubCfg=${Q()}&envRef=${Z()}&orgRef=${tt()}`,{headers:{"Content-Type":"application/json",Authorization:e}});return{status:i.status,data:i.data}}catch(i){return E.isAxiosError(i)?{status:(d=i.response)==null?void 0:d.status,data:null}:{status:null,data:null}}},Ht="sfcc_basket_id",ve="sfcc_customer_token",Ft="sfcc_token_expiry",vr=300*1e3,_t="1.0.0";const at=t=>{try{t?localStorage.setItem(Ht,t):localStorage.removeItem(Ht)}catch(e){console.error("Error saving basket ID to storage:",e)}},Vt=t=>{try{if(t){localStorage.setItem(ve,t);const e=Date.now()+vr;localStorage.setItem(Ft,e.toString())}else localStorage.removeItem(ve)}catch(e){console.error("Error storing token:",e)}},ke=300,kr=()=>{var l,s,g,h,k,_;const t=st.useDispatch(),e=st.useSelector(C=>C.product.product),r=st.useSelector(C=>C.store.store),[o,a]=S.useState(!!e);if(S.useEffect(()=>{a(!!e)},[e]),!e)return null;const d=async()=>{var C,z,Y,lt,R,ct,vt,Et,et,kt,St,dt,Tt,Ot,jt,O;console.log(e,"the prod");try{if(!((z=(C=e==null?void 0:e.variants)==null?void 0:C[0])!=null&&z.product_id)&&!(e.type.item||e.type.bundle)&&!((lt=(Y=e==null?void 0:e.variants)==null?void 0:Y[0])!=null&<.productId)){U.toast.error("Variants not available",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const j=[{product_id:((R=e.variants)==null?void 0:R[0].product_id)||((ct=e.variants)==null?void 0:ct[0].productId)||(e==null?void 0:e.id),quantity:1}];console.log(j,"the product data");const v=JSON.parse(sessionStorage.getItem("customerData")||"{}"),rt=(v==null?void 0:v.basketId)||localStorage.getItem(Ht),Kt=!1,Pt=localStorage.getItem(Ft),$t=Date.now();if(!Kt||!Pt||$t>=parseInt(Pt)){let P="";{const ft=await Nt();console.log("token from auth data"),P="Bearer "+ft.access_token}if(!P){console.error("Failed to get customer_token");return}const ut=$t+300*1e3;if(Vt(P),localStorage.setItem(Ft,ut.toString()),rt){const ft=await Ue({basketId:rt,customer_token:P});if(console.log(rt,"basket id from customer"),ft.status===200&&ft){const D=await Rt(rt,j,P);(((vt=D==null?void 0:D.product_items)==null?void 0:vt.length)>0||((Et=D==null?void 0:D.productItems)==null?void 0:Et.length)>0)&&(U.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Mt(rt));return}}const zt={productItems:[{productId:((et=e.variants)==null?void 0:et[0].product_id)||((kt=e.variants)==null?void 0:kt[0].productId)||(e==null?void 0:e.id),quantity:1}]};console.log("before create basket");const p=await Be(P,zt);if(console.log(p,p==null?void 0:p.basket_id,p==null?void 0:p.basketId,"the basket response"),!(p!=null&&p.basket_id)&&!(p!=null&&p.basketId)){console.error("Failed to create basket");return}console.log("setting stored id",(p==null?void 0:p.basket_id)||(p==null?void 0:p.basketId)),at((p==null?void 0:p.basket_id)||(p==null?void 0:p.basketId)),console.log("adding product to basket");const K=await Rt((p==null?void 0:p.basket_id)||(p==null?void 0:p.basketId),j,P);console.log("object added to basket"),(((St=K==null?void 0:K.product_items)==null?void 0:St.length)>0||((dt=K==null?void 0:K.productItems)==null?void 0:dt.length)>0)&&U.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Mt(p.basket_id||(p==null?void 0:p.basketId))}}catch(j){console.error("Error adding to cart:",j),U.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((Tt=j==null?void 0:j.response)==null?void 0:Tt.status)===404||((Ot=j==null?void 0:j.response)==null?void 0:Ot.status)===401?(((jt=j==null?void 0:j.response)==null?void 0:jt.status)===404&&at(null),((O=j==null?void 0:j.response)==null?void 0:O.status)===401&&(at(null),Vt(null))):(console.error("Failed to add product to basket:",j.message),U.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}},i=()=>{e&&(window.location.href=e.c_pdpUrl)};return console.log(e,"the prod"),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>{a(!1),setTimeout(()=>t(te(null)),ke)}}),n.jsxs("div",{className:`
|
|
3
3
|
flex flex-col gap-2 items-center h-[90vh] absolute right-0 bottom-0 z-50 w-full md:w-1/2 md:h-[100vh] lg:w-1/2 lg:h-[100vh] shadow-xl p-2 border-l-2 bg-white border-gray-200 overflow-y-scroll
|
|
4
4
|
transition-all duration-300
|
|
5
5
|
${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"}
|
|
6
|
-
`,style:{willChange:"transform, opacity"},onClick:C=>C.stopPropagation(),children:[n.jsxs("div",{className:"mt-3 flex flex-row justify-between w-full ",children:[n.jsx("div",{children:n.jsx("p",{className:"text-[#000000] font-bold font-nunitoSans",children:e.name})}),n.jsx("div",{children:n.jsx(
|
|
6
|
+
`,style:{willChange:"transform, opacity"},onClick:C=>C.stopPropagation(),children:[n.jsxs("div",{className:"mt-3 flex flex-row justify-between w-full ",children:[n.jsx("div",{children:n.jsx("p",{className:"text-[#000000] font-bold font-nunitoSans",children:e.name})}),n.jsx("div",{children:n.jsx(me.Icon,{icon:"mdi:close",className:"text-[#555555] w-6 h-6 cursor-pointer",onClick:()=>{a(!1),setTimeout(()=>t(te(null)),ke)}})})]}),n.jsxs("div",{className:"flex flex-row gap-2 items-center flex-wrap",children:[n.jsx("div",{className:"flex flex-row items-center justify-center w-[120px] h-[120px] my-5",children:n.jsx("img",{src:(h=(g=(s=(l=e.imageGroups)==null?void 0:l[0])==null?void 0:s.images)==null?void 0:g[0])==null?void 0:h.link,alt:e.name,className:"rounded-[10px]"})}),n.jsx("div",{className:"flex flex-col items-center gap-2",children:e.imageGroups.slice(1,2).map(C=>C.images.slice(1,2).map(z=>n.jsx("img",{src:z.link,alt:e.name,className:"rounded-[10px] w-[60px] h-[60px]"},z.link)))})]}),n.jsxs("div",{className:"flex flex-row items-center justify-between w-full",children:[n.jsxs("div",{className:"flex flex-row items-center gap-2",children:[n.jsxs("p",{className:"text-[#14121F] font-bold font-nunitoSans",children:[" ","$",e.price.toFixed(2)]})," ",n.jsxs("p",{className:"text-[#14121F] font-normal line-through text-sm font-nunitoSans",children:[" ","$",(e.price+5).toFixed(2)]})]}),n.jsx("div",{children:n.jsx("p",{className:"text-[#EC5050] font-bold font-nunitoSans",children:e.discount})})]}),n.jsx("div",{className:"mt-2 w-full border-t-2 border-gray-200"}),n.jsxs("div",{className:"w-full text-left",children:[n.jsx("div",{className:"text-[#323135] font-bold font-nunitoSans mt-3 text-[14px]",children:"Product Details"}),n.jsx("div",{className:"text-[#68656E] font-normal font-nunitoSans text-xs pl-2 mt-3",dangerouslySetInnerHTML:{__html:e.short_description||e.longDescription}})]}),n.jsxs("div",{className:"mt-4 flex flex-col gap-2 w-full p-2",children:[n.jsx("div",{className:"flex flex-row items-center gap-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-left font-nunitoSans",children:[n.jsxs("div",{className:"text-[#323135] font-bold",children:[((k=e==null?void 0:e.rating)==null?void 0:k.rate)||0," /"," ",n.jsx("span",{className:"text-[#68656E]",children:"5"})]}),n.jsx("div",{className:"text-[#323135] font-semibold text-sm",children:"Overall Rating"}),n.jsxs("div",{className:"text-[#68656E] font-semibold text-sm",children:[((_=e==null?void 0:e.rating)==null?void 0:_.count)||0," ratings"]})]})}),n.jsx("div",{className:"mt-2 flex flex-row items-center gap-2",children:Array.from({length:5}).map((C,z)=>{var Y;return n.jsx(me.Icon,{icon:"mdi:star",width:"20",height:"20",className:`text-yellow-500
|
|
7
7
|
${((Y=e==null?void 0:e.rating)==null?void 0:Y.rate)>z?"text-yellow-500":"text-gray-300"}
|
|
8
|
-
`},z)})})]}),n.jsxs("div",{className:"flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",style:{marginTop:"150px"},children:[n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",style:{backgroundColor:r.tanyaThemeColor},onClick:
|
|
9
|
-
`);q=V.pop()||"";for(const J of V)if(J.startsWith("data:")){const f=J.slice(5).trim();try{const B=JSON.parse(f);B.index===0&&
|
|
10
|
-
`);q=J.pop()||"";for(const f of J)if(f.startsWith("data:")){const B=f.slice(5).trim();try{const
|
|
8
|
+
`},z)})})]}),n.jsxs("div",{className:"flex flex-col items-center justify-between font-nunitoSans font-semibold w-5/6 text-black gap-2",style:{marginTop:"150px"},children:[n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer",style:{backgroundColor:r.tanyaThemeColor},onClick:d,children:"Add to Cart"}),n.jsx("button",{className:"rounded-[5px] shadow-sm text-[#FBFBFC] bg-[#6851C6] p-2 w-full text-center cursor-pointer mb-16",style:{backgroundColor:r.tanyaThemeColor},onClick:i,children:"View more"})]})]})]})},Sr=({tanyaConfig:t,basketId:e})=>{const r=["Myself","My Child","My Grandchild","Niece/Nephew","My Friends","Others"],o={Myself:"himself/herself","My Child":"his/her child","My Grandchild":"his/her grandchild","Niece/Nephew":"his/her niece/nephew","My Friends":"his/her friends",Others:"others"},a=S.useRef(null),d=S.useRef(null),i=S.useRef(null),l=S.useRef(null),[s,g]=S.useState(null),[h,k]=S.useState(!1),[_,C]=S.useState(!1),[z,Y]=S.useState(!1),[lt,R]=S.useState(!1),[ct,vt]=S.useState(!1),[Et,et]=S.useState(!1),[kt,St]=S.useState(""),[dt,Tt]=S.useState(""),Ot=c=>({id:c.id,title:c.name,image:c.image??"",price:c.price??0}),[jt,O]=S.useState([]),j=S.useRef(null),v=st.useSelector(c=>c.store.store),rt=st.useSelector(c=>c.product.product),Kt=()=>{Y(!0),setTimeout(()=>C(!0),10)},Pt=()=>{C(!1),setTimeout(()=>Y(!1),300)};S.useEffect(()=>{h?Kt():Pt()},[h]);const $t=c=>{Tt(o[c])};S.useEffect(()=>{j.current&&(j.current.scrollTop+=150)},[jt]);let P=null,ut=null;const zt=async()=>{if(P&&ut&&Date.now()<ut)return P;try{const c="https://us-east-1lsr29ln3u.auth.us-east-1.amazoncognito.com/oauth2/token",y=new URLSearchParams({grant_type:"client_credentials",client_id:"4i8rd70sgt961tc4dhskgf08c",client_secret:"bnsfq1220loh2cn2cm2ttn8fdhdpt0u8m1fgj8vfk2rn61aurjg",scope:"default-m2m-resource-server-8xzfzo/read"}),m=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:y});if(!m.ok)throw new Error(`Token request failed! status: ${m.status}`);const x=await m.json();P=x.access_token;const u=x.expires_in||3600;return ut=Date.now()+(u-60)*1e3,P}catch(c){return console.error("Error obtaining JWT token:",c),P=null,ut=null,null}},p=async()=>{const c=await Nt();c!=null&&g(c)};S.useEffect(()=>{if(t!=null&&t.siteId){const{clientID:c,host:y,organizationID:m,shortCode:x,siteId:u}=t;sessionStorage.setItem("Host",y),sessionStorage.setItem("SiteId",u),sessionStorage.setItem("pubCfg",btoa(c)),sessionStorage.setItem("envRef",x),sessionStorage.setItem("orgRef",m)}p(),console.log("scapi environment v1")},[]),S.useEffect(()=>{e&&(console.log("setting the basket id",e),at(e))},[e]);const K=async()=>{const c=JSON.parse(sessionStorage.getItem("customerData")||"{}").customerId;return(await mr(c||"")).c_interests},ft=async(c,y)=>{console.log("in secondary flow",_t);const m=await K();if(console.log(m,"interests of customer",_t),!!m)try{O(L=>L.map((H,V)=>V===L.length-1?{...H,secondaryLoading:!0}:H));const x=await zt();if(!x)throw new Error("Failed to fetch token");const u=localStorage.getItem("customerNumber"),w=localStorage.getItem("isLoggedIn"),pt=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(w||!1),userId:String(u||new Date().getTime())}).toString()}`,ht=JSON.stringify({flowId:"Q166PR519W",flowAliasId:"HKFUVLWVH2",input:{loyaltyPoints:"",productName:c,productPoints:String(y||0),interests:m}}),A=await fetch(pt,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x}`},body:ht});if(!A.body)throw new Error("Readable stream not supported");const mt=A.body.getReader(),wt=new TextDecoder;let q="";for(;;){const{done:L,value:H}=await mt.read();if(L)break;q+=wt.decode(H,{stream:!0});const V=q.split(`
|
|
9
|
+
`);q=V.pop()||"";for(const J of V)if(J.startsWith("data:")){const f=J.slice(5).trim();try{const B=JSON.parse(f);B.index===0&&O(I=>I.map((T,W)=>W===I.length-1?{...T,secondaryResponse:B.data,secondaryLoading:!1}:T))}catch(B){O(I=>I.map((T,W)=>W===I.length-1?{...T,secondaryLoading:!1}:T)),console.error("Secondary flow JSON parse error:",B)}}}}catch(x){console.error("Secondary flow error:",x)}},D=async c=>{const y=c||kt.trim();if(y){vt(!0),St(""),a.current=null,d.current=null,i.current=null,l.current=null,O(m=>[...m,{query:y,response:"Thinking for what suits you best...",potentialQuestions:"",products:[],keywords:"Thinking for best products..."}]);try{const m=dt,x=localStorage.getItem("customerNumber"),u=localStorage.getItem("isLoggedIn"),w=await zt();if(!w)throw new Error("Failed to obtain access token");const pt=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(u||!1),userId:String(x||new Date().getTime())}).toString()}`,ht=JSON.stringify({flowId:"MMHQKYI1NE",flowAliasId:"SZF9ZK1ATE",input:{userPrompt:y,whom:m}}),A=await fetch(pt,{signal:AbortSignal.timeout(3e4),method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${w}`},body:ht});if(!A.ok)throw new Error(`HTTP error! status: ${A.status}`);if(!A.body)throw new Error("Readable stream not supported");const mt=A.body.getReader(),wt=new TextDecoder;let q="",L="";for(;;){et(!0);const{done:H,value:V}=await mt.read();if(H)break;q+=wt.decode(V,{stream:!0});const J=q.split(`
|
|
10
|
+
`);q=J.pop()||"";for(const f of J)if(f.startsWith("data:")){const B=f.slice(5).trim();try{const I=JSON.parse(B);I.index==1&&(L=I.data),O(T=>T.map((W,Dt)=>Dt===T.length-1?{...W,[I.index==0?"response":I.index==1?"keywords":I.index==2?"potentialQuestions":"end"]:I.data}:W))}catch(I){console.error("Error parsing JSON:",I)}}}Qe(Xe(L))}catch(m){console.error("Error sending message to Tanya:",m)}finally{vt(!1)}}},Xe=c=>{const y=c.match(/top five relevant product or category names are: (.*)/i),u=(y?y[1]:c).split(", ").map($=>$.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi,"").trim());return[...new Set(u)].filter(Boolean).join(",")},Qe=async c=>{if(typeof c=="string"){console.log(c,"keywords");const y=c.split(",");for(const m of y){const x=await we(m);if(et(!1),(x==null?void 0:x.length)>0&&(O(u=>u.map((w,$)=>$===u.length-1?{...w,products:[...w.products||[],{keyword:m,items:x,loading:!1}]}:w)),!a.current||d.current==null)){const u=x[0];a.current=String((u==null?void 0:u.product_name)??""),i.current=u.image.link,d.current=u.product_id;const w=typeof(u==null?void 0:u.price)=="number"?u.price:void 0;l.current=typeof w=="number"&&Number.isFinite(w)?w:null}}}else for(const y of c){const m=await we(y);et(!1),(m==null?void 0:m.length)>0&&O(x=>x.map((u,w)=>w===x.length-1?{...u,products:[...u.products||[],{keyword:y,items:m,loading:!1}]}:u))}if(a.current){O(m=>m.map((x,u)=>u===m.length-1?{...x,productSnapshot:{id:d.current,name:a.current,image:i.current,price:l.current??null,points:0,quantity:1}}:x));const y=JSON.parse(sessionStorage.getItem("customerData")||"{}");(y==null?void 0:y.isGuest)==!1?(console.log("running secondary flow",_t),ft(a.current,0)):console.log("not running secondary flow",_t)}et(!1)},Ze=async(c,y)=>{var m,x,u,w,$,pt,ht,A,mt,wt,q,L,H,V,J;R(!0);try{const f=await Le(c.id);if(!((x=(m=f==null?void 0:f.variants)==null?void 0:m[0])!=null&&x.product_id||(w=(u=f==null?void 0:f.variants)==null?void 0:u[0])!=null&&w.productId)&&!(f.type.item||f.type.bundle)){R(!1),U.toast.error("Variants not found",{position:"bottom-right",autoClose:1e3}),console.error("No product variant found");return}const B=[{product_id:(($=f.variants)==null?void 0:$[0].product_id)||((pt=f.variants)==null?void 0:pt[0].productId)||(f==null?void 0:f.id),quantity:y}];console.log(B,"product data","app version",_t);const I=JSON.parse(sessionStorage.getItem("customerData")||"{}"),T=(I==null?void 0:I.basketId)||localStorage.getItem(Ht),W=!1,Dt=localStorage.getItem(Ft),pe=Date.now();if(!W||!Dt||pe>=parseInt(Dt)){const tr=await Ae();let{customer_token:ot}=await qe(tr);if(ot="Bearer "+s.access_token,!ot){console.error("Failed to get customer_token");return}const er=pe+300*1e3;if(Vt(ot),localStorage.setItem(Ft,er.toString()),console.log(T,"basketIdFromCustomer"),T){const he=await Ue({basketId:T,customer_token:ot});if(he.status===200&&he){const Jt=await Rt(T,B,ot);((ht=Jt==null?void 0:Jt.product_items)==null?void 0:ht.length)>0&&(U.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Mt(T),R(!1));return}}const rr={productItems:[{productId:((A=f.variants)==null?void 0:A[0].product_id)||((mt=f.variants)==null?void 0:mt[0].productId)||(f==null?void 0:f.id),quantity:1}]},b=await Be(ot,rr);if(console.log(b,b==null?void 0:b.basket_id,b==null?void 0:b.basketId,"the basket response"),!(b!=null&&b.basket_id||!(b!=null&&b.basketId))){R(!1),console.error("Failed to create basket");return}at((b==null?void 0:b.basket_id)||(b==null?void 0:b.basketId));const gt=await Rt((b==null?void 0:b.basket_id)||(b==null?void 0:b.basketId),B,ot);(((wt=gt==null?void 0:gt.product_items)==null?void 0:wt.length)>0||((q=gt==null?void 0:gt.productItems)==null?void 0:q.length)>0)&&U.toast.success("Added to cart",{position:"bottom-right",autoClose:3e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0}),Mt(b.basket_id||(b==null?void 0:b.basketId))}}catch(f){R(!1),console.error("Error adding to cart:",f),U.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}),((L=f==null?void 0:f.response)==null?void 0:L.status)===404||((H=f==null?void 0:f.response)==null?void 0:H.status)===401?(((V=f==null?void 0:f.response)==null?void 0:V.status)===404&&at(null),((J=f==null?void 0:f.response)==null?void 0:J.status)===401&&(at(null),Vt(null))):(console.error("Failed to add product to basket:",f.message),U.toast.error("Failed to add product to cart",{position:"bottom-right",autoClose:3e3}))}R(!1)};return n.jsx("div",{className:"relative flex justify-center",children:n.jsxs(pr,{open:h,onOpenChange:k,children:[n.jsx(hr,{onClick:()=>k(!0),style:{},className:"flex items-center rounded-lg cursor-pointer hover:opacity-90 transition-opacity p-0",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_958_585)",children:[n.jsx("path",{d:"M30.0002 5C31.7683 5 33.464 5.70238 34.7142 6.95262C35.9644 8.20286 36.6668 9.89856 36.6668 11.6667V25C36.6668 26.7681 35.9644 28.4638 34.7142 29.714C33.464 30.9643 31.7683 31.6667 30.0002 31.6667H25.6902L21.1785 36.1783C20.8915 36.4653 20.5097 36.6377 20.1046 36.6631C19.6996 36.6886 19.2992 36.5654 18.9785 36.3167L18.8218 36.1783L14.3085 31.6667H10.0002C8.28976 31.6667 6.64478 31.0093 5.40548 29.8305C4.16617 28.6516 3.42735 27.0416 3.34183 25.3333L3.3335 25V11.6667C3.3335 9.89856 4.03588 8.20286 5.28612 6.95262C6.53636 5.70238 8.23205 5 10.0002 5H30.0002Z",fill:"url(#paint0_linear_958_585)"}),n.jsx("path",{d:"M28.3335 15.6511V11.6667C28.3335 11.6667 22.2774 12.6042 20.1148 15.4167C17.9521 18.2292 18.6644 26.6667 18.6644 26.6667H22.5321C22.5321 26.6667 22.0614 18.9323 23.4989 17.2917C24.9364 15.6511 28.3335 15.6511 28.3335 15.6511Z",fill:"white"}),n.jsx("path",{d:"M13.3335 11.6667H19.6184V15.4167H13.3335V11.6667Z",fill:"white"})]}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_958_585",x1:"20.0002",y1:"5",x2:"35.0002",y2:"30",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{stopColor:"#452697"}),n.jsx("stop",{offset:"1",stopColor:"#7C5BFF"})]}),n.jsx("clipPath",{id:"clip0_958_585",children:n.jsx("rect",{width:"40",height:"40",fill:"white"})})]})]})})}),z&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:()=>k(!1)}),n.jsxs("div",{className:`
|
|
11
11
|
fixed z-50 h-screen w-[100vw] sm:w-[80vw] md:w-[770px] border-0 bg-white lg:rounded-l-xl overflow-hidden flex flex-col shadow-[0px_4px_10px_0px_#5F499840]
|
|
12
12
|
top-0 right-0
|
|
13
13
|
transition-transform duration-300 ease-in-out
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
// For mobile: animate from bottom
|
|
17
17
|
${_?"translate-y-0":"translate-y-full"}
|
|
18
18
|
lg:translate-y-0
|
|
19
|
-
`,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",color:v.tanyaThemeContrastColor,alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>k(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${lt?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:j,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(v==null?void 0:v.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:r.map(i=>n.jsx("button",{onClick:()=>Pt(i),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:it===o[i]?"#FFFFFF":"#F3F3F3",borderColor:it===o[i]?"#BBB3DD":""},children:i},i))})]}),St.map((i,y)=>{var m,x;return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-end",children:n.jsx("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})}),i.response&&i.response.includes("Thinking")?n.jsx("div",{children:n.jsx("div",{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",dangerouslySetInnerHTML:{__html:Wt(i.response)}})}):n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:Wt(i.response)}})}),Nt&&!i.response.includes("Thinking")&&((m=i.products)==null?void 0:m.length)==0&&n.jsx("div",{children:n.jsx("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"})}),(i==null?void 0:i.products)&&((x=i==null?void 0:i.products)==null?void 0:x.length)>0&&n.jsx(xr,{chat:i.products,storeDetails:v}),i.potentialQuestions.length>0&&n.jsxs("div",{className:"my-2 px-4 text-sm text-gray-700",children:[n.jsx("p",{className:"font-nunitoSans font-bold text-sm text-[#494949]",style:{color:v.themeDarkColor},children:"Why not explore these inquiries..."}),i.potentialQuestions.split(",").map((u,w)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${v.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>Kt(u),style:{backgroundColor:v.tanyaThemeColorLight},children:u},w))]}),i.secondaryLoading&&n.jsx("div",{className:"mt-3 mb-4 px-4",children:n.jsxs("div",{className:"tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",style:{margin:"0.75rem"},children:[n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"tanya-sparkle tanya-sparkle-1",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-2",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-3",children:"✨"})]}),n.jsx("div",{className:"tanya-shimmer"}),n.jsx("p",{className:"font-semibold tanya-pulse",style:{color:v.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:v.themeDarkColor},children:"• • •"})]})}),i.secondaryResponse&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]",children:[n.jsx("div",{className:"text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",style:{backgroundColor:v.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:Wt(i.secondaryResponse)}}),i.productSnapshot&&n.jsx("div",{className:"mt-4 w-full",children:n.jsxs("div",{className:"flex gap-4 items-stretch rounded-2xl p-4",style:{backgroundColor:v.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:i.productSnapshot.image?n.jsx("img",{src:i.productSnapshot.image,alt:i.productSnapshot.name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-500",children:"No Image"})}),n.jsxs("div",{className:"flex flex-col flex-1 justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-[15px] leading-snug",children:i.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:i.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(v==null?void 0:v.currency)||"USD"}).format(i.productSnapshot.price):""}),i.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[i.productSnapshot.points," ","points"]})]})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center border rounded-full overflow-hidden",children:[n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>T(u=>u.map((w,$)=>$===y&&w.productSnapshot?{...w,productSnapshot:{...w.productSnapshot,quantity:Math.max(1,w.productSnapshot.quantity-1)}}:w)),style:{background:"transparent",color:v.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:i.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>T(u=>u.map((w,$)=>$===y&&w.productSnapshot?{...w,productSnapshot:{...w.productSnapshot,quantity:w.productSnapshot.quantity+1}}:w)),style:{background:"transparent",color:v.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{Xe(Tt(i.productSnapshot),i.productSnapshot.quantity)},disabled:at,className:"px-4 py-2 rounded-full font-medium",style:{background:v.tanyaThemeColor,color:(v==null?void 0:v.tanyaThemeContrastColor)||"#fff",opacity:at?.8:1},children:at?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},y)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:vt,autoFocus:!0,onChange:i=>kt(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!st&&Kt()}}),n.jsx("button",{type:"submit",disabled:st,className:"p-3",onClick:()=>Kt(),children:st?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:v.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(yr,{})]})]})]})]})})};var ee=function(t,e){return ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])},ee(t,e)};function kr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ee(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var G=function(){return G=Object.assign||function(e){for(var r,o=1,a=arguments.length;o<a;o++){r=arguments[o];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e},G.apply(this,arguments)};function Sr(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(t);a<o.length;a++)e.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(r[o[a]]=t[o[a]]);return r}var Gt="Invariant Violation",ke=Object.setPrototypeOf,jr=ke===void 0?function(t,e){return t.__proto__=e,t}:ke,Be=(function(t){kr(e,t);function e(r){r===void 0&&(r=Gt);var o=t.call(this,typeof r=="number"?Gt+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=Gt,jr(o,e.prototype),o}return e})(Error);function Q(t,e){if(!t)throw new Be(e)}var Ue=["debug","log","warn","error","silent"],_r=Ue.indexOf("log");function Dt(t){return function(){if(Ue.indexOf(t)>=_r){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Dt("debug"),t.log=Dt("log"),t.warn=Dt("warn"),t.error=Dt("error")})(Q||(Q={}));var Me="3.14.0";function wt(t){try{return t()}catch{}}const re=wt(function(){return globalThis})||wt(function(){return window})||wt(function(){return self})||wt(function(){return global})||wt(function(){return wt.constructor("return this")()});var Se=new Map;function Cr(t){var e=Se.get(t)||1;return Se.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Fr(t,e){var r=Cr("stringifyForDisplay");return JSON.stringify(t,function(o,a){return a===void 0?r:a},e).split(JSON.stringify(r)).join("<undefined>")}function At(t){return function(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof e=="number"){var a=e;e=se(a),e||(e=ie(a,r),r=[])}t.apply(void 0,[e].concat(r))}}var Xt=Object.assign(function(e,r){for(var o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];e||Q(e,se(r,o)||ie(r,o))},{debug:At(Q.debug),log:At(Q.log),warn:At(Q.warn),error:At(Q.error)});function He(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new Be(se(t,e)||ie(t,e))}var je=Symbol.for("ApolloErrorMessageHandler_"+Me);function Ve(t){if(typeof t=="string")return t;try{return Fr(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function se(t,e){if(e===void 0&&(e=[]),!!t)return re[je]&&re[je](t,e.map(Ve))}function ie(t,e){if(e===void 0&&(e=[]),!!t)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:Me,message:t,args:e.map(Ve)})))}function Ir(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}let I=null;const _e={};let Nr=1;const Er=()=>class{constructor(){this.id=["slot",Nr++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=I;e;e=e.parent)if(this.id in e.slots){const r=e.slots[this.id];if(r===_e)break;return e!==I&&(I.slots[this.id]=r),!0}return I&&(I.slots[this.id]=_e),!1}getValue(){if(this.hasValue())return I.slots[this.id]}withValue(e,r,o,a){const l={__proto__:null,[this.id]:e},c=I;I={parent:c,slots:l};try{return r.apply(a,o)}finally{I=c}}static bind(e){const r=I;return function(){const o=I;try{return I=r,e.apply(this,arguments)}finally{I=o}}}static noContext(e,r,o){if(I){const a=I;try{return I=null,e.apply(o,r)}finally{I=a}}else return e.apply(o,r)}};function Ce(t){try{return t()}catch{}}const Qt="@wry/context:Slot",Tr=Ce(()=>globalThis)||Ce(()=>global)||Object.create(null),Fe=Tr,le=Fe[Qt]||Array[Qt]||(function(t){try{Object.defineProperty(Fe,Qt,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}})(Er()),{bind:oo,noContext:no}=le;new le;function Or(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=Pr(t))||e){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
20
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pr(t,e){if(t){if(typeof t=="string")return Ie(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ie(t,e)}}function Ie(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function Ne(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function ce(t,e,r){return e&&Ne(t.prototype,e),r&&Ne(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var de=function(){return typeof Symbol=="function"},ue=function(t){return de()&&!!Symbol[t]},fe=function(t){return ue(t)?Symbol[t]:"@@"+t};de()&&!ue("observable")&&(Symbol.observable=Symbol("observable"));var $r=fe("iterator"),oe=fe("observable"),Re=fe("species");function Rt(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function _t(t){var e=t.constructor;return e!==void 0&&(e=e[Re],e===null&&(e=void 0)),e!==void 0?e:N}function zr(t){return t instanceof N}function xt(t){xt.log?xt.log(t):setTimeout(function(){throw t})}function Lt(t){Promise.resolve().then(function(){try{t()}catch(e){xt(e)}})}function Ye(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=Rt(e,"unsubscribe");r&&r.call(e)}}catch(o){xt(o)}}function ne(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Dr(t){var e=t._queue;if(e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Ke(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Ke(t,e,r){t._state="running";var o=t._observer;try{var a=Rt(o,e);switch(e){case"next":a&&a.call(o,r);break;case"error":if(ne(t),a)a.call(o,r);else throw r;break;case"complete":ne(t),a&&a.call(o);break}}catch(l){xt(l)}t._state==="closed"?Ye(t):t._state==="running"&&(t._state="ready")}function Zt(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Lt(function(){return Dr(t)});return}Ke(t,e,r)}}var Ar=(function(){function t(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var a=new qr(this);try{this._cleanup=o.call(void 0,a)}catch(l){a.error(l)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(ne(this),Ye(this))},ce(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t})(),qr=(function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(o){Zt(this._subscription,"next",o)},e.error=function(o){Zt(this._subscription,"error",o)},e.complete=function(){Zt(this._subscription,"complete")},ce(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t})(),N=(function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(o){return(typeof o!="object"||o===null)&&(o={next:o,error:arguments[1],complete:arguments[2]}),new Ar(o,this._subscriber)},e.forEach=function(o){var a=this;return new Promise(function(l,c){if(typeof o!="function"){c(new TypeError(o+" is not a function"));return}function d(){s.unsubscribe(),l()}var s=a.subscribe({next:function(g){try{o(g,d)}catch(h){c(h),s.unsubscribe()}},error:c,complete:l})})},e.map=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var l=_t(this);return new l(function(c){return a.subscribe({next:function(d){try{d=o(d)}catch(s){return c.error(s)}c.next(d)},error:function(d){c.error(d)},complete:function(){c.complete()}})})},e.filter=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var l=_t(this);return new l(function(c){return a.subscribe({next:function(d){try{if(!o(d))return}catch(s){return c.error(s)}c.next(d)},error:function(d){c.error(d)},complete:function(){c.complete()}})})},e.reduce=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var l=_t(this),c=arguments.length>1,d=!1,s=arguments[1],g=s;return new l(function(h){return a.subscribe({next:function(k){var _=!d;if(d=!0,!_||c)try{g=o(g,k)}catch(C){return h.error(C)}else g=k},error:function(k){h.error(k)},complete:function(){if(!d&&!c)return h.error(new TypeError("Cannot reduce an empty sequence"));h.next(g),h.complete()}})})},e.concat=function(){for(var o=this,a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];var d=_t(this);return new d(function(s){var g,h=0;function k(_){g=_.subscribe({next:function(C){s.next(C)},error:function(C){s.error(C)},complete:function(){h===l.length?(g=void 0,s.complete()):k(d.from(l[h++]))}})}return k(o),function(){g&&(g.unsubscribe(),g=void 0)}})},e.flatMap=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var l=_t(this);return new l(function(c){var d=[],s=a.subscribe({next:function(h){if(o)try{h=o(h)}catch(_){return c.error(_)}var k=l.from(h).subscribe({next:function(_){c.next(_)},error:function(_){c.error(_)},complete:function(){var _=d.indexOf(k);_>=0&&d.splice(_,1),g()}});d.push(k)},error:function(h){c.error(h)},complete:function(){g()}});function g(){s.closed&&d.length===0&&c.complete()}return function(){d.forEach(function(h){return h.unsubscribe()}),s.unsubscribe()}})},e[oe]=function(){return this},t.from=function(o){var a=typeof this=="function"?this:t;if(o==null)throw new TypeError(o+" is not an object");var l=Rt(o,oe);if(l){var c=l.call(o);if(Object(c)!==c)throw new TypeError(c+" is not an object");return zr(c)&&c.constructor===a?c:new a(function(d){return c.subscribe(d)})}if(ue("iterator")&&(l=Rt(o,$r),l))return new a(function(d){Lt(function(){if(!d.closed){for(var s=Or(l.call(o)),g;!(g=s()).done;){var h=g.value;if(d.next(h),d.closed)return}d.complete()}})});if(Array.isArray(o))return new a(function(d){Lt(function(){if(!d.closed){for(var s=0;s<o.length;++s)if(d.next(o[s]),d.closed)return;d.complete()}})});throw new TypeError(o+" is not observable")},t.of=function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];var c=typeof this=="function"?this:t;return new c(function(d){Lt(function(){if(!d.closed){for(var s=0;s<a.length;++s)if(d.next(a[s]),d.closed)return;d.complete()}})})},ce(t,null,[{key:Re,get:function(){return this}}]),t})();de()&&Object.defineProperty(N,Symbol("extensions"),{value:{symbol:oe,hostReportError:xt},configurable:!0});function Lr(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var gt;typeof self<"u"?gt=self:typeof window<"u"?gt=window:typeof global<"u"?gt=global:typeof module<"u"?gt=module:gt=Function("return this")();Lr(gt);var Ee=N.prototype,Te="@@observable";Ee[Te]||(Ee[Te]=function(){return this});function Br(t){for(var e=["query","operationName","variables","extensions","context"],r=0,o=Object.keys(t);r<o.length;r++){var a=o[r];if(e.indexOf(a)<0)throw He(58,a)}return t}function Ur(t,e){var r=G({},t),o=function(l){typeof l=="function"?r=G(G({},r),l(r)):r=G(G({},r),l)},a=function(){return G({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:o}),Object.defineProperty(e,"getContext",{enumerable:!1,value:a}),e}function Mr(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Ir(e.query)||void 0:""),e}var Hr=Symbol.for("apollo.deprecations"),Vr=re,Rr=new le;function Yr(t){return Vr[Hr]||(Rr.getValue()||[]).includes(t)}function Kr(t,e){Yr(t)||e()}function Oe(t,e){return e?e(t):N.of()}function Ct(t){return typeof t=="function"?new Je(t):t}function qt(t){return t.request.length<=1}var Je=(function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return N.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Ct).reduce(function(r,o){return r.concat(o)})},t.split=function(e,r,o){var a=Ct(r),l=Ct(o||new t(Oe)),c;return qt(a)&&qt(l)?c=new t(function(d){return e(d)?a.request(d)||N.of():l.request(d)||N.of()}):c=new t(function(d,s){return e(d)?a.request(d,s)||N.of():l.request(d,s)||N.of()}),Object.assign(c,{left:a,right:l})},t.execute=function(e,r){return e.request(Ur(r.context,Mr(Br(r))))||N.of()},t.concat=function(e,r){var o=Ct(e);if(qt(o))return globalThis.__DEV__!==!1&&Xt.warn(47,o),o;var a=Ct(r),l;return qt(a)?l=new t(function(c){return o.request(c,function(d){return a.request(d)||N.of()})||N.of()}):l=new t(function(c,d){return o.request(c,function(s){return a.request(s,d)||N.of()})||N.of()}),Object.assign(l,{left:o,right:a})},t.prototype.split=function(e,r,o){return this.concat(t.split(e,r,o||new t(Oe)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw He(48)},t.prototype.onError=function(e,r){if(globalThis.__DEV__!==!1&&Kr("onError",function(){globalThis.__DEV__!==!1&&Xt.warn(49)}),r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&Xt.warn(50),this.onError=e,this},t})();function Jr(t){return new Je(function(e,r){var o=Sr(e,[]);return new N(function(a){var l,c=!1;return Promise.resolve(o).then(function(d){return t(d,e.getContext())}).then(e.setContext).then(function(){c||(l=r(e).subscribe({next:a.next.bind(a),error:a.error.bind(a),complete:a.complete.bind(a)}))}).catch(a.error.bind(a)),function(){c=!0,l&&l.unsubscribe()}})})}const Wr=async()=>{const t="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const a=await E.post(t,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return a.status===200&&a.data.access_token?a.data.access_token:(console.error("Failed to fetch token:",a.data),null)}catch(a){return E.isAxiosError(a)?console.error("Error fetching token:",a.response||a.message):console.error("Unexpected error:",a),null}},Gr="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Xr=Bt.createHttpLink({uri:`${Gr}`}),Qr=Jr(async(t,{headers:e})=>{const r=await Wr();return{headers:{...e,authorization:`Bearer ${r}`}}}),Zr=new Bt.ApolloClient({link:Qr.concat(Xr),cache:new Bt.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),to=t=>{const{tanyaConfig:e}=t;return n.jsx(Bt.ApolloProvider,{client:Zr,children:n.jsx(dr,{children:n.jsx(vr,{tanyaConfig:e})})})};exports.TanyaChatbot=to;exports.TanyaChatbotProvider=nr;
|
|
19
|
+
`,style:{background:"linear-gradient(170.1deg, #FFFFFF 60.03%, #E3DEEF 99.59%)"},children:[n.jsxs("div",{className:"flex justify-between p-3 bg-[#FFFFFF] border border-b-1 border-[#E5E5E5] ",children:[n.jsx("div",{style:{display:"flex",color:v.tanyaThemeContrastColor,alignItems:"center",gap:"0.5rem"},children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"flex gap-2 w-28 h-12 text-center items-center p-2 border rounded-l-[20px] rounded-tr-[20px]",style:{background:"linear-gradient(265.62deg, #6851C6 5.24%, #8668FF 98.49%)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 4.48438V0.5C15 0.5 8.94395 1.4375 6.78127 4.25C4.61859 7.0625 5.33095 15.5 5.33095 15.5H9.19857C9.19857 15.5 8.72793 7.76562 10.1654 6.125C11.6029 4.48438 15 4.48438 15 4.48438Z",fill:"white"}),n.jsx("path",{d:"M0 0.5H6.28488V4.25H0V0.5Z",fill:"white"})]}),n.jsx("p",{className:"text-[#FFFFFF] font-nunitoSans font-semibold",children:"TANYA"})]}),n.jsxs("p",{className:"text-[#5B5B5B] font-nunitoSans font-semibold",style:{fontStyle:"italic"},children:[" ","Your AI shopping assistant !"," "]})]})}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx("button",{onClick:()=>k(!1),children:n.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_501_6036)",children:[n.jsx("path",{d:"M18 6.5L6 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M6 6.5L18 18.5",stroke:"#555555",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_501_6036",children:n.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 0.5)"})})})]})})})]}),n.jsxs("div",{className:"flex h-full md:flex-row lg:flex-row",children:[n.jsxs("div",{className:`flex flex-col h-full ${rt?"lg:w-2/3 w-full":"w-full"}`,children:[n.jsxs("div",{ref:j,className:"overflow-y-auto pr-5 pb-2 space-y-4 hide-scrollbar flex-grow mb-24",children:[(v==null?void 0:v.whomRequired)&&n.jsxs("div",{className:"mx-3 p-3 rounded-2xl bg-[#FFFFFF]",children:[n.jsx("div",{className:"flex gap-2 bg-[#FFFFFF]",children:n.jsx("p",{className:"font-bold font-nunitoSans text-[#494949]",children:"Is this for you or someone else?"})}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:r.map(c=>n.jsx("button",{onClick:()=>$t(c),className:"px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",style:{backgroundColor:dt===o[c]?"#FFFFFF":"#F3F3F3",borderColor:dt===o[c]?"#BBB3DD":""},children:c},c))})]}),jt.map((c,y)=>{var m,x;return n.jsxs("div",{children:[n.jsx("div",{className:"flex justify-end",children:n.jsx("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:c.query})}),c.response&&c.response.includes("Thinking")?n.jsx("div",{children:n.jsx("div",{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",dangerouslySetInnerHTML:{__html:Wt(c.response)}})}):n.jsx("div",{children:n.jsx("div",{className:"font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",dangerouslySetInnerHTML:{__html:Wt(c.response)}})}),Et&&!c.response.includes("Thinking")&&((m=c.products)==null?void 0:m.length)==0&&n.jsx("div",{children:n.jsx("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"})}),(c==null?void 0:c.products)&&((x=c==null?void 0:c.products)==null?void 0:x.length)>0&&n.jsx(yr,{chat:c.products,storeDetails:v}),c.potentialQuestions.length>0&&n.jsxs("div",{className:"my-2 px-4 text-sm text-gray-700",children:[n.jsx("p",{className:"font-nunitoSans font-bold text-sm text-[#494949]",style:{color:v.themeDarkColor},children:"Why not explore these inquiries..."}),c.potentialQuestions.split(",").map((u,w)=>n.jsx("button",{className:`cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${v.themeDarkColor} m-1 rounded-xl px-2 py-1`,onClick:()=>D(u),style:{backgroundColor:v.tanyaThemeColorLight},children:u},w))]}),c.secondaryLoading&&n.jsx("div",{className:"mt-3 mb-4 px-4",children:n.jsxs("div",{className:"tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",style:{margin:"0.75rem"},children:[n.jsxs("div",{className:"flex gap-1",children:[n.jsx("div",{className:"tanya-sparkle tanya-sparkle-1",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-2",children:"✨"}),n.jsx("div",{className:"tanya-sparkle tanya-sparkle-3",children:"✨"})]}),n.jsx("div",{className:"tanya-shimmer"}),n.jsx("p",{className:"font-semibold tanya-pulse",style:{color:v.themeDarkColor},children:"I’ve found a special surprise crafted just for you… hang on a sec!"}),n.jsx("p",{className:"tanya-dots mt-1",style:{color:v.themeDarkColor},children:"• • •"})]})}),c.secondaryResponse&&n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]",children:[n.jsx("div",{className:"text-sm text-[#232323] bg-[#FFFFFF] px-7 py-4 rounded-br-xl rounded-bl-2xl w-full",style:{backgroundColor:v.tanyaThemeColorLight},dangerouslySetInnerHTML:{__html:Wt(c.secondaryResponse)}}),c.productSnapshot&&n.jsx("div",{className:"mt-4 w-full",children:n.jsxs("div",{className:"flex gap-4 items-stretch rounded-2xl p-4",style:{backgroundColor:v.tanyaThemeColorLight},children:[n.jsx("div",{className:"flex-shrink-0 rounded-xl overflow-hidden border",style:{width:112,height:112,borderColor:"#eee"},children:c.productSnapshot.image?n.jsx("img",{src:c.productSnapshot.image,alt:c.productSnapshot.name,className:"w-full h-full object-cover"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-500",children:"No Image"})}),n.jsxs("div",{className:"flex flex-col flex-1 justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-[15px] leading-snug",children:c.productSnapshot.name}),n.jsx("p",{className:"mt-1 text-[14px] font-medium",children:c.productSnapshot.price!=null?new Intl.NumberFormat(void 0,{style:"currency",currency:(v==null?void 0:v.currency)||"USD"}).format(c.productSnapshot.price):""}),c.productSnapshot.points>0&&n.jsxs("p",{className:"mt-1 text-xs opacity-80",children:["You will earn"," ",n.jsxs("strong",{children:[c.productSnapshot.points," ","points"]})]})]}),n.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center border rounded-full overflow-hidden",children:[n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>O(u=>u.map((w,$)=>$===y&&w.productSnapshot?{...w,productSnapshot:{...w.productSnapshot,quantity:Math.max(1,w.productSnapshot.quantity-1)}}:w)),style:{background:"transparent",color:v.themeDarkColor},children:"−"}),n.jsx("div",{className:"px-3 py-1 text-sm select-none",children:c.productSnapshot.quantity}),n.jsx("button",{className:"px-3 py-1 text-sm",onClick:()=>O(u=>u.map((w,$)=>$===y&&w.productSnapshot?{...w,productSnapshot:{...w.productSnapshot,quantity:w.productSnapshot.quantity+1}}:w)),style:{background:"transparent",color:v.themeDarkColor},children:"+"})]}),n.jsx("button",{onClick:()=>{Ze(Ot(c.productSnapshot),c.productSnapshot.quantity)},disabled:lt,className:"px-4 py-2 rounded-full font-medium",style:{background:v.tanyaThemeColor,color:(v==null?void 0:v.tanyaThemeContrastColor)||"#fff",opacity:lt?.8:1},children:lt?"Adding...":"Add to cart"})]})]})]})})]})}),n.jsx("div",{className:"mb-20"})]},y)})]}),n.jsx("div",{className:"flex flex-col gap-2 sticky bottom-0 left-0 right-0 bg-[#E3DEEF] z-50 px-4 py-2",children:n.jsx("div",{className:"p-[1px] rounded-xl",style:{background:"linear-gradient(180deg, #B09FFF 0%, #8D79F6 100%)"},children:n.jsxs("div",{className:"flex items-center bg-[#FFFFFF] flex-1 rounded-xl px-2 py-1",children:[n.jsx("input",{className:"flex-1 bg-[#FFFFFF] text-[#232323] outline-none border-none px-2 py-2 text-sm",placeholder:"How can I help you...",value:kt,autoFocus:!0,onChange:c=>St(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!ct&&D()}}),n.jsx("button",{type:"submit",disabled:ct,className:"p-3",onClick:()=>D(),children:ct?n.jsx("div",{className:"p-3 animate-spin rounded-full h-3 w-3 border-b-2",style:{borderBottom:"2px solid",color:v.tanyaThemeColor}}):n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M16.6357 13.6701L18.3521 8.5208C19.8516 4.02242 20.6013 1.77322 19.414 0.585948C18.2268 -0.601312 15.9776 0.148418 11.4792 1.64788L6.32987 3.36432C2.69923 4.57453 0.883923 5.17964 0.368062 6.06698C-0.122688 6.91112 -0.122688 7.95369 0.368062 8.7978C0.883923 9.6852 2.69923 10.2903 6.32987 11.5005C6.77981 11.6505 7.28601 11.5434 7.62294 11.2096L13.1286 5.75495C13.4383 5.44808 13.9382 5.45041 14.245 5.76015C14.5519 6.06989 14.5496 6.56975 14.2398 6.87662L8.8231 12.2432C8.4518 12.6111 8.3342 13.1742 8.4995 13.6701C9.7097 17.3007 10.3148 19.1161 11.2022 19.6319C12.0463 20.1227 13.0889 20.1227 13.933 19.6319C14.8204 19.1161 15.4255 17.3008 16.6357 13.6701Z",fill:"#6952C7"})})})]})})})]}),n.jsx(kr,{})]})]})]})]})})};var ee=function(t,e){return ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])},ee(t,e)};function jr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ee(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var G=function(){return G=Object.assign||function(e){for(var r,o=1,a=arguments.length;o<a;o++){r=arguments[o];for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&(e[d]=r[d])}return e},G.apply(this,arguments)};function _r(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(t);a<o.length;a++)e.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(r[o[a]]=t[o[a]]);return r}var Gt="Invariant Violation",Se=Object.setPrototypeOf,Cr=Se===void 0?function(t,e){return t.__proto__=e,t}:Se,Me=(function(t){jr(e,t);function e(r){r===void 0&&(r=Gt);var o=t.call(this,typeof r=="number"?Gt+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return o.framesToPop=1,o.name=Gt,Cr(o,e.prototype),o}return e})(Error);function nt(t,e){if(!t)throw new Me(e)}var Re=["debug","log","warn","error","silent"],Ir=Re.indexOf("log");function At(t){return function(){if(Re.indexOf(t)>=Ir){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=At("debug"),t.log=At("log"),t.warn=At("warn"),t.error=At("error")})(nt||(nt={}));var He="3.14.0";function xt(t){try{return t()}catch{}}const re=xt(function(){return globalThis})||xt(function(){return window})||xt(function(){return self})||xt(function(){return global})||xt(function(){return xt.constructor("return this")()});var je=new Map;function Fr(t){var e=je.get(t)||1;return je.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Nr(t,e){var r=Fr("stringifyForDisplay");return JSON.stringify(t,function(o,a){return a===void 0?r:a},e).split(JSON.stringify(r)).join("<undefined>")}function qt(t){return function(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(typeof e=="number"){var a=e;e=se(a),e||(e=ie(a,r),r=[])}t.apply(void 0,[e].concat(r))}}var Xt=Object.assign(function(e,r){for(var o=[],a=2;a<arguments.length;a++)o[a-2]=arguments[a];e||nt(e,se(r,o)||ie(r,o))},{debug:qt(nt.debug),log:qt(nt.log),warn:qt(nt.warn),error:qt(nt.error)});function Ve(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return new Me(se(t,e)||ie(t,e))}var _e=Symbol.for("ApolloErrorMessageHandler_"+He);function Ye(t){if(typeof t=="string")return t;try{return Nr(t,2).slice(0,1e3)}catch{return"<non-serializable>"}}function se(t,e){if(e===void 0&&(e=[]),!!t)return re[_e]&&re[_e](t,e.map(Ye))}function ie(t,e){if(e===void 0&&(e=[]),!!t)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:He,message:t,args:e.map(Ye)})))}function Er(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}let F=null;const Ce={};let Tr=1;const Or=()=>class{constructor(){this.id=["slot",Tr++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=F;e;e=e.parent)if(this.id in e.slots){const r=e.slots[this.id];if(r===Ce)break;return e!==F&&(F.slots[this.id]=r),!0}return F&&(F.slots[this.id]=Ce),!1}getValue(){if(this.hasValue())return F.slots[this.id]}withValue(e,r,o,a){const d={__proto__:null,[this.id]:e},i=F;F={parent:i,slots:d};try{return r.apply(a,o)}finally{F=i}}static bind(e){const r=F;return function(){const o=F;try{return F=r,e.apply(this,arguments)}finally{F=o}}}static noContext(e,r,o){if(F){const a=F;try{return F=null,e.apply(o,r)}finally{F=a}}else return e.apply(o,r)}};function Ie(t){try{return t()}catch{}}const Qt="@wry/context:Slot",Pr=Ie(()=>globalThis)||Ie(()=>global)||Object.create(null),Fe=Pr,le=Fe[Qt]||Array[Qt]||(function(t){try{Object.defineProperty(Fe,Qt,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}})(Or()),{bind:ao,noContext:so}=le;new le;function $r(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=zr(t))||e){r&&(t=r);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
20
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zr(t,e){if(t){if(typeof t=="string")return Ne(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ne(t,e)}}function Ne(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r<e;r++)o[r]=t[r];return o}function Ee(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function ce(t,e,r){return e&&Ee(t.prototype,e),r&&Ee(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var de=function(){return typeof Symbol=="function"},ue=function(t){return de()&&!!Symbol[t]},fe=function(t){return ue(t)?Symbol[t]:"@@"+t};de()&&!ue("observable")&&(Symbol.observable=Symbol("observable"));var Dr=fe("iterator"),oe=fe("observable"),Ke=fe("species");function Yt(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Ct(t){var e=t.constructor;return e!==void 0&&(e=e[Ke],e===null&&(e=void 0)),e!==void 0?e:N}function Ar(t){return t instanceof N}function yt(t){yt.log?yt.log(t):setTimeout(function(){throw t})}function Bt(t){Promise.resolve().then(function(){try{t()}catch(e){yt(e)}})}function Je(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=Yt(e,"unsubscribe");r&&r.call(e)}}catch(o){yt(o)}}function ne(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function qr(t){var e=t._queue;if(e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(We(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function We(t,e,r){t._state="running";var o=t._observer;try{var a=Yt(o,e);switch(e){case"next":a&&a.call(o,r);break;case"error":if(ne(t),a)a.call(o,r);else throw r;break;case"complete":ne(t),a&&a.call(o);break}}catch(d){yt(d)}t._state==="closed"?Je(t):t._state==="running"&&(t._state="ready")}function Zt(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Bt(function(){return qr(t)});return}We(t,e,r)}}var Lr=(function(){function t(r,o){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var a=new Br(this);try{this._cleanup=o.call(void 0,a)}catch(d){a.error(d)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(ne(this),Je(this))},ce(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t})(),Br=(function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(o){Zt(this._subscription,"next",o)},e.error=function(o){Zt(this._subscription,"error",o)},e.complete=function(){Zt(this._subscription,"complete")},ce(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t})(),N=(function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(o){return(typeof o!="object"||o===null)&&(o={next:o,error:arguments[1],complete:arguments[2]}),new Lr(o,this._subscriber)},e.forEach=function(o){var a=this;return new Promise(function(d,i){if(typeof o!="function"){i(new TypeError(o+" is not a function"));return}function l(){s.unsubscribe(),d()}var s=a.subscribe({next:function(g){try{o(g,l)}catch(h){i(h),s.unsubscribe()}},error:i,complete:d})})},e.map=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var d=Ct(this);return new d(function(i){return a.subscribe({next:function(l){try{l=o(l)}catch(s){return i.error(s)}i.next(l)},error:function(l){i.error(l)},complete:function(){i.complete()}})})},e.filter=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var d=Ct(this);return new d(function(i){return a.subscribe({next:function(l){try{if(!o(l))return}catch(s){return i.error(s)}i.next(l)},error:function(l){i.error(l)},complete:function(){i.complete()}})})},e.reduce=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var d=Ct(this),i=arguments.length>1,l=!1,s=arguments[1],g=s;return new d(function(h){return a.subscribe({next:function(k){var _=!l;if(l=!0,!_||i)try{g=o(g,k)}catch(C){return h.error(C)}else g=k},error:function(k){h.error(k)},complete:function(){if(!l&&!i)return h.error(new TypeError("Cannot reduce an empty sequence"));h.next(g),h.complete()}})})},e.concat=function(){for(var o=this,a=arguments.length,d=new Array(a),i=0;i<a;i++)d[i]=arguments[i];var l=Ct(this);return new l(function(s){var g,h=0;function k(_){g=_.subscribe({next:function(C){s.next(C)},error:function(C){s.error(C)},complete:function(){h===d.length?(g=void 0,s.complete()):k(l.from(d[h++]))}})}return k(o),function(){g&&(g.unsubscribe(),g=void 0)}})},e.flatMap=function(o){var a=this;if(typeof o!="function")throw new TypeError(o+" is not a function");var d=Ct(this);return new d(function(i){var l=[],s=a.subscribe({next:function(h){if(o)try{h=o(h)}catch(_){return i.error(_)}var k=d.from(h).subscribe({next:function(_){i.next(_)},error:function(_){i.error(_)},complete:function(){var _=l.indexOf(k);_>=0&&l.splice(_,1),g()}});l.push(k)},error:function(h){i.error(h)},complete:function(){g()}});function g(){s.closed&&l.length===0&&i.complete()}return function(){l.forEach(function(h){return h.unsubscribe()}),s.unsubscribe()}})},e[oe]=function(){return this},t.from=function(o){var a=typeof this=="function"?this:t;if(o==null)throw new TypeError(o+" is not an object");var d=Yt(o,oe);if(d){var i=d.call(o);if(Object(i)!==i)throw new TypeError(i+" is not an object");return Ar(i)&&i.constructor===a?i:new a(function(l){return i.subscribe(l)})}if(ue("iterator")&&(d=Yt(o,Dr),d))return new a(function(l){Bt(function(){if(!l.closed){for(var s=$r(d.call(o)),g;!(g=s()).done;){var h=g.value;if(l.next(h),l.closed)return}l.complete()}})});if(Array.isArray(o))return new a(function(l){Bt(function(){if(!l.closed){for(var s=0;s<o.length;++s)if(l.next(o[s]),l.closed)return;l.complete()}})});throw new TypeError(o+" is not observable")},t.of=function(){for(var o=arguments.length,a=new Array(o),d=0;d<o;d++)a[d]=arguments[d];var i=typeof this=="function"?this:t;return new i(function(l){Bt(function(){if(!l.closed){for(var s=0;s<a.length;++s)if(l.next(a[s]),l.closed)return;l.complete()}})})},ce(t,null,[{key:Ke,get:function(){return this}}]),t})();de()&&Object.defineProperty(N,Symbol("extensions"),{value:{symbol:oe,hostReportError:yt},configurable:!0});function Ur(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var bt;typeof self<"u"?bt=self:typeof window<"u"?bt=window:typeof global<"u"?bt=global:typeof module<"u"?bt=module:bt=Function("return this")();Ur(bt);var Te=N.prototype,Oe="@@observable";Te[Oe]||(Te[Oe]=function(){return this});function Mr(t){for(var e=["query","operationName","variables","extensions","context"],r=0,o=Object.keys(t);r<o.length;r++){var a=o[r];if(e.indexOf(a)<0)throw Ve(58,a)}return t}function Rr(t,e){var r=G({},t),o=function(d){typeof d=="function"?r=G(G({},r),d(r)):r=G(G({},r),d)},a=function(){return G({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:o}),Object.defineProperty(e,"getContext",{enumerable:!1,value:a}),e}function Hr(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Er(e.query)||void 0:""),e}var Vr=Symbol.for("apollo.deprecations"),Yr=re,Kr=new le;function Jr(t){return Yr[Vr]||(Kr.getValue()||[]).includes(t)}function Wr(t,e){Jr(t)||e()}function Pe(t,e){return e?e(t):N.of()}function It(t){return typeof t=="function"?new Ge(t):t}function Lt(t){return t.request.length<=1}var Ge=(function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return N.of()})},t.from=function(e){return e.length===0?t.empty():e.map(It).reduce(function(r,o){return r.concat(o)})},t.split=function(e,r,o){var a=It(r),d=It(o||new t(Pe)),i;return Lt(a)&&Lt(d)?i=new t(function(l){return e(l)?a.request(l)||N.of():d.request(l)||N.of()}):i=new t(function(l,s){return e(l)?a.request(l,s)||N.of():d.request(l,s)||N.of()}),Object.assign(i,{left:a,right:d})},t.execute=function(e,r){return e.request(Rr(r.context,Hr(Mr(r))))||N.of()},t.concat=function(e,r){var o=It(e);if(Lt(o))return globalThis.__DEV__!==!1&&Xt.warn(47,o),o;var a=It(r),d;return Lt(a)?d=new t(function(i){return o.request(i,function(l){return a.request(l)||N.of()})||N.of()}):d=new t(function(i,l){return o.request(i,function(s){return a.request(s,l)||N.of()})||N.of()}),Object.assign(d,{left:o,right:a})},t.prototype.split=function(e,r,o){return this.concat(t.split(e,r,o||new t(Pe)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw Ve(48)},t.prototype.onError=function(e,r){if(globalThis.__DEV__!==!1&&Wr("onError",function(){globalThis.__DEV__!==!1&&Xt.warn(49)}),r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&Xt.warn(50),this.onError=e,this},t})();function Gr(t){return new Ge(function(e,r){var o=_r(e,[]);return new N(function(a){var d,i=!1;return Promise.resolve(o).then(function(l){return t(l,e.getContext())}).then(e.setContext).then(function(){i||(d=r(e).subscribe({next:a.next.bind(a),error:a.error.bind(a),complete:a.complete.bind(a)}))}).catch(a.error.bind(a)),function(){i=!0,d&&d.unsubscribe()}})})}const Xr=async()=>{const t="https://auth.australia-southeast1.gcp.commercetools.com/oauth/token",o="Basic "+btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN")+":"+encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));try{const a=await E.post(t,new URLSearchParams({grant_type:"client_credentials"}),{headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:o}});return a.status===200&&a.data.access_token?a.data.access_token:(console.error("Failed to fetch token:",a.data),null)}catch(a){return E.isAxiosError(a)?console.error("Error fetching token:",a.response||a.message):console.error("Unexpected error:",a),null}},Qr="https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql",Zr=Ut.createHttpLink({uri:`${Qr}`}),to=Gr(async(t,{headers:e})=>{const r=await Xr();return{headers:{...e,authorization:`Bearer ${r}`}}}),eo=new Ut.ApolloClient({link:to.concat(Zr),cache:new Ut.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"cache-and-network"}}}),ro=t=>{const{tanyaConfig:e}=t;return n.jsx(Ut.ApolloProvider,{client:eo,children:n.jsx(fr,{children:n.jsx(Sr,{tanyaConfig:e})})})};exports.TanyaChatbot=ro;exports.TanyaChatbotProvider=sr;
|
|
21
21
|
//# sourceMappingURL=tanya-chatbot.cjs.js.map
|