PageSourceSearch

http://mindshare.com/_nuxt/D4IZ_X8J.js

js mindshare.com collected 2026-10-02 18:31:58 UTC 49,990 bytes, 1 lines download raw bytes

1import{_ as st}from"./2WB3vVbz.js";import{d as F,y as ce,f as k,c as g,o as l,i as x,a as s,u as n,g as f,h as R,D as W,r as D,m as Ae,E as Re,l as me,e as E,z as ee,s as he,j as C,_ as ie,v as Q,x as z,t as y,n as te,F as re,k as ue,b as ne,G as be,C as $e,H as pe,I as Te,J as se,K as fe,L as Le,M as Ue,q as ke,N as ot,O as at,T as it,P as lt,Q as rt}from"#entry";import{_ as _e}from"./BcEivbYL.js";import{_ as Qe}from"./DlAUqK2U.js";import{t as De}from"./D9z0N2sr.js";import{_ as dt}from"./BSaJcsec.js";import{g as ut,a as ct,b as mt}from"./Dj0WZZ1g.js";import{f as pt}from"./DVK2dzjt.js";import{u as gt}from"./Bw8nrQcX.js";import{w as vt}from"./nK1RUbYW.js";import{u as Be}from"./BXdSlQ7M.js";import{r as Y,c as ft,b as yt}from"./CFxNcTbF.js";import{u as xt,g as ht,_ as Ve,a as bt}from"./d8hqt6dW.js";import{f as $t}from"./fINzoL9r.js";import{_ as _t}from"./CCp8InLt.js";import{_ as wt}from"./DY5Z0UNy.js";import{_ as Ct,a as It}from"./DkPDF3nk.js";import"./sGHIt4b6.js";import"./BZgEL4my.js";import"./CF8f_aNJ.js";import"./ByAx9EQI.js";import"./Crwfu-dM.js";import"./BN6xg-KY.js";import"./Ci8iIgQs.js";import"./IFQjBq-e.js";const St={class:"relative flex md:flex-row mt-6 mb-[24px] lg:mb-[40px]"},kt={key:0},Vt=F({__name:"CartHeader",emits:["continue-shopping"],setup(e){const{mobile:a}=ce();return(t,r)=>{const o=k("v-icon"),u=k("v-btn");return l(),g("div",St,[n(a)?x("",!0):(l(),g("div",kt,[f(u,{onClick:r[0]||(r[0]=i=>t.$emit("continue-shopping")),rounded:"",color:"primary_green"},{default:R(()=>[f(o,{icon:"mdi-chevron-left"}),r[1]||(r[1]=s("span",null,"Continue Shopping",-1))]),_:1})])),r[2]||(r[2]=s("p",{class:"absolute left-1/2 transform -translate-x-1/2 text-center text-xl lg:text-4xl font-semibold mb-[24px] lg:mb-4 text-[#1B1F1B]"}," Cart ",-1))])}}}),At={},Rt={class:"flex flex-row gap-20 w-full p-3 py-[5.3rem] border-2 border-[#DEE7D3] m-rounded items-center justify-center"};function Dt(e,a){const t=k("v-progress-circular");return l(),g("div",Rt,[f(t,{indeterminate:"",color:"primary_green"})])}const ge=Qe(At,[["render",Dt]]),ze=async(e,a,t)=>W(`coupons/validate/${e}/user/${a}/${t}`,{method:"GET"},{withAuthorization:!0}),je=async(e,a)=>W(`coupons/code/${e}/${a}`,{method:"GET"}),qt=async(e,a,t=null)=>t?W(`user-cart/user-cart-item/${e}/update-quantity`,{method:"POST",body:{quantity:a,cart_uuid:t}}):W(`user-cart/user-cart-item/${e}/update-quantity`,{method:"POST",body:{quantity:a}},{withAuthorization:!0}),we=()=>{const e=D(!1),a=Ae(),t=Re(),r=me();return{requestIsSending:e,useUpdateUserCartItemQuantity:async(u,i)=>{e.value=!0;let m=null;!r.$state.user&&t.$state.cart_uuid&&(m=t.$state.cart_uuid);const{data:p,error:d}=await qt(u,i,m);return e.value=!1,p.value&&(t.$state=p.value),d.value&&(d.value.statusCode===422&&d.value.data?.message?a.error(d.value.data.message):a.error("Something went wrong while updating product quantity")),{data:p,error:d}}}},Oe=async e=>W(`user-cart/user-cart-item/${e}/remove-coupon`,{method:"POST"},{withAuthorization:!0}),Pt={key:0,class:"flex flex-col lg:flex-row lg:gap-8 w-full p-3 border-2 border-[#DEE7D3] m-rounded"},Et={class:"flex flex-col gap-1 lg:w-2/3"},Ft={class:"text-sm font-semibold text-[#334A0F]"},Lt={class:"flex flex-col w-full"},Ut=["textContent"],Bt={key:1,class:"text-md sm:text-2xl font-semibold text-orange-700"},Nt={class:"border-[#919490] border-b pb-2 text-[#919490] flex flex-row justify-between items-end"},Tt={key:0},Qt={class:"pl-4"},zt=["href"],jt={class:"flex flex-col xl:flex-row md:mt-4"},Ot={class:"flex flex-row w-full xl:w-1/2"},Mt={key:0,class:"text-[#4C4E4D] w-1/3 text-center mt-4"},Gt={key:1,class:"w-2/3"},Ht={key:0,class:"flex flex-row w-full xl:w-1/2"},Wt={key:0,class:"text-[#4C4E4D] w-1/3 text-center mt-4"},Zt={class:"w-2/3 flex items-center"},Kt={key:1},Xt={key:0,class:"text-primary-green font-[500] text-lg"},Jt={key:1,class:"text-primary-green font-[500] text-lg"},Yt={class:"w-full flex flex-row lg:w-1/3"},en={class:"w-1/3 flex justify-center lg:items-center"},tn={class:"w-2/3 flex flex-column justify-center items-end"},nn={class:"w-40 font-semibold text-xl md:text-2xl text-[#454F45]"},sn={class:"w-40 font-semibold text-l text-[#919490] mt-2"},on=["textContent"],an=["textContent"],ln=F({__name:"CartCard",props:{cartItem:{},categories:{},showQuantity:{type:Boolean},loading:{type:Boolean}},emits:["updatePrice","itemRemoved","couponRemoved"],setup(e,{emit:a}){ce();const t=e,r=a,o=E(()=>t.cartItem.product),u=me(),i=D("NOTUSED"),m=D(t.cartItem.coupon),p=D(""),d=D(t.cartItem.coupon?.coupon_code||""),I=async()=>
1{if(console.log("couponInputHandler"),!!u.$state.user&&(await S(),i.value&&d.value)){const{data:c,error:b}=await je(d.value||"",t.cartItem.id);if(b.value){m.value=null;return}c.value&&(m.value=c.value?.data)}},h=async c=>{try{await pe(c,{emit:r,eventName:"itemRemoved"})&&r("itemRemoved",c)}catch(b){console.error("Error removing item from cart:",b)}},{requestIsSending:P,useUpdateUserCartItemQuantity:B}=we();let V;const O=async c=>{P.value||(V&&clearTimeout(V),V=setTimeout(async()=>{if(!c)return;const{data:b}=await B(t.cartItem.record_id,c);b.value&&(t.cartItem.quantity=c,r("updatePrice"))},400))};ee(()=>d.value,(c,b)=>{c!==b&&S()},{deep:!0});const _=async()=>{if(!u.$state.user)return;if(!d.value){i.value="INVALID";return}const{data:c,error:b}=await ze(d.value,u.$state.user?.uuid||"",o.value.id);console.log(c.value),b.value&&(i.value="INVALID"),c.value?.valid?(i.value="VALID",se()):i.value="INVALID",r("updatePrice")},S=De(function(){_()},1e3),q=c=>{const b=o.value.price*Te(c)-m.value.value;return b<0?0:b.toFixed(2)},v=()=>{u.$state.user&&Oe(t.cartItem.record_id).then(c=>{c.data.value&&(se(),d.value="",i.value="NOTUSED"),c.error.value&&(d.value=t.cartItem.coupon.coupon_code)})};return he(async()=>{await I()}),(c,b)=>{const N=_e,M=k("v-text-field"),G=k("v-icon"),oe=k("v-btn"),L=ge,j=ie;return l(),C(j,null,{default:R(()=>[e.cartItem?Q((l(),g("div",Pt,[s("div",Et,[s("p",Ft,y(n(p)),1),s("div",Lt,[n(o)?(l(),C(N,{key:0,to:`/elearning-course/${n(o)?.slug}`},{default:R(()=>[s("p",{class:"text-xl sm:text-2xl font-semibold",textContent:y(n(o)?.name)},null,8,Ut)]),_:1},8,["to"])):(l(),g("div",Bt," eLearning Course Not Available ")),s("div",Nt,[s("div",{class:te(["flex flex-col text-sm md:text-md",{"line-through":!n(o)}])},[s("span",null,"Instructor(s): "+y(n(o)?.instructor_fullname),1),s("span",null,"Equivalent of: "+y(n(o)?.equivelent_of)+"-day course",1),s("span",null,"Subscription Length: "+y(n(o)?.subscription_length)+" days",1),n(o)?.elearning_courses.length?(l(),g("div",Tt,[b[6]||(b[6]=s("div",{class:"mt-2"},[s("strong",null,"Courses included:")],-1)),s("div",Qt,[(l(!0),g(re,null,ue(n(o)?.elearning_courses,U=>(l(),g("p",{key:`child_course_${U.id}`},[b[5]||(b[5]=ne(" - ",-1)),s("a",{href:`/elearning-course/${U.slug}`,target:"_blank",class:"text-blue-500 underline"},y(U.name),9,zt)]))),128))])])):x("",!0)],2)]),s("div",jt,[s("div",Ot,[e.showQuantity&&!e.cartItem.is_extension?(l(),g("span",Mt,"Quantity:")):x("",!0),e.showQuantity&&!e.cartItem.is_extension?(l(),g("div",Gt,[f(M,{"data-testid":"quantity_field",loading:n(P),disabled:n(P),type:"number",min:"1",step:"1",inputmode:"numeric",pattern:"[0-9]*",oninput:"validity.valid||(value='');",modelValue:e.cartItem.quantity,"onUpdate:modelValue":b[0]||(b[0]=U=>e.cartItem.quantity=U),value:e.cartItem.quantity,onInput:b[1]||(b[1]=U=>O(U.target.value)),class:"mt-2",density:"compact",variant:"outlined",rounded:""},null,8,["loading","disabled","modelValue","value"])])):x("",!0)]),n(be)()&&!e.cartItem.is_extension?(l(),g("div",Ht,[e.showQuantity?(l(),g("span",Wt,"Coupon:")):x("",!0),s("div",Zt,[n(u).$state.user?(l(),C(M,{key:0,"data-testid":"coupon_code",modelValue:n(d),"onUpdate:modelValue":b[2]||(b[2]=U=>$e(d)?d.value=U:null),value:n(d),disabled:n(i)==="VALID",oninput:"validity.valid||(value='');",onInput:b[3]||(b[3]=U=>I()),class:"mt-2",density:"compact",variant:"outlined",rounded:"",clearable:"","onClick:clear":v},null,8,["modelValue","value","disabled"])):x("",!0),n(d)&&n(i)!="NOTUSED"?(l(),g("div",{key:1,class:te(["mt-[-12px] ml-4",n(i)=="VALID"?"text-green-600":"text-red-600"])},[n(i)=="VALID"?(l(),C(G,{key:0,class:"cursor-pointer mr-2",onClick:v,icon:"mdi-close-circle",title:"Remove coupon",color:"red"})):x("",!0),n(i)=="VALID"?(l(),C(G,{key:1,icon:"mdi-check",color:"green"})):n(i)=="INVALID"?(l(),C(G,{key:2,icon:"mdi-close",color:"red"})):x("",!0),ne(" "+y(n(i)),1)],2)):x("",!0)])])):x("",!0),e.cartItem.is_extension?(l(),g("div",Kt,[e.cartItem.extension_type=="HALF"?(l(),g("span",Xt,"50% EXTENSION")):x("",!0),e.cartItem.extension_type=="FULL"?(l(),g("span",Jt,"FULL PRICE EXTENSION")):x("",!0)])):x("",!0)])])]),s("div",Yt,[s("div",en,[f(oe,{"data-testid":"remove_button",color:"#C4D0C7",icon:"mdi-trash-can-outline",variant:"text",onClick:b[4]||(b[4]=U=>h(e.cartItem))})]),s("div",tn,[s("span",nn," $"+y(n(o)&&e.cartItem.quantity?(Number(n(o)[e.cartItem.price_type])*e.cartItem.quantity).toFixed(2):"0.00"),1),s("span",sn,y(e.cartItem.quantity)+" x $"+y(n(o)?Number(n(o)[e.cartItem.price_type]).toFixed(2):"0"),1),n(m)&&n(i)=="VALID"?(l(),g("span",{key:0,class:"w-40 font-semibold text-md text-[#454F45]",textContent:y(`$ -${n(m).value}`)},null,8,on)):x("",!0),n(m)&&n(i)=="VALID"?(l(),g("span",{key:1,class:"w-40 border-t font-semibold text-md text-[#454F45]",textContent:y(`$ ${q(e.cartItem)}`)},null,8,an)):x("",!0)])])],512)),[[z,!e.loading]]):x("",!0),Q(f(L,null,
1null,512),[[z,e.loading]])]),_:1})}}}),rn={key:0,class:"flex flex-col lg:flex-row lg:gap-8 w-full p-3 border-2 border-[#DEE7D3] m-rounded"},dn={class:"flex flex-col lg:w-2/3"},un={class:"flex flex-col w-full"},cn=["textContent"],mn={key:1,class:"text-2xl font-semibold text-orange-700"},pn={class:"border-[#919490] border-b pb-2 text-[#919490] flex flex-row justify-between items-end"},gn={class:"flex flex-col md:flex-row md:mt-4"},vn={class:"flex flex-row w-full xl:w-1/2"},fn={key:0,class:"text-[#4C4E4D] text-base w-1/3 text-center mt-4"},yn={key:1,class:"w-2/3"},xn={class:"w-full flex flex-row lg:w-1/3"},hn={class:"w-1/3 flex justify-center lg:items-center"},bn={class:"w-2/3 flex flex-column justify-center items-end"},$n={class:"w-40 font-semibold text-xl md:text-2xl text-[#454F45]"},_n={class:"w-40 font-semibold text-l md:text-xl text-[#919490] mt-2"},wn=F({__name:"CartCard",props:{cartItem:{},showQuantity:{type:Boolean},loading:{type:Boolean},getShippingRatesRequestIsSending:{type:Boolean}},emits:["updatePrice","itemRemoved"],setup(e,{emit:a}){const t=e,r=a,o=E(()=>t.cartItem.product),u=async I=>{try{await pe(I,{emit:r,eventName:"itemRemoved"})&&r("itemRemove",I)}catch(h){console.error("Error removing item from cart:",h)}},{requestIsSending:i,useUpdateUserCartItemQuantity:m}=we();let p;const d=I=>{console.log("updatePrice ",t.getShippingRatesRequestIsSending),!(i.value||t.getShippingRatesRequestIsSending)&&(p&&clearTimeout(p),p=setTimeout(async()=>{if(!I)return;const{data:h}=await m(t.cartItem.record_id,I);h.value&&(t.cartItem.quantity=I,r("updatePrice"))},400))};return(I,h)=>{const P=_e,B=k("v-text-field"),V=k("v-btn"),O=ge,_=ie;return l(),C(_,null,{default:R(()=>[e.cartItem?Q((l(),g("div",rn,[s("div",dn,[s("div",un,[n(o)?(l(),C(P,{key:0,to:`/ebook/${n(o)?.slug}`},{default:R(()=>[s("p",{class:"text-xl sm:text-2xl font-semibold",textContent:y(n(o)?.name+` - ${e.cartItem?.type==="Ebook"?"eBook":e.cartItem?.type}`)},null,8,cn)]),_:1},8,["to"])):(l(),g("div",mn,y(e.cartItem?.type)+" Not Available ",1)),s("div",pn,[s("div",{class:te(["flex flex-col text-sm md:text-sm",{"line-through":!n(o)}])},[s("span",null,"Author(s): "+y(n(o)?.authors),1),s("span",null,"Publisher: "+y(n(o)?.publisher),1),s("span",null,"Pages: "+y(n(o)?.pages),1)],2)]),s("div",gn,[s("div",vn,[e.showQuantity?(l(),g("span",fn,"Quantity:")):x("",!0),e.showQuantity?(l(),g("div",yn,[f(B,{"data-testid":"quantity_field",loading:n(i)||e.getShippingRatesRequestIsSending,disabled:n(i)||e.getShippingRatesRequestIsSending,type:"number",min:"1",step:"1",inputmode:"numeric",pattern:"[0-9]*",oninput:"validity.valid||(value='');",modelValue:e.cartItem.quantity,"onUpdate:modelValue":h[0]||(h[0]=S=>e.cartItem.quantity=S),value:e.cartItem.quantity,onInput:h[1]||(h[1]=S=>d(S.target.value)),class:"mt-2",density:"compact",variant:"outlined",rounded:""},null,8,["loading","disabled","modelValue","value"])])):x("",!0)])])])]),s("div",xn,[s("div",hn,[f(V,{"data-testid":"remove_button",color:"#C4D0C7",icon:"mdi-trash-can-outline",variant:"text",onClick:h[2]||(h[2]=S=>u(e.cartItem))})]),s("div",bn,[s("span",$n," $"+y(n(o)&&e.cartItem.quantity?(Number(n(o)[e.cartItem.price_type])*e.cartItem.quantity).toFixed(2):"0.00"),1),s("span",_n,y(e.cartItem.quantity)+" x $"+y(n(o)?Number(n(o)[e.cartItem.price_type]).toFixed(2):"0"),1)])])],512)),[[z,!e.loading]]):x("",!0),Q(f(O,null,null,512),[[z,e.loading]])]),_:1})}}}),Cn=async(e,a,t)=>W(`public-class-coupons/validate/${e}/user/${a}/${t}`,{method:"GET"},{withAuthorization:!0}),In=async e=>W(`public-class-coupons/code/${e}`,{method:"GET"}),Sn=async e=>W(`user-cart/user-cart-item/${e}/remove-public-class-coupon`,{method:"POST"},{withAuthorization:!0}),kn={class:"flex flex-col lg:flex-row gap-4 lg:gap-8 w-full p-3 border-2 border-[#DEE7D3] m-rounded"},Vn={class:"flex flex-col gap-1 lg:w-2/3"},An={class:"flex flex-col gap-1 w-full"},Rn=["textContent"],Dn={key:0,class:"text-md sm:text-2xl font-semibold text-orange-700"},qn={class:"border-[#919490] border-b pb-2 text-[#919490] flex flex-row justify-between items-end"},Pn={class:"flex flex-col xl:flex-row md:mt-4"},En={class:"flex flex-row w-full xl:w-1/2"},Fn={key:0,class:"text-[#4C4E4D] w-1/3 text-center mt-4"},Ln={key:1,class:"w-2/3"},Un={key:0,class:"flex flex-row w-full xl:w-1/2"},Bn={key:0,class:"text-[#4C4E4D] w-1/3 text-center mt-4"},Nn={class:"w-2/3 flex items-center"},Tn={class:"w-full flex flex-row lg:w-1/3"},Qn={class:"w-1/3 flex justify-center lg:items-center"},zn={class:"w-2/3 flex flex-column justify-center items-end"},jn={class:"w-40 font-semibold text-3xl text-[#454F45]"},On={class:"w-40 font-semibold text-l text-[#919490] mt-2"},Mn=["textContent"],Gn=["textContent"],Hn=F({__name:"CartCard",props:{cartItem:{},showQuantity:{type:Boolean},loading:{type:Boolean}},emits:["updatePrice","itemRemoved"],setup(e,{emit:a}){const t=e,r=me(),o=a,u=D(t.cartItem.publicClassCoupon?.coupon_code||""),i=D("NOTUSED"),m=D(t.cartItem.publicClassCoupon),p=E(()=>t.cartItem.product),d=async v=>{try{await pe(v,{emit:o,eventName:"itemRemoved"})&&o("itemRemoved",v)}catch(c){console.error("Error removing item from cart:",c)}},{requestIsSending:I,useUpdateUserCartItemQuantity:h}=we();let P;const B=v=>{I.value||(P&&clearTimeout(P),P=setTimeout(async()=>
1{if(!v)return;const{data:c}=await h(t.cartItem.record_id,v);c.value&&(t.cartItem.quantity=v,o("updatePrice"))},400))};ee(()=>u.value,(v,c)=>{v!==c&&q()},{deep:!0});const V=async()=>{if(r.$state.user){if(await q(),i.value&&u.value){const{data:v,error:c}=await In(u.value||"");if(c.value){m.value=null;return}v.value&&(m.value=v.value?.data)}console.log("sadsa",u.value)}},O=v=>{const c=p.value.price*Te(v)-m.value.value;return c<0?0:c.toFixed(2)},_=()=>{r.$state.user&&Sn(t.cartItem.record_id).then(v=>{v.data.value&&(se(),u.value="",i.value="NOTUSED"),v.error.value&&(u.value=t.cartItem.publicClassCoupon.coupon_code)})},S=async()=>{if(!r.$state.user)return;if(!u.value){i.value="INVALID";return}const{data:v,error:c}=await Cn(u.value,r.$state.user?.uuid||"",p.value.id);console.log(v.value),c.value&&(i.value="INVALID"),v.value?.valid?(i.value="VALID",se()):i.value="INVALID",o("updatePrice")},q=De(function(){S()},1e3);return he(async()=>{await V()}),(v,c)=>{const b=_e,N=k("v-text-field"),M=k("v-icon"),G=k("v-btn"),oe=ge,L=ie;return l(),C(L,null,{default:R(()=>[Q(s("div",kn,[s("div",Vn,[s("div",An,[f(b,{to:`/public-class/${n(p)?.slug}`},{default:R(()=>[s("p",{class:"text-2xl sm:text-3xl font-semibold",textContent:y(n(p)?.name)},null,8,Rn)]),_:1},8,["to"]),n(p)?x("",!0):(l(),g("div",Dn," Public Class Not Available ")),s("div",qn,[s("div",{class:te(["flex flex-col text-sm md:text-md",{"line-through":!n(p)}])},[s("span",null,"Instructor: "+y(n(p)?.instructor),1),s("span",null,"Location: "+y(n(p)?.location),1),s("span",null,"Duration: "+y(n(p)?.duration),1)],2)]),s("div",Pn,[s("div",En,[e.showQuantity?(l(),g("span",Fn,"Quantity:")):x("",!0),e.showQuantity?(l(),g("div",Ln,[f(N,{"data-testid":"quantity_field",type:"number",min:"1",step:"1",inputmode:"numeric",pattern:"[0-9]*",oninput:"validity.valid||(value='');",modelValue:e.cartItem.quantity,"onUpdate:modelValue":c[0]||(c[0]=j=>e.cartItem.quantity=j),value:e.cartItem.quantity,onInput:c[1]||(c[1]=j=>B(j.target.value)),class:"mt-2",density:"compact",variant:"outlined",rounded:""},null,8,["modelValue","value"])])):x("",!0)]),n(be)()&&!e.cartItem.is_extension?(l(),g("div",Un,[e.showQuantity?(l(),g("span",Bn,"Coupon:")):x("",!0),s("div",Nn,[n(r).$state.user?(l(),C(N,{key:0,"data-testid":"coupon_code",modelValue:n(u),"onUpdate:modelValue":c[2]||(c[2]=j=>$e(u)?u.value=j:null),value:n(u),disabled:n(i)==="VALID",oninput:"validity.valid||(value='');",onInput:c[3]||(c[3]=j=>V()),class:"mt-2",density:"compact",variant:"outlined",rounded:"",clearable:"","onClick:clear":_},null,8,["modelValue","value","disabled"])):x("",!0),n(u)&&n(i)!="NOTUSED"?(l(),g("div",{key:1,class:te(["mt-[-12px] ml-4",n(i)=="VALID"?"text-green-600":"text-red-600"])},[n(i)=="VALID"?(l(),C(M,{key:0,class:"cursor-pointer mr-2",onClick:_,icon:"mdi-close-circle",title:"Remove coupon",color:"red"})):x("",!0),n(i)=="VALID"?(l(),C(M,{key:1,icon:"mdi-check",color:"green"})):n(i)=="INVALID"?(l(),C(M,{key:2,icon:"mdi-close",color:"red"})):x("",!0),ne(" "+y(n(i)),1)],2)):x("",!0)])])):x("",!0)])])]),s("div",Tn,[s("div",Qn,[f(G,{"data-testid":"remove_button",color:"#C4D0C7",icon:"mdi-trash-can-outline",variant:"text",onClick:c[4]||(c[4]=j=>d(e.cartItem))})]),s("div",zn,[s("span",jn," $"+y(n(p)&&e.cartItem.quantity?(Number(n(p)[e.cartItem.price_type])*e.cartItem.quantity).toFixed(2):"0.00"),1),s("span",On,y(e.cartItem.quantity)+" x $"+y(n(p)?Number(n(p)[e.cartItem.price_type]).toFixed(2):"0"),1),n(m)&&n(i)=="VALID"?(l(),g("span",{key:0,class:"w-40 font-semibold text-md text-[#454F45]",textContent:y(`$ -${n(m).value}`)},null,8,Mn)):x("",!0),n(m)&&n(i)=="VALID"?(l(),g("span",{key:1,class:"w-40 border-t font-semibold text-md text-[#454F45]",textContent:y(`$ ${O(e.cartItem)}`)},null,8,Gn)):x("",!0)])])],512),[[z,!e.loading]]),Q(f(oe,null,null,512),[[z,e.loading]])]),_:1})}}}),Wn={key:0,class:"flex flex-col lg:flex-row lg:gap-8 w-full p-3 border-2 border-[#DEE7D3] m-rounded"},Zn={class:"flex flex-col gap-1 lg:w-2/3"},Kn={class:"flex flex-col gap-1 w-full"},Xn=["textContent"],Jn={class:"w-full flex flex-row lg:w-1/3"},Yn={class:"w-1/3 flex justify-center lg:items-center"},es={class:"w-2/3 flex flex-column justify-center items-end"},ts=["textContent"],ns=F({__name:"CartCard",props:{cartItem:{},loading:{type:Boolean}},emits:["itemRemoved"],setup(e,{emit:a}){const t=e,r=a,o=E(()=>t.cartItem.product),u=async i=>{try{await pe(i,{emit:r,eventName:"itemRemoved"})&&r("itemRemove",i)}catch(m){console.error("Error removing item from cart:",m)}};return(i,m)=>{const p=_e,d=k("v-btn"),I=ge,h=ie;return l(),C(h,null,{default:R(()=>[e.cartItem?Q((l(),g("div",Wn,[s("div",Zn,[s("div",Kn,[f(p,{to:"Books/Library_subscription"},{default:R(()=>[s("p",{class:"text-xl sm:text-3xl font-semibold",textContent:y(n(o).name)},null,8,Xn)]),_:1}),m[1]||(m[1]=s("div",{class:"border-[#919490] border-b pb-2 text-[#919490] flex flex-row justify-between items-end"},null,-1))])]),s("div",Jn,[s("div",Yn,[f(d,{"data-testid":"remove_button",color:"#C4D0C7",icon:"mdi-trash-can-outline",variant:"text",onClick:m[0]||(m[0]=P=>u(e.cartItem))})]),s("div",es,[s("span",{class:"w-40 font-semibold text-xl md:text-3xl text-[#454F45]",textContent:y(`$${Number(n(o)[e.cartItem.price_type]).toFixed(2)}`)},null,8,ts)])])],512)),[[z,!e.loading]]):x("",!0),Q(f(I,null,null,512),[[z,e.loading]])]),_:1})}}}),ss={key:0,class:"flex flex-col lg:flex-row lg:gap-8 w-full p-3 border-2 border-[#DEE7D3] m-rounded"},os={class:"flex flex-col gap-1 lg:w-2/3"},as={class:"flex flex-col gap-1 w-full"},is=["textContent"],ls={class:"border-[#919490] border-b pb-2 text-[#919490] flex flex-row justify-between items-end"},rs={class:"flex flex-col xl:flex-row md:mt-4"},ds={class:"flex flex-row w-full xl:w-1/2"},us={key:0,class:"text-[#4C4E4D] w-1/3 text-center mt-4"},cs={key:1,class:"w-2/3"},ms={key:0,class:"flex flex-row w-full xl:w-1/2"}
1,ps={key:0,class:"text-[#4C4E4D] w-1/3 text-center mt-4"},gs={class:"w-2/3 flex items-center"},vs={class:"w-full flex flex-row lg:w-1/3"},fs={class:"w-1/3 flex justify-center lg:items-center"},ys={class:"w-2/3 flex flex-column justify-center items-end"},xs={class:"w-40 font-semibold text-xl md:text-2xl text-[#454F45]"},hs={class:"w-40 font-semibold text-l text-[#919490] mt-2"},bs=["textContent"],$s=["textContent"],_s=F({__name:"CartCard",props:{cartItem:{},loading:{type:Boolean},showQuantity:{type:Boolean}},emits:["itemRemoved","updatePrice","couponRemoved"],setup(e,{emit:a}){ce();const t=e,r=a,o=E(()=>t.cartItem.product),u=me(),i=D("NOTUSED"),m=D(t.cartItem.coupon),p=D(t.cartItem.coupon?.coupon_code||""),{requestIsSending:d,useUpdateUserCartItemQuantity:I}=we();let h;const P=async v=>{try{await pe(v,{emit:r,eventName:"itemRemoved"})&&r("itemRemove",v)}catch(c){console.error("Error removing item from cart:",c)}},B=async v=>{d.value||(h&&clearTimeout(h),h=setTimeout(async()=>{if(!v)return;const{data:c}=await I(t.cartItem.record_id,v);c.value&&(t.cartItem.quantity=v,r("updatePrice"))},400))},V=async()=>{if(u.$state.user&&(await _(),i.value&&p.value)){const{data:v,error:c}=await je(p.value||"");if(c.value){m.value=null;return}v.value&&(m.value=v.value?.data)}},O=async()=>{if(!u.$state.user)return;if(!p.value){i.value="INVALID";return}const{data:v,error:c}=await ze(p.value,u.$state.user?.uuid||"",o.value.id);c.value&&(i.value="INVALID"),v.value?.valid?(i.value="VALID",se()):i.value="INVALID",r("updatePrice")},_=De(function(){O()},1e3),S=v=>{const c=o.value.price*v.quantity-m.value.value;return c<0?0:c.toFixed(2)},q=()=>{u.$state.user&&Oe(t.cartItem.record_id).then(v=>{v.data.value&&(se(),p.value="",i.value="NOTUSED"),v.error.value&&(p.value=t.cartItem.coupon.coupon_code)})};return ee(()=>p.value,(v,c)=>{v!==c&&_()},{deep:!0}),he(async()=>{await V()}),(v,c)=>{const b=k("v-text-field"),N=k("v-icon"),M=k("v-btn"),G=ge,oe=ie;return l(),C(oe,null,{default:R(()=>[e.cartItem?Q((l(),g("div",ss,[s("div",os,[s("div",as,[s("p",{class:"text-xl sm:text-2xl font-semibold",textContent:y(n(o)?.name)},null,8,is),s("div",ls,[s("div",{class:te(["flex flex-col text-sm md:text-md",{"line-through":!n(o)}])},[s("span",null,y(n(o)?.description),1)],2)]),s("div",rs,[s("div",ds,[e.showQuantity&&n(fe)()?(l(),g("span",us,"Quantity:")):x("",!0),e.showQuantity&&n(fe)()?(l(),g("div",cs,[f(b,{"data-testid":"quantity_field",loading:n(d),disabled:n(d),type:"number",min:"1",step:"1",inputmode:"numeric",pattern:"[0-9]*",oninput:"validity.valid||(value='');",modelValue:e.cartItem.quantity,"onUpdate:modelValue":c[0]||(c[0]=L=>e.cartItem.quantity=L),value:e.cartItem.quantity,onInput:c[1]||(c[1]=L=>B(L.target.value)),class:"mt-2",density:"compact",variant:"outlined",rounded:""},null,8,["loading","disabled","modelValue","value"])])):x("",!0)]),n(be)()&&n(fe)()?(l(),g("div",ms,[e.showQuantity&&n(fe)()?(l(),g("span",ps,"Coupon:")):x("",!0),s("div",gs,[n(u).$state.user?(l(),C(b,{key:0,"data-testid":"coupon_code",modelValue:n(p),"onUpdate:modelValue":c[2]||(c[2]=L=>$e(p)?p.value=L:null),value:n(p),disabled:n(i)==="VALID",oninput:"validity.valid||(value='');",onInput:c[3]||(c[3]=L=>V()),class:"mt-2",density:"compact",variant:"outlined",rounded:"",clearable:"","onClick:clear":q},null,8,["modelValue","value","disabled"])):x("",!0),n(p)&&n(i)!="NOTUSED"?(l(),g("div",{key:1,class:te(["mt-[-12px] ml-4",n(i)=="VALID"?"text-green-600":"text-red-600"])},[n(i)=="VALID"?(l(),C(N,{key:0,class:"cursor-pointer mr-2",onClick:q,icon:"mdi-close-circle",title:"Remove coupon",color:"red"})):x("",!0),n(i)=="VALID"?(l(),C(N,{key:1,icon:"mdi-check",color:"green"})):n(i)=="INVALID"?(l(),C(N,{key:2,icon:"mdi-close",color:"red"})):x("",!0),ne(" "+y(n(i)),1)],2)):x("",!0)])])):x("",!0)])])]),s("div",vs,[s("div",fs,[f(M,{"data-testid":"remove_button",color:"#C4D0C7",icon:"mdi-trash-can-outline",variant:"text",onClick:c[4]||(c[4]=L=>P(e.cartItem))})]),s("div",ys,[s("span",xs,"$"+y(n(o)&&e.cartItem.quantity?(Number(n(o).price)*e.cartItem.quantity).toFixed(2):"0.00"),1),s("span",hs,y(e.cartItem.quantity)+" x $"+y(n(o)?Number(n(o).price).toFixed(2):"0"),1),n(m)&&n(i)=="VALID"?(l(),g("span",{key:0,class:"w-40 font-semibold text-md text-[#454F45]",textContent:y(`$ -${n(m).value}`)},null,8,bs)):x("",!0),n(m)&&n(i)=="VALID"?(l(),g("span",{key:1,class:"w-40 border-t font-semibold text-md text-[#454F45]",textContent:y(`$ ${S(e.cartItem)}`)},null,8,$s)):x("",!0)])])],512)),[[z,!e.loading]]):x("",!0),Q(f(G,null,null,512),[[z,e.loading]])]),_:1})}}}),ws=F({__name:"CartItemsList",props:{cartItems:{},categories:{},loading:{type:Boolean},showQuantity:{type:Boolean},shippingLoading:{type:Boolean}},emits:["item-removed","item-with-shipping-removed","update-price"],setup(e){return(a,t)=>{const r=ln,o=wn,u=Hn,i=ns,m=_s,p=ie;return l(),g("div",null,[(l(!0),g(re,null,ue(e.cartItems,(d,I)=>(l(),g("div",{key:`cart_card_${d.record_id}`,class:"mb-6"},[(l(),C(p,{key:`cart_card_client_${d.record_id}`},{default:R(()=>[d.type==="ElearningCourse"?(l(),C(r,{key:`elearning_course_card_${d.record_id}_${d.price_type}_${d.type}
1`,"cart-item":d,categories:e.categories,"show-quantity":e.showQuantity,loading:e.loading,onCouponRemoved:t[0]||(t[0]=h=>a.$emit("item-removed")),onItemRemoved:t[1]||(t[1]=h=>a.$emit("item-removed"))},null,8,["cart-item","categories","show-quantity","loading"])):d.type==="Ebook"?(l(),C(o,{key:`ebook_card_${d.record_id}_${d.price_type}_${d.type}`,"cart-item":d,"show-quantity":e.showQuantity,loading:e.loading,onItemRemoved:t[2]||(t[2]=h=>a.$emit("item-removed"))},null,8,["cart-item","show-quantity","loading"])):d.type==="Book"?(l(),C(o,{key:`book_card_${d.record_id}_${d.price_type}_${d.type}`,"cart-item":d,"show-quantity":e.showQuantity,"get-shipping-rates-request-is-sending":e.shippingLoading,onUpdatePrice:t[3]||(t[3]=h=>a.$emit("update-price")),onItemRemoved:t[4]||(t[4]=h=>a.$emit("item-with-shipping-removed")),loading:e.loading},null,8,["cart-item","show-quantity","get-shipping-rates-request-is-sending","loading"])):d.type==="EbookNBook"?(l(),C(o,{key:`ebook_n_book_card_${d.record_id}_${d.price_type}_${d.type}`,"cart-item":d,"show-quantity":e.showQuantity,"get-shipping-rates-request-is-sending":e.shippingLoading,onUpdatePrice:t[5]||(t[5]=h=>a.$emit("update-price")),onItemRemoved:t[6]||(t[6]=h=>a.$emit("item-with-shipping-removed")),loading:e.loading},null,8,["cart-item","show-quantity","get-shipping-rates-request-is-sending","loading"])):d.type==="PublicClass"?(l(),C(u,{key:`public_class_card_${d.record_id}_${d.price_type}_${d.type}`,"cart-item":d,"show-quantity":e.showQuantity,loading:e.loading,onItemRemoved:t[7]||(t[7]=h=>a.$emit("item-removed"))},null,8,["cart-item","show-quantity","loading"])):d.type==="LibrarySubscription"?(l(),C(i,{key:`library_subscription_card_${d.record_id}`,"cart-item":d,loading:e.loading,onItemRemoved:t[8]||(t[8]=h=>a.$emit("item-removed"))},null,8,["cart-item","loading"])):d.type==="Bundle"?(l(),C(m,{key:`bundle_card_${d.record_id}_${d.price_type}_${d.type}`,"cart-item":d,"show-quantity":e.showQuantity,loading:e.loading,onUpdatePrice:t[9]||(t[9]=h=>a.$emit("update-price")),onItemRemoved:t[10]||(t[10]=h=>a.$emit("item-removed"))},null,8,["cart-item","show-quantity","loading"])):x("",!0)]),_:2},1024))]))),128))])}}});class le{static createAddressFromUser(a,t){return{firstname:a.firstname,lastname:a.lastname,phone:a.phone_number,address_1:a.address,address_2:a.address2,city:a.city,state:a.state,zip:a.area_code,country:"",country_id:a.country_id??1,type:t}}static validatePhone(a){return a.replace(/[^\d+]/g,"")}static assignAddressData(a,t){Object.assign(a,{...t,country_id:Number(t.country_id)})}}class ye{static createBillingAddressRules(){return{firstname:{required:Y},lastname:{required:Y},phone:{required:Y},address_1:{required:Y},address_2:{},city:{required:Y},state:{required:Y},zip:{required:Y},country:{},country_id:{required:Y}}}static createShippingAddressRules(a){const t=ft.withMessage("Value is required",yt(!a));return{firstname:{requiredIf:t},lastname:{requiredIf:t},phone:{requiredIf:t},address_1:{requiredIf:t},address_2:{},city:{requiredIf:t},state:{requiredIf:t},zip:{requiredIf:t},country:{},country_id:{requiredIf:t}}}static hasRequiredFieldErrors(a){for(const t in a)if(a[t]&&Array.isArray(a[t].$errors)&&a[t].$errors.some(o=>o.$validator==="required"||o.$validator==="requiredIf"))return!0;return!1}}class xe{static statesCache=new Map;static loadingStates=new Set;static getStatesForCountry(a){const t=`states_${a}`;if(this.statesCache.has(t))return this.statesCache.get(t);const r=ut(a);return this.statesCache.set(t,r),r}static validateStateForCountry(a,t){return a.some(r=>r.code===t)}}function Cs(){const e=Re(),a=Le({firstname:"",lastname:"",phone:"",address_1:"",address_2:"",city:"",state:"",state_name:"",zip:"",country:"",country_id:189,type:"BILLING"}),t=Le({firstname:"",lastname:"",phone:"",address_1:"",address_2:"",city:"",state:"",state_name:"",zip:"",country:"",country_id:189,type:"SHIPPING"}),r=E({get:()=>e.only_billing_address,set:_=>e.only_billing_address=_}),o=D([]),u=D([]),i=D(!1),m=E(()=>r.value),p=E(()=>ye.createBillingAddressRules()),d=E(()=>ye.createShippingAddressRules(m.value)),I=Be(p,a),h=Be(d,t);return ee(()=>a.country_id,(_,S)=>{_===S||!_||!i.value||(o.value=xe.getStatesForCountry(_),Ue(()=>{xe.validateStateForCountry(o.value,a.state)||(a.state="")}))}),ee(()=>t.country_id,(_,S)=>{_===S||!_||!i.value||(u.value=xe.getStatesForCountry(_),Ue(()=>{xe.validateStateForCountry(u.value,t.state)||(t.state="")}))}),{billingAddress:a,shippingAddress:t,onlyBillingAddress:r,billingCountryStates:o,shippingCountryStates:u,billingValidator:I,shippingValidator:h,initialLoadComplete:i,initializeAddressesFromUser:_=>{const S=le.createAddressFromUser(_,"BILLING"),q=le.createAddressFromUser(_,"SHIPPING");Object.assign(a,S),Object.assign(t,q)},initializeAddressesFromAPI:_=>{_.billing_address&&(le.assignAddressData(a,_.billing_address),_.shipping_address?le.assignAddressData(t,_.shipping_address):le.assignAddressData(t,_.billing_address))},validatePhone:(_,S)=>{const q=_.target,v=le.validatePhone(q.value);q.value=v,S==="BILLING"?a.phone=v:t.phone=v},validateAddresses:async()=>{await I.value.$validate(),await h.value.$validate();const _=ye.hasRequiredFieldErrors(I.value),S=ye.hasRequiredFieldErrors(h.value);return{isValid:!I.value.$error&&!h.value.$error,hasRequiredErrors:_||S}}}}function Is(){const e=D(),{shippingRates:a,getShippingRates:t,updateShippingCost:r,getShippingCostFromCart:o,getShippingCostPrice:u,shippingCost:i,getPriceByShippingType:m,getFedexTokenFromStorage:p,getShippingRatesRequestIsSending:d,getShippingRatesRequestError:I,getCustomErrorMessages:h}=xt();return{selectedShippingCost:e,shippingRates:a,shippingCost:i,getShippingRates:t,updateSelectedShippingCost:V=>{V&&(e.value=V,r(V),a.value?.shippingRates?.shippingRates?.output?.rateReplyDetails&&(i.value=m(V,a.value.shippingRates.shippingRates.output.rateReplyDetails)))},handleShippingRatesUpdate:async()=>{a.value&&(e.value=await o(a.value?.shippingRates?.shippingRates?.output?.rateReplyDetails)),(!a.value||!Object.keys(a.value).length)&&(i.value=0)},getShippingRatesRequestIsSending:d,getShippingRatesRequestError:I,getCustomErrorMessages:h,getShippingCostPrice:u,getFedexTokenFromStorage:p}}const Ss=async(e,a)=>{let t=null,r=[];const o=await $t(e.id);if(o)r=o;else return null;for(let u=0;u<r.length;u++)if(r[u].code===a){t=r[u].tax_value;break}return t};class ks{static async calculateTaxForAddress(a,t){const r=ct(a);return r?await Ss(r,t):0}}function Vs(){const e=D(0);return{taxStateValue:e,updateTaxForAddress:async(t,r)=>{e.value=await ks.calculateTaxForAddress(t,r)}}}const As=async e=>W("cart/prepare-for-checkout",{method:"POST",body:e},{withAuthorization:!0});function Rs(){const e=Ae(),a=D(!1);return{waitingForResponse:a,onCartItemRemoved:async()=>{await se()},onCartItemWithShippingRemoved:async()=>{await se()},prepareCheckout:async u=>{a.value=!0;try{const i=await As(u);if(i.data.value)return{success:!0,data:i.data.value};const m=i.error.value?.data?.errors?ht(i.error.value.data.errors):i.error.value?.data;return e.error(m),{success:!1,error:m}}finally{a.value=!1}}}}const Ds={class:"flex flex-row justify-between mt-2 items-center"},qs={class:"p-4 flex flex-col gap-6"},Ps={class:"flex flex-row items-center gap-2 py-3 text-gray"},Es=F({__name:"AuthDialog",props:{modelValue:{type:Boolean}},emits:["update:modelValue","authenticated"],setup(e,{emit:a}){const t=e,r=a,o=E({get:()=>t.modelValue,set:i=>r("update:modelValue",i)}),u=()=>{r("authenticated")};return(i,m)=>{const p=k("v-btn"),d=k("v-card-title"),I=_t,h=k("v-divider"),P=k("v-card"),B=k("v-dialog");return l(),C(B,{modelValue:o.value,"onUpdate:modelValue":m[2]||(m[2]=V=>o.value=V)},{default:R(()=>[f(P,{rounded:"",class:"mx-auto w-full max-w-lg rounded-xl"},{default:R(()=>[f(d,null,{default:R(()=>[s("div",Ds,[m[3]||(m[3]=s("span",{class:"text-3xl mx-2"},"To purchase payment",-1)),f(p,{variant:"plain",icon:"mdi-close",onClick:m[0]||(m[0]=V=>o.value=!1)})])]),_:1}),s("div",qs,[f(I,{onSubmit:u,navigate:!1,"trigger-classes":"w-full"}),s("div",Ps,[f(h),m[4]||(m[4]=s("span",null,"Or",-1)),f(h)]),f(p,{type:"button",rounded:"",variant:"outlined",color:"primary_green",onClick:m[1]||(m[1]=V=>("navigateTo"in i?i.navigateTo:n(ke))("/register"))},{default:R(()=>
1[...m[5]||(m[5]=[ne(" register ",-1)])]),_:1})])]),_:1})]),_:1},8,["modelValue"])}}}),Fs={class:"w-screen h-screen absolute left-0 right-0 top-0 bottom-0 bg-[#DEE7D3] bg-opacity-25"},Ls=F({__name:"LoadingOverlay",props:{visible:{type:Boolean}},setup(e){return(a,t)=>Q((l(),g("div",Fs,[...t[0]||(t[0]=[s("div",{class:"opacity-50 h-full w-full flex"},[s("div",{role:"status",class:"mx-auto my-auto"},[s("svg",{"aria-hidden":"true",class:"w-20 h-20 text-primary-green animate-spin dark:text-gray-900 fill-primary-green",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C0 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),s("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})])])],-1)])],512)),[[z,e.visible]])}}),Us={class:"bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 mb-6",role:"alert"},Bs=F({__name:"WarningMessage",props:{message:{}},setup(e){return(a,t)=>(l(),g("div",Us,[t[0]||(t[0]=s("p",{class:"font-bold"},"Warning",-1)),s("p",null,y(e.message),1)]))}}),Ns={class:"border-2 border-[#DEE7D3] m-rounded p-4 mb-6"},Ts={key:0,class:"absolute flex items-center justify-center w-full h-full bg-[#ffffff]/75 z-40"},Qs={key:1,class:"text-[#313131] font-semibold"},zs={class:"border-2 border-[#DEE7D3] m-rounded relative"},js=["value"],Os=["value"],Ms={key:0,class:"bg-red-100 border-l-4 border-red-400 text-red-700 p-4 mt-4",role:"alert"},Gs={key:0},Hs=F({__name:"ShippingRatesSection",props:{shippingRates:{},selectedShipping:{},loading:{type:Boolean},error:{},getShippingCostPrice:{type:Function}},emits:["update-shipping"],setup(e,{emit:a}){const t=a,r=o=>{const i=o.target.value;t("update-shipping",i)};return(o,u)=>{const i=wt,m=bt;return l(),g("div",Ns,[f(Ve,{class:"col-span-full",title:"Shipping costs"}),s("div",{class:te(["relative",{"min-h-[40px]":e.loading&&!e.shippingRates?.shippingRates}])},[e.loading?(l(),g("div",Ts,[f(i,{width:20,height:20,color:"var(--primary-green)"})])):x("",!0),e.shippingRates?.shippingRates?(l(),g("div",Qs,[s("div",zs,[f(m,{width:14,height:14,class:"absolute right-[10px] top-[13px] z-[-1]"}),s("select",{class:"px-4 py-2 cursor-pointer w-full",value:e.selectedShipping,onChange:r},[(l(!0),g(re,null,ue(e.shippingRates.shippingRates.shippingRates.output.rateReplyDetails,p=>(l(),g("option",{key:p.serviceType,value:p.serviceType},[ne(y(p.serviceName)+" ",1),s("strong",null,y(e.getShippingCostPrice(p.ratedShipmentDetails[0])),1)],8,Os))),128))],40,js)])])):x("",!0)],2),e.error?.message?(l(),g("div",Ms,[u[1]||(u[1]=s("p",{class:"font-bold"},"Error while fetching shipping costs",-1)),(l(!0),g(re,null,ue(e.error.message.errors,(p,d)=>(l(),g("div",{key:`errorMsg_${d}`},[s("p",null,y(p.code)+" | "+y(p.message),1),p.parameterList?(l(),g("div",Gs,[u[0]||(u[0]=s("strong",null,"Messages:",-1)),(l(!0),g(re,null,ue(p.parameterList,(I,h)=>(l(),g("div",{key:`parameterErr_${h}`},y(I.value),1))),128))])):x("",!0)]))),128))])):x("",!0)])}}}),Ne=F({__name:"AddressForm",props:{address:{},states:{},validator:{},mobile:{type:Boolean}},emits:["validate-phone","postal-change"],setup(e){return(a,t)=>{const r=k("v-text-field");return l(),g("div",null,[f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.firstname,"onUpdate:modelValue":t[0]||(t[0]=o=>e.address.firstname=o),label:"First name*",class:"w-full","error-messages":e.validator.firstname.$errors[0]?.$message},null,8,["density","modelValue","error-messages"]),f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.lastname,"onUpdate:modelValue":t[1]||(t[1]=o=>e.address.lastname=o),label:"Last name*",class:"w-full","error-messages":e.validator.lastname.$errors[0]?.$message},null,8,["density","modelValue","error-messages"]),f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.phone,"onUpdate:modelValue":t[2]||(t[2]=o=>e.address.phone=o),label:"Phone*",class:"mb-2.5","error-messages":e.validator.phone.$errors[0]?.$message,onInput:t[3]||(t[3]=o=>a.$emit("validate-phone",o))},null,8,["density","modelValue","error-messages"]),f(Ct,{density:e.mobile?"compact":void 0,modelValue:e.address.country_id,"onUpdate:modelValue":t[4]||(t[4]=o=>e.address.country_id=o),"error-messages":e.validator.country_id.$errors[0]?.$message},null,8,["density","modelValue","error-messages"]),(l(),C(It,{key:`state-${e.address.country_id}`,density:e.mobile?"compact":void 0,modelValue:e.address.state,"onUpdate:modelValue":t[5]||(t[5]=o=>e.address.state=o),"country-id":e.address.country_id,"error-messages":e.validator.state.$errors[0]?.$message},null,8,["density","modelValue","country-id","error-messages"])),f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.city,"onUpdate:modelValue":t[6]||(t[6]=o=>e.address.city=o),label:"City*","error-messages":e.validator.city.$errors[0]?.$message},null,8,["density","modelValue","error-messages"]),f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.zip,"onUpdate:modelValue":t[7]||(t[7]=o=>e.address.zip=o),label:"Zip*",onChange:t[8]||(t[8]=o=>a.$emit("postal-change")),"error-messages":e.validator.zip.$errors[0]?.$message},null,8,["density","modelValue","error-messages"]),f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.address_1,"onUpdate:modelValue":t[9]||(t[9]=o=>e.address.address_1=o),label:"Address 1*","error-messages":e.validator.address_1.$errors[0]?.$message},null,8,["density","modelValue","error-messages"]),f(r,{density:e.mobile?"compact":void 0,modelValue:e.address.address_2,"onUpdate:modelValue":t[10]||(t[10]=o=>e.address.address_2=o),label:"Address 2","error-messages":e.validator.address_2.$errors[0]?.$message},null,8,["density","modelValue","error-messages"])])}}}),Ws={class:"flex flex-col lg:flex-row gap-4 md:gap-4"},Zs={class:"w-full border-2 border-[#DEE7D3] m-rounded p-4"},Ks={class:"w-full border-2 border-[#DEE7D3] m-rounded p-4"},Xs=F({__name:"AddressForms",props:{billingAddress:{},shippingAddress:{},onlyBilling:{type:Boolean},billingStates:{},shippingStates:{},billingValidator:{},shippingValidator:{}},emits:["validate-phone","billing-postal-change","shipping-postal-change","update:only-billing"],setup(e,{emit:a}){const t=e,r=a,{mobile:o}=ce(),u=E({get:()=>t.onlyBilling,set:i=>r("update:only-billing",i)});return(i,m)=>{const p=k("v-checkbox");return l(),g("div",Ws,[s("div",Zs,[f(Ve,{class:"col-span-full",title:"Billing Address"}),f(Ne,{address:e.billingAddress,states:e.billingStates,validator:e.billingValidator,mobile:n(o),onValidatePhone:m[0]||(m[0]=d=>i.$emit("validate-phone",d,"BILLING")),onPostalChange:m[1]||(m[1]=d=>i.$emit("billing-postal-change"))},null,8,["address","states","validator","mobile"]),f(p,{modelValue:u.value,"onUpdate:modelValue":m[2]||(m[2]=d=>u.value=d),label:"Shipping address is the same as billing address"},null,8,["modelValue"])]),Q(s("div",Ks,[f(Ve,{class:"col-span-full",title:"Shipping Address"}),f(Ne,{address:e.shippingAddress,states:e.shippingStates,validator:e.shippingValidator,mobile:n(o),onValidatePhone:m[3]||(m[3]=d=>i.$emit("validate-phone",d,"SHIPPING")),onPostalChange:m[4]||(m[4]=d=>i.$emit("shipping-postal-change"))},null,8,["address","states","validator","mobile"])],512),[[z,!e.onlyBilling]])])}}}),Js={class:"flex flex-col border-2 border-[#649120] m-rounded p-4 h-min"},Ys={class:"flex justify-between mb-2"},eo={class:"flex justify-between mb-2"},to={class:"flex justify-between mb-3"},no={class:"flex justify-between text-xl text-[#404040] mt-2"},so=F({__name:"CartBox",props:{cartPriceInfo:{},taxStateValue:{},shippingCost:{},totalPriceIncludingShipping:{},disabled:{type:Boolean},waitingForResponse:{type:Boolean},getShippingRatesRequestIsSending:{type:Boolean},onCheckout:{type:Function}},setup(e){return(a,t)=>{const r=k("v-icon"),o=k("v-btn");return l(),g("div",Js,[t[4]||(t[4]=s("p",{class:"mb-2 text-2xl text-[#404040]"},[s("strong",null,"To be paid:")],-1)),s("div",Ys,[t[0]||(t[0]=s("span",null,"Subtotal:",-1)),s("span",null,"$"+y(e.cartPriceInfo.price_with_no_taxes.toFixed(2)),1)]),s("div",eo,[s("span",null,"Tax ("+y((e.taxStateValue*100).toFixed(2))+"%):",1),s("span",null,"$"+y((e.cartPriceInfo.price_with_no_taxes*e.taxStateValue).toFixed(2)),1)]),s("div",to,[t[1]||(t[1]=s("span",null,"Shipping cost:",-1)),s("span",null,"$"+y(e.shippingCost?e.shippingCost:0),1)]),t[5]||(t[5]=s("div",{class:"w-full h-[2px] bg-[#DEE7D3]"},null,-1)),s("div",no,[t[2]||(t[2]=s("strong",null,"Total:",-1)),s("strong",null,"$"+y(e.totalPriceIncludingShipping.toFixed(2)),1)]),f(o,{"data-testid":"checkout_top",type:"submit",rounded:"",color:"primary_green",disabled:e.disabled||e.waitingForResponse||e.getShippingRatesRequestIsSending,class:"mt-6"},{default:R(()=>[f(r,{icon:"mdi-chevron-right"}),t[3]||(t[3]=s("span",null,"Review Order",-1))]),_:1},8,["disabled"])])}}}),oo={class:"flex flex-col"},ao={class:"flex flex-col w-full md:w-3/4 md:mt-4"},io={class:"flex flex-col gap-4 md:w-1/4 md:ml-12"},lo={class:"sticky-cart"},ro=F({__name:"index",setup(e){const a=Ae();ce();const t=me(),r=Re(),{billingAddress:o,shippingAddress:u,onlyBillingAddress:i,billingCountryStates:m,shippingCountryStates:p,billingValidator:d,shippingValidator:I,initialLoadComplete:h,initializeAddressesFromUser:P,initializeAddressesFromAPI:B,validatePhone:V,validateAddresses:O}=Cs(),{selectedShippingCost:_,shippingRates:S,shippingCost:q,getShippingRates:v,updateSelectedShippingCost:c,handleShippingRatesUpdate:b,getShippingRatesRequestIsSending:N,getShippingRatesRequestError:M,getShippingCostPrice:G,getFedexTokenFromStorage:oe}=Is(),{taxStateValue:L,updateTaxForAddress:j}=Vs(),{waitingForResponse:U,onCartItemRemoved:Me,onCartItemWithShippingRemoved:Ge,prepareCheckout:He}=Rs(),ve=D(!1),qe=D([]),Ce=D(!1),Z=mt(),Pe=E(()=>r.$state.cart.length),de=E(()=>r.$state.price_info),We=E(()=>Pe.value<1),Ze=E(()=>!!t.$state.user),Ke=E(()=>!0),Xe=E(()=>
1{if(!de.value||!de.value.price_with_no_taxes)return q.value;const w=Number(de.value.price_with_no_taxes.toFixed(2)),$=Number((de.value.price_with_no_taxes*L.value).toFixed(2)),T=Number(q.value||0);return w+$+T}),Je=(w,$)=>{switch(w){case"ElearningCourse":return"eLearning Course";case"Ebook":return"eBook";case"EbookNBook":return"eBook & book";case"Book":return"Book";case"PublicClass":return"Public Class";case"Bundle":return $&&$.product&&$.product.description?`Bundle - ${$.product.description}`:"Bundle";default:return""}};ee(()=>[o.state,o.country_id],([w,$],[T,K])=>{if((w!==T||$!==K)&&w&&$){j($,w);const H=Z.find(A=>A.id===$);H&&o.zip&&v({country_code:H.code,postal_code:o.zip})}}),ee(()=>S.value,b),ee(()=>[u.state,u.country_id],([w,$],[T,K])=>{if((w!==T||$!==K)&&w&&$&&!i.value){const H=Z.find(A=>A.id===u.country_id);H&&u.zip&&v({country_code:H.code,postal_code:u.zip})}});const Ee=async()=>{if(!be()){ve.value=!0;return}const w=await O();if(!w.isValid){w.hasRequiredErrors&&a.error("All required fields must be filled out.");return}if(await vt()){const X=r.$state.cart.map(J=>({item_id:J.product?.id,item_name:J.product?.name||"Unknown Product",price:Number(J.product?.price||0),quantity:Number(J.quantity||1),item_brand:"MindsShare",item_category:Je(J.type,J)})),ae=r.$state.price_info.total_price+q.value,Se=r.$state.cart.find(J=>J.coupon)?.coupon,Fe={currency:"USD",value:ae,items:X};Se&&(Fe.coupon=Se),window.gtag("event","begin_checkout",Fe),console.log("Begin checkout tracked:",{value:ae,items:X.length,coupon:Se})}const T=Z.find(X=>X.id===o.country_id),K=Z.find(X=>X.id===u.country_id);T&&(o.country=T.code),K&&(u.country=K.code);const H={cart_uuid:r.$state.cart_uuid,cartItems:{...r.$state.cart},billing_address:{...o},only_billing_address:i.value,shipping_address:{...u},fedex_token:oe()},A=await He(H);A.success?(r.$state=A.data,ke("/cart/review-order")):A.error?(rt(A.error),A.error?.status===422?A.error?.data&&A.error?.data?.errors?a.error(errorMessages):A.error?.data&&A.error?.data?.message?a.error(A.error?.data.message):a.error("Validation failed. Please check your input data and try again."):A.error?.data&&A.error?.data?.errors?a.error(A.error?.data?.errors):A.error?.data&&A.error?.data?.message?a.error(A.error?.data?.message):a.error("An unknown error occurred.")):a.error("An unknown error occurred.")},Ye=()=>{ve.value=!1,Ie(),v()},Ie=async()=>{const{data:w,error:$}=await gt();if($.value||!w.value){t.$state.user&&P(t.$state.user);return}B(w.value)},et=()=>{const w=Z.find($=>$.id===o.country_id);w&&v({country_code:w.code,postal_code:o.zip})},tt=()=>{const w=Z.find($=>$.id===u.country_id);w&&v({country_code:w.code,postal_code:u.zip})},nt=()=>{const w=i.value?o:u,$=Z.find(T=>T.id===w.country_id)?.code;$&&v({country_code:$,postal_code:w.zip})};return he(async()=>{Ce.value=!0;try{const w=Z[0]?.id||1;t.$state.user?await Ie():(o.country_id=w,u.country_id=w),qe.value=await pt()}catch(w){console.error("Error in onBeforeMount:",w)}finally{Ce.value=!1,h.value=!0}}),ot(async()=>{Ze.value&&await Promise.all([at(),Ie(),v()])}),(w,$)=>{const T=st,K=Vt,H=ws,A=ie,X=dt;return l(),g(re,null,[(l(),C(it,{to:"body"},[f(Ls,{visible:n(U)},null,8,["visible"])])),f(T,null,{left:R(()=>[...$[3]||($[3]=[ne("Cart",-1)])]),right:R(()=>[...$[4]||($[4]=[ne("Did you know that MindShare has been teaching technology classes since 1988?",-1)])]),_:1}),f(X,null,{default:R(()=>[f(A,null,{default:R(()=>[s("div",oo,[f(K,{onContinueShopping:$[0]||($[0]=ae=>("navigateTo"in w?w.navigateTo:n(ke))("/"))}),s("form",{class:"flex flex-col md:flex-row mt-6",onSubmit:lt(Ee,["prevent"])},[s("div",ao,[n(r).$state.messages?.products_deleted?(l(),C(Bs,{key:0,message:n(r).$state.messages.products_deleted},null,8,["message"])):x("",!0),f(H,{"cart-items":n(r).cart,categories:qe.value,loading:Ce.value,"show-quantity":Ke.value,"shipping-loading":n(N),onItemRemoved:n(Me),onItemWithShippingRemoved:n(Ge),onUpdatePrice:nt},null,8,["cart-items","categories","loading","show-quantity","shipping-loading","onItemRemoved","onItemWithShippingRemoved"]),n(S)?.shippingRates&&Pe.value>0?(l(),C(Hs,{key:1,"shipping-rates":n(S),"selected-shipping":n(_),loading:n(N),error:n(M),"get-shipping-cost-price":n(G),onUpdateShipping:n(c)},null,8,["shipping-rates","selected-shipping","loading","error","get-shipping-cost-price","onUpdateShipping"])):x("",!0),n(t).$state.user?(l(),C(Xs,{key:2,"only-billing":n(i),"onUpdate:onlyBilling":$[1]||($[1]=ae=>$e(i)?i.value=ae:null),"billing-address":n(o),"shipping-address":n(u),"billing-states":n(m),"shipping-states":n(p),"billing-validator":n(d),"shipping-validator":n(I),onValidatePhone:n(V),onBillingPostalChange:et,onShippingPostalChange:tt},null,8,["only-billing","billing-address","shipping-address","billing-states","shipping-states","billing-validator","shipping-validator","onValidatePhone"])):x("",!0)]),s("div",io,[s("div",lo,[f(so,{"cart-price-info":de.value,"tax-state-value":n(L),"shipping-cost":n(q),"total-price-including-shipping":Xe.value,disabled:We.value,"waiting-for-response":n(U),"shipping-loading":n(N),"on-checkout":Ee,class:"mt-4"},null,8,["cart-price-info","tax-state-value","shipping-cost","total-price-including-shipping","disabled","waiting-for-response","shipping-loading"])])])],32)])]),_:1})]),_:1}),f(Es,{modelValue:ve.value,"onUpdate:modelValue":$[2]||($[2]=ae=>ve.value=ae),onAuthenticated:Ye},null,8,["modelValue"])],64)}}}),Fo=Qe(ro,[["__scopeId","data-v-e7e52312"]]);export{Fo as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.