tanya-chatbot 0.9.9 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tanya-chatbot.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect as xe, useState as b, useRef as Ve, forwardRef as $n, createElement as
|
|
1
|
+
import { useEffect as xe, useState as b, useRef as Ve, forwardRef as $n, createElement as hr, useMemo as en } from "react";
|
|
2
2
|
import { jsx as a, jsxs as d, Fragment as ke } from "react/jsx-runtime";
|
|
3
3
|
import { createHttpLink as Uo, ApolloClient as qo, InMemoryCache as Ro, ApolloProvider as Ho } from "@apollo/client";
|
|
4
4
|
import { Provider as Vo, useDispatch as Ln, useSelector as er } from "react-redux";
|
|
@@ -6,13 +6,13 @@ import { createSlice as zn, configureStore as Yo } from "@reduxjs/toolkit";
|
|
|
6
6
|
import * as Dn from "@radix-ui/react-popover";
|
|
7
7
|
import "clsx";
|
|
8
8
|
import "tailwind-merge";
|
|
9
|
-
import
|
|
9
|
+
import de from "axios";
|
|
10
10
|
import "crypto-js";
|
|
11
11
|
import { Icon as Jo } from "@iconify/react";
|
|
12
12
|
import { toast as Be } from "react-toastify";
|
|
13
13
|
import { createPortal as Ko } from "react-dom";
|
|
14
14
|
const Wo = '*,: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}.visible{visibility:visible}.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}.m-\\[15px\\]{margin:15px}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.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-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.mr-2{margin-right:.5rem}.mr-6{margin-right:1.5rem}.mt-0\\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-12{height:3rem}.h-20{height:5rem}.h-28{height:7rem}.h-3{height:.75rem}.h-6{height:1.5rem}.h-\\[120px\\]{height:120px}.h-\\[150px\\]{height:150px}.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-12{width:3rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\\/4{width:75%}.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-\\[64\\.7vw\\]{width:64.7vw}.w-\\[96\\%\\]{width:96%}.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%}.max-w-\\[90\\%\\]{max-width:90%}.max-w-md{max-width:28rem}.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-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.items-baseline{align-items:baseline}.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}.gap-y-2{row-gap:.5rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.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-bl-xl{border-bottom-left-radius:.75rem}.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-2{border-width:2px}.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-\\[\\#804c9e\\]{--tw-border-opacity: 1;border-color:rgb(128 76 158 / var(--tw-border-opacity, 1))}.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-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / 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-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.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))}.bg-white\\/70{background-color:#ffffffb3}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\\[1px\\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.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-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.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-2\\.5{padding-top:.625rem;padding-bottom:.625rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pr-5{padding-right:1.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-nunitoSans{font-family:Nunito Sans}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm,.text-sm\\/5{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.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-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / 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-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.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))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-95{opacity:.95}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px 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_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-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 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-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}.drop-shadow-xl{--tw-drop-shadow: drop-shadow(0 20px 13px rgb(0 0 0 / .03)) drop-shadow(0 8px 5px rgb(0 0 0 / .08));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)}.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{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.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-150{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-150{animation-duration:.15s}.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}}.placeholder\\:text-red-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.placeholder\\:text-red-400::placeholder{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\\:-translate-y-0\\.5:hover{--tw-translate-y: -.125rem;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\\: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\\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\\:text-\\[\\#6952C7\\]:hover{--tw-text-opacity: 1;color:rgb(105 82 199 / var(--tw-text-opacity, 1))}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-lg:hover{--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)}.hover\\:shadow-sm:hover{--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)}.focus\\:border-transparent:focus{border-color:transparent}.focus\\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-gray-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1))}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.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\\:col-span-10{grid-column:span 10 / span 10}.sm\\:col-span-2{grid-column:span 2 / span 2}.sm\\:mx-0{margin-left:0;margin-right:0}.sm\\:w-\\[80vw\\]{width:80vw}.sm\\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:flex-row{flex-direction:row}.sm\\:items-center{align-items:center}.sm\\:justify-start{justify-content:flex-start}}@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\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.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}}';
|
|
15
|
-
function
|
|
15
|
+
function hi() {
|
|
16
16
|
return xe(() => {
|
|
17
17
|
if (typeof document < "u") {
|
|
18
18
|
const e = document.createElement("style");
|
|
@@ -98,21 +98,21 @@ function na({
|
|
|
98
98
|
}) {
|
|
99
99
|
return /* @__PURE__ */ a(Dn.Trigger, { "data-slot": "popover-trigger", ...e });
|
|
100
100
|
}
|
|
101
|
-
const
|
|
101
|
+
const Xe = () => ({ 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" }), Un = async () => {
|
|
102
102
|
const e = "https://tanya-sfcc-server.vercel.app/";
|
|
103
103
|
try {
|
|
104
|
-
const t = await
|
|
104
|
+
const t = await de.post(
|
|
105
105
|
`${e}api/auth/token-bm-grant?baseUrl=${Ye()}&siteId=${Ue()}`
|
|
106
106
|
);
|
|
107
107
|
return t.status === 200 && t.data.access_token ? t.data.access_token : (console.error("Failed to fetch token:", t.data), null);
|
|
108
108
|
} catch (t) {
|
|
109
|
-
return
|
|
109
|
+
return de.isAxiosError(t) ? console.error("Error fetching token:", t.response || t.message) : console.error("Unexpected error:", t), null;
|
|
110
110
|
}
|
|
111
111
|
}, qn = async (e) => {
|
|
112
112
|
const t = "https://tanya-sfcc-server.vercel.app/";
|
|
113
113
|
try {
|
|
114
|
-
const r = JSON.parse(sessionStorage.getItem("customerData") || "{}").dwsid, n = await
|
|
115
|
-
`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${
|
|
114
|
+
const r = JSON.parse(sessionStorage.getItem("customerData") || "{}").dwsid, n = await de.post(
|
|
115
|
+
`${t}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
116
116
|
{},
|
|
117
117
|
{
|
|
118
118
|
headers: {
|
|
@@ -123,10 +123,10 @@ const Ze = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
123
123
|
);
|
|
124
124
|
return n.status === 200 && n.data ? n.data : null;
|
|
125
125
|
} catch (r) {
|
|
126
|
-
return
|
|
126
|
+
return de.isAxiosError(r) ? console.error("Error creating basket:", r.response || r.message) : console.error("Unexpected error:", r), null;
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
async function
|
|
129
|
+
async function Ge() {
|
|
130
130
|
var s;
|
|
131
131
|
const e = Ue(), t = "access_token_" + e, r = "expires_in_" + e, n = localStorage.getItem(r), o = localStorage.getItem(t);
|
|
132
132
|
return console.log(o), (s = JSON.parse(sessionStorage.getItem("customerData") || "{}")) != null && s.isGuest, console.log("access token found in local storage"), { access_token: o, expires_in: n };
|
|
@@ -156,18 +156,18 @@ const wr = async (e, t) => {
|
|
|
156
156
|
} catch (r) {
|
|
157
157
|
return console.error("Error obtaining JWT token:", r), e = null, t = null, null;
|
|
158
158
|
}
|
|
159
|
-
}, Ye = () => sessionStorage.getItem("Host"), Ue = () => sessionStorage.getItem("SiteId"),
|
|
159
|
+
}, Ye = () => sessionStorage.getItem("Host"), Ue = () => sessionStorage.getItem("SiteId"), Ze = () => sessionStorage.getItem("pubCfg"), et = () => sessionStorage.getItem("envRef"), tt = () => sessionStorage.getItem("orgRef"), oa = async (e) => {
|
|
160
160
|
console.log("fetching results");
|
|
161
|
-
const { serverUrl: t, basePath: r } =
|
|
161
|
+
const { serverUrl: t, basePath: r } = Xe();
|
|
162
162
|
let n = "";
|
|
163
163
|
{
|
|
164
|
-
const o = await
|
|
164
|
+
const o = await Ge();
|
|
165
165
|
console.log("the token from getSearchResults", o), n = o.access_token;
|
|
166
166
|
}
|
|
167
167
|
try {
|
|
168
168
|
const o = Ye();
|
|
169
|
-
return (await
|
|
170
|
-
`${t}${r}/search-sfcc?baseUrl=${o}&query=${e}&siteId=${Ue()}&pubCfg=${
|
|
169
|
+
return (await de.get(
|
|
170
|
+
`${t}${r}/search-sfcc?baseUrl=${o}&query=${e}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
171
171
|
{
|
|
172
172
|
headers: {
|
|
173
173
|
"Content-Type": "application/json",
|
|
@@ -180,11 +180,11 @@ const wr = async (e, t) => {
|
|
|
180
180
|
}
|
|
181
181
|
}, Rn = async (e) => {
|
|
182
182
|
if (!e) throw new Error("Product ID is required");
|
|
183
|
-
const { serverUrl: t, basePath: r } =
|
|
183
|
+
const { serverUrl: t, basePath: r } = Xe(), n = Ye();
|
|
184
184
|
console.log("calling access");
|
|
185
|
-
const { access_token: o } = await
|
|
186
|
-
return (await
|
|
187
|
-
`${t}${r}/product-sfcc/${e}?baseUrl=${n}&siteId=${Ue()}&pubCfg=${
|
|
185
|
+
const { access_token: o } = await Ge();
|
|
186
|
+
return (await de.get(
|
|
187
|
+
`${t}${r}/product-sfcc/${e}?baseUrl=${n}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
188
188
|
{
|
|
189
189
|
headers: {
|
|
190
190
|
"Content-Type": "application/json",
|
|
@@ -196,9 +196,9 @@ const wr = async (e, t) => {
|
|
|
196
196
|
if (!e) throw new Error("customerId is required");
|
|
197
197
|
const t = await Un(), { customer_token: r } = await qn(
|
|
198
198
|
t
|
|
199
|
-
), { serverUrl: n, basePath: o } =
|
|
200
|
-
return (await
|
|
201
|
-
`${n}${o}/get-interest?baseUrl=${Ye()}&customerId=${e}&siteId=${Ue()}&pubCfg=${
|
|
199
|
+
), { serverUrl: n, basePath: o } = Xe(), i = (await Ge()).access_token;
|
|
200
|
+
return (await de.get(
|
|
201
|
+
`${n}${o}/get-interest?baseUrl=${Ye()}&customerId=${e}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
202
202
|
{
|
|
203
203
|
headers: {
|
|
204
204
|
"Content-Type": "application/json",
|
|
@@ -241,8 +241,8 @@ const ca = ({
|
|
|
241
241
|
(l) => l - r < 0 ? e.length - (e.length % r || r) : l - r
|
|
242
242
|
);
|
|
243
243
|
}, c = async (l) => {
|
|
244
|
-
const
|
|
245
|
-
t(gr(
|
|
244
|
+
const h = await Rn(l);
|
|
245
|
+
t(gr(h));
|
|
246
246
|
};
|
|
247
247
|
return /* @__PURE__ */ a("div", { className: "mt-2 overflow-x-hidden", children: /* @__PURE__ */ d("div", { className: "flex items-center justify-center gap-4 relative", children: [
|
|
248
248
|
(e == null ? void 0 : e.length) > r && /* @__PURE__ */ a(
|
|
@@ -259,7 +259,7 @@ const ca = ({
|
|
|
259
259
|
}
|
|
260
260
|
),
|
|
261
261
|
/* @__PURE__ */ a("div", { className: "flex gap-5 justify-center flex-1 overflow-hidden", children: e.slice(n, n + r).map((l) => {
|
|
262
|
-
var
|
|
262
|
+
var h, g, y, x;
|
|
263
263
|
return /* @__PURE__ */ d(
|
|
264
264
|
"div",
|
|
265
265
|
{
|
|
@@ -271,7 +271,7 @@ const ca = ({
|
|
|
271
271
|
/* @__PURE__ */ a("div", { className: "w-full p-2 flex items-center justify-center bg-white", children: /* @__PURE__ */ a(
|
|
272
272
|
"img",
|
|
273
273
|
{
|
|
274
|
-
src: ((
|
|
274
|
+
src: ((h = rn(l)[0]) == null ? void 0 : h.link) || rn(l)[0] || // fallback if it's a string
|
|
275
275
|
"https://via.placeholder.com/120",
|
|
276
276
|
alt: l != null && l.productName ? l.productName : "Product",
|
|
277
277
|
className: "w-28 h-28 rounded-[10px] transition-transform duration-300 hover:scale-125 object-cover"
|
|
@@ -365,10 +365,10 @@ const ca = ({
|
|
|
365
365
|
n
|
|
366
366
|
)) }), Ir = async (e, t) => {
|
|
367
367
|
var s, i;
|
|
368
|
-
const { serverUrl: r, basePath: n } =
|
|
368
|
+
const { serverUrl: r, basePath: n } = Xe(), o = `${r}`;
|
|
369
369
|
try {
|
|
370
|
-
const c = await
|
|
371
|
-
`${o}${n}/basket/create?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${
|
|
370
|
+
const c = await de.post(
|
|
371
|
+
`${o}${n}/basket/create?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
372
372
|
t,
|
|
373
373
|
{
|
|
374
374
|
headers: {
|
|
@@ -385,13 +385,13 @@ const ca = ({
|
|
|
385
385
|
"*"
|
|
386
386
|
), c.data;
|
|
387
387
|
} catch (c) {
|
|
388
|
-
return
|
|
388
|
+
return de.isAxiosError(c) ? console.error("Error creating basket:", c.response || c.message) : console.error("Unexpected error:", c), null;
|
|
389
389
|
}
|
|
390
390
|
}, yr = async (e, t, r) => {
|
|
391
|
-
const { serverUrl: n, basePath: o } =
|
|
391
|
+
const { serverUrl: n, basePath: o } = Xe(), s = `${n}`;
|
|
392
392
|
try {
|
|
393
|
-
const i = await
|
|
394
|
-
`${s}${o}/basket/add-product/${e}?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${
|
|
393
|
+
const i = await de.post(
|
|
394
|
+
`${s}${o}/basket/add-product/${e}?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
395
395
|
t,
|
|
396
396
|
{
|
|
397
397
|
headers: {
|
|
@@ -402,7 +402,7 @@ const ca = ({
|
|
|
402
402
|
);
|
|
403
403
|
return i.status === 200 && i.data ? i.data : null;
|
|
404
404
|
} catch (i) {
|
|
405
|
-
return
|
|
405
|
+
return de.isAxiosError(i) ? console.error(
|
|
406
406
|
"Error adding products to basket:",
|
|
407
407
|
i.response || i.message
|
|
408
408
|
) : console.error("Unexpected error:", i), null;
|
|
@@ -412,10 +412,10 @@ const ca = ({
|
|
|
412
412
|
customer_token: t
|
|
413
413
|
}) => {
|
|
414
414
|
var s;
|
|
415
|
-
const { serverUrl: r, basePath: n } =
|
|
415
|
+
const { serverUrl: r, basePath: n } = Xe(), o = `${r}`;
|
|
416
416
|
try {
|
|
417
|
-
const i = await
|
|
418
|
-
`${o}${n}/basket/${e}?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${
|
|
417
|
+
const i = await de.get(
|
|
418
|
+
`${o}${n}/basket/${e}?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
419
419
|
{
|
|
420
420
|
headers: {
|
|
421
421
|
"Content-Type": "application/json",
|
|
@@ -425,25 +425,27 @@ const ca = ({
|
|
|
425
425
|
);
|
|
426
426
|
return { status: i.status, data: i.data };
|
|
427
427
|
} catch (i) {
|
|
428
|
-
return
|
|
428
|
+
return de.isAxiosError(i) ? { status: (s = i.response) == null ? void 0 : s.status, data: null } : { status: null, data: null };
|
|
429
429
|
}
|
|
430
430
|
}, ua = async (e) => {
|
|
431
|
-
|
|
431
|
+
var i;
|
|
432
|
+
const { serverUrl: t, basePath: r } = Xe(), n = `${t}`, o = await Ge(), s = "Bearer " + (o == null ? void 0 : o.access_token);
|
|
432
433
|
try {
|
|
433
|
-
|
|
434
|
-
`${n}${r}/basket/shipping-methods/${e}?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${
|
|
434
|
+
const c = await de.get(
|
|
435
|
+
`${n}${r}/basket/shipping-methods/${e}?baseUrl=${Ye()}&siteId=${Ue()}&pubCfg=${Ze()}&envRef=${et()}&orgRef=${tt()}`,
|
|
435
436
|
{
|
|
436
437
|
headers: {
|
|
437
438
|
"Content-Type": "application/json",
|
|
438
439
|
Authorization: s
|
|
439
440
|
}
|
|
440
441
|
}
|
|
441
|
-
)
|
|
442
|
-
|
|
443
|
-
|
|
442
|
+
);
|
|
443
|
+
return ((i = c == null ? void 0 : c.data) == null ? void 0 : i.applicableShippingMethods) || [];
|
|
444
|
+
} catch (c) {
|
|
445
|
+
return de.isAxiosError(c) ? console.error(
|
|
444
446
|
"Error fetching shipping methods:",
|
|
445
|
-
|
|
446
|
-
) : console.error("Unexpected error:",
|
|
447
|
+
c.response || c.message
|
|
448
|
+
) : console.error("Unexpected error:", c), [];
|
|
447
449
|
}
|
|
448
450
|
}, Lt = "sfcc_basket_id", an = "sfcc_customer_token", zt = "sfcc_token_expiry", fa = 300 * 1e3, Vt = "1.0.0";
|
|
449
451
|
const lt = (e) => {
|
|
@@ -464,13 +466,13 @@ const lt = (e) => {
|
|
|
464
466
|
console.error("Error storing token:", t);
|
|
465
467
|
}
|
|
466
468
|
}, sn = 300, ma = ({ addToCartPwa: e }) => {
|
|
467
|
-
var l,
|
|
469
|
+
var l, h, g, y, x, I;
|
|
468
470
|
const t = Ln(), r = er((S) => S.product.product), n = er((S) => S.store.store), [o, s] = b(!!r);
|
|
469
471
|
if (xe(() => {
|
|
470
472
|
s(!!r);
|
|
471
473
|
}, [r]), !r) return null;
|
|
472
474
|
const i = async () => {
|
|
473
|
-
var S, A, k, P, J, q, Y, _e, C, K,
|
|
475
|
+
var S, A, k, P, J, q, Y, _e, C, K, te, ye, be, ct, N, ve;
|
|
474
476
|
try {
|
|
475
477
|
if (!((A = (S = r == null ? void 0 : r.variants) == null ? void 0 : S[0]) != null && A.product_id) && !(r.type.item || r.type.bundle) && !((P = (k = r == null ? void 0 : r.variants) == null ? void 0 : k[0]) != null && P.productId)) {
|
|
476
478
|
Be.error("Variants not available", {
|
|
@@ -486,26 +488,26 @@ const lt = (e) => {
|
|
|
486
488
|
}
|
|
487
489
|
], $ = JSON.parse(
|
|
488
490
|
sessionStorage.getItem("customerData") || "{}"
|
|
489
|
-
), Je = ($ == null ? void 0 : $.basketId) || localStorage.getItem(Lt),
|
|
490
|
-
if (!
|
|
491
|
-
let
|
|
492
|
-
if (
|
|
491
|
+
), Je = ($ == null ? void 0 : $.basketId) || localStorage.getItem(Lt), dt = !1, qe = localStorage.getItem(zt), rt = Date.now();
|
|
492
|
+
if (!dt || !qe || rt >= parseInt(qe)) {
|
|
493
|
+
let ue = "";
|
|
494
|
+
if (ue = "Bearer " + (await Ge()).access_token, !ue) {
|
|
493
495
|
console.error("Failed to get customer_token");
|
|
494
496
|
return;
|
|
495
497
|
}
|
|
496
|
-
const Ie =
|
|
497
|
-
if (rr(
|
|
498
|
+
const Ie = rt + 300 * 1e3;
|
|
499
|
+
if (rr(ue), localStorage.setItem(zt, Ie.toString()), Je) {
|
|
498
500
|
const Se = await Hn({
|
|
499
501
|
basketId: Je,
|
|
500
|
-
customer_token:
|
|
502
|
+
customer_token: ue
|
|
501
503
|
});
|
|
502
504
|
if (Se.status === 200 && Se) {
|
|
503
|
-
const
|
|
505
|
+
const re = await yr(
|
|
504
506
|
Je,
|
|
505
507
|
V,
|
|
506
|
-
|
|
508
|
+
ue
|
|
507
509
|
);
|
|
508
|
-
(((Y =
|
|
510
|
+
(((Y = re == null ? void 0 : re.product_items) == null ? void 0 : Y.length) > 0 || ((_e = re == null ? void 0 : re.productItems) == null ? void 0 : _e.length) > 0) && (Be.success("Added to cart", {
|
|
509
511
|
position: "bottom-right",
|
|
510
512
|
autoClose: 3e3,
|
|
511
513
|
hideProgressBar: !1,
|
|
@@ -523,7 +525,7 @@ const lt = (e) => {
|
|
|
523
525
|
quantity: 1
|
|
524
526
|
}
|
|
525
527
|
]
|
|
526
|
-
}, z = await Ir(
|
|
528
|
+
}, z = await Ir(ue, je);
|
|
527
529
|
if (!(z != null && z.basket_id) && !(z != null && z.basketId)) {
|
|
528
530
|
console.error("Failed to create basket");
|
|
529
531
|
return;
|
|
@@ -534,9 +536,9 @@ const lt = (e) => {
|
|
|
534
536
|
const Te = await yr(
|
|
535
537
|
(z == null ? void 0 : z.basket_id) || (z == null ? void 0 : z.basketId),
|
|
536
538
|
V,
|
|
537
|
-
|
|
539
|
+
ue
|
|
538
540
|
);
|
|
539
|
-
console.log("object added to basket"), (((
|
|
541
|
+
console.log("object added to basket"), (((te = Te == null ? void 0 : Te.product_items) == null ? void 0 : te.length) > 0 || ((ye = Te == null ? void 0 : Te.productItems) == null ? void 0 : ye.length) > 0) && Be.success("Added to cart", {
|
|
540
542
|
position: "bottom-right",
|
|
541
543
|
autoClose: 3e3,
|
|
542
544
|
hideProgressBar: !1,
|
|
@@ -550,7 +552,7 @@ const lt = (e) => {
|
|
|
550
552
|
position: "bottom-right",
|
|
551
553
|
autoClose: 3e3
|
|
552
554
|
}), ((be = V == null ? void 0 : V.response) == null ? void 0 : be.status) === 404 || // Basket not found
|
|
553
|
-
((
|
|
555
|
+
((ct = V == null ? void 0 : V.response) == null ? void 0 : ct.status) === 401 ? (((N = V == null ? void 0 : V.response) == null ? void 0 : N.status) === 404 && lt(null), ((ve = V == null ? void 0 : V.response) == null ? void 0 : ve.status) === 401 && (lt(null), rr(null))) : (console.error("Failed to add product to basket:", V.message), Be.error("Failed to add product to cart", {
|
|
554
556
|
position: "bottom-right",
|
|
555
557
|
autoClose: 3e3
|
|
556
558
|
}));
|
|
@@ -601,7 +603,7 @@ const lt = (e) => {
|
|
|
601
603
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center justify-center w-[120px] h-[120px] my-5", children: /* @__PURE__ */ a(
|
|
602
604
|
"img",
|
|
603
605
|
{
|
|
604
|
-
src: (y = (g = (
|
|
606
|
+
src: (y = (g = (h = (l = r.imageGroups) == null ? void 0 : l[0]) == null ? void 0 : h.images) == null ? void 0 : g[0]) == null ? void 0 : y.link,
|
|
605
607
|
alt: r.name,
|
|
606
608
|
className: "rounded-[10px]"
|
|
607
609
|
}
|
|
@@ -708,7 +710,7 @@ const lt = (e) => {
|
|
|
708
710
|
}
|
|
709
711
|
)
|
|
710
712
|
] });
|
|
711
|
-
},
|
|
713
|
+
}, pa = ({
|
|
712
714
|
tanyaConfig: e,
|
|
713
715
|
basketId: t,
|
|
714
716
|
addToCart: r
|
|
@@ -727,45 +729,45 @@ const lt = (e) => {
|
|
|
727
729
|
"Niece/Nephew": "his/her niece/nephew",
|
|
728
730
|
"My Friends": "his/her friends",
|
|
729
731
|
Others: "others"
|
|
730
|
-
}, s = Ve(null), i = Ve(null), c = Ve(null), l = Ve(null), [
|
|
732
|
+
}, s = Ve(null), i = Ve(null), c = Ve(null), l = Ve(null), [h, g] = b(null);
|
|
731
733
|
Ve(null);
|
|
732
|
-
const [y, x] = b(!1), [I, S] = b(!1), [A, k] = b(!1), [P, J] = b(!1), [q, Y] = b(!1), [_e, C] = b(!1), [K,
|
|
733
|
-
id:
|
|
734
|
-
title:
|
|
735
|
-
image:
|
|
736
|
-
price:
|
|
737
|
-
}), [N, ve] = b([]), V = Ve(null), $ = er((
|
|
734
|
+
const [y, x] = b(!1), [I, S] = b(!1), [A, k] = b(!1), [P, J] = b(!1), [q, Y] = b(!1), [_e, C] = b(!1), [K, te] = b(""), [ye, be] = b(""), ct = (p) => ({
|
|
735
|
+
id: p.id,
|
|
736
|
+
title: p.name,
|
|
737
|
+
image: p.image ?? "",
|
|
738
|
+
price: p.price ?? 0
|
|
739
|
+
}), [N, ve] = b([]), V = Ve(null), $ = er((p) => p.store.store), Je = er((p) => p.product.product);
|
|
738
740
|
xe(() => {
|
|
739
|
-
const
|
|
741
|
+
const p = localStorage.getItem(
|
|
740
742
|
`access_token_${e.siteId}`
|
|
741
743
|
), O = localStorage.getItem(
|
|
742
744
|
`chat-token-${e.siteId}`
|
|
743
745
|
);
|
|
744
|
-
if (
|
|
746
|
+
if (p && O === p) {
|
|
745
747
|
const B = localStorage.getItem("chatHistory");
|
|
746
748
|
B && ve(JSON.parse(B));
|
|
747
749
|
} else
|
|
748
750
|
localStorage.setItem("chatHistory", JSON.stringify([])), localStorage.setItem(
|
|
749
751
|
`chat-token-${e.siteId}`,
|
|
750
|
-
|
|
752
|
+
p || ""
|
|
751
753
|
);
|
|
752
754
|
}, []), xe(() => {
|
|
753
755
|
localStorage.setItem("chatHistory", JSON.stringify(N));
|
|
754
|
-
const
|
|
756
|
+
const p = localStorage.getItem(
|
|
755
757
|
`access_token_${e.siteId}`
|
|
756
758
|
);
|
|
757
|
-
|
|
759
|
+
p && localStorage.setItem(`chat-token-${e.siteId}`, p);
|
|
758
760
|
}, [N]);
|
|
759
|
-
const
|
|
761
|
+
const dt = () => {
|
|
760
762
|
k(!0), setTimeout(() => S(!0), 10);
|
|
761
763
|
}, qe = () => {
|
|
762
764
|
S(!1), setTimeout(() => k(!1), 300);
|
|
763
765
|
};
|
|
764
766
|
xe(() => {
|
|
765
|
-
y ?
|
|
767
|
+
y ? dt() : qe();
|
|
766
768
|
}, [y]);
|
|
767
|
-
const
|
|
768
|
-
be(o[
|
|
769
|
+
const rt = (p) => {
|
|
770
|
+
be(o[p]);
|
|
769
771
|
};
|
|
770
772
|
xe(() => {
|
|
771
773
|
A && V.current && V.current.scrollTo({
|
|
@@ -773,37 +775,37 @@ const lt = (e) => {
|
|
|
773
775
|
behavior: "smooth"
|
|
774
776
|
});
|
|
775
777
|
}, [N, A]);
|
|
776
|
-
const
|
|
777
|
-
const
|
|
778
|
-
|
|
778
|
+
const ue = null, Ie = null, je = async () => {
|
|
779
|
+
const p = await Ge();
|
|
780
|
+
p != null && g(p);
|
|
779
781
|
};
|
|
780
782
|
xe(() => {
|
|
781
783
|
if (e != null && e.siteId) {
|
|
782
|
-
const { clientID:
|
|
783
|
-
sessionStorage.setItem("Host", O), sessionStorage.setItem("SiteId", U), sessionStorage.setItem("pubCfg", btoa(
|
|
784
|
+
const { clientID: p, host: O, organizationID: B, shortCode: Q, siteId: U } = e;
|
|
785
|
+
sessionStorage.setItem("Host", O), sessionStorage.setItem("SiteId", U), sessionStorage.setItem("pubCfg", btoa(p)), sessionStorage.setItem("envRef", Q), sessionStorage.setItem("orgRef", B);
|
|
784
786
|
}
|
|
785
787
|
je(), console.log("scapi environment v1");
|
|
786
788
|
}, []), xe(() => {
|
|
787
789
|
t && (console.log("setting the basket id", t), lt(t));
|
|
788
790
|
}, [t]);
|
|
789
791
|
const z = async () => {
|
|
790
|
-
const
|
|
792
|
+
const p = JSON.parse(
|
|
791
793
|
sessionStorage.getItem("customerData") || "{}"
|
|
792
794
|
).customerId;
|
|
793
|
-
return (await aa(
|
|
794
|
-
}, Te = async (
|
|
795
|
+
return (await aa(p || "")).c_interests;
|
|
796
|
+
}, Te = async (p, O) => {
|
|
795
797
|
console.log("in secondary flow", Vt);
|
|
796
798
|
const B = await z();
|
|
797
799
|
if (console.log(B, "interests of customer", Vt), !!B)
|
|
798
800
|
try {
|
|
799
801
|
ve(
|
|
800
802
|
(me) => me.map(
|
|
801
|
-
(Ne,
|
|
803
|
+
(Ne, pe) => pe === me.length - 1 ? { ...Ne, secondaryLoading: !0 } : Ne
|
|
802
804
|
)
|
|
803
805
|
);
|
|
804
|
-
const Q = await wr(
|
|
806
|
+
const Q = await wr(ue, Ie);
|
|
805
807
|
if (!Q) throw new Error("Failed to fetch token");
|
|
806
|
-
const U = localStorage.getItem("customerNumber"), L = localStorage.getItem("isLoggedIn"),
|
|
808
|
+
const U = localStorage.getItem("customerNumber"), L = localStorage.getItem("isLoggedIn"), X = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
|
|
807
809
|
registered: String(L || !1),
|
|
808
810
|
userId: String(U || (/* @__PURE__ */ new Date()).getTime())
|
|
809
811
|
}).toString()}`, R = JSON.stringify({
|
|
@@ -811,11 +813,11 @@ const lt = (e) => {
|
|
|
811
813
|
flowAliasId: "HKFUVLWVH2",
|
|
812
814
|
input: {
|
|
813
815
|
loyaltyPoints: "",
|
|
814
|
-
productName:
|
|
816
|
+
productName: p,
|
|
815
817
|
productPoints: String(O || 0),
|
|
816
818
|
interests: B
|
|
817
819
|
}
|
|
818
|
-
}),
|
|
820
|
+
}), ne = await fetch(X, {
|
|
819
821
|
signal: AbortSignal.timeout(3e4),
|
|
820
822
|
method: "POST",
|
|
821
823
|
headers: {
|
|
@@ -824,46 +826,46 @@ const lt = (e) => {
|
|
|
824
826
|
},
|
|
825
827
|
body: R
|
|
826
828
|
});
|
|
827
|
-
if (!
|
|
828
|
-
const $e =
|
|
829
|
+
if (!ne.body) throw new Error("Readable stream not supported");
|
|
830
|
+
const $e = ne.body.getReader(), Re = new TextDecoder();
|
|
829
831
|
let G = "";
|
|
830
832
|
for (; ; ) {
|
|
831
833
|
const { done: me, value: Ne } = await $e.read();
|
|
832
834
|
if (me) break;
|
|
833
835
|
G += Re.decode(Ne, { stream: !0 });
|
|
834
|
-
const
|
|
836
|
+
const pe = G.split(`
|
|
835
837
|
`);
|
|
836
|
-
G =
|
|
837
|
-
for (const
|
|
838
|
-
if (
|
|
839
|
-
const _ =
|
|
838
|
+
G = pe.pop() || "";
|
|
839
|
+
for (const he of pe)
|
|
840
|
+
if (he.startsWith("data:")) {
|
|
841
|
+
const _ = he.slice(5).trim();
|
|
840
842
|
try {
|
|
841
|
-
const
|
|
842
|
-
|
|
843
|
+
const Z = JSON.parse(_);
|
|
844
|
+
Z.index === 0 && ve(
|
|
843
845
|
(D) => D.map(
|
|
844
|
-
(
|
|
845
|
-
...
|
|
846
|
-
secondaryResponse:
|
|
846
|
+
(oe, ae) => ae === D.length - 1 ? {
|
|
847
|
+
...oe,
|
|
848
|
+
secondaryResponse: Z.data,
|
|
847
849
|
secondaryLoading: !1
|
|
848
|
-
} :
|
|
850
|
+
} : oe
|
|
849
851
|
)
|
|
850
852
|
);
|
|
851
|
-
} catch (
|
|
853
|
+
} catch (Z) {
|
|
852
854
|
ve(
|
|
853
855
|
(D) => D.map(
|
|
854
|
-
(
|
|
856
|
+
(oe, ae) => ae === D.length - 1 ? { ...oe, secondaryLoading: !1 } : oe
|
|
855
857
|
)
|
|
856
|
-
), console.error("Secondary flow JSON parse error:",
|
|
858
|
+
), console.error("Secondary flow JSON parse error:", Z);
|
|
857
859
|
}
|
|
858
860
|
}
|
|
859
861
|
}
|
|
860
862
|
} catch (Q) {
|
|
861
863
|
console.error("Secondary flow error:", Q);
|
|
862
864
|
}
|
|
863
|
-
}, Se = async (
|
|
864
|
-
const O =
|
|
865
|
+
}, Se = async (p) => {
|
|
866
|
+
const O = p || K.trim();
|
|
865
867
|
if (O) {
|
|
866
|
-
Y(!0),
|
|
868
|
+
Y(!0), te(""), s.current = null, i.current = null, c.current = null, l.current = null, ve((B) => [
|
|
867
869
|
...B,
|
|
868
870
|
{
|
|
869
871
|
query: O,
|
|
@@ -874,10 +876,10 @@ const lt = (e) => {
|
|
|
874
876
|
}
|
|
875
877
|
]);
|
|
876
878
|
try {
|
|
877
|
-
const B = ye, Q = localStorage.getItem("customerNumber"), U = localStorage.getItem("isLoggedIn"), L = await wr(
|
|
879
|
+
const B = ye, Q = localStorage.getItem("customerNumber"), U = localStorage.getItem("isLoggedIn"), L = await wr(ue, Ie);
|
|
878
880
|
if (!L)
|
|
879
881
|
throw new Error("Failed to obtain access token");
|
|
880
|
-
const
|
|
882
|
+
const X = `https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({
|
|
881
883
|
registered: String(U || !1),
|
|
882
884
|
userId: String(Q || (/* @__PURE__ */ new Date()).getTime())
|
|
883
885
|
}).toString()}`, R = JSON.stringify({
|
|
@@ -887,7 +889,7 @@ const lt = (e) => {
|
|
|
887
889
|
userPrompt: O,
|
|
888
890
|
whom: B
|
|
889
891
|
}
|
|
890
|
-
}),
|
|
892
|
+
}), ne = await fetch(X, {
|
|
891
893
|
signal: AbortSignal.timeout(3e4),
|
|
892
894
|
method: "POST",
|
|
893
895
|
headers: {
|
|
@@ -896,30 +898,30 @@ const lt = (e) => {
|
|
|
896
898
|
},
|
|
897
899
|
body: R
|
|
898
900
|
});
|
|
899
|
-
if (!
|
|
900
|
-
throw new Error(`HTTP error! status: ${
|
|
901
|
-
if (!
|
|
902
|
-
const $e =
|
|
901
|
+
if (!ne.ok)
|
|
902
|
+
throw new Error(`HTTP error! status: ${ne.status}`);
|
|
903
|
+
if (!ne.body) throw new Error("Readable stream not supported");
|
|
904
|
+
const $e = ne.body.getReader(), Re = new TextDecoder();
|
|
903
905
|
let G = "", me = "";
|
|
904
906
|
for (; ; ) {
|
|
905
907
|
C(!0);
|
|
906
|
-
const { done: Ne, value:
|
|
908
|
+
const { done: Ne, value: pe } = await $e.read();
|
|
907
909
|
if (Ne) break;
|
|
908
|
-
G += Re.decode(
|
|
909
|
-
const
|
|
910
|
+
G += Re.decode(pe, { stream: !0 });
|
|
911
|
+
const he = G.split(`
|
|
910
912
|
`);
|
|
911
|
-
G =
|
|
912
|
-
for (const _ of
|
|
913
|
+
G = he.pop() || "";
|
|
914
|
+
for (const _ of he)
|
|
913
915
|
if (_.startsWith("data:")) {
|
|
914
|
-
const
|
|
916
|
+
const Z = _.slice(5).trim();
|
|
915
917
|
try {
|
|
916
|
-
const D = JSON.parse(
|
|
918
|
+
const D = JSON.parse(Z);
|
|
917
919
|
D.index == 1 && (me = D.data), ve(
|
|
918
|
-
(
|
|
919
|
-
(
|
|
920
|
-
...
|
|
920
|
+
(oe) => oe.map(
|
|
921
|
+
(ae, Ae) => Ae === oe.length - 1 ? {
|
|
922
|
+
...ae,
|
|
921
923
|
[D.index == 0 ? "response" : D.index == 1 ? "keywords" : D.index == 2 ? "potentialQuestions" : "end"]: D.data
|
|
922
|
-
} :
|
|
924
|
+
} : ae
|
|
923
925
|
)
|
|
924
926
|
);
|
|
925
927
|
} catch (D) {
|
|
@@ -927,52 +929,52 @@ const lt = (e) => {
|
|
|
927
929
|
}
|
|
928
930
|
}
|
|
929
931
|
}
|
|
930
|
-
|
|
932
|
+
fe(re(me));
|
|
931
933
|
} catch (B) {
|
|
932
934
|
console.error("Error sending message to Tanya:", B);
|
|
933
935
|
} finally {
|
|
934
936
|
Y(!1);
|
|
935
937
|
}
|
|
936
938
|
}
|
|
937
|
-
},
|
|
938
|
-
const O =
|
|
939
|
+
}, re = (p) => {
|
|
940
|
+
const O = p.match(
|
|
939
941
|
/top five relevant product or category names are: (.*)/i
|
|
940
|
-
), U = (O ? O[1] :
|
|
942
|
+
), U = (O ? O[1] : p).split(", ").map((W) => W.replace(/\s*(Toys|Bags|Miniature|etc\.*)\s*/gi, "").trim());
|
|
941
943
|
return [...new Set(U)].filter(Boolean).join(",");
|
|
942
|
-
},
|
|
944
|
+
}, fe = async (p) => {
|
|
943
945
|
var B, Q, U;
|
|
944
|
-
const O = typeof
|
|
946
|
+
const O = typeof p == "string" ? p.split(",") : p;
|
|
945
947
|
C(!0);
|
|
946
948
|
try {
|
|
947
949
|
const L = await Promise.all(
|
|
948
950
|
O.map((R) => oa(R).catch(() => []))
|
|
949
951
|
// prevent Promise.all crash
|
|
950
|
-
), W = O.map((R,
|
|
952
|
+
), W = O.map((R, ne) => ({
|
|
951
953
|
keyword: R,
|
|
952
|
-
items: L[
|
|
954
|
+
items: L[ne] ?? [],
|
|
953
955
|
loading: !1
|
|
954
|
-
})).filter((R) => R.items.length > 0),
|
|
955
|
-
if (
|
|
956
|
-
i.current =
|
|
957
|
-
const R = typeof
|
|
956
|
+
})).filter((R) => R.items.length > 0), X = (Q = (B = W[0]) == null ? void 0 : B.items) == null ? void 0 : Q[0];
|
|
957
|
+
if (X) {
|
|
958
|
+
i.current = X.product_id, s.current = X.product_name, c.current = (U = X.image) == null ? void 0 : U.link;
|
|
959
|
+
const R = typeof X.price == "number" ? X.price : null;
|
|
958
960
|
l.current = R;
|
|
959
961
|
}
|
|
960
962
|
if (ve(
|
|
961
963
|
(R) => R.map(
|
|
962
|
-
(
|
|
963
|
-
...
|
|
964
|
+
(ne, $e) => $e === R.length - 1 ? {
|
|
965
|
+
...ne,
|
|
964
966
|
products: W,
|
|
965
|
-
productSnapshot:
|
|
967
|
+
productSnapshot: X ? {
|
|
966
968
|
id: i.current,
|
|
967
969
|
name: s.current,
|
|
968
970
|
image: c.current,
|
|
969
971
|
price: l.current,
|
|
970
972
|
points: 0,
|
|
971
973
|
quantity: 1
|
|
972
|
-
} :
|
|
973
|
-
} :
|
|
974
|
+
} : ne.productSnapshot
|
|
975
|
+
} : ne
|
|
974
976
|
)
|
|
975
|
-
),
|
|
977
|
+
), X) {
|
|
976
978
|
const R = JSON.parse(
|
|
977
979
|
sessionStorage.getItem("customerData") || "{}"
|
|
978
980
|
);
|
|
@@ -983,11 +985,11 @@ const lt = (e) => {
|
|
|
983
985
|
} finally {
|
|
984
986
|
C(!1);
|
|
985
987
|
}
|
|
986
|
-
}, kt = async (
|
|
987
|
-
var B, Q, U, L, W,
|
|
988
|
+
}, kt = async (p, O) => {
|
|
989
|
+
var B, Q, U, L, W, X, R, ne, $e, Re, G, me, Ne, pe, he;
|
|
988
990
|
J(!0);
|
|
989
991
|
try {
|
|
990
|
-
const _ = await Rn(
|
|
992
|
+
const _ = await Rn(p.id);
|
|
991
993
|
if (!((Q = (B = _ == null ? void 0 : _.variants) == null ? void 0 : B[0]) != null && Q.product_id || (L = (U = _ == null ? void 0 : _.variants) == null ? void 0 : U[0]) != null && L.productId) && !(_.type.item || _.type.bundle)) {
|
|
992
994
|
J(!1), Be.error("Variants not found", {
|
|
993
995
|
position: "bottom-right",
|
|
@@ -995,36 +997,36 @@ const lt = (e) => {
|
|
|
995
997
|
}), console.error("No product variant found");
|
|
996
998
|
return;
|
|
997
999
|
}
|
|
998
|
-
const
|
|
1000
|
+
const Z = [
|
|
999
1001
|
{
|
|
1000
|
-
product_id: ((W = _.variants) == null ? void 0 : W[0].product_id) || ((
|
|
1002
|
+
product_id: ((W = _.variants) == null ? void 0 : W[0].product_id) || ((X = _.variants) == null ? void 0 : X[0].productId) || (_ == null ? void 0 : _.id),
|
|
1001
1003
|
quantity: O
|
|
1002
1004
|
}
|
|
1003
1005
|
];
|
|
1004
|
-
console.log(
|
|
1006
|
+
console.log(Z, "product data", "app version", Vt);
|
|
1005
1007
|
const D = JSON.parse(
|
|
1006
1008
|
sessionStorage.getItem("customerData") || "{}"
|
|
1007
|
-
),
|
|
1008
|
-
if (!
|
|
1009
|
+
), oe = (D == null ? void 0 : D.basketId) || localStorage.getItem(Lt), ae = !1, Ae = localStorage.getItem(zt), St = Date.now();
|
|
1010
|
+
if (!ae || !Ae || St >= parseInt(Ae)) {
|
|
1009
1011
|
const Oe = await Un();
|
|
1010
|
-
let { customer_token:
|
|
1012
|
+
let { customer_token: se } = await qn(
|
|
1011
1013
|
Oe
|
|
1012
1014
|
);
|
|
1013
|
-
if (
|
|
1015
|
+
if (se = "Bearer " + h.access_token, !se) {
|
|
1014
1016
|
console.error("Failed to get customer_token");
|
|
1015
1017
|
return;
|
|
1016
1018
|
}
|
|
1017
1019
|
const Nt = St + 300 * 1e3;
|
|
1018
|
-
if (rr(
|
|
1020
|
+
if (rr(se), localStorage.setItem(zt, Nt.toString()), console.log(oe, "basketIdFromCustomer"), oe) {
|
|
1019
1021
|
const Ct = await Hn({
|
|
1020
|
-
basketId:
|
|
1021
|
-
customer_token:
|
|
1022
|
+
basketId: oe,
|
|
1023
|
+
customer_token: se
|
|
1022
1024
|
});
|
|
1023
1025
|
if (Ct.status === 200 && Ct) {
|
|
1024
1026
|
const _t = await yr(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1027
|
+
oe,
|
|
1028
|
+
Z,
|
|
1029
|
+
se
|
|
1028
1030
|
);
|
|
1029
1031
|
((R = _t == null ? void 0 : _t.product_items) == null ? void 0 : R.length) > 0 && (Be.success("Added to cart", {
|
|
1030
1032
|
position: "bottom-right",
|
|
@@ -1033,18 +1035,18 @@ const lt = (e) => {
|
|
|
1033
1035
|
closeOnClick: !0,
|
|
1034
1036
|
pauseOnHover: !0,
|
|
1035
1037
|
draggable: !0
|
|
1036
|
-
}), tr(
|
|
1038
|
+
}), tr(oe), J(!1));
|
|
1037
1039
|
return;
|
|
1038
1040
|
}
|
|
1039
1041
|
}
|
|
1040
1042
|
const Ce = {
|
|
1041
1043
|
productItems: [
|
|
1042
1044
|
{
|
|
1043
|
-
productId: ((
|
|
1045
|
+
productId: ((ne = _.variants) == null ? void 0 : ne[0].product_id) || (($e = _.variants) == null ? void 0 : $e[0].productId) || (_ == null ? void 0 : _.id),
|
|
1044
1046
|
quantity: 1
|
|
1045
1047
|
}
|
|
1046
1048
|
]
|
|
1047
|
-
}, F = await Ir(
|
|
1049
|
+
}, F = await Ir(se, Ce);
|
|
1048
1050
|
if (console.log(
|
|
1049
1051
|
F,
|
|
1050
1052
|
F == null ? void 0 : F.basket_id,
|
|
@@ -1057,14 +1059,14 @@ const lt = (e) => {
|
|
|
1057
1059
|
lt(
|
|
1058
1060
|
(F == null ? void 0 : F.basket_id) || (F == null ? void 0 : F.basketId)
|
|
1059
1061
|
);
|
|
1060
|
-
const
|
|
1062
|
+
const ee = await r(
|
|
1061
1063
|
{
|
|
1062
1064
|
productId: i,
|
|
1063
1065
|
quantity: O
|
|
1064
1066
|
},
|
|
1065
1067
|
(F == null ? void 0 : F.basket_id) || (F == null ? void 0 : F.basketId)
|
|
1066
1068
|
);
|
|
1067
|
-
(((Re =
|
|
1069
|
+
(((Re = ee == null ? void 0 : ee.product_items) == null ? void 0 : Re.length) > 0 || ((G = ee == null ? void 0 : ee.productItems) == null ? void 0 : G.length) > 0) && Be.success("Added to cart", {
|
|
1068
1070
|
position: "bottom-right",
|
|
1069
1071
|
autoClose: 3e3,
|
|
1070
1072
|
hideProgressBar: !1,
|
|
@@ -1078,7 +1080,7 @@ const lt = (e) => {
|
|
|
1078
1080
|
position: "bottom-right",
|
|
1079
1081
|
autoClose: 3e3
|
|
1080
1082
|
}), ((me = _ == null ? void 0 : _.response) == null ? void 0 : me.status) === 404 || // Basket not found
|
|
1081
|
-
((Ne = _ == null ? void 0 : _.response) == null ? void 0 : Ne.status) === 401 ? (((
|
|
1083
|
+
((Ne = _ == null ? void 0 : _.response) == null ? void 0 : Ne.status) === 401 ? (((pe = _ == null ? void 0 : _.response) == null ? void 0 : pe.status) === 404 && lt(null), ((he = _ == null ? void 0 : _.response) == null ? void 0 : he.status) === 401 && (lt(null), rr(null))) : (console.error("Failed to add product to basket:", _.message), Be.error("Failed to add product to cart", {
|
|
1082
1084
|
position: "bottom-right",
|
|
1083
1085
|
autoClose: 3e3
|
|
1084
1086
|
}));
|
|
@@ -1309,38 +1311,38 @@ const lt = (e) => {
|
|
|
1309
1311
|
className: "mx-3 p-3 rounded-2xl bg-[#FFFFFF]",
|
|
1310
1312
|
children: [
|
|
1311
1313
|
/* @__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?" }) }),
|
|
1312
|
-
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: n.map((
|
|
1314
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: n.map((p) => /* @__PURE__ */ a(
|
|
1313
1315
|
"button",
|
|
1314
1316
|
{
|
|
1315
|
-
onClick: () =>
|
|
1317
|
+
onClick: () => rt(p),
|
|
1316
1318
|
className: "px-2 py-2 font-semibold text-xs text-[#18181B] bg-[#F3F3F3] rounded-2xl",
|
|
1317
1319
|
style: {
|
|
1318
|
-
backgroundColor: ye === o[
|
|
1319
|
-
borderColor: ye === o[
|
|
1320
|
+
backgroundColor: ye === o[p] ? "#FFFFFF" : "#F3F3F3",
|
|
1321
|
+
borderColor: ye === o[p] ? "#BBB3DD" : ""
|
|
1320
1322
|
},
|
|
1321
|
-
children:
|
|
1323
|
+
children: p
|
|
1322
1324
|
},
|
|
1323
|
-
|
|
1325
|
+
p
|
|
1324
1326
|
)) })
|
|
1325
1327
|
]
|
|
1326
1328
|
}
|
|
1327
1329
|
),
|
|
1328
|
-
N.map((
|
|
1330
|
+
N.map((p, O) => {
|
|
1329
1331
|
var B, Q;
|
|
1330
1332
|
return /* @__PURE__ */ d("div", { children: [
|
|
1331
1333
|
/* @__PURE__ */ a(
|
|
1332
1334
|
"div",
|
|
1333
1335
|
{
|
|
1334
1336
|
className: "flex justify-end",
|
|
1335
|
-
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:
|
|
1337
|
+
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: p.query })
|
|
1336
1338
|
}
|
|
1337
1339
|
),
|
|
1338
|
-
|
|
1340
|
+
p.response && p.response.includes("Thinking") ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
1339
1341
|
"div",
|
|
1340
1342
|
{
|
|
1341
1343
|
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",
|
|
1342
1344
|
dangerouslySetInnerHTML: {
|
|
1343
|
-
__html: lr(
|
|
1345
|
+
__html: lr(p.response)
|
|
1344
1346
|
}
|
|
1345
1347
|
}
|
|
1346
1348
|
) }) : /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
@@ -1348,19 +1350,19 @@ const lt = (e) => {
|
|
|
1348
1350
|
{
|
|
1349
1351
|
className: "font-nunitoSans font-bold text-sm text-[#494949] bg-[#FFFFFF] px-7 py-1 rounded-r-xl rounded-bl-2xl w-full",
|
|
1350
1352
|
dangerouslySetInnerHTML: {
|
|
1351
|
-
__html: lr(
|
|
1353
|
+
__html: lr(p.response)
|
|
1352
1354
|
}
|
|
1353
1355
|
}
|
|
1354
1356
|
) }),
|
|
1355
|
-
_e && !
|
|
1356
|
-
(
|
|
1357
|
+
_e && !p.response.includes("Thinking") && ((B = p.products) == null ? void 0 : B.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" }) }),
|
|
1358
|
+
(p == null ? void 0 : p.products) && ((Q = p == null ? void 0 : p.products) == null ? void 0 : Q.length) > 0 && /* @__PURE__ */ a(
|
|
1357
1359
|
da,
|
|
1358
1360
|
{
|
|
1359
|
-
chat:
|
|
1361
|
+
chat: p.products,
|
|
1360
1362
|
storeDetails: $
|
|
1361
1363
|
}
|
|
1362
1364
|
),
|
|
1363
|
-
(
|
|
1365
|
+
(p == null ? void 0 : p.potentialQuestions.length) > 0 && /* @__PURE__ */ d("div", { className: "my-2 px-4 text-sm text-gray-700", children: [
|
|
1364
1366
|
/* @__PURE__ */ a(
|
|
1365
1367
|
"p",
|
|
1366
1368
|
{
|
|
@@ -1369,7 +1371,7 @@ const lt = (e) => {
|
|
|
1369
1371
|
children: "Why not explore these inquiries..."
|
|
1370
1372
|
}
|
|
1371
1373
|
),
|
|
1372
|
-
|
|
1374
|
+
p.potentialQuestions.split(",").map((U, L) => /* @__PURE__ */ a(
|
|
1373
1375
|
"button",
|
|
1374
1376
|
{
|
|
1375
1377
|
className: `cursor-pointer font-nunitoSans font-semibold text-[#232323] border bg-[#804C9E0D] border-${$.themeDarkColor} m-1 rounded-xl px-2 py-1`,
|
|
@@ -1382,7 +1384,7 @@ const lt = (e) => {
|
|
|
1382
1384
|
L
|
|
1383
1385
|
))
|
|
1384
1386
|
] }),
|
|
1385
|
-
(
|
|
1387
|
+
(p == null ? void 0 : p.secondaryLoading) && /* @__PURE__ */ a("div", { className: "mt-3 mb-4 px-4", children: /* @__PURE__ */ d(
|
|
1386
1388
|
"div",
|
|
1387
1389
|
{
|
|
1388
1390
|
className: "tanya-surprise-wrapper bg-indigo-300 text-sm px-7 py-4 rounded-r-xl rounded-bl-2xl w-full relative overflow-hidden",
|
|
@@ -1415,7 +1417,7 @@ const lt = (e) => {
|
|
|
1415
1417
|
]
|
|
1416
1418
|
}
|
|
1417
1419
|
) }),
|
|
1418
|
-
(
|
|
1420
|
+
(p == null ? void 0 : p.secondaryResponse) && /* @__PURE__ */ a(ke, { children: /* @__PURE__ */ d("div", { className: "mt-3 mb-8 px-4 bg-indigo-300 rounded-tr-[5px]", children: [
|
|
1419
1421
|
/* @__PURE__ */ a(
|
|
1420
1422
|
"div",
|
|
1421
1423
|
{
|
|
@@ -1425,12 +1427,12 @@ const lt = (e) => {
|
|
|
1425
1427
|
},
|
|
1426
1428
|
dangerouslySetInnerHTML: {
|
|
1427
1429
|
__html: lr(
|
|
1428
|
-
|
|
1430
|
+
p.secondaryResponse
|
|
1429
1431
|
)
|
|
1430
1432
|
}
|
|
1431
1433
|
}
|
|
1432
1434
|
),
|
|
1433
|
-
|
|
1435
|
+
p.productSnapshot && // chat.productSnapshot.points > 0 &&
|
|
1434
1436
|
/* @__PURE__ */ a("div", { className: "mt-4 w-full", children: /* @__PURE__ */ d(
|
|
1435
1437
|
"div",
|
|
1436
1438
|
{
|
|
@@ -1448,11 +1450,11 @@ const lt = (e) => {
|
|
|
1448
1450
|
height: 112,
|
|
1449
1451
|
borderColor: "#eee"
|
|
1450
1452
|
},
|
|
1451
|
-
children:
|
|
1453
|
+
children: p.productSnapshot.image ? /* @__PURE__ */ a(
|
|
1452
1454
|
"img",
|
|
1453
1455
|
{
|
|
1454
|
-
src:
|
|
1455
|
-
alt:
|
|
1456
|
+
src: p.productSnapshot.image,
|
|
1457
|
+
alt: p.productSnapshot.name,
|
|
1456
1458
|
className: "w-full h-full object-cover"
|
|
1457
1459
|
}
|
|
1458
1460
|
) : /* @__PURE__ */ a("div", { className: "w-full h-full flex items-center justify-center text-xs text-gray-500", children: "No Image" })
|
|
@@ -1460,18 +1462,18 @@ const lt = (e) => {
|
|
|
1460
1462
|
),
|
|
1461
1463
|
/* @__PURE__ */ d("div", { className: "flex flex-col flex-1 justify-between", children: [
|
|
1462
1464
|
/* @__PURE__ */ d("div", { children: [
|
|
1463
|
-
/* @__PURE__ */ a("p", { className: "font-semibold text-[15px] leading-snug", children:
|
|
1464
|
-
/* @__PURE__ */ a("p", { className: "mt-1 text-[14px] font-medium", children:
|
|
1465
|
+
/* @__PURE__ */ a("p", { className: "font-semibold text-[15px] leading-snug", children: p.productSnapshot.name }),
|
|
1466
|
+
/* @__PURE__ */ a("p", { className: "mt-1 text-[14px] font-medium", children: p.productSnapshot.price != null ? new Intl.NumberFormat(void 0, {
|
|
1465
1467
|
style: "currency",
|
|
1466
1468
|
currency: ($ == null ? void 0 : $.currency) || "USD"
|
|
1467
1469
|
}).format(
|
|
1468
|
-
|
|
1470
|
+
p.productSnapshot.price
|
|
1469
1471
|
) : "" }),
|
|
1470
|
-
|
|
1472
|
+
p.productSnapshot.points > 0 && /* @__PURE__ */ d("p", { className: "mt-1 text-xs opacity-80", children: [
|
|
1471
1473
|
"You will earn",
|
|
1472
1474
|
" ",
|
|
1473
1475
|
/* @__PURE__ */ d("strong", { children: [
|
|
1474
|
-
|
|
1476
|
+
p.productSnapshot.points,
|
|
1475
1477
|
" ",
|
|
1476
1478
|
"points"
|
|
1477
1479
|
] })
|
|
@@ -1504,7 +1506,7 @@ const lt = (e) => {
|
|
|
1504
1506
|
children: "−"
|
|
1505
1507
|
}
|
|
1506
1508
|
),
|
|
1507
|
-
/* @__PURE__ */ a("div", { className: "px-3 py-1 text-sm select-none", children:
|
|
1509
|
+
/* @__PURE__ */ a("div", { className: "px-3 py-1 text-sm select-none", children: p.productSnapshot.quantity }),
|
|
1508
1510
|
/* @__PURE__ */ a(
|
|
1509
1511
|
"button",
|
|
1510
1512
|
{
|
|
@@ -1533,10 +1535,10 @@ const lt = (e) => {
|
|
|
1533
1535
|
{
|
|
1534
1536
|
onClick: () => {
|
|
1535
1537
|
kt(
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
+
ct(
|
|
1539
|
+
p.productSnapshot
|
|
1538
1540
|
),
|
|
1539
|
-
|
|
1541
|
+
p.productSnapshot.quantity
|
|
1540
1542
|
);
|
|
1541
1543
|
},
|
|
1542
1544
|
disabled: P,
|
|
@@ -1576,9 +1578,9 @@ const lt = (e) => {
|
|
|
1576
1578
|
placeholder: "How can I help you...",
|
|
1577
1579
|
value: K,
|
|
1578
1580
|
autoFocus: !0,
|
|
1579
|
-
onChange: (
|
|
1580
|
-
onKeyDown: (
|
|
1581
|
-
|
|
1581
|
+
onChange: (p) => te(p.target.value),
|
|
1582
|
+
onKeyDown: (p) => {
|
|
1583
|
+
p.key === "Enter" && !q && Se();
|
|
1582
1584
|
}
|
|
1583
1585
|
}
|
|
1584
1586
|
),
|
|
@@ -1638,7 +1640,7 @@ var xr = function(e, t) {
|
|
|
1638
1640
|
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (r[o] = n[o]);
|
|
1639
1641
|
}, xr(e, t);
|
|
1640
1642
|
};
|
|
1641
|
-
function
|
|
1643
|
+
function ha(e, t) {
|
|
1642
1644
|
if (typeof t != "function" && t !== null)
|
|
1643
1645
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
1644
1646
|
xr(e, t);
|
|
@@ -1647,14 +1649,14 @@ function pa(e, t) {
|
|
|
1647
1649
|
}
|
|
1648
1650
|
e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
1649
1651
|
}
|
|
1650
|
-
var
|
|
1651
|
-
return
|
|
1652
|
+
var Qe = function() {
|
|
1653
|
+
return Qe = Object.assign || function(t) {
|
|
1652
1654
|
for (var r, n = 1, o = arguments.length; n < o; n++) {
|
|
1653
1655
|
r = arguments[n];
|
|
1654
1656
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
1655
1657
|
}
|
|
1656
1658
|
return t;
|
|
1657
|
-
},
|
|
1659
|
+
}, Qe.apply(this, arguments);
|
|
1658
1660
|
};
|
|
1659
1661
|
function ga(e, t) {
|
|
1660
1662
|
var r = {};
|
|
@@ -1669,7 +1671,7 @@ var cr = "Invariant Violation", ln = Object.setPrototypeOf, wa = ln === void 0 ?
|
|
|
1669
1671
|
} : ln, Vn = (
|
|
1670
1672
|
/** @class */
|
|
1671
1673
|
(function(e) {
|
|
1672
|
-
|
|
1674
|
+
ha(t, e);
|
|
1673
1675
|
function t(r) {
|
|
1674
1676
|
r === void 0 && (r = cr);
|
|
1675
1677
|
var n = e.call(this, typeof r == "number" ? cr + ": " + r + " (see https://github.com/apollographql/invariant-packages)" : r) || this;
|
|
@@ -1784,7 +1786,7 @@ function va(e) {
|
|
|
1784
1786
|
return t.name.value;
|
|
1785
1787
|
})[0] || null;
|
|
1786
1788
|
}
|
|
1787
|
-
let
|
|
1789
|
+
let le = null;
|
|
1788
1790
|
const un = {};
|
|
1789
1791
|
let ka = 1;
|
|
1790
1792
|
const Sa = () => class {
|
|
@@ -1797,52 +1799,52 @@ const Sa = () => class {
|
|
|
1797
1799
|
].join(":");
|
|
1798
1800
|
}
|
|
1799
1801
|
hasValue() {
|
|
1800
|
-
for (let t =
|
|
1802
|
+
for (let t = le; t; t = t.parent)
|
|
1801
1803
|
if (this.id in t.slots) {
|
|
1802
1804
|
const r = t.slots[this.id];
|
|
1803
1805
|
if (r === un)
|
|
1804
1806
|
break;
|
|
1805
|
-
return t !==
|
|
1807
|
+
return t !== le && (le.slots[this.id] = r), !0;
|
|
1806
1808
|
}
|
|
1807
|
-
return
|
|
1809
|
+
return le && (le.slots[this.id] = un), !1;
|
|
1808
1810
|
}
|
|
1809
1811
|
getValue() {
|
|
1810
1812
|
if (this.hasValue())
|
|
1811
|
-
return
|
|
1813
|
+
return le.slots[this.id];
|
|
1812
1814
|
}
|
|
1813
1815
|
withValue(t, r, n, o) {
|
|
1814
1816
|
const s = {
|
|
1815
1817
|
__proto__: null,
|
|
1816
1818
|
[this.id]: t
|
|
1817
|
-
}, i =
|
|
1818
|
-
|
|
1819
|
+
}, i = le;
|
|
1820
|
+
le = { parent: i, slots: s };
|
|
1819
1821
|
try {
|
|
1820
1822
|
return r.apply(o, n);
|
|
1821
1823
|
} finally {
|
|
1822
|
-
|
|
1824
|
+
le = i;
|
|
1823
1825
|
}
|
|
1824
1826
|
}
|
|
1825
1827
|
// Capture the current context and wrap a callback function so that it
|
|
1826
1828
|
// reestablishes the captured context when called.
|
|
1827
1829
|
static bind(t) {
|
|
1828
|
-
const r =
|
|
1830
|
+
const r = le;
|
|
1829
1831
|
return function() {
|
|
1830
|
-
const n =
|
|
1832
|
+
const n = le;
|
|
1831
1833
|
try {
|
|
1832
|
-
return
|
|
1834
|
+
return le = r, t.apply(this, arguments);
|
|
1833
1835
|
} finally {
|
|
1834
|
-
|
|
1836
|
+
le = n;
|
|
1835
1837
|
}
|
|
1836
1838
|
};
|
|
1837
1839
|
}
|
|
1838
1840
|
// Immediately run a callback function without any captured context.
|
|
1839
1841
|
static noContext(t, r, n) {
|
|
1840
|
-
if (
|
|
1841
|
-
const o =
|
|
1842
|
+
if (le) {
|
|
1843
|
+
const o = le;
|
|
1842
1844
|
try {
|
|
1843
|
-
return
|
|
1845
|
+
return le = null, t.apply(n, r);
|
|
1844
1846
|
} finally {
|
|
1845
|
-
|
|
1847
|
+
le = o;
|
|
1846
1848
|
}
|
|
1847
1849
|
} else
|
|
1848
1850
|
return t.apply(n, r);
|
|
@@ -1900,26 +1902,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1900
1902
|
}
|
|
1901
1903
|
function _a(e, t) {
|
|
1902
1904
|
if (e) {
|
|
1903
|
-
if (typeof e == "string") return
|
|
1905
|
+
if (typeof e == "string") return pn(e, t);
|
|
1904
1906
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
1905
1907
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
1906
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
1908
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return pn(e, t);
|
|
1907
1909
|
}
|
|
1908
1910
|
}
|
|
1909
|
-
function
|
|
1911
|
+
function pn(e, t) {
|
|
1910
1912
|
(t == null || t > e.length) && (t = e.length);
|
|
1911
1913
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
1912
1914
|
n[r] = e[r];
|
|
1913
1915
|
return n;
|
|
1914
1916
|
}
|
|
1915
|
-
function
|
|
1917
|
+
function hn(e, t) {
|
|
1916
1918
|
for (var r = 0; r < t.length; r++) {
|
|
1917
1919
|
var n = t[r];
|
|
1918
1920
|
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
|
|
1919
1921
|
}
|
|
1920
1922
|
}
|
|
1921
1923
|
function Tr(e, t, r) {
|
|
1922
|
-
return t &&
|
|
1924
|
+
return t && hn(e.prototype, t), r && hn(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1923
1925
|
}
|
|
1924
1926
|
var Ar = function() {
|
|
1925
1927
|
return typeof Symbol == "function";
|
|
@@ -2087,9 +2089,9 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2087
2089
|
l.unsubscribe(), s();
|
|
2088
2090
|
}
|
|
2089
2091
|
var l = o.subscribe({
|
|
2090
|
-
next: function(
|
|
2092
|
+
next: function(h) {
|
|
2091
2093
|
try {
|
|
2092
|
-
n(
|
|
2094
|
+
n(h, c);
|
|
2093
2095
|
} catch (g) {
|
|
2094
2096
|
i(g), l.unsubscribe();
|
|
2095
2097
|
}
|
|
@@ -2145,26 +2147,26 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2145
2147
|
}, t.reduce = function(n) {
|
|
2146
2148
|
var o = this;
|
|
2147
2149
|
if (typeof n != "function") throw new TypeError(n + " is not a function");
|
|
2148
|
-
var s = Tt(this), i = arguments.length > 1, c = !1, l = arguments[1],
|
|
2150
|
+
var s = Tt(this), i = arguments.length > 1, c = !1, l = arguments[1], h = l;
|
|
2149
2151
|
return new s(function(g) {
|
|
2150
2152
|
return o.subscribe({
|
|
2151
2153
|
next: function(y) {
|
|
2152
2154
|
var x = !c;
|
|
2153
2155
|
if (c = !0, !x || i)
|
|
2154
2156
|
try {
|
|
2155
|
-
|
|
2157
|
+
h = n(h, y);
|
|
2156
2158
|
} catch (I) {
|
|
2157
2159
|
return g.error(I);
|
|
2158
2160
|
}
|
|
2159
2161
|
else
|
|
2160
|
-
|
|
2162
|
+
h = y;
|
|
2161
2163
|
},
|
|
2162
2164
|
error: function(y) {
|
|
2163
2165
|
g.error(y);
|
|
2164
2166
|
},
|
|
2165
2167
|
complete: function() {
|
|
2166
2168
|
if (!c && !i) return g.error(new TypeError("Cannot reduce an empty sequence"));
|
|
2167
|
-
g.next(
|
|
2169
|
+
g.next(h), g.complete();
|
|
2168
2170
|
}
|
|
2169
2171
|
});
|
|
2170
2172
|
});
|
|
@@ -2173,9 +2175,9 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2173
2175
|
s[i] = arguments[i];
|
|
2174
2176
|
var c = Tt(this);
|
|
2175
2177
|
return new c(function(l) {
|
|
2176
|
-
var
|
|
2178
|
+
var h, g = 0;
|
|
2177
2179
|
function y(x) {
|
|
2178
|
-
|
|
2180
|
+
h = x.subscribe({
|
|
2179
2181
|
next: function(I) {
|
|
2180
2182
|
l.next(I);
|
|
2181
2183
|
},
|
|
@@ -2183,12 +2185,12 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2183
2185
|
l.error(I);
|
|
2184
2186
|
},
|
|
2185
2187
|
complete: function() {
|
|
2186
|
-
g === s.length ? (
|
|
2188
|
+
g === s.length ? (h = void 0, l.complete()) : y(c.from(s[g++]));
|
|
2187
2189
|
}
|
|
2188
2190
|
});
|
|
2189
2191
|
}
|
|
2190
2192
|
return y(n), function() {
|
|
2191
|
-
|
|
2193
|
+
h && (h.unsubscribe(), h = void 0);
|
|
2192
2194
|
};
|
|
2193
2195
|
});
|
|
2194
2196
|
}, t.flatMap = function(n) {
|
|
@@ -2213,7 +2215,7 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2213
2215
|
},
|
|
2214
2216
|
complete: function() {
|
|
2215
2217
|
var x = c.indexOf(y);
|
|
2216
|
-
x >= 0 && c.splice(x, 1),
|
|
2218
|
+
x >= 0 && c.splice(x, 1), h();
|
|
2217
2219
|
}
|
|
2218
2220
|
});
|
|
2219
2221
|
c.push(y);
|
|
@@ -2222,10 +2224,10 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2222
2224
|
i.error(g);
|
|
2223
2225
|
},
|
|
2224
2226
|
complete: function() {
|
|
2225
|
-
|
|
2227
|
+
h();
|
|
2226
2228
|
}
|
|
2227
2229
|
});
|
|
2228
|
-
function
|
|
2230
|
+
function h() {
|
|
2229
2231
|
l.closed && c.length === 0 && i.complete();
|
|
2230
2232
|
}
|
|
2231
2233
|
return function() {
|
|
@@ -2251,8 +2253,8 @@ var Ea = /* @__PURE__ */ (function() {
|
|
|
2251
2253
|
return new o(function(c) {
|
|
2252
2254
|
Wt(function() {
|
|
2253
2255
|
if (!c.closed) {
|
|
2254
|
-
for (var l = Ca(s.call(n)),
|
|
2255
|
-
var g =
|
|
2256
|
+
for (var l = Ca(s.call(n)), h; !(h = l()).done; ) {
|
|
2257
|
+
var g = h.value;
|
|
2256
2258
|
if (c.next(g), c.closed) return;
|
|
2257
2259
|
}
|
|
2258
2260
|
c.complete();
|
|
@@ -2313,9 +2315,9 @@ function Aa(e) {
|
|
|
2313
2315
|
t = "@@observable";
|
|
2314
2316
|
return t;
|
|
2315
2317
|
}
|
|
2316
|
-
var
|
|
2317
|
-
typeof self < "u" ?
|
|
2318
|
-
Aa(
|
|
2318
|
+
var yt;
|
|
2319
|
+
typeof self < "u" ? yt = self : typeof window < "u" ? yt = window : typeof global < "u" ? yt = global : typeof module < "u" ? yt = module : yt = Function("return this")();
|
|
2320
|
+
Aa(yt);
|
|
2319
2321
|
var gn = we.prototype, wn = "@@observable";
|
|
2320
2322
|
gn[wn] || (gn[wn] = function() {
|
|
2321
2323
|
return this;
|
|
@@ -2335,10 +2337,10 @@ function Oa(e) {
|
|
|
2335
2337
|
return e;
|
|
2336
2338
|
}
|
|
2337
2339
|
function ja(e, t) {
|
|
2338
|
-
var r =
|
|
2339
|
-
typeof s == "function" ? r =
|
|
2340
|
+
var r = Qe({}, e), n = function(s) {
|
|
2341
|
+
typeof s == "function" ? r = Qe(Qe({}, r), s(r)) : r = Qe(Qe({}, r), s);
|
|
2340
2342
|
}, o = function() {
|
|
2341
|
-
return
|
|
2343
|
+
return Qe({}, r);
|
|
2342
2344
|
};
|
|
2343
2345
|
return Object.defineProperty(t, "setContext", {
|
|
2344
2346
|
enumerable: !1,
|
|
@@ -2449,7 +2451,7 @@ function Ua(e) {
|
|
|
2449
2451
|
const qa = async () => {
|
|
2450
2452
|
const e = "https://auth.australia-southeast1.gcp.commercetools.com/oauth/token", n = "Basic " + btoa(encodeURIComponent("tfegsSBVOYnR7e_yE-AjxVVN") + ":" + encodeURIComponent("pyKWgHuTxuMwDygh9JH1ehLEaLvAhBo4"));
|
|
2451
2453
|
try {
|
|
2452
|
-
const o = await
|
|
2454
|
+
const o = await de.post(
|
|
2453
2455
|
e,
|
|
2454
2456
|
new URLSearchParams({ grant_type: "client_credentials" }),
|
|
2455
2457
|
// Only grant_type in body
|
|
@@ -2462,7 +2464,7 @@ const qa = async () => {
|
|
|
2462
2464
|
);
|
|
2463
2465
|
return o.status === 200 && o.data.access_token ? o.data.access_token : (console.error("Failed to fetch token:", o.data), null);
|
|
2464
2466
|
} catch (o) {
|
|
2465
|
-
return
|
|
2467
|
+
return de.isAxiosError(o) ? console.error("Error fetching token:", o.response || o.message) : console.error("Unexpected error:", o), null;
|
|
2466
2468
|
}
|
|
2467
2469
|
}, Ra = "https://api.australia-southeast1.gcp.commercetools.com/kt-demo/graphql", Ha = Uo({
|
|
2468
2470
|
uri: `${Ra}`
|
|
@@ -2484,7 +2486,7 @@ const qa = async () => {
|
|
|
2484
2486
|
}
|
|
2485
2487
|
}), bi = (e) => {
|
|
2486
2488
|
const { tanyaConfig: t } = e;
|
|
2487
|
-
return /* @__PURE__ */ a(Ho, { client: Ya, children: /* @__PURE__ */ a(ta, { children: /* @__PURE__ */ a(
|
|
2489
|
+
return /* @__PURE__ */ a(Ho, { client: Ya, children: /* @__PURE__ */ a(ta, { children: /* @__PURE__ */ a(pa, { tanyaConfig: t }) }) });
|
|
2488
2490
|
};
|
|
2489
2491
|
function Ja(e, t) {
|
|
2490
2492
|
const r = e.icons, n = e.aliases || /* @__PURE__ */ Object.create(null), o = /* @__PURE__ */ Object.create(null);
|
|
@@ -2608,12 +2610,12 @@ const oo = /^[a-z0-9]+(-[a-z0-9]+)*$/, ar = (e, t, r, n = "") => {
|
|
|
2608
2610
|
}
|
|
2609
2611
|
if (o.length > 3 || !o.length) return null;
|
|
2610
2612
|
if (o.length > 1) {
|
|
2611
|
-
const c = o.pop(), l = o.pop(),
|
|
2613
|
+
const c = o.pop(), l = o.pop(), h = {
|
|
2612
2614
|
provider: o.length > 0 ? o[0] : n,
|
|
2613
2615
|
prefix: l,
|
|
2614
2616
|
name: c
|
|
2615
2617
|
};
|
|
2616
|
-
return t && !Qt(
|
|
2618
|
+
return t && !Qt(h) ? null : h;
|
|
2617
2619
|
}
|
|
2618
2620
|
const s = o[0], i = s.split("-");
|
|
2619
2621
|
if (i.length > 1) {
|
|
@@ -2746,9 +2748,9 @@ function is(e, t) {
|
|
|
2746
2748
|
}
|
|
2747
2749
|
q % 2 === 1 && (o.left !== o.top && (Y = o.left, o.left = o.top, o.top = Y), o.width !== o.height && (Y = o.width, o.width = o.height, o.height = Y)), k.length && (s = as(s, '<g transform="' + k.join(" ") + '">', "</g>"));
|
|
2748
2750
|
});
|
|
2749
|
-
const i = n.width, c = n.height, l = o.width,
|
|
2751
|
+
const i = n.width, c = n.height, l = o.width, h = o.height;
|
|
2750
2752
|
let g, y;
|
|
2751
|
-
i === null ? (y = c === null ? "1em" : c === "auto" ?
|
|
2753
|
+
i === null ? (y = c === null ? "1em" : c === "auto" ? h : c, g = kn(y, l / h)) : (g = i === "auto" ? l : i, y = c === null ? kn(g, h / l) : c === "auto" ? h : c);
|
|
2752
2754
|
const x = {}, I = (A, k) => {
|
|
2753
2755
|
ss(k) || (x[A] = k.toString());
|
|
2754
2756
|
};
|
|
@@ -2757,7 +2759,7 @@ function is(e, t) {
|
|
|
2757
2759
|
o.left,
|
|
2758
2760
|
o.top,
|
|
2759
2761
|
l,
|
|
2760
|
-
|
|
2762
|
+
h
|
|
2761
2763
|
];
|
|
2762
2764
|
return x.viewBox = S.join(" "), {
|
|
2763
2765
|
attributes: x,
|
|
@@ -2810,15 +2812,15 @@ function ms(e, t) {
|
|
|
2810
2812
|
function Dr(e) {
|
|
2811
2813
|
return zr[e];
|
|
2812
2814
|
}
|
|
2813
|
-
const
|
|
2815
|
+
const ps = () => {
|
|
2814
2816
|
let e;
|
|
2815
2817
|
try {
|
|
2816
2818
|
if (e = fetch, typeof e == "function") return e;
|
|
2817
2819
|
} catch {
|
|
2818
2820
|
}
|
|
2819
2821
|
};
|
|
2820
|
-
let Sn =
|
|
2821
|
-
function
|
|
2822
|
+
let Sn = ps();
|
|
2823
|
+
function hs(e, t) {
|
|
2822
2824
|
const r = Dr(e);
|
|
2823
2825
|
if (!r) return 0;
|
|
2824
2826
|
let n;
|
|
@@ -2837,15 +2839,15 @@ function gs(e) {
|
|
|
2837
2839
|
return e === 404;
|
|
2838
2840
|
}
|
|
2839
2841
|
const ws = (e, t, r) => {
|
|
2840
|
-
const n = [], o =
|
|
2842
|
+
const n = [], o = hs(e, t), s = "icons";
|
|
2841
2843
|
let i = {
|
|
2842
2844
|
type: s,
|
|
2843
2845
|
provider: e,
|
|
2844
2846
|
prefix: t,
|
|
2845
2847
|
icons: []
|
|
2846
2848
|
}, c = 0;
|
|
2847
|
-
return r.forEach((l,
|
|
2848
|
-
c += l.length + 1, c >= o &&
|
|
2849
|
+
return r.forEach((l, h) => {
|
|
2850
|
+
c += l.length + 1, c >= o && h > 0 && (n.push(i), i = {
|
|
2849
2851
|
type: s,
|
|
2850
2852
|
provider: e,
|
|
2851
2853
|
prefix: t,
|
|
@@ -2925,16 +2927,16 @@ function vs(e) {
|
|
|
2925
2927
|
const i = s.icons, c = i.pending.length;
|
|
2926
2928
|
i.pending = i.pending.filter((l) => {
|
|
2927
2929
|
if (l.prefix !== o) return !0;
|
|
2928
|
-
const
|
|
2929
|
-
if (e.icons[
|
|
2930
|
+
const h = l.name;
|
|
2931
|
+
if (e.icons[h]) i.loaded.push({
|
|
2930
2932
|
provider: n,
|
|
2931
2933
|
prefix: o,
|
|
2932
|
-
name:
|
|
2934
|
+
name: h
|
|
2933
2935
|
});
|
|
2934
|
-
else if (e.missing.has(
|
|
2936
|
+
else if (e.missing.has(h)) i.missing.push({
|
|
2935
2937
|
provider: n,
|
|
2936
2938
|
prefix: o,
|
|
2937
|
-
name:
|
|
2939
|
+
name: h
|
|
2938
2940
|
});
|
|
2939
2941
|
else
|
|
2940
2942
|
return r = !0, !0;
|
|
@@ -2972,9 +2974,9 @@ function Ns(e) {
|
|
|
2972
2974
|
return e.forEach((o) => {
|
|
2973
2975
|
if (n.name === o.name && n.prefix === o.prefix && n.provider === o.provider) return;
|
|
2974
2976
|
n = o;
|
|
2975
|
-
const s = o.provider, i = o.prefix, c = o.name, l = r[s] || (r[s] = /* @__PURE__ */ Object.create(null)),
|
|
2977
|
+
const s = o.provider, i = o.prefix, c = o.name, l = r[s] || (r[s] = /* @__PURE__ */ Object.create(null)), h = l[i] || (l[i] = vt(s, i));
|
|
2976
2978
|
let g;
|
|
2977
|
-
c in
|
|
2979
|
+
c in h.icons ? g = t.loaded : i === "" || h.missing.has(c) ? g = t.missing : g = t.pending;
|
|
2978
2980
|
const y = {
|
|
2979
2981
|
provider: s,
|
|
2980
2982
|
prefix: i,
|
|
@@ -3010,7 +3012,7 @@ function Is(e, t, r, n) {
|
|
|
3010
3012
|
i = i.concat(C);
|
|
3011
3013
|
} else i = e.resources.slice(s).concat(e.resources.slice(0, s));
|
|
3012
3014
|
const c = Date.now();
|
|
3013
|
-
let l = "pending",
|
|
3015
|
+
let l = "pending", h = 0, g, y = null, x = [], I = [];
|
|
3014
3016
|
typeof n == "function" && I.push(n);
|
|
3015
3017
|
function S() {
|
|
3016
3018
|
y && (clearTimeout(y), y = null);
|
|
@@ -3028,7 +3030,7 @@ function Is(e, t, r, n) {
|
|
|
3028
3030
|
startTime: c,
|
|
3029
3031
|
payload: t,
|
|
3030
3032
|
status: l,
|
|
3031
|
-
queriesSent:
|
|
3033
|
+
queriesSent: h,
|
|
3032
3034
|
queriesPending: x.length,
|
|
3033
3035
|
subscribe: k,
|
|
3034
3036
|
abort: A
|
|
@@ -3044,7 +3046,7 @@ function Is(e, t, r, n) {
|
|
|
3044
3046
|
C.status === "pending" && (C.status = "aborted");
|
|
3045
3047
|
}), x = [];
|
|
3046
3048
|
}
|
|
3047
|
-
function Y(C, K,
|
|
3049
|
+
function Y(C, K, te) {
|
|
3048
3050
|
const ye = K !== "success";
|
|
3049
3051
|
switch (x = x.filter((be) => be !== C), l) {
|
|
3050
3052
|
case "pending":
|
|
@@ -3056,11 +3058,11 @@ function Is(e, t, r, n) {
|
|
|
3056
3058
|
return;
|
|
3057
3059
|
}
|
|
3058
3060
|
if (K === "abort") {
|
|
3059
|
-
g =
|
|
3061
|
+
g = te, J();
|
|
3060
3062
|
return;
|
|
3061
3063
|
}
|
|
3062
3064
|
if (ye) {
|
|
3063
|
-
g =
|
|
3065
|
+
g = te, x.length || (i.length ? _e() : J());
|
|
3064
3066
|
return;
|
|
3065
3067
|
}
|
|
3066
3068
|
if (S(), q(), !e.random) {
|
|
@@ -3068,7 +3070,7 @@ function Is(e, t, r, n) {
|
|
|
3068
3070
|
be !== -1 && be !== e.index && (e.index = be);
|
|
3069
3071
|
}
|
|
3070
3072
|
l = "completed", I.forEach((be) => {
|
|
3071
|
-
be(
|
|
3073
|
+
be(te);
|
|
3072
3074
|
});
|
|
3073
3075
|
}
|
|
3074
3076
|
function _e() {
|
|
@@ -3088,11 +3090,11 @@ function Is(e, t, r, n) {
|
|
|
3088
3090
|
const K = {
|
|
3089
3091
|
status: "pending",
|
|
3090
3092
|
resource: C,
|
|
3091
|
-
callback: (
|
|
3092
|
-
Y(K,
|
|
3093
|
+
callback: (te, ye) => {
|
|
3094
|
+
Y(K, te, ye);
|
|
3093
3095
|
}
|
|
3094
3096
|
};
|
|
3095
|
-
x.push(K),
|
|
3097
|
+
x.push(K), h++, y = setTimeout(_e, e.rotate), r(C, t, K.callback);
|
|
3096
3098
|
}
|
|
3097
3099
|
return setTimeout(_e), P;
|
|
3098
3100
|
}
|
|
@@ -3105,9 +3107,9 @@ function co(e) {
|
|
|
3105
3107
|
function n() {
|
|
3106
3108
|
r = r.filter((c) => c().status === "pending");
|
|
3107
3109
|
}
|
|
3108
|
-
function o(c, l,
|
|
3110
|
+
function o(c, l, h) {
|
|
3109
3111
|
const g = Is(t, c, l, (y, x) => {
|
|
3110
|
-
n(),
|
|
3112
|
+
n(), h && h(y, x);
|
|
3111
3113
|
});
|
|
3112
3114
|
return r.push(g), g;
|
|
3113
3115
|
}
|
|
@@ -3126,18 +3128,18 @@ function co(e) {
|
|
|
3126
3128
|
}
|
|
3127
3129
|
function Nn() {
|
|
3128
3130
|
}
|
|
3129
|
-
const
|
|
3131
|
+
const pr = /* @__PURE__ */ Object.create(null);
|
|
3130
3132
|
function Ps(e) {
|
|
3131
|
-
if (!
|
|
3133
|
+
if (!pr[e]) {
|
|
3132
3134
|
const t = Dr(e);
|
|
3133
3135
|
if (!t) return;
|
|
3134
3136
|
const r = co(t), n = {
|
|
3135
3137
|
config: t,
|
|
3136
3138
|
redundancy: r
|
|
3137
3139
|
};
|
|
3138
|
-
|
|
3140
|
+
pr[e] = n;
|
|
3139
3141
|
}
|
|
3140
|
-
return
|
|
3142
|
+
return pr[e];
|
|
3141
3143
|
}
|
|
3142
3144
|
function Fs(e, t, r) {
|
|
3143
3145
|
let n, o;
|
|
@@ -3250,17 +3252,17 @@ const Os = (e, t) => {
|
|
|
3250
3252
|
const o = /* @__PURE__ */ Object.create(null), s = [];
|
|
3251
3253
|
let i, c;
|
|
3252
3254
|
return n.pending.forEach((l) => {
|
|
3253
|
-
const { provider:
|
|
3254
|
-
if (g === c &&
|
|
3255
|
-
i =
|
|
3256
|
-
const y = o[
|
|
3255
|
+
const { provider: h, prefix: g } = l;
|
|
3256
|
+
if (g === c && h === i) return;
|
|
3257
|
+
i = h, c = g, s.push(vt(h, g));
|
|
3258
|
+
const y = o[h] || (o[h] = /* @__PURE__ */ Object.create(null));
|
|
3257
3259
|
y[g] || (y[g] = []);
|
|
3258
3260
|
}), n.pending.forEach((l) => {
|
|
3259
|
-
const { provider:
|
|
3260
|
-
I.has(y) || (I.add(y), o[
|
|
3261
|
+
const { provider: h, prefix: g, name: y } = l, x = vt(h, g), I = x.pendingIcons || (x.pendingIcons = /* @__PURE__ */ new Set());
|
|
3262
|
+
I.has(y) || (I.add(y), o[h][g].push(y));
|
|
3261
3263
|
}), s.forEach((l) => {
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
+
const h = o[l.provider][l.prefix];
|
|
3265
|
+
h.length && As(l, h);
|
|
3264
3266
|
}), t ? Ss(t, n, s) : Cn;
|
|
3265
3267
|
};
|
|
3266
3268
|
function js(e, t) {
|
|
@@ -3434,7 +3436,7 @@ const Js = (e, t, r) => {
|
|
|
3434
3436
|
n[k] === void 0 && (l[k] = P);
|
|
3435
3437
|
}
|
|
3436
3438
|
}
|
|
3437
|
-
const
|
|
3439
|
+
const h = is(e, o), g = h.attributes;
|
|
3438
3440
|
if (o.inline && (i.verticalAlign = "-0.125em"), s === "svg") {
|
|
3439
3441
|
l.style = {
|
|
3440
3442
|
...i,
|
|
@@ -3442,8 +3444,8 @@ const Js = (e, t, r) => {
|
|
|
3442
3444
|
}, Object.assign(l, g);
|
|
3443
3445
|
let k = 0, P = t.id;
|
|
3444
3446
|
return typeof P == "string" && (P = P.replace(/-/g, "_")), l.dangerouslySetInnerHTML = {
|
|
3445
|
-
__html: Rs(us(
|
|
3446
|
-
},
|
|
3447
|
+
__html: Rs(us(h.body, P ? () => P + "ID" + k++ : "iconifyReact"))
|
|
3448
|
+
}, hr("svg", l);
|
|
3447
3449
|
}
|
|
3448
3450
|
const { body: y, width: x, height: I } = e, S = s === "mask" || (s === "bg" ? !1 : y.indexOf("currentColor") !== -1), A = Ds(y, {
|
|
3449
3451
|
...g,
|
|
@@ -3458,7 +3460,7 @@ const Js = (e, t, r) => {
|
|
|
3458
3460
|
...Vs,
|
|
3459
3461
|
...S ? _r : fo,
|
|
3460
3462
|
...c
|
|
3461
|
-
},
|
|
3463
|
+
}, hr("span", l);
|
|
3462
3464
|
};
|
|
3463
3465
|
ao(!0);
|
|
3464
3466
|
fs("", bs);
|
|
@@ -3519,7 +3521,7 @@ function mo(e) {
|
|
|
3519
3521
|
const I = n.callback;
|
|
3520
3522
|
I && (I(), o({}));
|
|
3521
3523
|
}
|
|
3522
|
-
function
|
|
3524
|
+
function h(I) {
|
|
3523
3525
|
if (JSON.stringify(i) !== JSON.stringify(I))
|
|
3524
3526
|
return l(), c(I), !0;
|
|
3525
3527
|
}
|
|
@@ -3527,14 +3529,14 @@ function mo(e) {
|
|
|
3527
3529
|
var I;
|
|
3528
3530
|
const S = e.icon;
|
|
3529
3531
|
if (typeof S == "object") {
|
|
3530
|
-
|
|
3532
|
+
h({
|
|
3531
3533
|
name: "",
|
|
3532
3534
|
data: S
|
|
3533
3535
|
});
|
|
3534
3536
|
return;
|
|
3535
3537
|
}
|
|
3536
3538
|
const A = vn(S);
|
|
3537
|
-
if (
|
|
3539
|
+
if (h({
|
|
3538
3540
|
name: S,
|
|
3539
3541
|
data: A
|
|
3540
3542
|
}))
|
|
@@ -3552,7 +3554,7 @@ function mo(e) {
|
|
|
3552
3554
|
return x ? Js({
|
|
3553
3555
|
...$r,
|
|
3554
3556
|
...x
|
|
3555
|
-
}, e, y) : e.children ? e.children : e.fallback ? e.fallback :
|
|
3557
|
+
}, e, y) : e.children ? e.children : e.fallback ? e.fallback : hr("span", {});
|
|
3556
3558
|
}
|
|
3557
3559
|
const ce = $n((e, t) => mo({
|
|
3558
3560
|
...e,
|
|
@@ -3563,11 +3565,11 @@ $n((e, t) => mo({
|
|
|
3563
3565
|
...e,
|
|
3564
3566
|
_ref: t
|
|
3565
3567
|
}));
|
|
3566
|
-
const
|
|
3568
|
+
const xt = "USD", Ks = (e, t = xt) => {
|
|
3567
3569
|
const r = (e == null ? void 0 : e.prices) ?? [];
|
|
3568
3570
|
if (!r.length) return null;
|
|
3569
3571
|
const n = (i) => {
|
|
3570
|
-
var
|
|
3572
|
+
var h, g;
|
|
3571
3573
|
const c = i.find((y) => {
|
|
3572
3574
|
var x;
|
|
3573
3575
|
return !!((x = y.discounted) != null && x.value);
|
|
@@ -3576,7 +3578,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3576
3578
|
return {
|
|
3577
3579
|
cent: c.discounted.value.centAmount,
|
|
3578
3580
|
cur: c.discounted.value.currencyCode,
|
|
3579
|
-
regularCent: (
|
|
3581
|
+
regularCent: (h = c.value) == null ? void 0 : h.centAmount
|
|
3580
3582
|
};
|
|
3581
3583
|
const l = (g = i[0]) == null ? void 0 : g.value;
|
|
3582
3584
|
return l ? { cent: l.centAmount, cur: l.currencyCode } : null;
|
|
@@ -3601,7 +3603,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3601
3603
|
r && r.value && (t = typeof r.value == "object" ? r.value.label || "" : r.value);
|
|
3602
3604
|
}
|
|
3603
3605
|
return { sizeLabel: t };
|
|
3604
|
-
},
|
|
3606
|
+
}, ht = (e) => Ws((e == null ? void 0 : e.attributesRaw) ?? [], "color"), gt = (e) => Qs((e == null ? void 0 : e.attributesRaw) ?? []).sizeLabel, We = (e) => e.charAt(0).toUpperCase() + e.slice(1), wt = {
|
|
3605
3607
|
standard: {
|
|
3606
3608
|
label: "Standard Delivery",
|
|
3607
3609
|
fee: 0,
|
|
@@ -3624,7 +3626,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3624
3626
|
standard: "GROUND",
|
|
3625
3627
|
express: "2-DAY SHIPPING",
|
|
3626
3628
|
sameday: "OVERNIGHT"
|
|
3627
|
-
},
|
|
3629
|
+
}, st = (e, t) => {
|
|
3628
3630
|
try {
|
|
3629
3631
|
return e.toLocaleString("en-US", {
|
|
3630
3632
|
style: "currency",
|
|
@@ -3633,25 +3635,25 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3633
3635
|
} catch {
|
|
3634
3636
|
return `${t} ${e.toFixed(2)}`;
|
|
3635
3637
|
}
|
|
3636
|
-
},
|
|
3637
|
-
const t =
|
|
3638
|
+
}, po = (e) => e == null ? void 0 : e.masterVariant, En = (e) => Array.isArray(e == null ? void 0 : e.variants) ? e.variants : [], Xt = (e) => {
|
|
3639
|
+
const t = po(e);
|
|
3638
3640
|
return t ? [t, ...En(e)] : En(e);
|
|
3639
3641
|
}, Xs = (e, t = 0) => Xt(e)[t], Zs = (e) => {
|
|
3640
3642
|
var t, r;
|
|
3641
3643
|
return ((r = (t = e == null ? void 0 : e.images) == null ? void 0 : t[0]) == null ? void 0 : r.url) ?? "";
|
|
3642
3644
|
}, Tn = (e, t) => {
|
|
3643
|
-
var r, n, o, s, i, c, l,
|
|
3644
|
-
return Zs(t) || ((s = (o = (n = (r = e.imageGroups) == null ? void 0 : r[0]) == null ? void 0 : n.images) == null ? void 0 : o[0]) == null ? void 0 : s.link) || ((
|
|
3645
|
+
var r, n, o, s, i, c, l, h;
|
|
3646
|
+
return Zs(t) || ((s = (o = (n = (r = e.imageGroups) == null ? void 0 : r[0]) == null ? void 0 : n.images) == null ? void 0 : o[0]) == null ? void 0 : s.link) || ((h = (l = (c = (i = e.image_groups) == null ? void 0 : i[0]) == null ? void 0 : c.images) == null ? void 0 : l[0]) == null ? void 0 : h.link) || "";
|
|
3645
3647
|
}, An = (e) => (e == null ? void 0 : e.name) || (e == null ? void 0 : e.title) || (e == null ? void 0 : e.productName) || "any", Zt = (e) => {
|
|
3646
|
-
var s, i, c, l,
|
|
3647
|
-
const t = e ? Ks(e,
|
|
3648
|
+
var s, i, c, l, h, g;
|
|
3649
|
+
const t = e ? Ks(e, xt) : null;
|
|
3648
3650
|
if (t != null && t.cent && (t != null && t.cur))
|
|
3649
3651
|
return {
|
|
3650
3652
|
amount: +(t.cent / 100),
|
|
3651
3653
|
currency: t.cur,
|
|
3652
3654
|
regularAmount: t.regularCent ? t.regularCent / 100 : void 0
|
|
3653
3655
|
};
|
|
3654
|
-
const r = (c = (i = (s = e == null ? void 0 : e.prices) == null ? void 0 : s[0]) == null ? void 0 : i.value) == null ? void 0 : c.centAmount, n = ((g = (
|
|
3656
|
+
const r = (c = (i = (s = e == null ? void 0 : e.prices) == null ? void 0 : s[0]) == null ? void 0 : i.value) == null ? void 0 : c.centAmount, n = ((g = (h = (l = e == null ? void 0 : e.prices) == null ? void 0 : l[0]) == null ? void 0 : h.value) == null ? void 0 : g.currencyCode) ?? xt;
|
|
3655
3657
|
return { amount: Number.isFinite(r) ? +(Number(r) / 100) : 0, currency: n };
|
|
3656
3658
|
}, On = (e, t) => {
|
|
3657
3659
|
const { amount: r } = Zt(t);
|
|
@@ -3676,9 +3678,9 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3676
3678
|
addressLoading: s,
|
|
3677
3679
|
variationAttributes: i
|
|
3678
3680
|
}) => {
|
|
3679
|
-
const
|
|
3681
|
+
const h = Xt(r), g = Math.min(
|
|
3680
3682
|
Math.max(0, n || 0),
|
|
3681
|
-
Math.max(0,
|
|
3683
|
+
Math.max(0, h.length - 1)
|
|
3682
3684
|
), [y, x] = b([]), [I, S] = b(0), [A, k] = b([]);
|
|
3683
3685
|
xe(() => {
|
|
3684
3686
|
if (r != null && r.variants) {
|
|
@@ -3693,14 +3695,14 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3693
3695
|
const P = (u, m, f) => {
|
|
3694
3696
|
const { colorMap: w, sizeMap: v } = J(f), j = {};
|
|
3695
3697
|
m == null || m.forEach((E) => {
|
|
3696
|
-
var
|
|
3697
|
-
const M = (
|
|
3698
|
+
var ie, Pe, ze;
|
|
3699
|
+
const M = (ie = E.variationAttributes) == null ? void 0 : ie.find(
|
|
3698
3700
|
(De) => De.id === "color"
|
|
3699
3701
|
), T = (ze = (Pe = M == null ? void 0 : M.values) == null ? void 0 : Pe[0]) == null ? void 0 : ze.value;
|
|
3700
3702
|
T && (j[T] || (j[T] = {}), j[T][E.viewType] = E.images);
|
|
3701
3703
|
});
|
|
3702
3704
|
const H = u.reduce((E, M) => {
|
|
3703
|
-
const T = M.variationValues.color,
|
|
3705
|
+
const T = M.variationValues.color, ie = M.variationValues.size;
|
|
3704
3706
|
return E[T] || (E[T] = {
|
|
3705
3707
|
color: T,
|
|
3706
3708
|
name: w[T] || T,
|
|
@@ -3708,15 +3710,15 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3708
3710
|
images: j[T] || {},
|
|
3709
3711
|
variants: []
|
|
3710
3712
|
}), E[T].variants.push({
|
|
3711
|
-
size:
|
|
3712
|
-
name: v[
|
|
3713
|
+
size: ie,
|
|
3714
|
+
name: v[ie] || ie,
|
|
3713
3715
|
// ✅ DISPLAY NAME
|
|
3714
3716
|
...M
|
|
3715
3717
|
}), E;
|
|
3716
3718
|
}, {});
|
|
3717
3719
|
return Object.values(H).sort((E, M) => {
|
|
3718
|
-
const T = E.colorName || E.color || "",
|
|
3719
|
-
return T.localeCompare(
|
|
3720
|
+
const T = E.colorName || E.color || "", ie = M.colorName || M.color || "";
|
|
3721
|
+
return T.localeCompare(ie);
|
|
3720
3722
|
}).map((E) => ({
|
|
3721
3723
|
...E,
|
|
3722
3724
|
variants: E.variants.sort(
|
|
@@ -3732,31 +3734,31 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3732
3734
|
f[v.value] = v.name;
|
|
3733
3735
|
});
|
|
3734
3736
|
}), { colorMap: m, sizeMap: f };
|
|
3735
|
-
}, q =
|
|
3737
|
+
}, q = h.length, [Y, _e] = b(g), [C, K] = b(null), [te, ye] = b(null), be = Ve(null), ct = Ve(null), N = Xs(r, Y), [ve, V] = b(""), [$, Je] = b(""), [dt, qe] = b(!1), [rt, ue] = b(!1), [Ie, je] = b(!1), [z, Te] = b(""), [Se, re] = b(!1), [fe, kt] = b(null), [p, O] = b([]), [B, Q] = b([]), [U, L] = b([]), [W, X] = b(!1), [R, ne] = b(), [$e, Re] = b(!0), [G, me] = b(!1), [Ne, pe] = b(!1), [he, _] = b("standard"), [Z, D] = b(!1), [oe, ae] = b(!1), [Ae, St] = b("card"), [Oe, se] = b(!1), [Nt, Ce] = b(!1), [F, ee] = b(!1), [Ct, _t] = b(null), [Mt, Mr] = b(null), [sr, Br] = b(""), [Ur, qr] = b(!1), [It, ho] = b(r == null ? void 0 : r.id), Bt = Ve(null);
|
|
3736
3738
|
xe(() => {
|
|
3737
3739
|
const u = Xt(r), m = Math.min(
|
|
3738
3740
|
Math.max(0, n || 0),
|
|
3739
3741
|
Math.max(0, u.length - 1)
|
|
3740
3742
|
);
|
|
3741
3743
|
_e(m);
|
|
3742
|
-
const f =
|
|
3743
|
-
be.current = w || null,
|
|
3744
|
+
const f = po(r), w = ht(f), v = gt(f);
|
|
3745
|
+
be.current = w || null, ct.current = v || null, K(w || null), ye(v || null);
|
|
3744
3746
|
}, [n, r]), xe(() => {
|
|
3745
3747
|
Bt.current && (Bt.current.scrollTop = Bt.current.scrollHeight);
|
|
3746
3748
|
}, [
|
|
3747
|
-
|
|
3749
|
+
p,
|
|
3748
3750
|
W,
|
|
3749
3751
|
G,
|
|
3750
3752
|
Ne,
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
+
Z,
|
|
3754
|
+
oe,
|
|
3753
3755
|
Oe,
|
|
3754
3756
|
Nt,
|
|
3755
3757
|
F,
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
+
dt,
|
|
3759
|
+
rt
|
|
3758
3760
|
]);
|
|
3759
|
-
const
|
|
3761
|
+
const ut = "var(--tanya)", Rr = "var(--tanya-contrast)", Ut = ut, Le = "#804c9e", go = () => {
|
|
3760
3762
|
console.log("AgenticShopping feedback:", {
|
|
3761
3763
|
rating: Mt,
|
|
3762
3764
|
comment: sr
|
|
@@ -3827,7 +3829,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3827
3829
|
type: "button",
|
|
3828
3830
|
onClick: go,
|
|
3829
3831
|
className: "px-4 py-2 rounded-full text-sm font-semibold text-white shadow",
|
|
3830
|
-
style: { background:
|
|
3832
|
+
style: { background: ut },
|
|
3831
3833
|
disabled: !Mt && !sr.trim(),
|
|
3832
3834
|
children: "Submit"
|
|
3833
3835
|
}
|
|
@@ -3845,7 +3847,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3845
3847
|
);
|
|
3846
3848
|
let m = (u == null ? void 0 : u.basketId) || localStorage.getItem(Lt);
|
|
3847
3849
|
if (!m) {
|
|
3848
|
-
const f = await
|
|
3850
|
+
const f = await Ge(), w = "Bearer " + (f == null ? void 0 : f.access_token), v = await Ir(w);
|
|
3849
3851
|
m = (v == null ? void 0 : v.basket_id) || v.basketId;
|
|
3850
3852
|
}
|
|
3851
3853
|
xo(m), V(m);
|
|
@@ -3885,14 +3887,14 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3885
3887
|
)
|
|
3886
3888
|
);
|
|
3887
3889
|
}, qt = () => {
|
|
3888
|
-
Ce(!1),
|
|
3890
|
+
Ce(!1), X(!1), pe(!1), ae(!1), me(!1), D(!1), se(!1), ee(!1), re(!1), kt(null), bo(), qe(!1), ue(!1);
|
|
3889
3891
|
}, vo = () => {
|
|
3890
|
-
|
|
3892
|
+
X(!1), me(!1), pe(!1), _("standard"), D(!1), ae(!1), St("card"), se(!1), Ce(!1), ee(!1), Re(!0), kt(null), localStorage.removeItem("agentic_order"), localStorage.removeItem("agentic_order_address"), localStorage.removeItem("agentic_order_delivery"), localStorage.removeItem("agentic_order_payment"), localStorage.removeItem("agentic_order_final");
|
|
3891
3893
|
}, Rt = en(() => Xt(r).map((m, f) => ({
|
|
3892
3894
|
index: f,
|
|
3893
3895
|
variant: m,
|
|
3894
3896
|
images: ((m == null ? void 0 : m.images) || []).map((w) => (w == null ? void 0 : w.url) || "").filter(Boolean)
|
|
3895
|
-
})), [r]), Ft = en(() => Rt.length ? !!((C || void 0) && (
|
|
3897
|
+
})), [r]), Ft = en(() => Rt.length ? !!((C || void 0) && (te || void 0)) : !1, [Rt, C, te, N]), ko = Ie || Se || !Ft, Et = (u) => {
|
|
3896
3898
|
const m = Number((u == null ? void 0 : u.quantity) ?? 1);
|
|
3897
3899
|
return Number.isFinite(m) && m > 0 ? m : 1;
|
|
3898
3900
|
}, Yr = (u) => {
|
|
@@ -3900,10 +3902,10 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3900
3902
|
return Number.isFinite(f) && f > 0 ? +(f / 100) : +(On(r, N) * m);
|
|
3901
3903
|
}, Jr = (u) => {
|
|
3902
3904
|
var E;
|
|
3903
|
-
const m =
|
|
3905
|
+
const m = fe, f = Zt(N), w = u || (m == null ? void 0 : m.currency) || f.currency || xt, v = Yr(m), j = +(v * 0.08).toFixed(2), H = ((E = wt[he]) == null ? void 0 : E.price) || 0;
|
|
3904
3906
|
return { product_total: v, tax: j, shipping_fee: H, currency: w };
|
|
3905
3907
|
}, ir = async (u, m, f) => {
|
|
3906
|
-
Vr(), vo(), je(!0),
|
|
3908
|
+
Vr(), vo(), je(!0), re(!0), qe(!1), ue(!1);
|
|
3907
3909
|
const w = B.slice(-jn);
|
|
3908
3910
|
try {
|
|
3909
3911
|
const v = await wr(null, null);
|
|
@@ -3932,21 +3934,21 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3932
3934
|
})
|
|
3933
3935
|
});
|
|
3934
3936
|
if (!T.body) throw new Error("Readable stream not supported");
|
|
3935
|
-
const
|
|
3936
|
-
let ze = "", De = "",
|
|
3937
|
+
const ie = T.body.getReader(), Pe = new TextDecoder();
|
|
3938
|
+
let ze = "", De = "", nt = "";
|
|
3937
3939
|
for (; ; ) {
|
|
3938
|
-
const { done: Ee, value: Ke } = await
|
|
3940
|
+
const { done: Ee, value: Ke } = await ie.read();
|
|
3939
3941
|
if (Ee) break;
|
|
3940
3942
|
ze += Pe.decode(Ke, { stream: !0 });
|
|
3941
|
-
const
|
|
3943
|
+
const ft = ze.split(`
|
|
3942
3944
|
`);
|
|
3943
|
-
ze =
|
|
3944
|
-
for (const
|
|
3945
|
-
if (!
|
|
3946
|
-
const
|
|
3945
|
+
ze = ft.pop() || "";
|
|
3946
|
+
for (const mt of ft) {
|
|
3947
|
+
if (!mt.startsWith("data:")) continue;
|
|
3948
|
+
const ot = mt.slice(5).trim();
|
|
3947
3949
|
try {
|
|
3948
|
-
const He = JSON.parse(
|
|
3949
|
-
Me === 0 ? De = String(ge ?? "") : Me === 1 && (
|
|
3950
|
+
const He = JSON.parse(ot), Me = He.index, ge = He.data;
|
|
3951
|
+
Me === 0 ? De = String(ge ?? "") : Me === 1 && (nt = String(ge ?? ""));
|
|
3950
3952
|
} catch (He) {
|
|
3951
3953
|
console.error("Error parsing JSON chunk:", He);
|
|
3952
3954
|
}
|
|
@@ -3974,11 +3976,11 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3974
3976
|
{
|
|
3975
3977
|
userQuery: u,
|
|
3976
3978
|
mainResponse: De || "",
|
|
3977
|
-
keywords:
|
|
3979
|
+
keywords: nt || ""
|
|
3978
3980
|
}
|
|
3979
3981
|
].slice(-jn));
|
|
3980
3982
|
} catch (v) {
|
|
3981
|
-
console.error("Error sending message to Tanya:", v),
|
|
3983
|
+
console.error("Error sending message to Tanya:", v), re(!1);
|
|
3982
3984
|
} finally {
|
|
3983
3985
|
je(!1);
|
|
3984
3986
|
}
|
|
@@ -3993,37 +3995,37 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
3993
3995
|
ir(m, f, Y);
|
|
3994
3996
|
return;
|
|
3995
3997
|
}
|
|
3996
|
-
|
|
3998
|
+
ue(!0), re(!0);
|
|
3997
3999
|
return;
|
|
3998
4000
|
}
|
|
3999
|
-
f ? (qe(!0),
|
|
4001
|
+
f ? (qe(!0), re(!0)) : (ue(!0), re(!0));
|
|
4000
4002
|
}, So = () => {
|
|
4001
4003
|
const u = It;
|
|
4002
4004
|
u && ir($, u, Y);
|
|
4003
4005
|
}, No = () => {
|
|
4004
|
-
qe(!1),
|
|
4006
|
+
qe(!1), ue(!0), re(!0);
|
|
4005
4007
|
}, Co = () => {
|
|
4006
4008
|
if (!It) return;
|
|
4007
4009
|
ir($, It, Y);
|
|
4008
4010
|
}, _o = async () => {
|
|
4009
|
-
|
|
4010
|
-
extractedDetails:
|
|
4011
|
+
X(!0), pe(!1), ae(!1), Ce(!1), me(!1), D(!1), se(!1), ee(!1), await yo(), console.log("calling"), Vr("initial", {
|
|
4012
|
+
extractedDetails: fe ?? void 0
|
|
4011
4013
|
});
|
|
4012
4014
|
}, Io = () => {
|
|
4013
4015
|
if (!R) return;
|
|
4014
4016
|
const u = U.find(
|
|
4015
4017
|
(m) => String(m.addressId ?? m.id) === R
|
|
4016
4018
|
) || null;
|
|
4017
|
-
u && (localStorage.setItem("agentic_order_address", JSON.stringify(u)), me(!0),
|
|
4019
|
+
u && (localStorage.setItem("agentic_order_address", JSON.stringify(u)), me(!0), pe(!0), D(!1), ae(!1), se(!1), Ce(!1), ee(!1), Pt("address", u));
|
|
4018
4020
|
}, Po = () => {
|
|
4019
|
-
me(!1),
|
|
4021
|
+
me(!1), pe(!1), D(!1), ae(!1), se(!1), Ce(!1), ee(!1), localStorage.removeItem("agentic_order_address");
|
|
4020
4022
|
}, Fo = () => {
|
|
4021
|
-
|
|
4022
|
-
method:
|
|
4023
|
-
...
|
|
4023
|
+
he && (localStorage.setItem("agentic_order_delivery", he), D(!0), ae(!0), se(!1), Ce(!1), ee(!1), Pt("delivery", {
|
|
4024
|
+
method: he,
|
|
4025
|
+
...wt[he]
|
|
4024
4026
|
}));
|
|
4025
4027
|
}, Wr = () => {
|
|
4026
|
-
|
|
4028
|
+
pe(!1), D(!1), ae(!1), se(!1), Ce(!1), ee(!1), re(!1), qt(), O((u) => [
|
|
4027
4029
|
...u,
|
|
4028
4030
|
{
|
|
4029
4031
|
query: "",
|
|
@@ -4034,11 +4036,11 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4034
4036
|
}
|
|
4035
4037
|
]);
|
|
4036
4038
|
}, Eo = () => {
|
|
4037
|
-
D(!1),
|
|
4039
|
+
D(!1), ae(!1), se(!1), Ce(!1), ee(!1), localStorage.removeItem("agentic_order_delivery");
|
|
4038
4040
|
}, To = () => {
|
|
4039
|
-
Ae && (localStorage.setItem("agentic_order_payment", Ae),
|
|
4041
|
+
Ae && (localStorage.setItem("agentic_order_payment", Ae), se(!0), Ce(!0), ee(!1), Pt("payment", { method: Ae }));
|
|
4040
4042
|
}, Ao = () => {
|
|
4041
|
-
|
|
4043
|
+
ae(!1), se(!1), Ce(!1), ee(!1), re(!1), qt(), O((u) => [
|
|
4042
4044
|
...u,
|
|
4043
4045
|
{
|
|
4044
4046
|
query: "",
|
|
@@ -4049,24 +4051,24 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4049
4051
|
}
|
|
4050
4052
|
]);
|
|
4051
4053
|
}, Oo = () => {
|
|
4052
|
-
|
|
4054
|
+
se(!1), Ce(!1), ee(!1), localStorage.removeItem("agentic_order_payment");
|
|
4053
4055
|
}, jo = async () => {
|
|
4054
4056
|
try {
|
|
4055
4057
|
je(!0);
|
|
4056
|
-
const u =
|
|
4058
|
+
const u = fe || {}, m = JSON.parse(
|
|
4057
4059
|
localStorage.getItem("agentic_order_address") || "null"
|
|
4058
4060
|
), f = localStorage.getItem(
|
|
4059
4061
|
"agentic_order_delivery"
|
|
4060
|
-
), w = localStorage.getItem("agentic_order_payment") || "card", { product_total: v, tax: j, shipping_fee: H, currency: E } = Jr(), M = u.shopper_id || localStorage.getItem("customerId") || void 0, T = (m == null ? void 0 : m.addressId) || (m == null ? void 0 : m.id) || void 0,
|
|
4062
|
+
), w = localStorage.getItem("agentic_order_payment") || "card", { product_total: v, tax: j, shipping_fee: H, currency: E } = Jr(), M = u.shopper_id || localStorage.getItem("customerId") || void 0, T = (m == null ? void 0 : m.addressId) || (m == null ? void 0 : m.id) || void 0, ie = f ? Gs[f] : "GROUND", Pe = "card-visa", ze = N == null ? void 0 : N.sku, De = (r == null ? void 0 : r.id) || "", nt = Et(u), Fe = typeof u.max_price_minor == "number" ? u.max_price_minor : Math.round(v * 100), ft = {
|
|
4061
4063
|
shopper_id: M,
|
|
4062
4064
|
shipping_address_id: T,
|
|
4063
|
-
shipping_method_id:
|
|
4065
|
+
shipping_method_id: ie,
|
|
4064
4066
|
payment_method_id: Pe,
|
|
4065
4067
|
sku: ze,
|
|
4066
4068
|
platform: "SFCC",
|
|
4067
4069
|
storeCode: "Sites-SiteGenesis-Site",
|
|
4068
4070
|
product_id: De,
|
|
4069
|
-
quantity:
|
|
4071
|
+
quantity: nt,
|
|
4070
4072
|
max_price_minor: Fe,
|
|
4071
4073
|
currency: E,
|
|
4072
4074
|
instruction_text: $
|
|
@@ -4083,16 +4085,16 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4083
4085
|
), je(!1);
|
|
4084
4086
|
return;
|
|
4085
4087
|
}
|
|
4086
|
-
const
|
|
4087
|
-
if (!
|
|
4088
|
+
const ot = (await Ge()).access_token;
|
|
4089
|
+
if (!ot)
|
|
4088
4090
|
throw new Error("Failed to fetch auth token for intent-mandate");
|
|
4089
|
-
const { serverUrl: He } =
|
|
4091
|
+
const { serverUrl: He } = Xe(), Me = await fetch(`${He}/api/intent-mandate`, {
|
|
4090
4092
|
method: "POST",
|
|
4091
4093
|
headers: {
|
|
4092
4094
|
"Content-Type": "application/json",
|
|
4093
|
-
Authorization: `Bearer ${
|
|
4095
|
+
Authorization: `Bearer ${ot}`
|
|
4094
4096
|
},
|
|
4095
|
-
body: JSON.stringify(
|
|
4097
|
+
body: JSON.stringify(ft)
|
|
4096
4098
|
});
|
|
4097
4099
|
if (!Me.ok) {
|
|
4098
4100
|
const Bo = await Me.text().catch(() => "");
|
|
@@ -4103,17 +4105,17 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4103
4105
|
}
|
|
4104
4106
|
const ge = await Me.json().catch(() => null);
|
|
4105
4107
|
console.log("intent-mandate success:", ge);
|
|
4106
|
-
const
|
|
4107
|
-
|
|
4108
|
+
const at = (ge == null ? void 0 : ge.intent_mandate_id) || (ge == null ? void 0 : ge.intent_mandateId) || (ge == null ? void 0 : ge.key) || null;
|
|
4109
|
+
at && _t(at);
|
|
4108
4110
|
const Ht = {
|
|
4109
4111
|
...u,
|
|
4110
4112
|
address: m,
|
|
4111
4113
|
delivery: f,
|
|
4112
4114
|
payment: w,
|
|
4113
4115
|
summary: { product_total: v, tax: j, shipping_fee: H, currency: E },
|
|
4114
|
-
intent_mandate_id:
|
|
4116
|
+
intent_mandate_id: at
|
|
4115
4117
|
};
|
|
4116
|
-
localStorage.setItem("agentic_order_final", JSON.stringify(Ht)),
|
|
4118
|
+
localStorage.setItem("agentic_order_final", JSON.stringify(Ht)), ee(!0), Re(!1), Pt("final", Ht), Pt("success", { intentMandateId: at }), qt();
|
|
4117
4119
|
} catch (u) {
|
|
4118
4120
|
console.error("Error in handleConfirmWatch / intent-mandate:", u), alert(
|
|
4119
4121
|
"Unable to complete your smart order right now. Please try again in a moment."
|
|
@@ -4134,7 +4136,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4134
4136
|
]);
|
|
4135
4137
|
}, $o = ({ selectedIndex: u }) => {
|
|
4136
4138
|
var T;
|
|
4137
|
-
const m = ((T = y[u]) == null ? void 0 : T.images.large[0].link) || Tn(r, N), f = An(r), w = It || "", v =
|
|
4139
|
+
const m = ((T = y[u]) == null ? void 0 : T.images.large[0].link) || Tn(r, N), f = An(r), w = It || "", v = ht(N) || "", j = gt(N) || "", { amount: H } = Zt(N), E = !!(r != null && r.id), M = E;
|
|
4138
4140
|
return /* @__PURE__ */ a("div", { className: "mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4", children: /* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row items-center sm:items-center gap-4", children: [
|
|
4139
4141
|
/* @__PURE__ */ a("div", { className: "flex-shrink-0 flex justify-center sm:justify-start", children: /* @__PURE__ */ a("div", { className: "w-[150px] h-[150px] rounded-lg bg-gray-50 border border-gray-200 flex items-center justify-center overflow-hidden", children: m ? /* @__PURE__ */ a(
|
|
4140
4142
|
"img",
|
|
@@ -4169,9 +4171,9 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4169
4171
|
showSubmit: u = !0
|
|
4170
4172
|
}) => {
|
|
4171
4173
|
const m = {};
|
|
4172
|
-
Rt.map((w) =>
|
|
4174
|
+
Rt.map((w) => ht(w.variant)).filter((w) => !!w && !m[w] && (m[w] = !0));
|
|
4173
4175
|
const f = {};
|
|
4174
|
-
return Rt.map((w) =>
|
|
4176
|
+
return Rt.map((w) => gt(w.variant)).filter((w) => !!w && !f[w] && (f[w] = !0)), /* @__PURE__ */ d("div", { className: "mx-4 mt-4 mb-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in", children: [
|
|
4175
4177
|
/* @__PURE__ */ a("h3", { className: "font-semibold text-gray-800", children: "Choose a variant" }),
|
|
4176
4178
|
/* @__PURE__ */ d("div", { className: "mt-4", children: [
|
|
4177
4179
|
/* @__PURE__ */ d("div", { className: "flex items-baseline gap-2", children: [
|
|
@@ -4211,7 +4213,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4211
4213
|
C && /* @__PURE__ */ d("div", { className: "mt-4", children: [
|
|
4212
4214
|
/* @__PURE__ */ d("div", { className: "flex items-baseline gap-2", children: [
|
|
4213
4215
|
/* @__PURE__ */ a("div", { className: "text-sm font-bold", children: "Size :" }),
|
|
4214
|
-
|
|
4216
|
+
te && /* @__PURE__ */ a("div", { className: "text-sm text-gray-600", children: te })
|
|
4215
4217
|
] }),
|
|
4216
4218
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2 mt-2", children: (() => {
|
|
4217
4219
|
const w = y.find(
|
|
@@ -4223,9 +4225,9 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4223
4225
|
"button",
|
|
4224
4226
|
{
|
|
4225
4227
|
onClick: () => {
|
|
4226
|
-
ye(H), _e(j),
|
|
4228
|
+
ye(H), _e(j), ho(v.productId);
|
|
4227
4229
|
},
|
|
4228
|
-
className: `px-4 py-2 rounded-md border text-sm ${
|
|
4230
|
+
className: `px-4 py-2 rounded-md border text-sm ${te === H ? "border-2 border-[#804c9e] font-semibold" : "border-gray-300"}`,
|
|
4229
4231
|
title: H,
|
|
4230
4232
|
children: H
|
|
4231
4233
|
},
|
|
@@ -4247,9 +4249,9 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4247
4249
|
] });
|
|
4248
4250
|
}, Xr = (u, m = !0) => {
|
|
4249
4251
|
!(u != null && u.extractedDetails) && u && (u = { extractedDetails: u });
|
|
4250
|
-
const f = (u == null ? void 0 : u.extractedDetails) ||
|
|
4252
|
+
const f = (u == null ? void 0 : u.extractedDetails) || fe;
|
|
4251
4253
|
if (!f) return null;
|
|
4252
|
-
const w = Et(f), { currency: v } = Zt(N), j = On(r, N), H = Number((f == null ? void 0 : f.max_price_minor) ?? 0), M = Number.isFinite(H) && H > 0 ? +(H / 100) : +(j * w), T = (f == null ? void 0 : f.currency) || v ||
|
|
4254
|
+
const w = Et(f), { currency: v } = Zt(N), j = On(r, N), H = Number((f == null ? void 0 : f.max_price_minor) ?? 0), M = Number.isFinite(H) && H > 0 ? +(H / 100) : +(j * w), T = (f == null ? void 0 : f.currency) || v || xt, ie = N != null && N.sku ? N.sku : f.product_id;
|
|
4253
4255
|
return /* @__PURE__ */ d(
|
|
4254
4256
|
"div",
|
|
4255
4257
|
{
|
|
@@ -4267,22 +4269,22 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4267
4269
|
/* @__PURE__ */ d("div", { className: "w-full max-w-md bg-white rounded-xl shadow-inner p-4", children: [
|
|
4268
4270
|
/* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-y-2 text-sm", children: [
|
|
4269
4271
|
/* @__PURE__ */ a("p", { className: "font-semibold text-gray-600", children: "SKU:" }),
|
|
4270
|
-
/* @__PURE__ */ a("p", { className: "text-gray-800", children:
|
|
4272
|
+
/* @__PURE__ */ a("p", { className: "text-gray-800", children: ie }),
|
|
4271
4273
|
/* @__PURE__ */ a("p", { className: "font-semibold text-gray-600", children: "Quantity:" }),
|
|
4272
4274
|
/* @__PURE__ */ a("p", { className: "text-gray-800", children: Et(f) }),
|
|
4273
4275
|
/* @__PURE__ */ a("p", { className: "font-semibold text-gray-600", children: "Currency:" }),
|
|
4274
4276
|
/* @__PURE__ */ a("p", { className: "text-gray-800", children: T }),
|
|
4275
4277
|
/* @__PURE__ */ a("p", { className: "font-semibold text-gray-600", children: "Maximum Total Price:" }),
|
|
4276
|
-
/* @__PURE__ */ a("p", { className: "text-gray-800", children:
|
|
4278
|
+
/* @__PURE__ */ a("p", { className: "text-gray-800", children: st(M, T) })
|
|
4277
4279
|
] }),
|
|
4278
4280
|
/* @__PURE__ */ d("div", { className: "mt-3 flex flex-wrap gap-2 text-xs", children: [
|
|
4279
|
-
|
|
4281
|
+
ht(N) && /* @__PURE__ */ d("span", { className: "rounded-full bg-gray-100 px-2 py-1", children: [
|
|
4280
4282
|
"Color: ",
|
|
4281
|
-
|
|
4283
|
+
ht(N)
|
|
4282
4284
|
] }),
|
|
4283
|
-
|
|
4285
|
+
gt(N) && /* @__PURE__ */ d("span", { className: "rounded-full bg-gray-100 px-2 py-1", children: [
|
|
4284
4286
|
"Size: ",
|
|
4285
|
-
|
|
4287
|
+
gt(N)
|
|
4286
4288
|
] }),
|
|
4287
4289
|
(N == null ? void 0 : N.sku) && /* @__PURE__ */ d("span", { className: "rounded-full bg-gray-100 px-2 py-1", children: [
|
|
4288
4290
|
"SKU: ",
|
|
@@ -4352,14 +4354,14 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4352
4354
|
}
|
|
4353
4355
|
);
|
|
4354
4356
|
}, Zr = (u, m = !0) => {
|
|
4355
|
-
var
|
|
4356
|
-
const f = u || {}, w = ((
|
|
4357
|
+
var mt, ot, He, Me, ge, at;
|
|
4358
|
+
const f = u || {}, w = ((mt = f == null ? void 0 : f.summary) == null ? void 0 : mt.currency) || (fe == null ? void 0 : fe.currency) || xt, v = Tn(r, N), j = An(r), H = N != null && N.sku ? N.sku : (r == null ? void 0 : r.id) ?? (fe == null ? void 0 : fe.product_id), E = (N == null ? void 0 : N.sku) ?? ei(r), M = ht(N) || ti(r), T = gt(N) || ri(r), ie = Et(f), Pe = ((ot = f == null ? void 0 : f.summary) == null ? void 0 : ot.product_total) != null ? +f.summary.product_total : Yr(f), ze = ie > 0 ? +(Pe / ie).toFixed(2) : 0, De = Pe, nt = ((He = f == null ? void 0 : f.summary) == null ? void 0 : He.tax) ?? +(Pe * 0.08).toFixed(2), Fe = ((Me = f == null ? void 0 : f.summary) == null ? void 0 : Me.shipping_fee) ?? (((ge = wt[he]) == null ? void 0 : ge.price) || 0), Ee = f != null && f.address ? [
|
|
4357
4359
|
f.address.addressLine1,
|
|
4358
4360
|
f.address.addressLine2,
|
|
4359
4361
|
f.address.street,
|
|
4360
4362
|
[f.address.city, f.address.state, f.address.postalCode].filter(Boolean).join(", "),
|
|
4361
4363
|
f.address.country
|
|
4362
|
-
].filter(Boolean).map((Ht) => We(String(Ht))).join(", ") : "—", Ke = (f == null ? void 0 : f.payment) || "card",
|
|
4364
|
+
].filter(Boolean).map((Ht) => We(String(Ht))).join(", ") : "—", Ke = (f == null ? void 0 : f.payment) || "card", ft = Ke === "card" ? /* @__PURE__ */ d(ke, { children: [
|
|
4363
4365
|
"Credit Card — Mastercard",
|
|
4364
4366
|
/* @__PURE__ */ a("br", {}),
|
|
4365
4367
|
"•••• 7820 Exp: 12/26"
|
|
@@ -4371,7 +4373,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4371
4373
|
{
|
|
4372
4374
|
icon: "mdi:receipt-text-check-outline",
|
|
4373
4375
|
width: "24",
|
|
4374
|
-
color:
|
|
4376
|
+
color: ut
|
|
4375
4377
|
}
|
|
4376
4378
|
),
|
|
4377
4379
|
"All set! Here’s what your smart order looks like 🧾"
|
|
@@ -4423,15 +4425,15 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4423
4425
|
/* @__PURE__ */ d("div", { className: "grid grid-cols-1 md-grid-cols-3 md:grid-cols-3 gap-3", children: [
|
|
4424
4426
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center", children: [
|
|
4425
4427
|
/* @__PURE__ */ a("div", { className: "text-[11px] uppercase tracking-wide text-gray-500", children: "Unit Price" }),
|
|
4426
|
-
/* @__PURE__ */ a("div", { className: "mt-0.5 text-base font-bold text-gray-900", children:
|
|
4428
|
+
/* @__PURE__ */ a("div", { className: "mt-0.5 text-base font-bold text-gray-900", children: st(ze, w) })
|
|
4427
4429
|
] }),
|
|
4428
4430
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center", children: [
|
|
4429
4431
|
/* @__PURE__ */ a("div", { className: "text-[11px] uppercase tracking-wide text-gray-500", children: "Quantity" }),
|
|
4430
|
-
/* @__PURE__ */ a("div", { className: "mt-0.5 text-base font-bold text-gray-900", children:
|
|
4432
|
+
/* @__PURE__ */ a("div", { className: "mt-0.5 text-base font-bold text-gray-900", children: ie })
|
|
4431
4433
|
] }),
|
|
4432
4434
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center", children: [
|
|
4433
4435
|
/* @__PURE__ */ a("div", { className: "text-[11px] uppercase tracking-wide text-gray-500", children: "Subtotal" }),
|
|
4434
|
-
/* @__PURE__ */ a("div", { className: "mt-0.5 text-base font-bold text-gray-900", children:
|
|
4436
|
+
/* @__PURE__ */ a("div", { className: "mt-0.5 text-base font-bold text-gray-900", children: st(De, w) })
|
|
4435
4437
|
] })
|
|
4436
4438
|
] })
|
|
4437
4439
|
] })
|
|
@@ -4444,25 +4446,25 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4444
4446
|
] }),
|
|
4445
4447
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3", children: [
|
|
4446
4448
|
/* @__PURE__ */ a("div", { className: "text-xs uppercase tracking-wide text-gray-500", children: "💳 Payment" }),
|
|
4447
|
-
/* @__PURE__ */ a("div", { className: "mt-1 text-sm font-semibold text-gray-900 text-center", children:
|
|
4449
|
+
/* @__PURE__ */ a("div", { className: "mt-1 text-sm font-semibold text-gray-900 text-center", children: ft })
|
|
4448
4450
|
] }),
|
|
4449
4451
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3", children: [
|
|
4450
4452
|
/* @__PURE__ */ a("div", { className: "text-xs uppercase tracking-wide text-gray-500", children: "🚚 Delivery" }),
|
|
4451
|
-
/* @__PURE__ */ a("div", { className: "mt-1 text-sm font-semibold text-gray-900 text-center", children: f != null && f.delivery && ((
|
|
4453
|
+
/* @__PURE__ */ a("div", { className: "mt-1 text-sm font-semibold text-gray-900 text-center", children: f != null && f.delivery && ((at = wt[f.delivery]) == null ? void 0 : at.name) || "—" })
|
|
4452
4454
|
] })
|
|
4453
4455
|
] }),
|
|
4454
4456
|
/* @__PURE__ */ d("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
|
|
4455
4457
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center", children: [
|
|
4456
4458
|
/* @__PURE__ */ a("div", { className: "text-xs uppercase tracking-wide text-gray-500", children: "💰 any(s)" }),
|
|
4457
|
-
/* @__PURE__ */ a("div", { className: "mt-1 text-2xl font-bold text-gray-900", children:
|
|
4459
|
+
/* @__PURE__ */ a("div", { className: "mt-1 text-2xl font-bold text-gray-900", children: st(Pe, w) })
|
|
4458
4460
|
] }),
|
|
4459
4461
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center", children: [
|
|
4460
4462
|
/* @__PURE__ */ a("div", { className: "text-xs uppercase tracking-wide text-gray-500", children: "🏛️ Taxes" }),
|
|
4461
|
-
/* @__PURE__ */ a("div", { className: "mt-1 text-2xl font-bold text-gray-900", children:
|
|
4463
|
+
/* @__PURE__ */ a("div", { className: "mt-1 text-2xl font-bold text-gray-900", children: st(nt, w) })
|
|
4462
4464
|
] }),
|
|
4463
4465
|
/* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center", children: [
|
|
4464
4466
|
/* @__PURE__ */ a("div", { className: "text-xs uppercase tracking-wide text-gray-500", children: "🚚 Shipping" }),
|
|
4465
|
-
/* @__PURE__ */ a("div", { className: "mt-1 text-2xl font-bold text-gray-900", children:
|
|
4467
|
+
/* @__PURE__ */ a("div", { className: "mt-1 text-2xl font-bold text-gray-900", children: st(Fe, w) })
|
|
4466
4468
|
] })
|
|
4467
4469
|
] }),
|
|
4468
4470
|
/* @__PURE__ */ d(
|
|
@@ -4472,7 +4474,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4472
4474
|
style: { background: Ut },
|
|
4473
4475
|
children: [
|
|
4474
4476
|
/* @__PURE__ */ a("div", { className: "text-sm/5 opacity-95", children: "🔹 Total Payable" }),
|
|
4475
|
-
/* @__PURE__ */ a("div", { className: "mt-1 text-3xl font-extrabold tracking-tight", children:
|
|
4477
|
+
/* @__PURE__ */ a("div", { className: "mt-1 text-3xl font-extrabold tracking-tight", children: st(Pe + nt + Fe, w) })
|
|
4476
4478
|
]
|
|
4477
4479
|
}
|
|
4478
4480
|
)
|
|
@@ -4518,7 +4520,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4518
4520
|
style: { backgroundColor: "var(--tanya-light)" },
|
|
4519
4521
|
children: /* @__PURE__ */ d("div", { className: "rounded-xl border border-gray-200 bg-white p-4", children: [
|
|
4520
4522
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
4521
|
-
/* @__PURE__ */ a(ce, { icon: "mdi:home-map-marker", width: "20", color:
|
|
4523
|
+
/* @__PURE__ */ a(ce, { icon: "mdi:home-map-marker", width: "20", color: ut }),
|
|
4522
4524
|
/* @__PURE__ */ a("div", { className: "font-semibold text-gray-800", children: "Delivery Address" })
|
|
4523
4525
|
] }),
|
|
4524
4526
|
/* @__PURE__ */ a("div", { className: "text-sm text-gray-800", children: m })
|
|
@@ -4526,7 +4528,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4526
4528
|
}
|
|
4527
4529
|
);
|
|
4528
4530
|
}, zo = (u) => {
|
|
4529
|
-
const m = u == null ? void 0 : u.method, f = m ?
|
|
4531
|
+
const m = u == null ? void 0 : u.method, f = m ? wt[m] : void 0;
|
|
4530
4532
|
return /* @__PURE__ */ a(
|
|
4531
4533
|
"div",
|
|
4532
4534
|
{
|
|
@@ -4534,7 +4536,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4534
4536
|
style: { backgroundColor: "var(--tanya-light)" },
|
|
4535
4537
|
children: /* @__PURE__ */ d("div", { className: "rounded-xl border border-gray-200 bg-white p-4", children: [
|
|
4536
4538
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
4537
|
-
/* @__PURE__ */ a(ce, { icon: "mdi:truck-delivery", width: "20", color:
|
|
4539
|
+
/* @__PURE__ */ a(ce, { icon: "mdi:truck-delivery", width: "20", color: ut }),
|
|
4538
4540
|
/* @__PURE__ */ a("div", { className: "font-semibold text-gray-800", children: "Delivery Method" })
|
|
4539
4541
|
] }),
|
|
4540
4542
|
/* @__PURE__ */ a("div", { className: "text-sm text-gray-800", children: f ? /* @__PURE__ */ d(ke, { children: [
|
|
@@ -4561,7 +4563,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4561
4563
|
{
|
|
4562
4564
|
icon: "mdi:credit-card-outline",
|
|
4563
4565
|
width: "20",
|
|
4564
|
-
color:
|
|
4566
|
+
color: ut
|
|
4565
4567
|
}
|
|
4566
4568
|
),
|
|
4567
4569
|
/* @__PURE__ */ a("div", { className: "font-semibold text-gray-800", children: "Payment Method" })
|
|
@@ -4576,7 +4578,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4576
4578
|
);
|
|
4577
4579
|
}, Mo = (u, m) => {
|
|
4578
4580
|
const f = u.snapshotStage;
|
|
4579
|
-
if (!f || f === "address" && W || f === "delivery" && Ne || f === "payment" &&
|
|
4581
|
+
if (!f || f === "address" && W || f === "delivery" && Ne || f === "payment" && oe || f === "final" && Nt)
|
|
4580
4582
|
return null;
|
|
4581
4583
|
switch (f) {
|
|
4582
4584
|
case "initial":
|
|
@@ -4707,9 +4709,9 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4707
4709
|
),
|
|
4708
4710
|
/* @__PURE__ */ a($o, { selectedIndex: I }),
|
|
4709
4711
|
q > 1 && /* @__PURE__ */ a(Gr, { showSubmit: !1 }),
|
|
4710
|
-
|
|
4712
|
+
p.map((u, m) => {
|
|
4711
4713
|
var v;
|
|
4712
|
-
const f = m ===
|
|
4714
|
+
const f = m === p.length - 1, w = !!u.snapshotStage;
|
|
4713
4715
|
return /* @__PURE__ */ d("div", { children: [
|
|
4714
4716
|
u.query && /* @__PURE__ */ a("div", { className: "flex justify-end", children: /* @__PURE__ */ a(
|
|
4715
4717
|
"p",
|
|
@@ -4733,14 +4735,14 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4733
4735
|
children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ a("p", { children: u.snapshotPayload.text }) })
|
|
4734
4736
|
}
|
|
4735
4737
|
) }),
|
|
4736
|
-
f &&
|
|
4738
|
+
f && dt && q > 1 && /* @__PURE__ */ d("div", { className: "mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in", children: [
|
|
4737
4739
|
/* @__PURE__ */ d("div", { className: "text-sm text-gray-800", children: [
|
|
4738
4740
|
"Proceed with color:",
|
|
4739
4741
|
" ",
|
|
4740
4742
|
/* @__PURE__ */ a("span", { className: "font-semibold", children: C || "—" }),
|
|
4741
4743
|
", size:",
|
|
4742
4744
|
" ",
|
|
4743
|
-
/* @__PURE__ */ a("span", { className: "font-semibold", children:
|
|
4745
|
+
/* @__PURE__ */ a("span", { className: "font-semibold", children: te || "—" }),
|
|
4744
4746
|
"?"
|
|
4745
4747
|
] }),
|
|
4746
4748
|
/* @__PURE__ */ d("div", { className: "mt-3 flex gap-3", children: [
|
|
@@ -4767,7 +4769,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4767
4769
|
)
|
|
4768
4770
|
] })
|
|
4769
4771
|
] }),
|
|
4770
|
-
f &&
|
|
4772
|
+
f && rt && /* @__PURE__ */ a(Gr, { showSubmit: !0 }),
|
|
4771
4773
|
f && Ie && /* @__PURE__ */ a("div", { className: "mt-4", children: /* @__PURE__ */ a(
|
|
4772
4774
|
"div",
|
|
4773
4775
|
{
|
|
@@ -4858,7 +4860,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4858
4860
|
className: "mt-1 accent-tanya-light",
|
|
4859
4861
|
checked: H,
|
|
4860
4862
|
disabled: G,
|
|
4861
|
-
onChange: () =>
|
|
4863
|
+
onChange: () => ne(j),
|
|
4862
4864
|
value: j
|
|
4863
4865
|
}
|
|
4864
4866
|
),
|
|
@@ -4918,7 +4920,7 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4918
4920
|
),
|
|
4919
4921
|
"Great! Now choose how fast you want it delivered 🚚"
|
|
4920
4922
|
] }),
|
|
4921
|
-
|
|
4923
|
+
Z && /* @__PURE__ */ d(ke, { children: [
|
|
4922
4924
|
/* @__PURE__ */ a("span", { className: "ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold", children: "Selected" }),
|
|
4923
4925
|
!F && /* @__PURE__ */ a(
|
|
4924
4926
|
"button",
|
|
@@ -4939,15 +4941,15 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4939
4941
|
/* @__PURE__ */ a(
|
|
4940
4942
|
"div",
|
|
4941
4943
|
{
|
|
4942
|
-
className: `space-y-3 ${
|
|
4944
|
+
className: `space-y-3 ${Z ? "opacity-70" : ""}`,
|
|
4943
4945
|
children: Object.keys(A).map(
|
|
4944
4946
|
(u) => {
|
|
4945
|
-
const m =
|
|
4947
|
+
const m = wt[u], f = he === u;
|
|
4946
4948
|
return /* @__PURE__ */ d(
|
|
4947
4949
|
"label",
|
|
4948
4950
|
{
|
|
4949
|
-
className: `flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${f ? "border-tanya-light" : "border-gray-300"} ${
|
|
4950
|
-
title:
|
|
4951
|
+
className: `flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${f ? "border-tanya-light" : "border-gray-300"} ${Z ? "pointer-events-none" : ""}`,
|
|
4952
|
+
title: Z ? "Delivery already submitted" : "",
|
|
4951
4953
|
children: [
|
|
4952
4954
|
/* @__PURE__ */ a(
|
|
4953
4955
|
"input",
|
|
@@ -4956,22 +4958,15 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4956
4958
|
name: "delivery",
|
|
4957
4959
|
className: "mt-1 accent-tanya-light",
|
|
4958
4960
|
checked: f,
|
|
4959
|
-
disabled:
|
|
4961
|
+
disabled: Z,
|
|
4960
4962
|
onChange: () => _(u)
|
|
4961
4963
|
}
|
|
4962
4964
|
),
|
|
4963
4965
|
/* @__PURE__ */ d("div", { className: "flex-1", children: [
|
|
4964
|
-
/* @__PURE__ */
|
|
4965
|
-
|
|
4966
|
-
" ",
|
|
4967
|
-
m.label
|
|
4968
|
-
] }),
|
|
4969
|
-
/* @__PURE__ */ a("div", { className: "text-sm text-gray-700", children: m.subtitle })
|
|
4966
|
+
/* @__PURE__ */ a("div", { className: "font-semibold text-gray-800 flex items-center gap-2", children: m.name }),
|
|
4967
|
+
/* @__PURE__ */ a("div", { className: "text-sm text-gray-700", children: m.description })
|
|
4970
4968
|
] }),
|
|
4971
|
-
/* @__PURE__ */ a("div", { className: "text-sm font-semibold text-gray-800", children: m.
|
|
4972
|
-
m.fee,
|
|
4973
|
-
(X == null ? void 0 : X.currency) || ct
|
|
4974
|
-
) })
|
|
4969
|
+
/* @__PURE__ */ a("div", { className: "text-sm font-semibold text-gray-800", children: m.price === 0 ? "Free" : m.price })
|
|
4975
4970
|
]
|
|
4976
4971
|
},
|
|
4977
4972
|
u
|
|
@@ -4997,15 +4992,15 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
4997
4992
|
"button",
|
|
4998
4993
|
{
|
|
4999
4994
|
onClick: Fo,
|
|
5000
|
-
disabled:
|
|
5001
|
-
className: `px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${
|
|
4995
|
+
disabled: Z,
|
|
4996
|
+
className: `px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${Z ? "opacity-60 cursor-not-allowed" : "hover:-translate-y-0.5 hover:shadow-lg"}`,
|
|
5002
4997
|
style: { background: Le },
|
|
5003
|
-
children:
|
|
4998
|
+
children: Z ? "Delivery Submitted" : "Submit Delivery Option"
|
|
5004
4999
|
}
|
|
5005
5000
|
)
|
|
5006
5001
|
] })
|
|
5007
5002
|
] }),
|
|
5008
|
-
|
|
5003
|
+
oe && /* @__PURE__ */ d("div", { className: "mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in", children: [
|
|
5009
5004
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
5010
5005
|
/* @__PURE__ */ d("h3", { className: "font-semibold text-lg text-gray-800 flex items-center gap-2", children: [
|
|
5011
5006
|
/* @__PURE__ */ a(
|
|
@@ -5101,13 +5096,13 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
5101
5096
|
] }),
|
|
5102
5097
|
Nt && Zr(
|
|
5103
5098
|
{
|
|
5104
|
-
...
|
|
5099
|
+
...fe,
|
|
5105
5100
|
address: JSON.parse(
|
|
5106
5101
|
localStorage.getItem("agentic_order_address") || "null"
|
|
5107
5102
|
),
|
|
5108
5103
|
delivery: localStorage.getItem("agentic_order_delivery"),
|
|
5109
5104
|
payment: localStorage.getItem("agentic_order_payment"),
|
|
5110
|
-
summary: Jr(
|
|
5105
|
+
summary: Jr(fe == null ? void 0 : fe.currency)
|
|
5111
5106
|
},
|
|
5112
5107
|
!1
|
|
5113
5108
|
)
|
|
@@ -5165,6 +5160,6 @@ const ct = "USD", Ks = (e, t = ct) => {
|
|
|
5165
5160
|
export {
|
|
5166
5161
|
vi as AgenticShoppingButton,
|
|
5167
5162
|
bi as TanyaChatbot,
|
|
5168
|
-
|
|
5163
|
+
hi as TanyaChatbotProvider
|
|
5169
5164
|
};
|
|
5170
5165
|
//# sourceMappingURL=tanya-chatbot.es.js.map
|