PageSourceSearch

https://explore.getmulberry.com/assets/index-BeBru6Aw.js

js getmulberry.com collected 2026-10-01 11:25:33 UTC 13,803 bytes, 2 lines download raw bytes

1import{V as ee,aa as se,c as ae,m as te,ab as re,ac as oe,C as le,G as ne,H as ce,r as c,ad as G,p as U,j as e,Z as q,z as k,a9 as ie,a4 as M,a5 as de,a6 as me,a7 as ue,I as v,_ as pe,v as he,ae as xe,af as z,ag as fe,Q as K,ah as ge,ai as be,o as _e,d as ye,aj as V,w as je,ak as Ne,al as ve,y as ke,am as we,an as Ce,ao as F,S as Se,ap as Ee}from"./index-Zu07ZFbl.js";import{S as Z}from"./star-Dr1TLtS-.js";import{d as Pe,C as Te,O as Me}from"./middleware-D1Uw1dbE.js";import{u as Ie,c as Ae}from"./schemas-BuBWdTeq.js";import{u as Le}from"./postPurchaseSuccessStore-BtmUQsFq.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="bc712ff9-699b-4d37-827d-d4ddd2b2e1e2",s._sentryDebugIdIdentifier="sentry-dbid-bc712ff9-699b-4d37-827d-d4ddd2b2e1e2")}catch{}})();const Re="explore/post-purchase-warranty-offers",Oe=async({retailerUuid:s,program:t})=>(await ee.post(Re,{retailer_uuid:s,...t?{program:t}:{}})).data.warranty_offers,De="postPurchaseOffers",Fe=({retailerUuid:s,program:t,enabled:o=!0})=>se({queryKey:[De,s,t],queryFn:async()=>await Oe({retailerUuid:s,program:t}),enabled:o}),Qe=100,Q={cta:"post-purchase__cta",loader:"post-purchase__loader",linkAboutMb:"post-purchase__link--about-mulberry",linkTerms:"post-purchase__link--terms"},W=ae()(Pe(s=>({price:Qe,setPrice:t=>s(o=>({...o,price:t})),selectedOffer:null,setSelectedOffer:t=>s(o=>({...o,selectedOffer:t}))}),{name:"custom-post-purchase-cart"})),Ue=({isOpen:s,closeModal:t,retailerId:o,retailerName:r,selectedOffer:i,program:y,programName:n,campaignSource:f,campaignName:w})=>{const I=te(),j=re(),u=oe(),{cardComplete:p,handleCardElementOnChange:h}=le(),{mutateAsync:B}=Ie(),g=Le(l=>l.setPostPurchaseSuccessData),{register:H,handleSubmit:Y,formState:{isValid:A,isDirty:L,errors:m},control:R}=ne({resolver:ce(Ae),mode:"onChange",defaultValues:{email:"",state:""}}),C=c.useRef(null),[b,O]=c.useState(""),[S,E]=c.useState(!1),P=G({duration:i.duration_months,labelMonths:" month",labelYears:" year"}),T=c.useMemo(()=>({lineItems:[{name:`${P} protection plan`,price:Number(i.customer_cost||i.cost)}],promoCode:null,subTotal:Number(i.customer_cost||i.cost),tax:0,total:Number(i.customer_cost||i.cost)}),[i,P]),_=c.useMemo(()=>({...n?{program_name:n}:{},...f?{campaign_source:f}:{},...w?{campaign_name:w}:{}}),[n,f,w]);c.useEffect(()=>{s&&U("mb_post_purch_checkout_viewed",{app_name:r,..._})},[s,r,_]);const a=async l=>{var d,N;E(!0);try{if(!o)throw new Error("post purchase checkout - retailerId is not defined");if(!j||!u)throw new Error("stripe is not initialized");const $=u.getElement(fe);if(!$)throw new Error("card element is not initialized");const D=await j.createToken($,{name:b});if(D.error)throw new Error(D.error.message);const J=((d=D.token.card)==null?void 0:d.country)==="CA"?"cad":"usd",X=D.token.id;await B({warranty_id:i.warranty_offer_id,email:l.email,state:l.state,retailer_id:o,currency:J,stripe_token:X,program:y}),g({cartType:"post_purchase",customer:{email:l.email,customerId:null},selectedSubscriptionId:null,orderSummaryProps:T,retailerName:r}),U("mb_post_purch_checkout_success",{app_name:r,..._}),I("/carts/success")}catch{U("mb_post_purch_checkout_error",{app_name:r,..._}),(N=C.current)==null||N.scrollTo({top:0,behavior:"smooth"}),setTimeout(()=>{K({children:ge})},500)}finally{E(!1)}},x=!p.cardCvc||!A||!L||!b.includes(" ")||b.length<3;return e.jsxs(Te,{ref:C,closeModal:t,isOpen:s,immediateMessage:!1,children:[e.jsx("h1",{className:"font-bold text-2xl",children:"Complete Checkout"}),e.jsxs("form",{onSubmit:Y(a),className:"space-y-4 pt-6 z-10",children:[e.jsxs(q,{className:"grid grid-cols-6 gap-4 text-xs",children:[e.jsxs("div",{className:"col-span-6 space-y-1 text-black",children:[e.jsx("h2",{className:"text-base font-bold leading-5",children:"Contact information"}),e.jsx("div",{className:"flex gap-1 text-xs",children:"This email will be used for your account."})]}),e.jsxs("div",{className:"col-span-4 space-y-1",children:[e.jsx("label",{htmlFor:"email",className:k({"text-red":m.email},"flex gap-3"),children:e.jsx("span",{className:"font-semibold",children:"Email"})}),e.jsx("input",{className:k({"border-red focus:border-red":m.email},"input text-xs"),type:"email",...H("email",{required:!0}),id:"email",autoComplete:"email",required:!0}),m.email&&e.jsx("p",{className:"text-red",children:m.email.message})]}
1),e.jsx(ie,{control:R,name:"state",rules:{required:!0},render:({field:l})=>e.jsxs(M,{...l,as:"div",className:"relative col-span-2 space-y-1",children:[e.jsx(M.Label,{className:"font-semibold",children:"State"}),e.jsx(M.Button,{className:"input flex w-full flex-1 items-center justify-between text-xs",children:({open:d,value:N})=>e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex flex-grow",children:[N," "]}),e.jsx(de,{className:k({"rotate-180":d},"pointer-events-none transform text-black transition-transform")})]})}),e.jsx(me,{as:c.Fragment,leave:"transition ease-in",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e.jsx(M.Options,{className:"absolute inset-0 top-full z-10 h-64 w-full overflow-auto rounded border border-purple bg-white text-sm text-black shadow-lg focus:outline-none",children:ue.map(d=>e.jsx(M.Option,{value:d,className:({active:N})=>k({"bg-purple-violet/10":N},"relative cursor-pointer select-none py-2 pl-3 pr-9"),children:d},d))})})]})}),m.state&&e.jsx("p",{className:"text-red",children:m.state.message})]}),e.jsxs(v,{onStripeInputChange:h,children:[e.jsx("div",{className:"col-span-6 space-y-1 text-black",children:e.jsx(v.PaymentMethods,{})}),e.jsx("div",{className:"col-span-6 space-y-1",children:e.jsx(v.CardNumberInput,{})}),e.jsx("div",{className:"col-span-4 space-y-1",children:e.jsx(v.CardExpiryInput,{})}),e.jsx("div",{className:"col-span-2 space-y-1",children:e.jsx(v.CardCvcInput,{})}),e.jsxs("div",{className:"col-span-6 space-y-1",children:[e.jsx("label",{htmlFor:"Name",className:"text-xs font-medium",children:"Name on card"}),e.jsx("input",{className:"w-full rounded border border-gray px-2 py-2 outline-none focus:border-purple",id:"Name",required:!0,name:"name on card",value:b,autoComplete:"cc-name",onChange:l=>O(l.target.value.toUpperCase())})]}),e.jsx("div",{className:"text-gray-dark col-span-6 flex items-center text-xxs text-gray-light",children:e.jsx(v.ProtectedByStripe,{})})]}),e.jsxs(q,{as:"section",className:"space-y-3",children:[e.jsx("h2",{className:"text-base font-bold leading-5",children:"Order Summary"}),e.jsx(pe,{...T})]}),e.jsxs(he,{grayed:x,loading:S,disabled:x||S,type:"submit",children:[e.jsx(xe,{}),e.jsx("span",{children:"Pay Now"})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-gray-light text-sm",children:[e.jsxs("p",{children:["Mulberry provides accidental damage coverage for your purchase."," ",e.jsx("a",{className:"text-purple",href:z,rel:"noreferrer",target:"_blank",children:"Learn more about Mulberry"})]}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("span",{className:"inline-flex gap-x-px align-top text-peach",children:Array.from({length:5},(l,d)=>e.jsx(Z,{className:"h-[18px] w-[12.5px]"},`star${d}`))}),e.jsx("span",{children:"5 star service ratings"})]}),e.jsxs("div",{children:["Mulberry is protecting ",e.jsx("strong",{className:"font-bold text-black",children:"3,000,000+"})," ","products for people like you."]})]})]})]})},$e=()=>{var A,L,m,R,C,b,O,S,E,P,T,_;const s=be(),{category:t}=_e(),[o]=ye(),r=W(a=>a.selectedOffer),i=W(a=>a.setSelectedOffer),y=Fe({retailerUuid:((A=s.data)==null?void 0:A.uuid)??"",program:t,enabled:s.isSuccess&&!!((L=s.data)!=null&&L.uuid)}),n=y.data??null,f=y.isLoading,[w,I]=c.useState(!1),j=t?((R=(m=s.data)==null?void 0:m.post_purchase_config)==null?void 0:R.find(a=>a.program===t))??null:((b=(C=s.data)==null?void 0:C.post_purchase_config)==null?void 0:b[0])??null,u=((j==null?void 0:j.display_category)??"electronics").toLowerCase(),p=o.get("utm_source")??void 0,h=o.get("utm_campaign")??t,B=()=>{I(!1)},g=c.useCallback((a,x)=>{var l;U(a,{app_name:((l=s.data)==null?void 0:l.name)??null,...t?{program_id:t}:{},program_name:u,...p?{campaign_source:p}:{},...h?{campaign_name:h}:{},...x})},[(O=s.data)==null?void 0:O.name,t,u,p,h]),H=a=>{a&&g("mb_post_purch_partner_plan_selected",{plan_duration:a.duration_months,plan_cost:a.customer_cost||a.cost}),i(a)};c.useEffect(()=>{y.isError&&K({showCloseButton:!1,duration:5e3,children:"There was an issue fetching details for your item."})},[y.isError]),c.useEffect(()=>{var a;s.isSuccess&&((a=s.data)!=null&&a.uuid)&&(g("mb_post_purch_partner_view"),V({program_name:u}))},[s.isSuccess]),c.useEffect(()=>{je();const a={};
1p&&(a.campaign_source=p),h&&(a.campaign_name=h),t&&(a.program_id=t),Object.keys(a).length>0&&V(a)},[]);const Y=()=>{I(!0),g("mb_post_purch_partner_cta_clicked")};return e.jsxs("div",{className:k("py-8 flex flex-col gap-6 relative pb-16 md:pb-8 mx-auto flex-1",Ee),children:[e.jsx("h1",{className:"text-[2rem] md:text-[2.625rem] leading-10 md:leading-[1.238] text-center font-bold",children:"Take off the bubble wrap"}),e.jsxs("p",{className:"text-base text-center md:max-w-[900px] md:mx-auto",children:["All it takes is one accident before you're dealing with expensive repairs. Protect your new ",u," from drops, spills, breakdowns, and other accidents."]}),e.jsx("section",{className:"py-6 mx-auto w-full",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-24 items-start",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs(q,{as:"section",className:"p-0 overflow-hidden border-purple flex flex-col border shadow-none",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 border-b px-4 py-4",children:[e.jsx(Ne,{className:"h-8 w-auto text-purple shrink-0","aria-hidden":"true"}),e.jsx("h2",{className:"text-lg font-bold text-purple leading-snug",children:"Protect your purchase"})]}),e.jsx("div",{className:"px-4 py-4",children:!f&&(n!=null&&n.length)?e.jsx(Me,{offers:n,selected:r,onSelectionChange:H}):f?e.jsx(ve,{className:"animate-spin h-8 mx-auto text-purple w-8","data-testid":Q.loader}):e.jsx("p",{children:"No offers are available."})})]}),!f&&!!(n!=null&&n.length)&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h3",{className:"font-bold text-base",children:"What's Covered"}),e.jsx("ul",{className:"flex flex-col gap-3",children:(P=(E=(S=n.at(0))==null?void 0:S.coverage_details.at(0))==null?void 0:E.long)==null?void 0:P.map((a,x)=>!!a&&e.jsxs("li",{className:"flex gap-1.5 text-sm",children:[e.jsx("div",{className:"h-full",children:e.jsx(ke,{"aria-hidden":"true",className:"h-5 text-purple w-3",role:"presentation"})}),e.jsx("span",{children:a})]},`coverage_${x}`))})]}),e.jsxs("a",{className:'relative flex w-max text-black-deep items-center gap-1 text-sm after:absolute after:inset-x-0 after:-bottom-0.5 after:h-[1px] after:bg-current after:opacity-0 after:transition-opacity after:content-[""] hover:after:opacity-100',"data-testid":Q.linkTerms,href:we,onClick:()=>g("mb_post_purch_partner_terms_clicked"),rel:"noreferrer",target:"_blank",children:[e.jsx(Ce,{className:"h-3 w-3"}),e.jsx("span",{children:"See Contract Terms and FAQs"})]})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs(q,{as:"section",className:"flex flex-col gap-4 shadow-none border-2 border-gray-500",children:[e.jsx("h2",{className:"font-bold text-2xl",children:"Order Summary"}),r?e.jsxs("div",{className:"grid grid-cols-[2fr_1fr] gap-3 text-sm",children:[e.jsxs("h4",{className:"font-bold",children:[G({duration:r.duration_months,labelMonths:" month",labelYears:" year"})," ","protection plan"]}),e.jsx("p",{className:"text-right font-bold",children:F({value:Number(r.customer_cost||r.cost)})}),e.jsx("h3",{children:"Subtotal"}),e.jsx("p",{className:"text-right",children:F({value:Number(r.customer_cost||r.cost)})}),e.jsx("h3",{children:"Tax"}),e.jsx("p",{className:"text-right",children:F({value:0})}),e.jsx("h3",{className:"font-bold",children:"Total"}),e.jsx("p",{className:"text-right font-bold",children:F({value:Number(r.customer_cost||r.cost)})})]}):e.jsx("p",{className:"text-sm text-gray-light",children:"No items in cart"}),e.jsx("button",{className:k("w-full rounded-full py-3 font-bold text-white transition-colors",r?"bg-purple hover:bg-purple/90 cursor-pointer":"bg-gray-light cursor-not-allowed"),"data-testid":Q.cta,disabled:!r,onClick:Y,children:"Checkout"})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-gray-light text-sm",children:[e.jsxs("p",{children:["Mulberry provides accidental damage coverage for your purchase."," ",e.jsx("a",{className:"text-purple","data-testid":Q.linkAboutMb,href:z,onClick:()=>g("mb_post_purch_partner_about_mb_clicked"),rel:"noreferrer",target:"_blank",children:"Learn more about Mulberry"})]}),e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx("span",{className:"inline-flex gap-x-px align-top text-peach",children:Array.from({length:5},(a,x)=>e.jsx(Z,{className:"h-[18px] w-[12.5px]"},`star${x}`))}),e.jsx("span",{children:"5 star service ratings"})]}),e.jsxs("div",{children:["Mulberry is protecting ",e.jsx("strong",{className:"font-bold text-black",children:"3,000,000+"})," ","products for people like you."]})]})]})]})}),e.jsx(Se,{children:r&&e.jsx(Ue,{retailerId:((T=s.data)==null?void 0:T.uuid)??"",retailerName:((_=s.data)==null?void 0:_.name)??"",closeModal:B,isOpen:w,selectedOffer:r,program:t,programName:u,campaignSource:p,campaignName:h})}),e.jsx("footer",{className:"mt-auto pt-4 border-t border-gray-200 text-center text-sm text-gray-light",children:e.jsx("p",{children:e.jsx("a",{href:z,rel:"noreferrer",target:"_blank",children:"Learn more about Mulberry"})})})]})};export{$e as CustomPostPurchase};
2

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.