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