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