tanya-chatbot 0.8.9 → 0.9.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.
|
@@ -18,8 +18,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
18
18
|
${i}
|
|
19
19
|
bg-white cursor-pointer relative
|
|
20
20
|
${s?"border-black":"border-gray-300 hover:border-gray-500"}
|
|
21
|
-
`,children:[r==="circle"?n.jsx("div",{className:"h-full w-full rounded-full",style:{backgroundImage:`url(${(o==null?void 0:o.disBaseLink)||(o==null?void 0:o.link)||""})`,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:t==null?void 0:t.toLowerCase()}}):n.jsx("span",{className:"text-base font-medium",children:t}),s&&r==="circle"&&n.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-black pointer-events-none"})]})},$a=({label:e,selectedValue:t,onChange:r,children:o})=>n.jsxs("div",{className:"mb-6",children:[n.jsxs("div",{className:"font-medium text-lg mb-2",children:[e,":"," ",n.jsx("span",{className:"font-normal text-gray-700",children:t||""})]}),n.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:o})]}),Je=e=>e.charAt(0).toUpperCase()+e.slice(1),tt={standard:{label:"Standard Delivery",fee:0,subtitle:"Arrives in 4–6 days (Free)",icon:"mdi:clock-outline"},express:{label:"Express Delivery",fee:5,subtitle:"Arrives in 1–2 days (+$5)",icon:"mdi:flash"},sameday:{label:"Same-Day Delivery",fee:10,subtitle:"Available in select locations (+$10)",icon:"mdi:truck-fast-outline"}},La={standard:"GROUND",express:"2-DAY SHIPPING",sameday:"OVERNIGHT"},$e=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},eo=e=>e==null?void 0:e.masterVariant,wn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ht=e=>{const t=eo(e);return t?[t,...wn(e)]:wn(e)},Da=(e,t=0)=>Ht(e)[t],za=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},yn=(e,t)=>{var r,o,s,a,i,c,l,h;return za(t)||((a=(s=(o=(r=e.imageGroups)==null?void 0:r[0])==null?void 0:o.images)==null?void 0:s[0])==null?void 0:a.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)||""},bn=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Vt=e=>{var a,i,c,l,h,p;const t=e?br(e,Ge):null;if(t!=null&&t.cent&&(t!=null&&t.cur))return{amount:+(t.cent/100),currency:t.cur,regularAmount:t.regularCent?t.regularCent/100:void 0};const r=(c=(i=(a=e==null?void 0:e.prices)==null?void 0:a[0])==null?void 0:i.value)==null?void 0:c.centAmount,o=((p=(h=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:h.value)==null?void 0:p.currencyCode)??Ge;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},vn=(e,t)=>{const{amount:r}=Vt(t);if(r)return r;const o=(e==null?void 0:e.price)??(e==null?void 0:e.sellingPrice)??(e==null?void 0:e.unitPrice)??(e==null?void 0:e.mrp)??0,s=Number(o);return Number.isFinite(s)?s:0},jn=e=>{var t;return(e==null?void 0:e.sku)||((t=e==null?void 0:e.variant)==null?void 0:t.sku)||(e==null?void 0:e.selectedSku)||""},Ma=e=>{var t;return(e==null?void 0:e.color)||(e==null?void 0:e.selectedColor)||((t=e==null?void 0:e.variant)==null?void 0:t.color)||""},qa=e=>{var t;return(e==null?void 0:e.size)||(e==null?void 0:e.selectedSize)||((t=e==null?void 0:e.variant)==null?void 0:t.size)||""},kn=20,Ba=({open:e,onClose:t,product:r,index:o,addressListProp:s,addressLoading:a,variationAttributes:i})=>{console.log(r,"the product for ai shopping");const c=null,l=null,h=Ht(r),p=Math.min(Math.max(0,o||0),Math.max(0,h.length-1)),b=h.length,[y,N]=g.useState(p),[S,I]=g.useState(null),[j,C]=g.useState(null),Y=g.useRef(null),M=g.useRef(null),x=Da(r,y),[Ce,F]=g.useState(""),[J,de]=g.useState(!1),[ye,te]=g.useState(!1),[_e,be]=g.useState(!1),[pe,q]=g.useState(""),[O,ue]=g.useState(!1),[K,Re]=g.useState(null),[Ue,X]=g.useState([]),[ct,xt]=g.useState([]),[L,Te]=g.useState([]),[ge,Ie]=g.useState(!1),[wt,Zt]=g.useState(),[m,z]=g.useState(!0),[P,R]=g.useState(!1),[U,E]=g.useState(!1),[W,re]=g.useState("standard"),[A,B]=g.useState(!1),[Fe,fe]=g.useState(!1),[se,ve]=g.useState("card"),[Z,G]=g.useState(!1),[Pe,k]=g.useState(!1),[ae,$]=g.useState(!1),[ie,Oe]=g.useState(null),[De,yt]=g.useState(null),[bt,ze]=g.useState(""),[Et,Tt]=g.useState(!1),[T,He]=g.useState({}),Ot=(d,f,u)=>{He(v=>({...v,[d]:{value:f,name:u}}))},Ve=g.useRef(null);g.useEffect(()=>{const d=Ht(r),f=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));N(f);const u=eo(r),v=qe(u),_=Ke(u);Y.current=v||null,M.current=_||null,I(v||null),C(_||null)},[o,r]),g.useEffect(()=>{Ve.current&&(Ve.current.scrollTop=Ve.current.scrollHeight)},[Ue,ge,P,U,A,Fe,Z,Pe,ae,J,ye]);const je="var(--tanya)",er="var(--tanya-contrast)",At=je,to="#804c9e",ro=()=>{console.log("AgenticShopping feedback:",{rating:De,comment:bt}),Tt(!0)},no=()=>{yt(null),ze(""),Tt(!0)},Or=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??ie;return e?n.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-lg border border-green-200 bg-green-50 p-4 text-green-800",children:[n.jsx("div",{className:"success-tick-animation",children:n.jsx(oe,{icon:"mdi:check-circle",width:"28",color:"#16a34a"})}),n.jsxs("div",{className:"text-sm w-full",children:[n.jsx("div",{className:"font-semibold",children:"Success!"}),n.jsx("div",{children:"Your smart order has been saved. I’ll watch the price and auto-purchase when the conditions are met."}),u&&n.jsxs("div",{className:"mt-2 text-xs font-medium",children:["Your Smart Order ID: ",n.jsx("span",{className:"font-semibold text-blue-600 cursor-pointer underline",children:u})]}),!Et&&n.jsxs("div",{className:"mt-4 rounded-lg bg-white/70 p-3 text-gray-900",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Please post your feedback here"}),n.jsx("p",{className:"text-sm text-gray-700 mb-3",children:"Rate us on how much our response was helpful"}),n.jsx("div",{className:"flex items-center gap-1 mb-3",children:[1,2,3,4,5].map(v=>n.jsx("button",{type:"button",onClick:()=>yt(v),className:"p-0.5",children:n.jsx(oe,{icon:De&&De>=v?"mdi:star":"mdi:star-outline",width:"20",className:"text-yellow-500"})},v))}),n.jsx("label",{className:"block text-sm text-gray-700 mb-1",children:"Tell us more about the response"}),n.jsx("textarea",{value:bt,onChange:v=>ze(v.target.value),rows:3,className:"mt-1 w-full rounded-md border border-gray-300 p-2 text-sm outline-none focus:ring-1 focus:ring-gray-300",placeholder:"Your feedback helps us improve..."}),n.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:no,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:ro,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:je},disabled:!De&&!bt.trim(),children:"Submit"})]})]}),Et&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},oo=async()=>{try{Te(s)}catch(d){console.error("Error fetching addresses:",d)}},vt=(d,f)=>{X(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:f}])},Ar=(d,f)=>{X(u=>u.map(v=>v.response==="__CARD__"?{...v,response:"__SNAPSHOT__",snapshotStage:d??v.snapshotStage,snapshotPayload:f??v.snapshotPayload}:v))},so=()=>{X(d=>d.filter(f=>!(f.query===""&&f.response!=="__SNAPSHOT__"&&f.response!=="__TEXT__")))},$t=()=>{k(!1),Ie(!1),E(!1),fe(!1),R(!1),B(!1),G(!1),$(!1),ue(!1),Re(null),so(),de(!1),te(!1)},ao=()=>{Ie(!1),R(!1),E(!1),re("standard"),B(!1),fe(!1),ve("card"),G(!1),k(!1),$(!1),z(!0),Re(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")},Ee=g.useMemo(()=>Ht(r).map((f,u)=>({index:u,variant:f,images:((f==null?void 0:f.images)||[]).map(v=>(v==null?void 0:v.url)||"").filter(Boolean)})),[r]),jt=g.useMemo(()=>{if(!Ee.length)return!1;const d=S||void 0,f=j||void 0,u=(v,_)=>{var D;const w=et(Ee,v||void 0,_||void 0);return!!(w&&((D=w.variant)!=null&&D.sku))};return d&&f?u(d,f):d&&!f?u(d,null):!d&&f?u(void 0,f)
|
|
22
|
-
`);ke=dt.pop()||"";for(const ut of dt){if(!ut.startsWith("data:"))continue;const Xe=ut.slice(5).trim();try{const Me=JSON.parse(Xe),Ae=Me.index,me=Me.data;Ae===0?Se=String(me??""):Ae===1&&(Ne=String(me??""))}catch(Me){console.error("Error parsing JSON chunk:",Me)}}}let le=null;if(Se){const xe=String(Se).replace(/\\n/g,"").trim();if(xe.startsWith("{")&&xe.endsWith("}"))try{le=JSON.parse(xe),le.product_id=f,le.sku_id=f,localStorage.setItem("agentic_order",JSON.stringify(le))}catch(Ye){console.log(Ye)}}Re(le),le&&X(xe=>[...xe,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:le}}]),xt(xe=>[...xe,{userQuery:d,mainResponse:Se||"",keywords:Ne||""}].slice(-kn))}catch(_){console.error("Error sending message to Tanya:",_),ue(!1)}finally{be(!1)}},Dr=async d=>{if(O||_e||!jt)return;const f=pe.trim();if(!f)return;X(w=>[...w,{query:f,response:""}]),q(""),F(f);const u=x==null?void 0:x.sku,v=jn(r),_=u||v||"";if(b<=1){if(_){tr(f,_,y);return}te(!0),ue(!0);return}_?(de(!0),ue(!0)):(te(!0),ue(!0))},lo=()=>{const d=x==null?void 0:x.sku;d&&tr(Ce,d,y)},co=()=>{de(!1),te(!0),ue(!0)},uo=()=>{if(!x||!x.sku)return;const d=x.sku;tr(Ce,d,y)},fo=async()=>{Ie(!0),E(!1),fe(!1),k(!1),R(!1),B(!1),G(!1),$(!1),await oo(),Ar("initial",{extractedDetails:K??void 0})},mo=()=>{if(!wt)return;const d=L.find(f=>String(f.addressId??f.id)===wt)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),R(!0),E(!0),B(!1),fe(!1),G(!1),k(!1),$(!1),vt("address",d))},ho=()=>{R(!1),E(!1),B(!1),fe(!1),G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_address")},po=()=>{W&&(localStorage.setItem("agentic_order_delivery",W),B(!0),fe(!0),G(!1),k(!1),$(!1),vt("delivery",{method:W,...tt[W]}))},zr=()=>{E(!1),B(!1),fe(!1),G(!1),k(!1),$(!1),ue(!1),$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},go=()=>{B(!1),fe(!1),G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_delivery")},xo=()=>{se&&(localStorage.setItem("agentic_order_payment",se),G(!0),k(!0),$(!1),vt("payment",{method:se}))},wo=()=>{fe(!1),G(!1),k(!1),$(!1),ue(!1),$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},yo=()=>{G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_payment")},bo=async()=>{try{be(!0);const d=K||{},f=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),v=localStorage.getItem("agentic_order_payment")||"card",{product_total:_,tax:w,shipping_fee:D,currency:H}=Lr(),ne=d.shopper_id||localStorage.getItem("customerId")||void 0,V=(f==null?void 0:f.addressId)||(f==null?void 0:f.id)||void 0,ee=u?La[u]:"GROUND",Q="card-visa",ke=x==null?void 0:x.sku,Se=(r==null?void 0:r.id)||"",Ne=kt(d),le=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(_*100),dt={shopper_id:ne,shipping_address_id:V,shipping_method_id:ee,payment_method_id:Q,sku:ke,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Se,quantity:Ne,max_price_minor:le,currency:H,instruction_text:Ce};if(!ne||!V){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:ne,shippingAddressId:V}),alert("Missing customer or address information. Please re-select address and try again."),be(!1);return}const Xe=(await gt()).access_token;if(!Xe)throw new Error("Failed to fetch auth token for intent-mandate");const{serverUrl:Me}=st(),Ae=await fetch(`${Me}/api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Xe}`},body:JSON.stringify(dt)});if(!Ae.ok){const Co=await Ae.text().catch(()=>"");console.error("intent-mandate failed",Ae.status,Co),alert("Something went wrong while saving your smart order. Please try again."),be(!1);return}const me=await Ae.json().catch(()=>null);console.log("intent-mandate success:",me);const Ze=(me==null?void 0:me.intent_mandate_id)||(me==null?void 0:me.intent_mandateId)||(me==null?void 0:me.key)||null;Ze&&Oe(Ze);const Lt={...d,address:f,delivery:u,payment:v,summary:{product_total:_,tax:w,shipping_fee:D,currency:H},intent_mandate_id:Ze};localStorage.setItem("agentic_order_final",JSON.stringify(Lt)),$(!0),z(!1),vt("final",Lt),vt("success",{intentMandateId:Ze}),$t()}catch(d){console.error("Error in handleConfirmWatch / intent-mandate:",d),alert("Unable to complete your smart order right now. Please try again in a moment.")}finally{be(!1)}},Mr=()=>{$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},vo=()=>{const d=yn(r,x),f=bn(r),u=(r==null?void 0:r.id)||"",v=qe(x)||"",_=Ke(x)||"",{amount:w}=Vt(x),D=!!(r!=null&&r.id),H=D;return console.log(d,f,u,v,_,w,D,H,"base product"),n.jsx("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-4",children:[n.jsx("div",{className:"flex-shrink-0 flex justify-center sm:justify-start",children:n.jsx("div",{className:"w-[150px] h-[150px] rounded-lg bg-gray-50 border border-gray-200 flex items-center justify-center overflow-hidden",children:d?n.jsx("img",{src:d,alt:f,className:"object-contain w-full h-full"}):n.jsx(oe,{icon:"mdi:image-outline",width:"28",className:"opacity-60"})})}),n.jsxs("div",{className:"flex-grow flex flex-col justify-center text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-gray-900 mb-1",children:f}),n.jsx("div",{className:"text-sm text-gray-700 mb-1",children:[u&&`SKU: ${u}`,v&&`Color: ${v}`,_&&`Size: ${_}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:D
|
|
21
|
+
`,children:[r==="circle"?n.jsx("div",{className:"h-full w-full rounded-full",style:{backgroundImage:`url(${(o==null?void 0:o.disBaseLink)||(o==null?void 0:o.link)||""})`,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:t==null?void 0:t.toLowerCase()}}):n.jsx("span",{className:"text-base font-medium",children:t}),s&&r==="circle"&&n.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-black pointer-events-none"})]})},$a=({label:e,selectedValue:t,onChange:r,children:o})=>n.jsxs("div",{className:"mb-6",children:[n.jsxs("div",{className:"font-medium text-lg mb-2",children:[e,":"," ",n.jsx("span",{className:"font-normal text-gray-700",children:t||""})]}),n.jsx("div",{className:"flex items-center gap-3 flex-wrap",children:o})]}),Je=e=>e.charAt(0).toUpperCase()+e.slice(1),tt={standard:{label:"Standard Delivery",fee:0,subtitle:"Arrives in 4–6 days (Free)",icon:"mdi:clock-outline"},express:{label:"Express Delivery",fee:5,subtitle:"Arrives in 1–2 days (+$5)",icon:"mdi:flash"},sameday:{label:"Same-Day Delivery",fee:10,subtitle:"Available in select locations (+$10)",icon:"mdi:truck-fast-outline"}},La={standard:"GROUND",express:"2-DAY SHIPPING",sameday:"OVERNIGHT"},$e=(e,t)=>{try{return e.toLocaleString("en-US",{style:"currency",currency:t||"USD"})}catch{return`${t} ${e.toFixed(2)}`}},eo=e=>e==null?void 0:e.masterVariant,wn=e=>Array.isArray(e==null?void 0:e.variants)?e.variants:[],Ht=e=>{const t=eo(e);return t?[t,...wn(e)]:wn(e)},Da=(e,t=0)=>Ht(e)[t],za=e=>{var t,r;return((r=(t=e==null?void 0:e.images)==null?void 0:t[0])==null?void 0:r.url)??""},yn=(e,t)=>{var r,o,s,a,i,c,l,h;return za(t)||((a=(s=(o=(r=e.imageGroups)==null?void 0:r[0])==null?void 0:o.images)==null?void 0:s[0])==null?void 0:a.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)||""},bn=e=>(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.productName)||"any",Vt=e=>{var a,i,c,l,h,p;const t=e?br(e,Ge):null;if(t!=null&&t.cent&&(t!=null&&t.cur))return{amount:+(t.cent/100),currency:t.cur,regularAmount:t.regularCent?t.regularCent/100:void 0};const r=(c=(i=(a=e==null?void 0:e.prices)==null?void 0:a[0])==null?void 0:i.value)==null?void 0:c.centAmount,o=((p=(h=(l=e==null?void 0:e.prices)==null?void 0:l[0])==null?void 0:h.value)==null?void 0:p.currencyCode)??Ge;return{amount:Number.isFinite(r)?+(Number(r)/100):0,currency:o}},vn=(e,t)=>{const{amount:r}=Vt(t);if(r)return r;const o=(e==null?void 0:e.price)??(e==null?void 0:e.sellingPrice)??(e==null?void 0:e.unitPrice)??(e==null?void 0:e.mrp)??0,s=Number(o);return Number.isFinite(s)?s:0},jn=e=>{var t;return(e==null?void 0:e.sku)||((t=e==null?void 0:e.variant)==null?void 0:t.sku)||(e==null?void 0:e.selectedSku)||""},Ma=e=>{var t;return(e==null?void 0:e.color)||(e==null?void 0:e.selectedColor)||((t=e==null?void 0:e.variant)==null?void 0:t.color)||""},qa=e=>{var t;return(e==null?void 0:e.size)||(e==null?void 0:e.selectedSize)||((t=e==null?void 0:e.variant)==null?void 0:t.size)||""},kn=20,Ba=({open:e,onClose:t,product:r,index:o,addressListProp:s,addressLoading:a,variationAttributes:i})=>{console.log(r,"the product for ai shopping");const c=null,l=null,h=Ht(r),p=Math.min(Math.max(0,o||0),Math.max(0,h.length-1)),b=h.length,[y,N]=g.useState(p),[S,I]=g.useState(null),[j,C]=g.useState(null),Y=g.useRef(null),M=g.useRef(null),x=Da(r,y),[Ce,F]=g.useState(""),[J,de]=g.useState(!1),[ye,te]=g.useState(!1),[_e,be]=g.useState(!1),[pe,q]=g.useState(""),[O,ue]=g.useState(!1),[K,Re]=g.useState(null),[Ue,X]=g.useState([]),[ct,xt]=g.useState([]),[L,Te]=g.useState([]),[ge,Ie]=g.useState(!1),[wt,Zt]=g.useState(),[m,z]=g.useState(!0),[P,R]=g.useState(!1),[U,E]=g.useState(!1),[W,re]=g.useState("standard"),[A,B]=g.useState(!1),[Fe,fe]=g.useState(!1),[se,ve]=g.useState("card"),[Z,G]=g.useState(!1),[Pe,k]=g.useState(!1),[ae,$]=g.useState(!1),[ie,Oe]=g.useState(null),[De,yt]=g.useState(null),[bt,ze]=g.useState(""),[Et,Tt]=g.useState(!1),[T,He]=g.useState({}),Ot=(d,f,u)=>{He(v=>({...v,[d]:{value:f,name:u}}))},Ve=g.useRef(null);g.useEffect(()=>{const d=Ht(r),f=Math.min(Math.max(0,o||0),Math.max(0,d.length-1));N(f);const u=eo(r),v=qe(u),_=Ke(u);Y.current=v||null,M.current=_||null,I(v||null),C(_||null)},[o,r]),g.useEffect(()=>{Ve.current&&(Ve.current.scrollTop=Ve.current.scrollHeight)},[Ue,ge,P,U,A,Fe,Z,Pe,ae,J,ye]);const je="var(--tanya)",er="var(--tanya-contrast)",At=je,to="#804c9e",ro=()=>{console.log("AgenticShopping feedback:",{rating:De,comment:bt}),Tt(!0)},no=()=>{yt(null),ze(""),Tt(!0)},Or=d=>{const u=((d==null?void 0:d.intentMandateId)||(d==null?void 0:d.intent_mandate_id)||(d==null?void 0:d.id)||null)??ie;return e?n.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-lg border border-green-200 bg-green-50 p-4 text-green-800",children:[n.jsx("div",{className:"success-tick-animation",children:n.jsx(oe,{icon:"mdi:check-circle",width:"28",color:"#16a34a"})}),n.jsxs("div",{className:"text-sm w-full",children:[n.jsx("div",{className:"font-semibold",children:"Success!"}),n.jsx("div",{children:"Your smart order has been saved. I’ll watch the price and auto-purchase when the conditions are met."}),u&&n.jsxs("div",{className:"mt-2 text-xs font-medium",children:["Your Smart Order ID: ",n.jsx("span",{className:"font-semibold text-blue-600 cursor-pointer underline",children:u})]}),!Et&&n.jsxs("div",{className:"mt-4 rounded-lg bg-white/70 p-3 text-gray-900",children:[n.jsx("h4",{className:"font-semibold mb-1",children:"Please post your feedback here"}),n.jsx("p",{className:"text-sm text-gray-700 mb-3",children:"Rate us on how much our response was helpful"}),n.jsx("div",{className:"flex items-center gap-1 mb-3",children:[1,2,3,4,5].map(v=>n.jsx("button",{type:"button",onClick:()=>yt(v),className:"p-0.5",children:n.jsx(oe,{icon:De&&De>=v?"mdi:star":"mdi:star-outline",width:"20",className:"text-yellow-500"})},v))}),n.jsx("label",{className:"block text-sm text-gray-700 mb-1",children:"Tell us more about the response"}),n.jsx("textarea",{value:bt,onChange:v=>ze(v.target.value),rows:3,className:"mt-1 w-full rounded-md border border-gray-300 p-2 text-sm outline-none focus:ring-1 focus:ring-gray-300",placeholder:"Your feedback helps us improve..."}),n.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:no,className:"px-4 py-2 rounded-full border text-sm font-medium hover:bg-gray-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:ro,className:"px-4 py-2 rounded-full text-sm font-semibold text-white shadow",style:{background:je},disabled:!De&&!bt.trim(),children:"Submit"})]})]}),Et&&n.jsx("div",{className:"mt-3 text-xs text-green-900 font-medium",children:"Thanks for your feedback! 💚"})]})]}):null},oo=async()=>{try{Te(s)}catch(d){console.error("Error fetching addresses:",d)}},vt=(d,f)=>{X(u=>[...u,{query:"",response:"__SNAPSHOT__",snapshotStage:d,snapshotPayload:f}])},Ar=(d,f)=>{X(u=>u.map(v=>v.response==="__CARD__"?{...v,response:"__SNAPSHOT__",snapshotStage:d??v.snapshotStage,snapshotPayload:f??v.snapshotPayload}:v))},so=()=>{X(d=>d.filter(f=>!(f.query===""&&f.response!=="__SNAPSHOT__"&&f.response!=="__TEXT__")))},$t=()=>{k(!1),Ie(!1),E(!1),fe(!1),R(!1),B(!1),G(!1),$(!1),ue(!1),Re(null),so(),de(!1),te(!1)},ao=()=>{Ie(!1),R(!1),E(!1),re("standard"),B(!1),fe(!1),ve("card"),G(!1),k(!1),$(!1),z(!0),Re(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")},Ee=g.useMemo(()=>Ht(r).map((f,u)=>({index:u,variant:f,images:((f==null?void 0:f.images)||[]).map(v=>(v==null?void 0:v.url)||"").filter(Boolean)})),[r]),jt=g.useMemo(()=>{if(!Ee.length)return!1;const d=S||void 0,f=j||void 0,u=(v,_)=>{var D;const w=et(Ee,v||void 0,_||void 0);return!!(w&&((D=w.variant)!=null&&D.sku))};return d&&f?u(d,f):d&&!f?u(d,null):!d&&f?u(void 0,f):!0},[Ee,S,j,x]),io=_e||O||!jt,kt=d=>{const f=Number((d==null?void 0:d.quantity)??1);return Number.isFinite(f)&&f>0?f:1},$r=d=>{const f=kt(d),u=Number((d==null?void 0:d.max_price_minor)??0);return Number.isFinite(u)&&u>0?+(u/100):+(vn(r,x)*f)},Lr=d=>{var H;const f=K,u=Vt(x),v=d||(f==null?void 0:f.currency)||u.currency||Ge,_=$r(f),w=+(_*.08).toFixed(2),D=((H=tt[W])==null?void 0:H.fee)||0;return{product_total:_,tax:w,shipping_fee:D,currency:v}},tr=async(d,f,u)=>{Ar(),ao(),be(!0),ue(!0),de(!1),te(!1);const v=ct.slice(-kn);try{const _=await dr(c,l);if(!_)throw new Error("Failed to fetch token");const w=localStorage.getItem("customerNumber"),D=localStorage.getItem("isLoggedIn"),ne=`https://tanya.aspiresystems.com/api/bedrock/invoke/stream?${new URLSearchParams({registered:String(D||!1),userId:String(w||new Date().getTime())}).toString()}`,V=await fetch(`${ne}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_}`},body:JSON.stringify({flowId:"MTMI0P4LC6",flowAliasId:"BCUA138F2Q",input:{instruction:`Use SKU ${f}. Currency is USD. ${d}`,metadata:{productId:(r==null?void 0:r.id)??null,skuId:f??null,variantIndex:u},context:v}})});if(!V.body)throw new Error("Readable stream not supported");const ee=V.body.getReader(),Q=new TextDecoder;let ke="",Se="",Ne="";for(;;){const{done:xe,value:Ye}=await ee.read();if(xe)break;ke+=Q.decode(Ye,{stream:!0});const dt=ke.split(`
|
|
22
|
+
`);ke=dt.pop()||"";for(const ut of dt){if(!ut.startsWith("data:"))continue;const Xe=ut.slice(5).trim();try{const Me=JSON.parse(Xe),Ae=Me.index,me=Me.data;Ae===0?Se=String(me??""):Ae===1&&(Ne=String(me??""))}catch(Me){console.error("Error parsing JSON chunk:",Me)}}}let le=null;if(Se){const xe=String(Se).replace(/\\n/g,"").trim();if(xe.startsWith("{")&&xe.endsWith("}"))try{le=JSON.parse(xe),le.product_id=f,le.sku_id=f,localStorage.setItem("agentic_order",JSON.stringify(le))}catch(Ye){console.log(Ye)}}Re(le),le&&X(xe=>[...xe,{query:"",response:"__CARD__",snapshotPayload:{extractedDetails:le}}]),xt(xe=>[...xe,{userQuery:d,mainResponse:Se||"",keywords:Ne||""}].slice(-kn))}catch(_){console.error("Error sending message to Tanya:",_),ue(!1)}finally{be(!1)}},Dr=async d=>{if(O||_e||!jt)return;const f=pe.trim();if(!f)return;X(w=>[...w,{query:f,response:""}]),q(""),F(f);const u=x==null?void 0:x.sku,v=jn(r),_=u||v||"";if(b<=1){if(_){tr(f,_,y);return}te(!0),ue(!0);return}_?(de(!0),ue(!0)):(te(!0),ue(!0))},lo=()=>{const d=x==null?void 0:x.sku;d&&tr(Ce,d,y)},co=()=>{de(!1),te(!0),ue(!0)},uo=()=>{if(!x||!x.sku)return;const d=x.sku;tr(Ce,d,y)},fo=async()=>{Ie(!0),E(!1),fe(!1),k(!1),R(!1),B(!1),G(!1),$(!1),await oo(),Ar("initial",{extractedDetails:K??void 0})},mo=()=>{if(!wt)return;const d=L.find(f=>String(f.addressId??f.id)===wt)||null;d&&(localStorage.setItem("agentic_order_address",JSON.stringify(d)),R(!0),E(!0),B(!1),fe(!1),G(!1),k(!1),$(!1),vt("address",d))},ho=()=>{R(!1),E(!1),B(!1),fe(!1),G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_address")},po=()=>{W&&(localStorage.setItem("agentic_order_delivery",W),B(!0),fe(!0),G(!1),k(!1),$(!1),vt("delivery",{method:W,...tt[W]}))},zr=()=>{E(!1),B(!1),fe(!1),G(!1),k(!1),$(!1),ue(!1),$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},go=()=>{B(!1),fe(!1),G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_delivery")},xo=()=>{se&&(localStorage.setItem("agentic_order_payment",se),G(!0),k(!0),$(!1),vt("payment",{method:se}))},wo=()=>{fe(!1),G(!1),k(!1),$(!1),ue(!1),$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},yo=()=>{G(!1),k(!1),$(!1),localStorage.removeItem("agentic_order_payment")},bo=async()=>{try{be(!0);const d=K||{},f=JSON.parse(localStorage.getItem("agentic_order_address")||"null"),u=localStorage.getItem("agentic_order_delivery"),v=localStorage.getItem("agentic_order_payment")||"card",{product_total:_,tax:w,shipping_fee:D,currency:H}=Lr(),ne=d.shopper_id||localStorage.getItem("customerId")||void 0,V=(f==null?void 0:f.addressId)||(f==null?void 0:f.id)||void 0,ee=u?La[u]:"GROUND",Q="card-visa",ke=x==null?void 0:x.sku,Se=(r==null?void 0:r.id)||"",Ne=kt(d),le=typeof d.max_price_minor=="number"?d.max_price_minor:Math.round(_*100),dt={shopper_id:ne,shipping_address_id:V,shipping_method_id:ee,payment_method_id:Q,sku:ke,platform:"SFCC",storeCode:"Sites-SiteGenesis-Site",product_id:Se,quantity:Ne,max_price_minor:le,currency:H,instruction_text:Ce};if(!ne||!V){console.error("Missing shopper_id or shipping_address_id for intent-mandate",{shopperId:ne,shippingAddressId:V}),alert("Missing customer or address information. Please re-select address and try again."),be(!1);return}const Xe=(await gt()).access_token;if(!Xe)throw new Error("Failed to fetch auth token for intent-mandate");const{serverUrl:Me}=st(),Ae=await fetch(`${Me}/api/intent-mandate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Xe}`},body:JSON.stringify(dt)});if(!Ae.ok){const Co=await Ae.text().catch(()=>"");console.error("intent-mandate failed",Ae.status,Co),alert("Something went wrong while saving your smart order. Please try again."),be(!1);return}const me=await Ae.json().catch(()=>null);console.log("intent-mandate success:",me);const Ze=(me==null?void 0:me.intent_mandate_id)||(me==null?void 0:me.intent_mandateId)||(me==null?void 0:me.key)||null;Ze&&Oe(Ze);const Lt={...d,address:f,delivery:u,payment:v,summary:{product_total:_,tax:w,shipping_fee:D,currency:H},intent_mandate_id:Ze};localStorage.setItem("agentic_order_final",JSON.stringify(Lt)),$(!0),z(!1),vt("final",Lt),vt("success",{intentMandateId:Ze}),$t()}catch(d){console.error("Error in handleConfirmWatch / intent-mandate:",d),alert("Unable to complete your smart order right now. Please try again in a moment.")}finally{be(!1)}},Mr=()=>{$t(),X(d=>[...d,{query:"",response:"__TEXT__",snapshotPayload:{text:"No worries! I’ve cancelled this request. You can start again anytime — just tell me what you’d like to buy or track"}}])},vo=()=>{const d=yn(r,x),f=bn(r),u=(r==null?void 0:r.id)||"",v=qe(x)||"",_=Ke(x)||"",{amount:w}=Vt(x),D=!!(r!=null&&r.id),H=D;return console.log(d,f,u,v,_,w,D,H,"base product"),n.jsx("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4",children:n.jsxs("div",{className:"flex flex-col sm:flex-row items-center sm:items-center gap-4",children:[n.jsx("div",{className:"flex-shrink-0 flex justify-center sm:justify-start",children:n.jsx("div",{className:"w-[150px] h-[150px] rounded-lg bg-gray-50 border border-gray-200 flex items-center justify-center overflow-hidden",children:d?n.jsx("img",{src:d,alt:f,className:"object-contain w-full h-full"}):n.jsx(oe,{icon:"mdi:image-outline",width:"28",className:"opacity-60"})})}),n.jsxs("div",{className:"flex-grow flex flex-col justify-center text-center",children:[n.jsx("div",{className:"text-2xl font-bold text-gray-900 mb-1",children:f}),n.jsx("div",{className:"text-sm text-gray-700 mb-1",children:[u&&`SKU: ${u}`,v&&`Color: ${v}`,_&&`Size: ${_}`].filter(Boolean).join(" • ")||"—"}),n.jsx("div",{className:"mt-1 text-xl font-semibold text-gray-900",children:D?`$${r.price}`:"Currently unavailable"}),D&&!H&&n.jsx("div",{className:"mt-1 text-xs font-medium text-red-600",children:"Currently out of stock"})]})]})})},qr=({showSubmit:d=!0})=>{const f={},u=Ee.map(w=>qe(w.variant)).filter(w=>!!w&&!f[w]&&(f[w]=!0)),v={},_=Ee.map(w=>Ke(w.variant)).filter(w=>!!w&&!v[w]&&(v[w]=!0));return n.jsxs("div",{className:"mx-4 mt-4 mb-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsx("h3",{className:"font-semibold text-gray-800",children:"Choose a variant"}),u.length>0&&n.jsxs("div",{className:"mt-4",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("div",{className:"text-sm font-bold",children:"Color :"}),S&&n.jsx("div",{className:"text-sm text-gray-600",children:S})]}),n.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:u.map(w=>{var Ne;const D=S===w,H=j||M.current||null,ne=H?et(Ee,w,H):et(Ee,w,null),V=!!ne,ee=V&&Ea(ne.variant),Q=V&&ee?br(ne.variant,Ge)||br(ne.variant):null,ke=Ee.find(le=>qe(le.variant)===w),Se=(Ne=ke==null?void 0:ke.images)==null?void 0:Ne[0];return n.jsxs("div",{className:`flex flex-col items-center w-28 border rounded-md p-2
|
|
23
23
|
${D?"border-2 border-tanya-light":"border-gray-300"}
|
|
24
24
|
${!V||!ee?"opacity-60":""}`,children:[n.jsx("button",{onClick:()=>{I(w);const le=j||M.current||null,xe=le&&et(Ee,w,le)||et(Ee,w,null);xe&&N(xe.index)},className:"w-full h-20 flex items-center justify-center overflow-hidden",title:w,children:Se?n.jsx("img",{src:Se,alt:w,className:"w/full h-full object-contain"}):n.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs px-1",children:w})}),n.jsx("div",{className:"w-full border-t my-2"}),V&&!ee&&n.jsx("div",{className:"text-[11px] text-red-600 text-center",children:"Out of stock"}),!V&&n.jsx("div",{className:"text-[11px] text-red-600 text-center",children:"any not offered"}),V&&ee&&Q&&n.jsxs("div",{className:"text-xs text-gray-800 font-medium text-center",children:[$e(Q.cent/100,Q.cur),Q.regularCent&&Q.regularCent>Q.cent&&n.jsx("span",{className:"ml-1 line-through text-gray-500",children:$e(Q.regularCent/100,Q.cur)})]})]},`color-${w}`)})})]}),_.length>0&&n.jsxs("div",{className:"mt-4",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("div",{className:"text-sm font-bold",children:"Size :"}),j&&n.jsx("div",{className:"text-sm text-gray-600",children:j})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:_.map(w=>{const D=j===w;return n.jsx("button",{onClick:()=>{C(w);const H=S&&et(Ee,S,w)||et(Ee,void 0,w);H&&N(H.index)},className:`px-4 py-2 rounded-md border text-sm ${D?"border-2 border-tanya-light font-semibold":"border-gray-300"}`,title:w,children:w},`size-${w}`)})})]}),i.map(({id:w,name:D,selectedValue:H,values:ne})=>{var V;return n.jsx($a,{label:D,selectedValue:((V=T[w])==null?void 0:V.name)||"",children:ne.map(({value:ee,name:Q,image:ke})=>{var Ne;const Se=((Ne=T[w])==null?void 0:Ne.value)===ee;return n.jsx(Aa,{value:ee,name:Q,image:ke,variant:w==="color"?"circle":"square",selected:Se,onClick:()=>Ot(w,ee,Q)},ee)})},w)}),d&&n.jsx("div",{className:"mt-4 flex justify-end",children:n.jsx("button",{onClick:uo,className:"px-6 py-2.5 rounded-full font-semibold text-white shadow-md",style:{background:je},disabled:!jt,children:"Submit"})})]})},Br=(d,f=!0)=>{!(d!=null&&d.extractedDetails)&&d&&(d={extractedDetails:d});const u=(d==null?void 0:d.extractedDetails)||K;if(!u)return null;const v=kt(u),{currency:_}=Vt(x),w=vn(r,x),D=Number((u==null?void 0:u.max_price_minor)??0),ne=Number.isFinite(D)&&D>0?+(D/100):+(w*v),V=(u==null?void 0:u.currency)||_||Ge,ee=x!=null&&x.sku?x.sku:u.product_id;return n.jsxs("div",{className:"px-6 pb-6 flex flex-col items-center space-y-4",style:{backgroundColor:"#14377D"},children:[n.jsx("p",{className:"text-base font-semibold text-center mt-2",style:{color:er},children:"Here’s what I found from your instruction:"}),n.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-inner p-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-y-2 text-sm",children:[n.jsx("p",{className:"font-semibold text-gray-600",children:"SKU:"}),n.jsx("p",{className:"text-gray-800",children:ee}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Quantity:"}),n.jsx("p",{className:"text-gray-800",children:kt(u)}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Currency:"}),n.jsx("p",{className:"text-gray-800",children:V}),n.jsx("p",{className:"font-semibold text-gray-600",children:"Maximum Total Price:"}),n.jsx("p",{className:"text-gray-800",children:$e(ne,V)})]}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[qe(x)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Color: ",qe(x)]}),Ke(x)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["Size: ",Ke(x)]}),(x==null?void 0:x.sku)&&n.jsxs("span",{className:"rounded-full bg-gray-100 px-2 py-1",children:["SKU: ",x.sku]})]})]}),!f&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"text-sm font-medium text-gray-700 text-center max-w-[90%] leading-relaxed",style:{color:er},children:["Would you like me to ",n.jsx("strong",{children:"lock this in"})," and monitor it for you?"]}),n.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[n.jsxs("button",{onClick:fo,disabled:ge,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${ge?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:`${je}`},children:[n.jsx(oe,{icon:"fluent:checkmark-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"Yes, lock it in"]}),n.jsxs("button",{onClick:Mr,disabled:ge,className:`relative inline-flex items-center justify-center px-6 py-2.5 rounded-full font-semibold border transition-all duration-300 ${ge?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{borderColor:je,color:er},children:[n.jsx(oe,{icon:"fluent:dismiss-circle-24-filled",className:"mr-2",width:"18",height:"18"}),"No"]})]})]})]})},Rr=(d,f=!0)=>{var ut,Xe,Me,Ae,me,Ze;const u=d||{},v=((ut=u==null?void 0:u.summary)==null?void 0:ut.currency)||(K==null?void 0:K.currency)||Ge,_=yn(r,x),w=bn(r),D=x!=null&&x.sku?x.sku:(r==null?void 0:r.id)??(K==null?void 0:K.product_id),H=(x==null?void 0:x.sku)??jn(r),ne=qe(x)||Ma(r),V=Ke(x)||qa(r),ee=kt(u),Q=((Xe=u==null?void 0:u.summary)==null?void 0:Xe.product_total)!=null?+u.summary.product_total:$r(u),ke=ee>0?+(Q/ee).toFixed(2):0,Se=Q,Ne=((Me=u==null?void 0:u.summary)==null?void 0:Me.tax)??+(Q*.08).toFixed(2),le=((Ae=u==null?void 0:u.summary)==null?void 0:Ae.shipping_fee)??(((me=tt[W])==null?void 0:me.fee)||0),xe=u!=null&&u.address?[u.address.addressLine1,u.address.addressLine2,u.address.street,[u.address.city,u.address.state,u.address.postalCode].filter(Boolean).join(", "),u.address.country].filter(Boolean).map(Lt=>Je(String(Lt))).join(", "):"—",Ye=(u==null?void 0:u.payment)||"card",dt=Ye==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):n.jsx(n.Fragment,{children:Je(Ye)});return n.jsxs("div",{className:"mx-auto mt-3 mb-3 rounded-2xl bg-white",children:[n.jsx("div",{className:"px-6 pt-5 pb-3",children:n.jsxs("h3",{className:"font-semibold text-lg mb-2 text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:receipt-text-check-outline",width:"24",color:je}),"All set! Here’s what your smart order looks like 🧾"]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-4 rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"sm:col-span-2 flex",children:n.jsx("div",{className:"w-30 h-26 sm:w-30 sm:h-26 overflow-hidden rounded-lg bg-white border border-gray-200 flex items-center justify-center mx-auto sm:mx-0",children:_?n.jsx("img",{src:_,alt:w,className:"w-full h-full object-contain"}):n.jsx(oe,{icon:"mdi:image-outline",width:"24",className:"opacity-50"})})}),n.jsxs("div",{className:"sm:col-span-10",children:[n.jsxs("div",{className:"mb-3",children:[n.jsx("div",{className:"text-lg text-center font-bold text-gray-900",children:w}),n.jsxs("div",{className:"text-xs text-center font-bold text-gray-600",children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",D??"—"]}),(H||ne||V)&&n.jsxs("div",{className:"text-xs text-gray-600 mt-0.5 text-center",children:[H&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"SKU:"})," ",H," "]}),ne&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Color:"})," ",ne," "]}),V&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-medium",children:"Size:"})," ",V]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md-grid-cols-3 md:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Unit Price"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:$e(ke,v)})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Quantity"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:ee})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-white p-3 text-center",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Subtotal"}),n.jsx("div",{className:"mt-0.5 text-base font-bold text-gray-900",children:$e(Se,v)})]})]})]})]})}),n.jsxs("div",{className:"px-6 pb-2",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-3",children:[n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🏠 Address"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:xe})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💳 Payment"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:dt})]}),n.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-gray-200 bg-gray-50 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Delivery"}),n.jsx("div",{className:"mt-1 text-sm font-semibold text-gray-900 text-center",children:u!=null&&u.delivery&&((Ze=tt[u.delivery])==null?void 0:Ze.label)||"—"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"💰 any(s)"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:$e(Q,v)})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🏛️ Taxes"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:$e(Ne,v)})]}),n.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-gray-200 bg-gray-50 p-4 text-center",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-gray-500",children:"🚚 Shipping"}),n.jsx("div",{className:"mt-1 text-2xl font-bold text-gray-900",children:$e(le,v)})]})]}),n.jsxs("div",{className:"mt-4 rounded-xl p-4 text-center text-white shadow-sm",style:{background:At},children:[n.jsx("div",{className:"text-sm/5 opacity-95",children:"🔹 Total Payable"}),n.jsx("div",{className:"mt-1 text-3xl font-extrabold tracking-tight",children:$e(Q+Ne+le,v)})]})]}),!f&&n.jsxs("div",{className:"px-6 pb-5",children:[!ae&&n.jsx("p",{className:"mt-3 text-center text-sm text-gray-700",children:"Everything looks good! Do you want me to watch this product and buy it automatically when it meets your condition?"}),ae&&Or({intentMandateId:ie}),m&&!ae&&n.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-3",children:[n.jsx("button",{onClick:bo,className:"inline-flex items-center justify-center rounded-full px-6 py-2.5 font-semibold text-white shadow-md transition-transform duration-150 hover:-translate-y-0.5 hover:shadow-lg",style:{background:At},children:"Confirm"}),n.jsx("button",{onClick:Mr,className:"inline-flex items-center justify-center rounded-full border px-6 py-2.5 font-semibold hover:bg-gray-50",style:{borderColor:At,color:At},children:"Cancel"})]})]})]})},jo=d=>{if(!d)return null;const f=[d.addressLine1,d.addressLine2,d.street,[d.city,d.state,d.postalCode].filter(Boolean).join(", "),d.country].filter(u=>!!u).map(u=>Je(u)).join(", ");return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"20",color:je}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Address"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f})]})})},ko=d=>{const f=d==null?void 0:d.method,u=f?tt[f]:void 0;return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"20",color:je}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Delivery Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:u?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(oe,{icon:u.icon,width:"18"}),n.jsx("span",{className:"font-medium",children:u.label})]}),n.jsx("div",{className:"text-gray-600",children:u.subtitle})]}):"—"})]})})},So=d=>{const f=(d==null?void 0:d.method)||"card";return n.jsx("div",{className:"px-6 py-4",style:{backgroundColor:"var(--tanya-light)"},children:n.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"20",color:je}),n.jsx("div",{className:"font-semibold text-gray-800",children:"Payment Method"})]}),n.jsx("div",{className:"text-sm text-gray-800",children:f==="card"?n.jsxs(n.Fragment,{children:["Credit Card — Mastercard",n.jsx("br",{}),"•••• 7820 Exp: 12/26"]}):Je(f)})]})})},No=(d,f)=>{const u=d.snapshotStage;if(!u||u==="address"&&ge||u==="delivery"&&U||u==="payment"&&Fe||u==="final"&&Pe)return null;switch(u){case"initial":return Br(d.snapshotPayload,!f);case"address":return jo(d.snapshotPayload);case"delivery":return ko(d.snapshotPayload);case"payment":return So(d.snapshotPayload);case"final":return Rr(d.snapshotPayload,!f);case"success":return Or(d.snapshotPayload);default:return null}};return Fo.createPortal(n.jsxs("div",{className:"fixed inset-0",style:{zIndex:2147483647},"aria-modal":"true",role:"dialog",children:[n.jsx("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.25)"},onClick:t}),n.jsx("div",{className:"absolute right-0 ",children:n.jsxs("div",{className:"w-[64.7vw] h-screen bg-white rounded-xl overflow-hidden flex flex-col shadow-xl",children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTopLeftRadius:"0.75rem",borderBottomLeftRadius:"0.75rem",padding:"0.25rem",background:to},children:[n.jsxs("div",{style:{display:"flex",color:"#ffffff",alignItems:"center",gap:"0.5rem"},children:[n.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 256 256",children:n.jsxs("g",{fill:"currentColor",children:[n.jsx("path",{d:"m194.82 151.43l-55.09 20.3l-20.3 55.09a7.92 7.92 0 0 1-14.86 0l-20.3-55.09l-55.09-20.3a7.92 7.92 0 0 1 0-14.86l55.09-20.3l20.3-55.09a7.92 7.92 0 0 1 14.86 0l20.3 55.09l55.09 20.3a7.92 7.92 0 0 1 0 14.86",opacity:"0.2"}),n.jsx("path",{d:"M197.58 129.06L146 110l-19-51.62a15.92 15.92 0 0 0-29.88 0L78 110l-51.62 19a15.92 15.92 0 0 0 0 29.88L78 178l19 51.62a15.92 15.92 0 0 0 29.88 0L146 178l51.62-19a15.92 15.92 0 0 0 0-29.88ZM137 164.22a8 8 0 0 0-4.74 4.74L112 223.85L91.78 169a8 8 0 0 0-4.78-4.78L32.15 144L87 123.78a8 8 0 0 0 4.78-4.78L112 64.15L132.22 119a8 8 0 0 0 4.74 4.74L191.85 144ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8"})]})}),n.jsx("div",{children:n.jsx("p",{className:"font-bold",children:"Agentic Shopping with TANYA"})})]}),n.jsx("div",{style:{display:"flex",alignItems:"center",gap:"1.25rem",margin:"0.75rem"},children:n.jsx(oe,{icon:"fluent:dismiss-24-filled",color:"#ffffff",width:"24",height:"24",className:"cursor-pointer",onClick:t})})]}),n.jsxs("div",{ref:Ve,className:"overflow-y-auto pr-5 pb-4 space-y-4 hide-scrollbar flex-grow",children:[n.jsxs("div",{className:"text-sm text-[16px] rounded-r-xl p-3 m-3 rounded-bl-xl w-3/4 text-tanya-contrast",style:{backgroundColor:"#e5dbeb"},children:["Welcome to your smart shopping companion!",n.jsxs("p",{children:["Simply share your instruction — like “If this product goes below $",parseInt(r.price)-5," grab it for me.”"]}),n.jsx("p",{children:"I’ll monitor it, calculate total prices, and place the order when your conditions are met."})]}),n.jsx(vo,{}),b>1&&n.jsx(qr,{showSubmit:!1}),Ue.map((d,f)=>{var _;const u=f===Ue.length-1,v=!!d.snapshotStage;return n.jsxs("div",{children:[d.query&&n.jsx("div",{className:"flex justify-end",children:n.jsx("p",{className:"text-sm rounded-l-xl p-3 m-3 mb-4 rounded-br-xl max-w-[75%]",style:{color:"#ffffff",backgroundColor:"var(--tanya)"},children:d.query})}),d.response==="__TEXT__"&&((_=d.snapshotPayload)==null?void 0:_.text)&&n.jsx("div",{className:"mt-2",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("p",{children:d.snapshotPayload.text})})})}),u&&J&&b>1&&n.jsxs("div",{className:"mx-4 mt-2 rounded-xl border border-gray-200 bg-white p-4 animate-fade-in",children:[n.jsxs("div",{className:"text-sm text-gray-800",children:["Proceed with color:"," ",n.jsx("span",{className:"font-semibold",children:qe(x)||"—"}),", size:"," ",n.jsx("span",{className:"font-semibold",children:Ke(x)||"—"}),"?"]}),n.jsxs("div",{className:"mt-3 flex gap-3",children:[n.jsx("button",{onClick:lo,className:"px-5 py-2 rounded-full text-white font-semibold",style:{background:je},children:"Yes"}),n.jsx("button",{onClick:co,className:"px-5 py-2 rounded-full font-semibold border",style:{borderColor:je,color:je},children:"No, change SKU"})]})]}),u&&ye&&n.jsx(qr,{showSubmit:!0}),u&&_e&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"text-sm text-tanya-contrast px-7 py-4 rounded-r-xl rounded-bl-2xl w-full",style:{backgroundColor:"var(--tanya-light)",margin:"0.75rem"},children:n.jsx("div",{className:"flex items-center gap-2 tanya-pulse-text",children:n.jsx("p",{children:"Reading your instruction and setting things up…"})})})}),(v||d.response==="__CARD__")&&(!_e||!u)&&n.jsx("div",{className:"mt-6 mb-4 mx-4 animate-fade-in",style:{backgroundColor:"#fff",borderRadius:"1rem",boxShadow:"0 2px 8px rgba(0,0,0,0.08)",overflow:"hidden"},children:v?No(d,u):Br(d.snapshotPayload,!1)})]},f)}),ge&&n.jsxs("div",{className:"mt-6 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:home-map-marker",width:"24",color:"var(--tanya-light)"}),"Select a Delivery Address"]}),P&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!ae&&n.jsx("button",{onClick:ho,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change address",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Choose where you’d like us to deliver this item."}),a?n.jsxs("div",{className:"flex items-center py-6",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottomColor:"var(--tanya-light)"}}),n.jsx("p",{className:"ml-3 text-gray-600",children:"Fetching your addresses..."})]}):L.length>0?n.jsxs("div",{className:`space-y-3 ${P?"opacity-70":""}`,children:[L.map(d=>{const f=[d.addressLine1,d.addressLine2].filter(Boolean).map(H=>Je(H||"")).join(" "),u=Je(d.city||""),v=`${Je(d.state||"")}${d.state&&d.postalCode?", ":""}${d.postalCode||""}`,_=Je(d.country||""),w=String(d.addressId??d.id),D=wt===w;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${D?"border-tanya-light":"border-gray-300"} ${P?"pointer-events-none":""}`,title:P?"Address already submitted":"",children:[n.jsx("input",{type:"radio",name:"address",className:"mt-1 accent-tanya-light",checked:D,disabled:P,onChange:()=>Zt(w),value:w}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-semibold text-gray-800",children:f||"Address"}),n.jsxs("div",{className:"text-sm text-gray-700",children:[u,n.jsx("br",{}),v,n.jsx("br",{}),_]})]})]},w)}),n.jsxs("div",{className:"flex justify-between pt-2",children:[n.jsx("button",{onClick:zr,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:mo,disabled:P,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${P?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:je},children:P?"Address Submitted":"Submit Address"})]})]}):n.jsx("div",{className:"text-center py-8 text-gray-600",children:"No addresses found. Please add a new one in your profile."})]}),U&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:truck-delivery",width:"24",color:"var(--tanya-light)"}),"Great! Now choose how fast you want it delivered 🚚"]}),A&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!ae&&n.jsx("button",{onClick:go,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change shipping method",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Which one would you like me to use for this order?"}),n.jsx("div",{className:`space-y-3 ${A?"opacity-70":""}`,children:Object.keys(tt).map(d=>{const f=tt[d],u=W===d;return n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${u?"border-tanya-light":"border-gray-300"} ${A?"pointer-events-none":""}`,title:A?"Delivery already submitted":"",children:[n.jsx("input",{type:"radio",name:"delivery",className:"mt-1 accent-tanya-light",checked:u,disabled:A,onChange:()=>re(d)}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:f.icon,width:"18"})," ",f.label]}),n.jsx("div",{className:"text-sm text-gray-700",children:f.subtitle})]}),n.jsx("div",{className:"text-sm font-semibold text-gray-800",children:f.fee===0?"Free":$e(f.fee,(K==null?void 0:K.currency)||Ge)})]},d)})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:zr,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:po,disabled:A,className:`px-6 py-2.5 rounded-full font-semibold text-white shadow-md transition-all duration-300 ${A?"opacity-60 cursor-not-allowed":"hover:-translate-y-0.5 hover:shadow-lg"}`,style:{background:"var(--tanya)"},children:A?"Delivery Submitted":"Submit Delivery Option"})]})]}),Fe&&n.jsxs("div",{className:"mt-2 mb-6 mx-6 rounded-xl p-6 shadow-md border border-gray-200 bg-white animate-fade-in",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("h3",{className:"font-semibold text-lg text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-outline",width:"24",color:"var(--tanya-light)"}),"Almost done! 💳"]}),Z&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded-full bg-green-100 text-green-700 font-semibold",children:"Selected"}),!ae&&n.jsx("button",{onClick:yo,className:"ml-2 text-xs px-2 py-1 rounded-full border hover:bg-gray-50",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},title:"Change payment method",children:"Change"})]})]}),n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Please choose a payment method for this order:"}),n.jsx("div",{className:`space-y-3 ${Z?"opacity-70":""}`,children:n.jsxs("label",{className:`flex items-start gap-3 p-4 border rounded-lg cursor-pointer transition hover:shadow-sm ${se==="card"?"border-tanya-light":"border-gray-300"} ${Z?"pointer-events-none":""}`,title:Z?"Payment already submitted":"",children:[n.jsx("input",{type:"radio",name:"payment",className:"mt-1 accent-tanya-light",checked:se==="card",disabled:Z,onChange:()=>ve("card")}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[n.jsx(oe,{icon:"mdi:credit-card-chip-outline",width:"18"})," ","Credit Card"]}),se==="card"&&n.jsxs("div",{className:"text-sm text-gray-700 mt-1",children:["Mastercard •••• 7820",n.jsx("br",{}),"Expiry: 12/26"]})]})]})}),n.jsxs("div",{className:"flex justify-between pt-4",children:[n.jsx("button",{onClick:wo,className:"px-6 py-2.5 rounded-full font-semibold border transition-all hover:-translate-y-0.5 hover:shadow-sm",style:{borderColor:"var(--tanya-light)",color:"var(--tanya-light)"},children:"Cancel"}),n.jsx("button",{onClick:xo,disabled:Z,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"}`,style:{background:"var(--tanya)"},children:Z?"Payment Submitted":"Submit Payment Method"})]})]}),Pe&&Rr({...K,address:JSON.parse(localStorage.getItem("agentic_order_address")||"null"),delivery:localStorage.getItem("agentic_order_delivery"),payment:localStorage.getItem("agentic_order_payment"),summary:Lr(K==null?void 0:K.currency)},!1)]}),n.jsxs("div",{className:"sticky bottom-0 w-[96%] drop-shadow-xl flex items-center rounded-full bg-white border border-gray-300 m-[15px]",children:[n.jsx("input",{placeholder:O?"Complete the current step…":jt?`What would you like me to do? (e.g., If this product goes below $${parseInt(r.price)-5}, grab it for me.)`:"Oops! This combination isn’t available for this product. Try a different option.",disabled:io,className:`w-full rounded-full p-4 outline-none border-none focus:ring-0 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed
|
|
25
25
|
${jt?"":"placeholder:text-red-400 text-red-500"}`,value:pe,onKeyDown:d=>{d.key==="Enter"&&!_e&&!O&&Dr()},onChange:d=>q(d.target.value)}),n.jsx("button",{type:"submit",disabled:_e||O,className:"mr-6 font-medium",style:{color:"var(--tanya-light)"},onClick:()=>Dr(),children:_e?n.jsx("div",{className:"m-3 animate-spin rounded-full h-6 w-6 border-b-2",style:{borderBottom:"2px solid"}}):n.jsx(oe,{icon:"fluent:send-48-filled",color:"var(--tanya-light)",width:"24",height:"24"})})]})]})})]}),document.body)};exports.AgenticShoppingButton=Ba;exports.TanyaChatbot=Fs;exports.TanyaChatbotProvider=To;
|