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