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